Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
master
zhiyong.ning 4 years ago
commit 8459e8537b
  1. 2
      pom.xml
  2. 4
      src/main/java/com/yipin/liuwanr/controller/UserController.java
  3. 33
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  4. 16
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  5. 2
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  6. 43
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  7. 19
      src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
  8. 3
      src/main/resources/application.properties

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

@ -256,7 +256,7 @@ public class UserController {
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
}
}
/**
* 删除用户(根据ID修改isdel状态,0可见 1不可见)
@ -429,7 +429,7 @@ public class UserController {
}
}
return resp;
}
}
@PostMapping("/uploadUserAvatars")
Response uploadUserAvatars(MultipartFile file,Integer userId) {

@ -5,6 +5,7 @@ import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.service.UserService;
import com.yipin.liuwanr.vo.UserInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,9 @@ public class UserInfoController {
@Autowired
private UserInfoService userInfoService;
@Autowired
private UserService userService;
@Autowired
RedisHelper redisHelper;
@ -295,6 +299,35 @@ public class UserInfoController {
}
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;
}
/**
* 服务端登陆

@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoReceiveVo;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*;
@ -143,14 +144,22 @@ public interface UserInfoMapper {
@Select("SELECT userId,roleId from student where userId = #{userId} and schoolId = #{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")
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")
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}")
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}",
"</script>"})
void deleteOrganizationRelationship(Integer userId);
@Select("SELECT disableAccount FROM hr_user_info WHERE schoolId = #{schoolId} AND account = #{account}")
Integer queryDisableAccount(UserInfo userInfo);
}

@ -112,7 +112,7 @@ public interface UserMapper {
// + " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId})")
// void addStaff(Staff staff);
// @Select("SELECT * from user where isdel = 1 and countries = #{countries} and provinces = #{provinces} and city = #{city}")
// @Select("SELECT * from user where isdel = 1 and countries = #{countries} and provinces = #{provinces} and city = #{city}")
@Select({"<script>",
"SELECT u.*,s.schoolName,p.provinceName,c.cityName from user u,school s,province p,city c where u.isdel = 0 and p.provinceId = u.provinceId and p.provinceId = c.provinceId and u.cityId = c.cityId and u.schoolId = s.schoolId",
" <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",

@ -12,6 +12,7 @@ import com.yipin.liuwanr.mapper.OrganizationRelationshipMapper;
import com.yipin.liuwanr.mapper.StaffMapper;
import com.yipin.liuwanr.mapper.StudentMapper;
import com.yipin.liuwanr.mapper.UserInfoMapper;
import com.yipin.liuwanr.vo.UserInfoReceiveVo;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -144,7 +145,7 @@ public class UserInfoService {
throw new RuntimeException();
}
return resp;
}
}
//查询用户信息
public HashMap<String, Object> queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){
@ -388,6 +389,46 @@ public class UserInfoService {
}
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){

@ -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.minIdle=3
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