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. 70
      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. 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>
<artifactId>liuwanr</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<packaging>jar</packaging>
<name>Spring Boot Project</name>

@ -38,7 +38,7 @@ public class UserController {
@GetMapping("/login")
Response loginUser(@RequestParam("id") String id, @RequestParam("password") String password,
HttpServletResponse response) {
HttpServletResponse response) {
Response resp = new Response();
HashMap<String, Object> ret = userService.login(id, password);
int status = (int) ret.get("retcode");
@ -70,10 +70,10 @@ public class UserController {
return resp;
}
@GetMapping("/reauth")
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();
String oldtoken = redisHelper.getTokenById(uuid);
String oldrefreshtoken = redisHelper.getRefreshTokenById(uuid);
@ -202,7 +202,7 @@ public class UserController {
}
return resp;
}
/**
* 查询用户(根据国家省份城市)
*/
@ -255,9 +255,9 @@ public class UserController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
}
return resp;
}
/**
* 删除用户(根据ID修改isdel状态,0可见 1不可见)
*/
@ -315,11 +315,11 @@ public class UserController {
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
}
}
}
return resp;
}
/**
* 更新用户
*/
@ -377,7 +377,7 @@ public class UserController {
}
return resp;
}
/**
* 登陆(前台传来的key必须是phonepassword)
@ -401,10 +401,10 @@ public class UserController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
return resp;
}
/**
* 查询用户详情(ID)
*/
@ -426,30 +426,30 @@ public class UserController {
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
}
return resp;
}
return resp;
}
@PostMapping("/uploadUserAvatars")
Response uploadUserAvatars(MultipartFile file,Integer userId) {
Response resp = new Response();
if (userId==null) {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
}else {
HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId);
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;
Response uploadUserAvatars(MultipartFile file,Integer userId) {
Response resp = new Response();
if (userId==null) {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
}else {
HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId);
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;
}
/**

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

@ -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}")
User getOne(String uuid);
@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}")
User getSelfById(String uuid);
@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}")
User getSelfByAccount(String key);
@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}")
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}")
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}")
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())")
void insert(User user);
@Update({ "<script>",
"UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
@Update({ "<script>",
"UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
void update(User user);
@ -63,41 +63,41 @@ public interface UserMapper {
@Insert("INSERT INTO lw_user_block(uuid, buuid, createtime) VALUES(#{uuid}, #{buuid}, now())")
void blockOne(String uuid, String buuid);
@Delete("DELETE FROM lw_user_block WHERE uuid = #{uuid} AND buuid = #{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}")
List<User> blockList(String uuid);
@Update({ "UPDATE lw_user SET password=#{password}, updatetime=now() WHERE uuid=#{uuid}"})
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())")
void genconf(Config config);
@Select("SELECT uuid,conf1, conf2, conf3, conf4, conf5 FROM lw_user_config where uuid=#{uuid}")
Config getconf(String uuid);
@Update({ "<script>",
"UPDATE lw_user_config SET",
"<when test='conf1!=-1'>", "conf1=#{conf1},", "</when>",
"<when test='conf2!=-1'>", "conf2=#{conf2},", "</when>",
"<when test='conf3!=-1'>", "conf3=#{conf3},", "</when>",
"<when test='conf4!=-1'>", "conf4=#{conf4},", "</when>",
"<when test='conf5!=-1'>", "conf5=#{conf5},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
@Update({ "<script>",
"UPDATE lw_user_config SET",
"<when test='conf1!=-1'>", "conf1=#{conf1},", "</when>",
"<when test='conf2!=-1'>", "conf2=#{conf2},", "</when>",
"<when test='conf3!=-1'>", "conf3=#{conf3},", "</when>",
"<when test='conf4!=-1'>", "conf4=#{conf4},", "</when>",
"<when test='conf5!=-1'>", "conf5=#{conf5},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
void putconf(Config config);
@Select("SELECT * from 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,"
+ "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}) ")
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)"
+ " 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);
@ -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})")
// 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>",
" <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null'>and u.schoolId = #{schoolId} </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='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==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==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>",
"GROUP BY u.userId order by u.creationTime desc",
"</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>",
" <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null'>and u.schoolId = #{schoolId} </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='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==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==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>",
"GROUP BY u.userId order by u.creationTime desc",
"</script> "})
List<UserM> queryUser(UserM user);
@Select({"<script>",
@ -188,8 +188,8 @@ public interface UserMapper {
//查询用户详情
@Select({"<script>",
"SELECT u.*,schoolName from user u,school s where u.isdel = 0 and u.schoolId = s.schoolId and u.userId = #{userId}",
"</script> "})
"SELECT u.*,schoolName from user u,school s where u.isdel = 0 and u.schoolId = s.schoolId and u.userId = #{userId}",
"</script> "})
List<UserM> queryUserDetails(Integer userId);
@Select({"<script>",
@ -235,28 +235,28 @@ public interface UserMapper {
"</script> "})
List<Staff> queryUserDetailsSta(Integer userId);
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0 and provinceId = #{provinceId} and cityId = #{cityId}",
"</script> "})
List<Customer> queryCustomer(Integer cityId,Integer provinceId);
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0 and provinceId = #{provinceId} and cityId = #{cityId}",
"</script> "})
List<Customer> queryCustomer(Integer cityId,Integer provinceId);
/**
* 批量插入用户
* @param user
*/
@Insert({
"<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>",
"</script>"
})
"<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>",
"</script>"
})
void addUserM(@Param("users")List<UserM> users);
//修改用户头像
@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}"})

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

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