修改登录

master
mzh820631607 4 years ago
parent 90b26c90ab
commit 8e7a90cd2c
  1. 2
      pom.xml
  2. 52
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  3. 16
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  4. 41
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  5. 19
      src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
  6. 3
      src/main/resources/application.properties

@ -6,7 +6,7 @@
<groupId>com.yipin</groupId> <groupId>com.yipin</groupId>
<artifactId>liuwanr</artifactId> <artifactId>liuwanr</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<packaging>war</packaging> <packaging>jar</packaging>
<name>Spring Boot Project</name> <name>Spring Boot Project</name>

@ -299,6 +299,35 @@ public class UserInfoController {
} }
return resp; return resp;
} }
/**
* 登陆查询学校/电子科大
*/
@GetMapping("/loginSchoolClient")
Response loginSchoolClient(@RequestParam("account") String account, @RequestParam("password") String password , HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
userInfo.setSchoolId(2105);//暂定学校id
if (account == null || account=="") {
resp.setStatus(300);
resp.setErrmessage("用户账号为空,登录失败!");
}else if(password ==null || password=="") {
resp.setStatus(300);
resp.setErrmessage("用户密码为空,登录失败!");
}else{
userInfo.setAccount(account);
userInfo.setPassword(password);
HashMap<String, Object> ret = userInfoService.loginSchoolClient(userInfo);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
/** /**
* 服务端登陆 * 服务端登陆
@ -693,4 +722,27 @@ public class UserInfoController {
} }
return resp; return resp;
} }
/**
* 查询电话
*/
@GetMapping("/queryPhone")
com.yipin.liuwanr.entity.Response queryPhone(@RequestParam String phone) {
com.yipin.liuwanr.entity.Response resp = new com.yipin.liuwanr.entity.Response();
if (phone==null||phone=="") {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("手机号为空!查询失败!");
}else {
HashMap<String, Object> ret = userInfoService.queryPhone(phone);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
} }

@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yipin.liuwanr.entity.*; import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoReceiveVo;
import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO; import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -143,14 +144,22 @@ public interface UserInfoMapper {
@Select("SELECT userId,roleId from student where userId = #{userId} and schoolId = #{schoolId}") @Select("SELECT userId,roleId from student where userId = #{userId} and schoolId = #{schoolId}")
List<Student> loginStudentRole(Integer userId, Integer schoolId); List<Student> loginStudentRole(Integer userId, Integer schoolId);
//登陆查询学校 //登陆查询员工学校信息
@Select("SELECT sta.schoolId,sch.schoolName,sta.userId from staff sta,school sch where sta.userId = #{userId} and sta.schoolId = sch.schoolId GROUP BY sta.schoolId") @Select("SELECT sta.schoolId,sch.schoolName,sta.userId from staff sta,school sch where sta.userId = #{userId} and sta.schoolId = sch.schoolId GROUP BY sta.schoolId")
List<UserInfo> loginGetStaffSchool(Integer userId); List<UserInfo> loginGetStaffSchool(Integer userId);
//登陆查询学校 //登陆查询学生学信息
@Select("SELECT stu.schoolId,sch.schoolName,stu.userId from student stu,school sch where stu.userId = #{userId} and stu.schoolId = sch.schoolId GROUP BY stu.schoolId") @Select("SELECT stu.schoolId,sch.schoolName,stu.userId from student stu,school sch where stu.userId = #{userId} and stu.schoolId = sch.schoolId GROUP BY stu.schoolId")
List<UserInfo> loginGetStudentSchool(Integer userId); List<UserInfo> loginGetStudentSchool(Integer userId);
//登陆查询员工学校信息/dianzikeda
@Select("SELECT sta.schoolId,sch.schoolName,sta.userId from staff sta,school sch where sta.userId = #{userId} and sta.schoolId = sch.schoolId and sch.schoolId=#{schoolId} GROUP BY sta.schoolId")
List<UserInfo> loginsGetStaffSchoolInfo(Integer userId,Integer schoolId);
//登陆查询学生学校信息/dianzikeda
@Select("SELECT stu.schoolId,sch.schoolName,stu.userId,stu.studentId from student stu,school sch where stu.userId = #{userId} and stu.schoolId = sch.schoolId and sch.schoolId=#{schoolId} GROUP BY stu.schoolId")
List<UserInfoReceiveVo> loginsGetStudentSchoolInfo(Integer userId, Integer schoolId);
//查询用户员工组织关系 //查询用户员工组织关系
@Select("SELECT * from staff where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}") @Select("SELECT * from staff where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}")
List<Staff> queryStaffAll(Integer userId, String roleId, Integer schoolId); List<Staff> queryStaffAll(Integer userId, String roleId, Integer schoolId);
@ -328,4 +337,7 @@ public interface UserInfoMapper {
"UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}", "UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}",
"</script>"}) "</script>"})
void deleteOrganizationRelationship(Integer userId); void deleteOrganizationRelationship(Integer userId);
@Select("SELECT disableAccount FROM hr_user_info WHERE schoolId = #{schoolId} AND account = #{account}")
Integer queryDisableAccount(UserInfo userInfo);
} }

@ -12,6 +12,7 @@ import com.yipin.liuwanr.mapper.OrganizationRelationshipMapper;
import com.yipin.liuwanr.mapper.StaffMapper; import com.yipin.liuwanr.mapper.StaffMapper;
import com.yipin.liuwanr.mapper.StudentMapper; import com.yipin.liuwanr.mapper.StudentMapper;
import com.yipin.liuwanr.mapper.UserInfoMapper; import com.yipin.liuwanr.mapper.UserInfoMapper;
import com.yipin.liuwanr.vo.UserInfoReceiveVo;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -383,6 +384,46 @@ public class UserInfoService {
} }
return resp; return resp;
} }
//登陆获取学校/电子科大
public HashMap<String, Object> loginSchoolClient(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
Integer schoolId = userInfo.getSchoolId();
Integer state = userInfoMapper.queryDisableAccount(userInfo);
if (state==null){
resp.put("retcode",300);
resp.put("retvalue","账号不存在");
}else if (state==0){
try {
UserInfo user=userInfoMapper.loginsAP(userInfo);
// obj.put("user",user);
if(user!=null) {
Integer userId = user.getUserId();
List<UserInfo> staffList = userInfoMapper.loginsGetStaffSchoolInfo(userId,schoolId);
obj.put("staffList",staffList);
// List<UserInfo> studentList = userInfoMapper.loginsGetStudentSchoolInfo(userId,schoolId);
List<UserInfoReceiveVo> studentList = userInfoMapper.loginsGetStudentSchoolInfo(userId,schoolId);
obj.put("studentList",studentList);
resp.put("retcode", 200);
resp.put("retvalue", obj);
}else {
resp.put("retcode", 300);
resp.put("retvalue", "登录失败,密码有误!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "登录异常,请稍后再试!");
return resp;
}
}else if (state==1){
resp.put("retcode",400);
resp.put("retvalue","账号处于禁用状态");
}
return resp;
}
//登陆 //登陆
public HashMap<String, Object> logins(UserInfo userInfo){ public HashMap<String, Object> logins(UserInfo userInfo){

@ -0,0 +1,19 @@
package com.yipin.liuwanr.vo;
import lombok.Data;
@Data
public class UserInfoReceiveVo {
//学校id
private Integer schoolId;
//学校名称
private String schoolName;
//用户id
private Integer userId;
//学生id
private Integer studentId;
//账号状态
private Integer state;
}

@ -48,3 +48,6 @@ redis.cluster.maxTotal=200
redis.cluster.maxIdle=8 redis.cluster.maxIdle=8
redis.cluster.minIdle=3 redis.cluster.minIdle=3
redis.cluster.nodes=192.168.136.191:8000,192.168.136.191:8001,192.168.136.191:8002 redis.cluster.nodes=192.168.136.191:8000,192.168.136.191:8001,192.168.136.191:8002
server.port=8090
server.servlet.context-path= /liuwanr
Loading…
Cancel
Save