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. 50
      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. 104
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  6. 49
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  7. 146
      src/main/java/com/yipin/liuwanr/service/UserService.java
  8. 19
      src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
  9. 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>

@ -38,7 +38,7 @@ public class UserController {
@GetMapping("/login") @GetMapping("/login")
Response loginUser(@RequestParam("id") String id, @RequestParam("password") String password, Response loginUser(@RequestParam("id") String id, @RequestParam("password") String password,
HttpServletResponse response) { HttpServletResponse response) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = userService.login(id, password); HashMap<String, Object> ret = userService.login(id, password);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
@ -73,7 +73,7 @@ public class UserController {
@GetMapping("/reauth") @GetMapping("/reauth")
Response getNewToken(@RequestHeader("X-UUID") String uuid, @RequestHeader("X-TOKEN") String stoken, Response getNewToken(@RequestHeader("X-UUID") String uuid, @RequestHeader("X-TOKEN") String stoken,
@RequestHeader("X-SIGN") String sign, HttpServletResponse response) { @RequestHeader("X-SIGN") String sign, HttpServletResponse response) {
Response resp = new Response(); Response resp = new Response();
String oldtoken = redisHelper.getTokenById(uuid); String oldtoken = redisHelper.getTokenById(uuid);
String oldrefreshtoken = redisHelper.getRefreshTokenById(uuid); String oldrefreshtoken = redisHelper.getRefreshTokenById(uuid);
@ -255,8 +255,8 @@ public class UserController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
return resp; return resp;
} }
/** /**
* 删除用户(根据ID修改isdel状态,0可见 1不可见) * 删除用户(根据ID修改isdel状态,0可见 1不可见)
@ -315,7 +315,7 @@ public class UserController {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
} }
} }
return resp; return resp;
} }
@ -401,7 +401,7 @@ public class UserController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
return resp; return resp;
} }
@ -428,28 +428,28 @@ public class UserController {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
} }
return resp; return resp;
} }
@PostMapping("/uploadUserAvatars") @PostMapping("/uploadUserAvatars")
Response uploadUserAvatars(MultipartFile file,Integer userId) { Response uploadUserAvatars(MultipartFile file,Integer userId) {
Response resp = new Response(); Response resp = new Response();
if (userId==null) {//前台传来的值是否为空 if (userId==null) {//前台传来的值是否为空
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("Parameter Invalid"); resp.setErrmessage("Parameter Invalid");
}else { }else {
HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId); HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
resp.setMessage(ret.get("retvalue")); resp.setMessage(ret.get("retvalue"));
} else { } else {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
} }
return resp; return resp;
} }
/** /**

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

@ -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);
} }

@ -16,19 +16,19 @@ public interface UserMapper {
User getOne(String uuid); User getOne(String uuid);
@Results({ @Results({
@Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER)) @Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER))
}) })
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE uuid = #{uuid}") @Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE uuid = #{uuid}")
User getSelfById(String uuid); User getSelfById(String uuid);
@Results({ @Results({
@Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER)) @Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER))
}) })
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE mobile = #{key} or email = #{key}") @Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE mobile = #{key} or email = #{key}")
User getSelfByAccount(String key); User getSelfByAccount(String key);
@Results({ @Results({
@Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER)) @Result(property="pets", column="petlist", many=@Many(select="com.yipin.liuwanr.mapper.PetMapper.getAll",fetchType=FetchType.EAGER))
}) })
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE wxid = #{value} or qqid = #{value} or aliid = #{value} or sinaid = #{value} or netid = #{value}") @Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city, uuid as petlist, password,createtime,updatetime FROM lw_user WHERE wxid = #{value} or qqid = #{value} or aliid = #{value} or sinaid = #{value} or netid = #{value}")
User getSelfBy3rdId(String value); User getSelfBy3rdId(String value);
@ -43,18 +43,18 @@ public interface UserMapper {
void insert(User user); void insert(User user);
@Update({ "<script>", @Update({ "<script>",
"UPDATE lw_user SET", "UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>", "<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>", "<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>", "<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>", "<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>", "<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>", "<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>", "<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>", "<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>", "<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>", "<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}", "updatetime=now() WHERE uuid =#{uuid}",
"</script>"}) "</script>"})
void update(User user); void update(User user);
@ -80,14 +80,14 @@ public interface UserMapper {
Config getconf(String uuid); Config getconf(String uuid);
@Update({ "<script>", @Update({ "<script>",
"UPDATE lw_user_config SET", "UPDATE lw_user_config SET",
"<when test='conf1!=-1'>", "conf1=#{conf1},", "</when>", "<when test='conf1!=-1'>", "conf1=#{conf1},", "</when>",
"<when test='conf2!=-1'>", "conf2=#{conf2},", "</when>", "<when test='conf2!=-1'>", "conf2=#{conf2},", "</when>",
"<when test='conf3!=-1'>", "conf3=#{conf3},", "</when>", "<when test='conf3!=-1'>", "conf3=#{conf3},", "</when>",
"<when test='conf4!=-1'>", "conf4=#{conf4},", "</when>", "<when test='conf4!=-1'>", "conf4=#{conf4},", "</when>",
"<when test='conf5!=-1'>", "conf5=#{conf5},", "</when>", "<when test='conf5!=-1'>", "conf5=#{conf5},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}", "updatetime=now() WHERE uuid =#{uuid}",
"</script>"}) "</script>"})
void putconf(Config config); void putconf(Config config);
@Select("SELECT * from demo") @Select("SELECT * from demo")
@ -112,22 +112,22 @@ 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})") // + " 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); // 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({"<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", "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>", " <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>", " <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null'>and u.schoolId = #{schoolId} </if>", " <if test='schoolId!=null'>and u.schoolId = #{schoolId} </if>",
" <if test='cityId!=null and cityId !=\"\" '>and u.cityId = #{cityId} </if>", " <if test='cityId!=null and cityId !=\"\" '>and u.cityId = #{cityId} </if>",
" <if test='accountRole!=null and accountRole !=\"\" '>and u.accountRole = #{accountRole} </if>", " <if test='accountRole!=null and accountRole !=\"\" '>and u.accountRole = #{accountRole} </if>",
" <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')</if>", " <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>", " <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>", " <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",
" <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>", " <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>",
" <if test='month==12'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)</if>", " <if test='month==12'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)</if>",
" <if test='creationTime!=null and endTime!=null and endTime!=\"\" and creationTime!=\"\" '> and u.creationTime between #{creationTime} and #{endTime}</if>", " <if test='creationTime!=null and endTime!=null and endTime!=\"\" and creationTime!=\"\" '> and u.creationTime between #{creationTime} and #{endTime}</if>",
"GROUP BY u.userId order by u.creationTime desc", "GROUP BY u.userId order by u.creationTime desc",
"</script> "}) "</script> "})
List<UserM> queryUser(UserM user); List<UserM> queryUser(UserM user);
@Select({"<script>", @Select({"<script>",
@ -188,8 +188,8 @@ public interface UserMapper {
//查询用户详情 //查询用户详情
@Select({"<script>", @Select({"<script>",
"SELECT u.*,schoolName from user u,school s where u.isdel = 0 and u.schoolId = s.schoolId and u.userId = #{userId}", "SELECT u.*,schoolName from user u,school s where u.isdel = 0 and u.schoolId = s.schoolId and u.userId = #{userId}",
"</script> "}) "</script> "})
List<UserM> queryUserDetails(Integer userId); List<UserM> queryUserDetails(Integer userId);
@Select({"<script>", @Select({"<script>",
@ -235,28 +235,28 @@ public interface UserMapper {
"</script> "}) "</script> "})
List<Staff> queryUserDetailsSta(Integer userId); List<Staff> queryUserDetailsSta(Integer userId);
@Select({"<script>", @Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0 and provinceId = #{provinceId} and cityId = #{cityId}", "SELECT customerId,customerName,schoolId FROM customer where isdel = 0 and provinceId = #{provinceId} and cityId = #{cityId}",
"</script> "}) "</script> "})
List<Customer> queryCustomer(Integer cityId,Integer provinceId); List<Customer> queryCustomer(Integer cityId,Integer provinceId);
/** /**
* 批量插入用户 * 批量插入用户
* @param user * @param user
*/ */
@Insert({ @Insert({
"<script>", "<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ", "insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>", "<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)", "(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>", "</foreach>",
"</script>" "</script>"
}) })
void addUserM(@Param("users")List<UserM> users); void addUserM(@Param("users")List<UserM> users);
//修改用户头像 //修改用户头像
@Update("update user set userAvatars=#{userAvatars} where userId=#{userId}") @Update("update user set userAvatars=#{userAvatars} where userId=#{userId}")
void updateUserAvatars(@Param("userAvatars")String userAvatars, @Param("userId")Integer userId); void updateUserAvatars(@Param("userAvatars")String userAvatars, @Param("userId")Integer userId);
//更新用户登录次数和最后一次登录时间 //更新用户登录次数和最后一次登录时间
@Update({ "UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"}) @Update({ "UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"})

@ -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;
@ -142,9 +143,9 @@ public class UserInfoService {
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "添加用户失败!"); resp.put("retvalue", "添加用户失败!");
throw new RuntimeException(); throw new RuntimeException();
}
return resp;
} }
return resp;
}
//查询用户信息 //查询用户信息
public HashMap<String, Object> queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){ public HashMap<String, Object> queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){
@ -388,6 +389,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){
@ -701,8 +742,8 @@ public class UserInfoService {
//查询员工信息和学生信息 //查询员工信息和学生信息
public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){ public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> obj = new HashMap<String, Object>();
try { try {
obj.put("Staff", userInfoMapper.queryStaff(platformId,userId)); obj.put("Staff", userInfoMapper.queryStaff(platformId,userId));
obj.put("Student", userInfoMapper.queryStudent1(platformId,userId)); obj.put("Student", userInfoMapper.queryStudent1(platformId,userId));

@ -43,11 +43,11 @@ public class UserService {
@Autowired @Autowired
private JedisCluster jedis; private JedisCluster jedis;
@Autowired @Autowired
private AliyunOssConfig config; private AliyunOssConfig config;
@Autowired @Autowired
private BeanFactory beanFactory; private BeanFactory beanFactory;
public HashMap<String, Object> login(String id, String password){ public HashMap<String, Object> login(String id, String password){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
@ -152,7 +152,7 @@ public class UserService {
totalPages = total1 / pageSize; totalPages = total1 / pageSize;
if (total1 % pageSize != 0){ if (total1 % pageSize != 0){
totalPages ++; totalPages ++;
} }
long total = total1; long total = total1;
resp.put("retvalue", new PageResult(total, list,totalPages)); resp.put("retvalue", new PageResult(total, list,totalPages));
resp.put("retcode", 200); resp.put("retcode", 200);
@ -185,38 +185,38 @@ public class UserService {
return resp; return resp;
} }
//批量删除员工 //批量删除员工
public HashMap<String, Object> deleteStaff(UserM user){ public HashMap<String, Object> deleteStaff(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
userMapper.deleteStaff(user); userMapper.deleteStaff(user);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "删除员工失败"); resp.put("retvalue", "删除员工失败");
return resp; return resp;
} }
return resp; return resp;
} }
//批量删除学生 //批量删除学生
public HashMap<String, Object> deleteStudent(UserM user){ public HashMap<String, Object> deleteStudent(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
userMapper.deleteStudent(user); userMapper.deleteStudent(user);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "删除学生失败"); resp.put("retvalue", "删除学生失败");
return resp; return resp;
} }
return resp; return resp;
} }
//更新用户 //更新用户
@Transactional @Transactional
public HashMap<String, Object> updateUser(UserM user){ public HashMap<String, Object> updateUser(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
@ -226,7 +226,7 @@ public class UserService {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "更新用户失败!"); resp.put("retvalue", "更新用户失败!");
throw new RuntimeException(); throw new RuntimeException();
} }
return resp; return resp;
} }
@ -266,9 +266,9 @@ public class UserService {
//登陆 //登陆
public HashMap<String, Object> logins(UserM userM){ public HashMap<String, Object> logins(UserM userM){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> obj = new HashMap<String, Object>();
Student student; Student student;
Staff staff; Staff staff;
try { try {
UserM user=userMapper.logins(userM); UserM user=userMapper.logins(userM);
if(user!=null) { if(user!=null) {
@ -279,14 +279,14 @@ public class UserService {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String lastTime=sd.format(date); String lastTime=sd.format(date);
if(user.getAccountRole().equals(4)) { if(user.getAccountRole().equals(4)) {
student=studentMapper.queryStudentQ(user); student=studentMapper.queryStudentQ(user);
if(student!=null) { if(student!=null) {
Integer studentId=student.getStudentId(); Integer studentId=student.getStudentId();
studentMapper.updateStudentQ(lastTime,loginNumber, studentId); studentMapper.updateStudentQ(lastTime,loginNumber, studentId);
obj.put("student",student); obj.put("student",student);
} }
}else if(user.getAccountRole().equals(3)) { }else if(user.getAccountRole().equals(3)) {
staff =staffMapper.queryStaffQ(user); staff =staffMapper.queryStaffQ(user);
if(staff!=null) { if(staff!=null) {
Integer staffId=staff.getStaffId(); Integer staffId=staff.getStaffId();
staffMapper.updateStaffQ(lastTime,loginNumber, staffId); staffMapper.updateStaffQ(lastTime,loginNumber, staffId);
@ -315,16 +315,16 @@ public class UserService {
public HashMap<String, Object> queryUserDetails(Integer userId,Integer roleId){ public HashMap<String, Object> queryUserDetails(Integer userId,Integer roleId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if (roleId == 3){ if (roleId == 3){
resp.put("retvalue", userMapper.queryUserDetailsStaff(userId)); resp.put("retvalue", userMapper.queryUserDetailsStaff(userId));
resp.put("retcode", 200); resp.put("retcode", 200);
}else if (roleId == 4){ }else if (roleId == 4){
resp.put("retvalue", userMapper.queryUserDetailsStudent(userId)); resp.put("retvalue", userMapper.queryUserDetailsStudent(userId));
resp.put("retcode", 200); resp.put("retcode", 200);
}else{ }else{
resp.put("retvalue", userMapper.queryUserDetailsAdmin(userId)); resp.put("retvalue", userMapper.queryUserDetailsAdmin(userId));
resp.put("retcode", 200); resp.put("retcode", 200);
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
@ -349,28 +349,28 @@ public class UserService {
return resp; return resp;
} }
//修改用户头像 //修改用户头像
public HashMap<String, Object> uploadUserAvatars(MultipartFile file,Integer userId){ public HashMap<String, Object> uploadUserAvatars(MultipartFile file,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
OSSClient client=beanFactory.getBean(OSSClient.class); OSSClient client=beanFactory.getBean(OSSClient.class);
FilesResult result=OssConfigUtil.uploadUserAvatars(file, client, config); FilesResult result=OssConfigUtil.uploadUserAvatars(file, client, config);
//用户图片路径 //用户图片路径
String userAvatars=result.getFileUrl(); String userAvatars=result.getFileUrl();
userMapper.updateUserAvatars(userAvatars,userId); userMapper.updateUserAvatars(userAvatars,userId);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", userAvatars); resp.put("retvalue", userAvatars);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage()); logger.info(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "修改头像失败!"); resp.put("retvalue", "修改头像失败!");
return resp; return resp;
} }
return resp; return resp;
} }
//更新登录次数和时间 //更新登录次数和时间
public HashMap<String, Object> updateLogInNumber(UserM user){ public HashMap<String, Object> updateLogInNumber(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {

@ -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