diff --git a/pom.xml b/pom.xml
index f0069d6..26d0da4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.yipin
liuwanr
1.0.0
- war
+ jar
Spring Boot Project
diff --git a/src/main/java/com/yipin/liuwanr/controller/UserController.java b/src/main/java/com/yipin/liuwanr/controller/UserController.java
index 59d816d..e7c72aa 100644
--- a/src/main/java/com/yipin/liuwanr/controller/UserController.java
+++ b/src/main/java/com/yipin/liuwanr/controller/UserController.java
@@ -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 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必须是phone、password)
@@ -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 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 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;
}
/**
diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
index d6de4e8..0027551 100644
--- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
+++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
@@ -299,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 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;
}
+
+ /**
+ * 查询电话
+ */
+ @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 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;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
index fca38f2..7a0465a 100644
--- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
+++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
@@ -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 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 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 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 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 loginsGetStudentSchoolInfo(Integer userId, Integer schoolId);
+
//查询用户员工组织关系
@Select("SELECT * from staff where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}")
List queryStaffAll(Integer userId, String roleId, Integer schoolId);
@@ -328,4 +337,7 @@ public interface UserInfoMapper {
"UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}",
""})
void deleteOrganizationRelationship(Integer userId);
+
+ @Select("SELECT disableAccount FROM hr_user_info WHERE schoolId = #{schoolId} AND account = #{account}")
+ Integer queryDisableAccount(UserInfo userInfo);
}
\ No newline at end of file
diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
index 89e1d3d..c027c55 100644
--- a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
+++ b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
@@ -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({ ""})
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 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({ ""})
+
+ @Update({ ""})
void putconf(Config config);
-
+
@Select("SELECT * from demo")
List 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({" "})
+ "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",
+ " and u.countries = #{countries} ",
+ " and u.provinceId = #{provinceId} ",
+ " and u.schoolId = #{schoolId} ",
+ " and u.cityId = #{cityId} ",
+ " and u.accountRole = #{accountRole} ",
+ " AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')",
+ " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)",
+ " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)",
+ " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)",
+ " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)",
+ " and u.creationTime between #{creationTime} and #{endTime}",
+ "GROUP BY u.userId order by u.creationTime desc",
+ " "})
List queryUser(UserM user);
@Select({" "})
+ "SELECT u.*,schoolName from user u,school s where u.isdel = 0 and u.schoolId = s.schoolId and u.userId = #{userId}",
+ " "})
List queryUserDetails(Integer userId);
@Select({" "})
List queryUserDetailsSta(Integer userId);
- @Select({" "})
- List queryCustomer(Integer cityId,Integer provinceId);
+ @Select({" "})
+ List queryCustomer(Integer cityId,Integer provinceId);
/**
* 批量插入用户
* @param user
*/
@Insert({
- ""
- })
+ ""
+ })
void addUserM(@Param("users")List 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}"})
diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java
index 4e820c8..b2dd48e 100644
--- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java
+++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java
@@ -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;
@@ -137,9 +138,9 @@ public class UserInfoService {
resp.put("retcode", 500);
resp.put("retvalue", "添加用户失败!");
throw new RuntimeException();
+ }
+ return resp;
}
- return resp;
-}
//查询用户信息
public HashMap queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){
@@ -383,6 +384,46 @@ public class UserInfoService {
}
return resp;
}
+ //登陆获取学校/电子科大
+ public HashMap loginSchoolClient(UserInfo userInfo){
+ HashMap resp = new HashMap();
+ HashMap obj = new HashMap();
+ 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 staffList = userInfoMapper.loginsGetStaffSchoolInfo(userId,schoolId);
+ obj.put("staffList",staffList);
+// List studentList = userInfoMapper.loginsGetStudentSchoolInfo(userId,schoolId);
+ List 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 logins(UserInfo userInfo){
@@ -692,8 +733,8 @@ public class UserInfoService {
//删除平台
public HashMap queryStuAndSta(Integer platformId,Integer userId){
- HashMap resp = new HashMap();
- HashMap obj = new HashMap();
+ HashMap resp = new HashMap();
+ HashMap obj = new HashMap();
try {
obj.put("Staff", userInfoMapper.queryStaff(platformId,userId));
obj.put("Student", userInfoMapper.queryStudent1(platformId,userId));
diff --git a/src/main/java/com/yipin/liuwanr/service/UserService.java b/src/main/java/com/yipin/liuwanr/service/UserService.java
index cac1651..ca48336 100644
--- a/src/main/java/com/yipin/liuwanr/service/UserService.java
+++ b/src/main/java/com/yipin/liuwanr/service/UserService.java
@@ -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 login(String id, String password){
HashMap resp = new HashMap();
User user = null;
@@ -78,7 +78,7 @@ public class UserService {
}
return resp;
}
-
+
public HashMap demo(Demo demo) {
HashMap result = new HashMap();
@@ -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 deleteStaff(UserM user){
- HashMap resp = new HashMap();
- 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 deleteStudent(UserM user){
- HashMap resp = new HashMap();
- 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 deleteStaff(UserM user){
+ HashMap resp = new HashMap();
+ 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 deleteStudent(UserM user){
+ HashMap resp = new HashMap();
+ 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 updateUser(UserM user){
HashMap resp = new HashMap();
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 logins(UserM userM){
HashMap resp = new HashMap();
- HashMap obj = new HashMap();
- Student student;
- Staff staff;
+ HashMap obj = new HashMap();
+ 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 queryUserDetails(Integer userId,Integer roleId){
HashMap resp = new HashMap();
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 uploadUserAvatars(MultipartFile file,Integer userId){
- HashMap resp = new HashMap();
- 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 uploadUserAvatars(MultipartFile file,Integer userId){
+ HashMap resp = new HashMap();
+ 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 updateLogInNumber(UserM user){
HashMap resp = new HashMap();
try {
diff --git a/src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java b/src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
new file mode 100644
index 0000000..0239be9
--- /dev/null
+++ b/src/main/java/com/yipin/liuwanr/vo/UserInfoReceiveVo.java
@@ -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;
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 9414e43..831f8c6 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -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
\ No newline at end of file
+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
\ No newline at end of file