修改登录

master
mzh820631607 4 years ago
parent 90b26c90ab
commit 8e7a90cd2c
  1. 2
      pom.xml
  2. 70
      src/main/java/com/yipin/liuwanr/controller/UserController.java
  3. 52
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  4. 16
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  5. 134
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  6. 49
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  7. 156
      src/main/java/com/yipin/liuwanr/service/UserService.java
  8. 19
      src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
  9. 5
      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");
@ -70,10 +70,10 @@ public class UserController {
return resp; return resp;
} }
@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);
@ -202,7 +202,7 @@ public class UserController {
} }
return resp; return resp;
} }
/** /**
* 查询用户(根据国家省份城市) * 查询用户(根据国家省份城市)
*/ */
@ -255,9 +255,9 @@ 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,11 +315,11 @@ 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;
} }
/** /**
* 更新用户 * 更新用户
*/ */
@ -377,7 +377,7 @@ public class UserController {
} }
return resp; return resp;
} }
/** /**
* 登陆(前台传来的key必须是phonepassword) * 登陆(前台传来的key必须是phonepassword)
@ -401,10 +401,10 @@ 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) * 查询用户详情(ID)
*/ */
@ -426,30 +426,30 @@ public class UserController {
} else { } else {
resp.setStatus(status); resp.setStatus(status);
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;
} }
/** /**

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

@ -14,47 +14,47 @@ public interface UserMapper {
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,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,password,createtime,updatetime FROM lw_user WHERE uuid = #{uuid}")
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);
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime,updatetime FROM lw_user WHERE mobile = #{value}") @Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime,updatetime FROM lw_user WHERE mobile = #{value}")
User getOneByMobile(String value); User getOneByMobile(String value);
@Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime,updatetime FROM lw_user WHERE email = #{value}") @Select("SELECT uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime,updatetime FROM lw_user WHERE email = #{value}")
User getOneByEmail(String value); User getOneByEmail(String value);
@Insert("INSERT INTO lw_user(uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime) VALUES(#{uuid},#{mobile},#{email},#{wxid},#{qqid},#{aliid},#{sinaid},#{netid},#{nickname},#{sex},#{birthday},#{sign},#{avatar},#{country},#{province},#{city},#{password},now())") @Insert("INSERT INTO lw_user(uuid,mobile,email,wxid,qqid,aliid,sinaid,netid,nickname,sex,birthday,sign,avatar,country,province,city,password,createtime) VALUES(#{uuid},#{mobile},#{email},#{wxid},#{qqid},#{aliid},#{sinaid},#{netid},#{nickname},#{sex},#{birthday},#{sign},#{avatar},#{country},#{province},#{city},#{password},now())")
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);
@ -63,41 +63,41 @@ public interface UserMapper {
@Insert("INSERT INTO lw_user_block(uuid, buuid, createtime) VALUES(#{uuid}, #{buuid}, now())") @Insert("INSERT INTO lw_user_block(uuid, buuid, createtime) VALUES(#{uuid}, #{buuid}, now())")
void blockOne(String uuid, String buuid); void blockOne(String uuid, String buuid);
@Delete("DELETE FROM lw_user_block WHERE uuid = #{uuid} AND buuid = #{buuid}") @Delete("DELETE FROM lw_user_block WHERE uuid = #{uuid} AND buuid = #{buuid}")
void unblockOne(String uuid, String buuid); void unblockOne(String uuid, String buuid);
@Select("SELECT lw_user.uuid, lw_user.nickname, lw_user.sex, lw_user.sign, lw_user.avatar FROM lw_user_block JOIN lw_user ON lw_user_block.buuid = lw_user.uuid WHERE lw_user_block.uuid = #{uuid}") @Select("SELECT lw_user.uuid, lw_user.nickname, lw_user.sex, lw_user.sign, lw_user.avatar FROM lw_user_block JOIN lw_user ON lw_user_block.buuid = lw_user.uuid WHERE lw_user_block.uuid = #{uuid}")
List<User> blockList(String uuid); List<User> blockList(String uuid);
@Update({ "UPDATE lw_user SET password=#{password}, updatetime=now() WHERE uuid=#{uuid}"}) @Update({ "UPDATE lw_user SET password=#{password}, updatetime=now() WHERE uuid=#{uuid}"})
void changePassword(String uuid, String password); void changePassword(String uuid, String password);
@Insert("INSERT INTO lw_user_config(uuid, conf1, conf2, conf3, conf4, conf5, updatetime) VALUES(#{uuid}, #{conf1}, #{conf2}, #{conf3}, #{conf4}, #{conf5}, now())") @Insert("INSERT INTO lw_user_config(uuid, conf1, conf2, conf3, conf4, conf5, updatetime) VALUES(#{uuid}, #{conf1}, #{conf2}, #{conf3}, #{conf4}, #{conf5}, now())")
void genconf(Config config); void genconf(Config config);
@Select("SELECT uuid,conf1, conf2, conf3, conf4, conf5 FROM lw_user_config where uuid=#{uuid}") @Select("SELECT uuid,conf1, conf2, conf3, conf4, conf5 FROM lw_user_config where uuid=#{uuid}")
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")
List<Demo> demo(Demo demo); List<Demo> demo(Demo demo);
@Insert("INSERT INTO demo(symbol,code,name,trade,pricechange,changepercent,buy,sell,settlement,open,high,low,volume,amount,ticktime," @Insert("INSERT INTO demo(symbol,code,name,trade,pricechange,changepercent,buy,sell,settlement,open,high,low,volume,amount,ticktime,"
+ "per,pb,mktcap,nmc,turnoverratio) VALUES(#{symbol},#{code},#{name},#{trade},#{pricechange},#{changepercent},#{buy},#{sell}," + "per,pb,mktcap,nmc,turnoverratio) VALUES(#{symbol},#{code},#{name},#{trade},#{pricechange},#{changepercent},#{buy},#{sell},"
+ "#{settlement},#{open},#{high},#{low},#{volume},#{amount},#{ticktime},#{per},#{pb},#{mktcap},#{nmc},#{turnoverratio}) ") + "#{settlement},#{open},#{high},#{low},#{volume},#{amount},#{ticktime},#{per},#{pb},#{mktcap},#{nmc},#{turnoverratio}) ")
void insertDemo(Demo demo); void insertDemo(Demo demo);
@Insert("INSERT INTO user(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId,userAccount,workNumber)" @Insert("INSERT INTO user(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId,userAccount,workNumber)"
+ " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId},#{userAccount},#{workNumber})") + " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId},#{userAccount},#{workNumber})")
void addUser(UserM user); void addUser(UserM user);
@ -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;
@ -137,9 +138,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){
@ -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){
@ -692,8 +733,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));

@ -30,9 +30,9 @@ import redis.clients.jedis.JedisCluster;
@Service @Service
public class UserService { public class UserService {
private static Logger logger = Logger.getLogger(UserService.class); private static Logger logger = Logger.getLogger(UserService.class);
@Autowired @Autowired
private UserMapper userMapper; private UserMapper userMapper;
@Autowired @Autowired
@ -43,12 +43,12 @@ 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>();
User user = null; User user = null;
@ -78,7 +78,7 @@ public class UserService {
} }
return resp; return resp;
} }
public HashMap<String, Object> demo(Demo demo) { public HashMap<String, Object> demo(Demo demo) {
HashMap<String, Object> result = new HashMap<String, Object>(); HashMap<String, Object> result = 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;
}

@ -47,4 +47,7 @@ logging.level.com.yipin.liuwanr.mapper=debug
redis.cluster.maxTotal=200 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