上传代码

master
zhiyong.ning 4 years ago
parent 5585f78693
commit d6d4ef9b92
  1. 20
      pom.xml
  2. 2
      src/main/java/com/yipin/liuwanr/UserTest.java
  3. 113
      src/main/java/com/yipin/liuwanr/controller/StaffController.java
  4. 174
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  5. 414
      src/main/java/com/yipin/liuwanr/entity/StuStaff.java
  6. 72
      src/main/java/com/yipin/liuwanr/entity/UserInfo.java
  7. 35
      src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
  8. 10
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  9. 36
      src/main/java/com/yipin/liuwanr/service/StaffService.java
  10. 26
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  11. 9
      src/main/java/com/yipin/liuwanr/vo/UserInfoVO.java
  12. 12
      src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java

@ -71,6 +71,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId> <artifactId>spring-boot-starter-logging</artifactId>
</exclusion> </exclusion>
<!--<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>-->
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -241,7 +245,7 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.21</version> <version>1.7.12</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>
@ -249,10 +253,24 @@
<version>1.4</version> <version>1.4</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--添加servlet-api的依赖,用来打war包 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>ROOT</finalName> <finalName>ROOT</finalName>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>

@ -21,8 +21,8 @@ import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException; import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.tomcat.util.codec.binary.Base64;
import com.aliyun.oss.OSSClient; import com.aliyun.oss.OSSClient;
import com.yipin.liuwanr.entity.Speed; import com.yipin.liuwanr.entity.Speed;

@ -293,33 +293,128 @@ public class StaffController {
@PostMapping("/addStaff") @PostMapping("/addStaff")
Response addStaff(@RequestBody UserInfoVO vo) { Response addStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response(); Response resp = new Response();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
UserInfo userInfo = vo.getUserInfo(); UserInfo userInfo = vo.getUserInfo();
Integer userId = userInfo.getUserId();
String account = userInfo.getAccount(); String account = userInfo.getAccount();
Integer isNewUser = userInfo.getIsNewUser();
if (account==null||account=="") { if (account==null||account=="") {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("账号为空添加失败!"); resp.setErrmessage("账号为空添加失败!");
} else { } else {
HashMap<String, Object> ret = userInfoService.logins(userInfo); if (isNewUser==0){
int status = (int) ret.get("retcode"); HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
if (200 == status) { int status = (int) sta.get("retcode");
if (status == 200){
resp.setStatus(status); resp.setStatus(status);
resp.setMessage(ret.get("retvalue")); resp.setMessage(sta.get("retvalue"));
HashMap<String, Object> ret1 = userInfoService.addUser(userInfo); }else{
int status1 = (int) ret1.get("retcode"); resp.setStatus(status);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}else if(isNewUser==1){
HashMap<String, Object> ret = userInfoService.addUser(userInfo);
userId = (int) ret.get("userId");
int status = (int) ret.get("retcode");
if (status == 200){
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int status1 = (int) sta.get("retcode");
if (status1 == 200){ if (status1 == 200){
resp.setStatus(status1); resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue")); resp.setMessage(sta.get("retvalue"));
}else{ }else{
resp.setStatus(status1); resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString()); resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
} else { }else{
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
}else{
resp.setStatus(300);
resp.setErrmessage("新老用户为空添加失败!");
}
}
return resp;
}
/**
* 更新员工
*/
@PostMapping("/updateStaff")
Response updateStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response();
OrganizationRelationship or = vo.getOrganizationRelationship();
UserInfo userInfo = vo.getUserInfo();
if (or==null) {
resp.setStatus(300);
resp.setErrmessage("组织架构为空,修改失败!");
}else if (userInfo.getUserId()==null){
resp.setStatus(300);
resp.setErrmessage("用户为空,修改失败!");
} else {
HashMap<String, Object> ret = staffService.updateNewStaff(vo);
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;
}
/**
* 删除员工
*/
@PostMapping("/deleteStaff")
Response deleteStaff(@RequestBody List<OrganizationRelationship> OrganizationRelationshipList) {
Response resp = new Response();
if (OrganizationRelationshipList.isEmpty()){
resp.setStatus(300);
resp.setErrmessage("员工为空,删除失败!");
} else {
HashMap<String, Object> ret = staffService.deleteStaff(OrganizationRelationshipList);
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; return resp;
} }
/**
* 查询员工详情
*/
@GetMapping("/queryStaffDetails")
Response queryStaffDetails(@RequestParam Integer userId,Integer roleId) {
Response resp = new Response();
if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,查询失败!");
}else if (roleId==null){
resp.setStatus(300);
resp.setErrmessage("角色id为空,查询失败!");
} else {
HashMap<String, Object> ret = staffService.queryStaffDetails(userId,roleId);
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;
}
} }

@ -1,13 +1,11 @@
package com.yipin.liuwanr.controller; package com.yipin.liuwanr.controller;
import com.yipin.liuwanr.entity.*; import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.helper.QueryStudentUtils;
import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService; import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService; import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserInfoService; import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserInfoVO;
import jdk.nashorn.internal.ir.IfNode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -15,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -167,59 +164,50 @@ public class UserInfoController {
Response resp = new Response(); Response resp = new Response();
//个人档案实体 //个人档案实体
List<UserProfiles> userProfilesList = vo.getUserProfilesList(); List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//学生员工实体list
List<StuStaff> stuStaffList = vo.getStuStaffList();
//组织架构list //组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList(); List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
//用户实体 //用户实体
UserInfo user = vo.getUserInfo(); UserInfo user = vo.getUserInfo();
//用户手机号 //用户手机号
String phone = user.getPhone(); String account = user.getAccount();
//用户名称 //用户名称
String name = user.getUserName(); String name = user.getUserName();
//省份id
Integer provinceId = user.getProvinceId();
//用户角色id //用户角色id
Integer roleId = user.getRoleId(); Integer roleId = user.getRoleId();
//城市id
Integer cityId = user.getCityId();
//学校id //学校id
Integer schoolId = user.getSchoolId(); Integer schoolId = user.getSchoolId();
if (name == null || name == "") { if(name==null||name==""){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("姓名不能为空!"); resp.setErrmessage("姓名不能为空!");
} else if (provinceId == null) { }else if(account==null||account==""){
resp.setStatus(300);
resp.setErrmessage("省份不能为空!");
} else if (cityId == null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("城市不能为空!"); resp.setErrmessage("账号不能为空!");
} else if (schoolId == null) { }else if(schoolId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("学校不能为空!"); resp.setErrmessage("学校不能为空!");
} else { }else {
HashMap<String, Object> ret = userInfoService.addUser(user); HashMap<String, Object> ret = userInfoService.addUser(user);
Integer userId = user.getUserId(); Integer userId = user.getUserId();
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"));
HashMap<String, Object> stu = userInfoService.addPersonalFile(userProfilesList, userId); HashMap<String, Object> stu = userInfoService.addPersonalFile(userProfilesList,userId);
int stuStatus = (int) stu.get("retcode"); int stuStatus = (int) stu.get("retcode");
if (stuStatus == 200) { if (stuStatus == 200){
resp.setStatus(stuStatus); resp.setStatus(stuStatus);
resp.setMessage(stu.get("retvalue")); resp.setMessage(stu.get("retvalue"));
} else { }else {
resp.setStatus(stuStatus); resp.setStatus(stuStatus);
resp.setErrmessage(stu.get("retvalue").toString()); resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList, userId); HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int staStatus = (int) sta.get("retcode"); int staStatus = (int) sta.get("retcode");
if (staStatus == 200) { if (staStatus == 200){
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue")); resp.setMessage(sta.get("retvalue"));
} else { }else {
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString()); resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
@ -241,43 +229,42 @@ public class UserInfoController {
Response resp = new Response(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
//设置国家 //设置国家
if (countries != null && countries != "") { if (countries != null&&countries!="") {
userInfo.setCountries(countries); userInfo.setCountries(countries);
} }
//设置省份 //设置省份
if (provinceId != null) { if(provinceId!=null) {
userInfo.setProvinceId(provinceId); userInfo.setProvinceId(provinceId);
} }
//设置城市 //设置城市
if (cityId != null) { if(cityId!=null) {
userInfo.setCityId(cityId); userInfo.setCityId(cityId);
} }
//学校 //学校
if (schoolId != null) { if (schoolId!=null) {
userInfo.setSchoolId(schoolId); userInfo.setSchoolId(schoolId);
} }
//角色 //角色
if (roleId != null) { if (roleId!=null) {
userInfo.setRoleId(roleId); userInfo.setRoleId(roleId);
} }
//搜索内容 //搜索内容
if (searchContent != null && searchContent != "") { if (searchContent!=null&&searchContent!="") {
userInfo.setSearchContent(searchContent); userInfo.setSearchContent(searchContent);
} }
//月份 //月份
if (month != null) { if (month!=null) {
userInfo.setMonth(month); userInfo.setMonth(month);;
;
} }
//创建时间 //创建时间
if (creationTime != null && creationTime != "") { if (creationTime!=null&&creationTime!="") {
userInfo.setCreationTime(creationTime); userInfo.setCreationTime(creationTime);
} }
//结束时间 //结束时间
if (endTime != null && endTime != "") { if (endTime!=null&&endTime!="") {
userInfo.setEndTime(endTime); userInfo.setEndTime(endTime);
} }
HashMap<String, Object> ret = userInfoService.queryUserInfo(userInfo, pageNo, pageSize); HashMap<String, Object> ret = userInfoService.queryUserInfo(userInfo,pageNo,pageSize);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -296,7 +283,7 @@ public class UserInfoController {
@PostMapping("/deleteUserInfo") @PostMapping("/deleteUserInfo")
public Response deleteUserInfo(@RequestBody List<Integer> userIdList) { public Response deleteUserInfo(@RequestBody List<Integer> userIdList) {
Response resp = new Response(); Response resp = new Response();
if (userIdList == null) { if (userIdList==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空,删除用户失败!"); resp.setErrmessage("用户id为空,删除用户失败!");
} else { } else {
@ -310,12 +297,12 @@ public class UserInfoController {
if (200 == staStatus) { if (200 == staStatus) {
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue")); resp.setMessage(sta.get("retvalue"));
} else { }else{
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString()); resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
} else { }else {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
@ -332,7 +319,7 @@ public class UserInfoController {
public Response updateUserInfo(@RequestBody UserInfo userInfo) { public Response updateUserInfo(@RequestBody UserInfo userInfo) {
Response resp = new Response(); Response resp = new Response();
Integer userId = userInfo.getUserId(); Integer userId = userInfo.getUserId();
if (userId == null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户ID为空,修改用户失败!"); resp.setErrmessage("用户ID为空,修改用户失败!");
} else { } else {
@ -408,13 +395,13 @@ public class UserInfoController {
Response loginSchool(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) { Response loginSchool(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
if (account == null || account == "") { if (account == null || account=="") {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户账号为空,登录失败!"); resp.setErrmessage("用户账号为空,登录失败!");
} else if (password == null || password == "") { }else if(password ==null || password=="") {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户密码为空,登录失败!"); resp.setErrmessage("用户密码为空,登录失败!");
} else { }else{
userInfo.setAccount(account); userInfo.setAccount(account);
userInfo.setPassword(password); userInfo.setPassword(password);
HashMap<String, Object> ret = userInfoService.loginSchool(userInfo); HashMap<String, Object> ret = userInfoService.loginSchool(userInfo);
@ -434,19 +421,20 @@ public class UserInfoController {
* 登陆 * 登陆
*/ */
@GetMapping("/logins") @GetMapping("/logins")
Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId, @RequestParam("roleId") Integer roleId, HttpServletRequest req, HttpServletResponse res) { Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId,@RequestParam("roleId") Integer roleId, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
if (userId == null) { if (userId == null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!"); resp.setErrmessage("用户id为空,登录失败!");
} else if (schoolId == null) { }else if(schoolId ==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户学校id为空,登录失败!"); resp.setErrmessage("用户学校id为空,登录失败!");
} else if (roleId == null) { }else if(roleId ==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色id为空,登录失败!"); resp.setErrmessage("用户角色id为空,登录失败!");
} else { }
else{
userInfo.setRoleId(roleId); userInfo.setRoleId(roleId);
userInfo.setUserId(userId); userInfo.setUserId(userId);
userInfo.setSchoolId(schoolId); userInfo.setSchoolId(schoolId);
@ -473,10 +461,10 @@ public class UserInfoController {
if (userId == null) { if (userId == null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!"); resp.setErrmessage("用户id为空,登录失败!");
} else if (schoolId == null) { }else if(schoolId ==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("角色id为空,登录失败!"); resp.setErrmessage("角色id为空,登录失败!");
} else { }else{
OR.setUserId(userId); OR.setUserId(userId);
OR.setSchoolId(schoolId); OR.setSchoolId(schoolId);
HashMap<String, Object> ret = userInfoService.loginRole(OR); HashMap<String, Object> ret = userInfoService.loginRole(OR);
@ -498,10 +486,10 @@ public class UserInfoController {
@GetMapping("/queryUserInfoDetails") @GetMapping("/queryUserInfoDetails")
Response queryUserInfoDetails(@RequestParam Integer userId) { Response queryUserInfoDetails(@RequestParam Integer userId) {
Response resp = new Response(); Response resp = new Response();
if (userId == null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!"); resp.setErrmessage("用户id为空!查询失败!");
} else { }else {
HashMap<String, Object> ret = userInfoService.queryUserInfoDetails(userId); HashMap<String, Object> ret = userInfoService.queryUserInfoDetails(userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
@ -519,16 +507,16 @@ public class UserInfoController {
* 查询用户组织架构OR(organization relationship) * 查询用户组织架构OR(organization relationship)
*/ */
@GetMapping("/queryUserOR") @GetMapping("/queryUserOR")
Response queryUserOR(@RequestParam Integer userId, Integer platformId) { Response queryUserOR(@RequestParam Integer userId,Integer platformId) {
Response resp = new Response(); Response resp = new Response();
if (userId == null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!"); resp.setErrmessage("用户id为空!查询失败!");
} else if (platformId == null) { }else if (platformId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("平台id为空!查询失败!"); resp.setErrmessage("平台id为空!查询失败!");
} else { } else {
HashMap<String, Object> ret = userInfoService.queryUserOR(userId, platformId); HashMap<String, Object> ret = userInfoService.queryUserOR(userId,platformId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -547,10 +535,10 @@ public class UserInfoController {
@GetMapping("/queryUserProfiles") @GetMapping("/queryUserProfiles")
Response queryUserProfiles(@RequestParam Integer userId) { Response queryUserProfiles(@RequestParam Integer userId) {
Response resp = new Response(); Response resp = new Response();
if (userId == null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!"); resp.setErrmessage("用户id为空!查询失败!");
} else { }else {
HashMap<String, Object> ret = userInfoService.queryUserProfiles(userId); HashMap<String, Object> ret = userInfoService.queryUserProfiles(userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
@ -567,11 +555,11 @@ public class UserInfoController {
@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 = userInfoService.uploadUserAvatars(file, userId); HashMap<String, Object> ret = userInfoService.uploadUserAvatars(file,userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
@ -594,13 +582,13 @@ public class UserInfoController {
Integer userId = user.getUserId(); Integer userId = user.getUserId();
String phone = user.getPhone(); String phone = user.getPhone();
Integer accountRole = user.getAccountRole(); Integer accountRole = user.getAccountRole();
if (userId == null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id不能为空!"); resp.setErrmessage("用户id不能为空!");
} else if (phone == null || phone == "") { }else if(phone==null||phone==""){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户电话不能为空!"); resp.setErrmessage("用户电话不能为空!");
} else if (accountRole == null) { } else if(accountRole==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色不能为空!"); resp.setErrmessage("用户角色不能为空!");
} else { } else {
@ -616,14 +604,13 @@ public class UserInfoController {
} }
return resp; return resp;
} }
/** /**
* 用户模块查询客户 * 用户模块查询客户
*/ */
@GetMapping("/queryCustomer") @GetMapping("/queryCustomer")
Response queryCustomer(@RequestParam String searchContent, @RequestParam List<Integer> customerIds) { Response queryCustomer(@RequestParam String searchContent,@RequestParam List<Integer> customerIds) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = userInfoService.queryCustomer(searchContent, customerIds); HashMap<String, Object> ret = userInfoService.queryCustomer(searchContent,customerIds);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -639,13 +626,40 @@ public class UserInfoController {
* 查询账号是否存在 * 查询账号是否存在
*/ */
@GetMapping("/queryAccountIsExist") @GetMapping("/queryAccountIsExist")
Response queryAccountIsExist(@RequestParam String account) { Response queryAccountIsExist(@RequestParam String account,Integer schoolId) {
Response resp = new Response(); Response resp = new Response();
if (account == null && account == "") { if (account == null && account == "") {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("账号为空!"); resp.setErrmessage("账号为空!");
}else if (schoolId==null){
resp.setStatus(300);
resp.setErrmessage("学校为空!");
}
else {
HashMap<String, Object> ret = userInfoService.queryAccountIsExist(account,schoolId);
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;
}
/**
* 查询服务端账号是否存在
*/
@GetMapping("/queryServerAccountIsExist")
Response queryServerAccountIsExist(@RequestParam String account) {
Response resp = new Response();
if (account==null&&account=="") {
resp.setStatus(300);
resp.setErrmessage("账号为空!");
} else { } else {
HashMap<String, Object> ret = userInfoService.queryAccountIsExist(account); HashMap<String, Object> ret = userInfoService.queryServerAccountIsExist(account);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -662,16 +676,17 @@ public class UserInfoController {
* 查询学号工号是否存在 * 查询学号工号是否存在
*/ */
@GetMapping("/queryWorkNumberIsExist") @GetMapping("/queryWorkNumberIsExist")
Response queryWorkNumberIsExist(@RequestParam String workNumber, Integer roleId, Integer schoolId) { Response queryWorkNumberIsExist(@RequestParam String workNumber,Integer roleId,Integer schoolId) {
Response resp = new Response(); Response resp = new Response();
if (workNumber == null) { if (workNumber==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("学号、工号为空!"); resp.setErrmessage("学号、工号为空!");
} else if (roleId == null) { }else if (roleId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("角色id为空!"); resp.setErrmessage("角色id为空!");
} else { }
HashMap<String, Object> ret = userInfoService.queryWorkNumberIsExist(workNumber, roleId, schoolId); else {
HashMap<String, Object> ret = userInfoService.queryWorkNumberIsExist(workNumber,roleId,schoolId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -692,10 +707,10 @@ public class UserInfoController {
Response resp = new Response(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
//平台id //平台id
if (platformId == null && platformId == "") { if (platformId==null&&platformId=="") {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("平台id为空!"); resp.setErrmessage("平台id为空!");
} else { }else{
HashMap<String, Object> ret = userInfoService.queryPlatform(platformId); HashMap<String, Object> ret = userInfoService.queryPlatform(platformId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
@ -718,14 +733,15 @@ public class UserInfoController {
Integer platformId = OR.getPlatformId(); Integer platformId = OR.getPlatformId();
Integer userId = OR.getUserId(); Integer userId = OR.getUserId();
//平台id //平台id
if (platformId == null) { if (platformId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("平台id为空!"); resp.setErrmessage("平台id为空!");
} else if (userId == null) { }else if(userId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空!"); resp.setErrmessage("用户id为空!");
} else { }
HashMap<String, Object> ret = userInfoService.deletePlatform(platformId, userId); else{
HashMap<String, Object> ret = userInfoService.deletePlatform(platformId,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);

@ -1,207 +1,207 @@
package com.yipin.liuwanr.entity; //package com.yipin.liuwanr.entity;
//
import java.util.List; //import java.util.List;
//
//学生和老师管理员组织关系信息实体 ////学生和老师管理员组织关系信息实体
public class StuStaff { //public class StuStaff {
//主键ID // //主键ID
private Integer id; // private Integer id;
//账号 // //账号
private String account; // private String account;
//用户id // //用户id
private Integer userId; // private Integer userId;
//名字 // //名字
private String name; // private String name;
//角色Id // //角色Id
private Integer roleId; // private Integer roleId;
//工号 // //工号
private String workNumber; // private String workNumber;
//电话 // //电话
private String phone; // private String phone;
//邮件 // //邮件
private String email; // private String email;
//绑定员工年级架构ID // //绑定员工年级架构ID
private Integer staffGradeId; // private Integer staffGradeId;
//绑定专业ID // //绑定专业ID
private Integer staffProfessionalArchitectureId; // private Integer staffProfessionalArchitectureId;
//绑定专业名称 // //绑定专业名称
private String staffProfessionalArchitectureName; // private String staffProfessionalArchitectureName;
//绑定员工年级名称 // //绑定员工年级名称
private String staffGradeName; // private String staffGradeName;
//唯一标示性账号 // //唯一标示性账号
private String uniqueIdentificationAccount; // private String uniqueIdentificationAccount;
//绑定学校id // //绑定学校id
private Integer schoolId; // private Integer schoolId;
//绑定专业ID // //绑定专业ID
private Integer professionalId; // private Integer professionalId;
//绑定年级ID // //绑定年级ID
private Integer gradeId; // private Integer gradeId;
//绑定班级ID // //绑定班级ID
private Integer classId; // private Integer classId;
//专业名称 // //专业名称
private String professionalName; // private String professionalName;
//年级名称 // //年级名称
private String gradeName; // private String gradeName;
//绑定班级名称 // //绑定班级名称
private String className; // private String className;
//
public Integer getUserId() { // public Integer getUserId() {
return userId; // return userId;
} // }
//
public void setUserId(Integer userId) { // public void setUserId(Integer userId) {
this.userId = userId; // this.userId = userId;
} // }
//
public Integer getId() { // public Integer getId() {
return id; // return id;
} // }
//
public void setId(Integer id) { // public void setId(Integer id) {
this.id = id; // this.id = id;
} // }
//
public String getAccount() { // public String getAccount() {
return account; // return account;
} // }
//
public void setAccount(String account) { // public void setAccount(String account) {
this.account = account; // this.account = account;
} // }
//
public String getName() { // public String getName() {
return name; // return name;
} // }
//
public void setName(String name) { // public void setName(String name) {
this.name = name; // this.name = name;
} // }
//
public String getWorkNumber() { // public String getWorkNumber() {
return workNumber; // return workNumber;
} // }
//
public void setWorkNumber(String workNumber) { // public void setWorkNumber(String workNumber) {
this.workNumber = workNumber; // this.workNumber = workNumber;
} // }
//
public String getPhone() { // public String getPhone() {
return phone; // return phone;
} // }
//
public void setPhone(String phone) { // public void setPhone(String phone) {
this.phone = phone; // this.phone = phone;
} // }
//
public String getEmail() { // public String getEmail() {
return email; // return email;
} // }
//
public void setEmail(String email) { // public void setEmail(String email) {
this.email = email; // this.email = email;
} // }
//
public Integer getStaffGradeId() { // public Integer getStaffGradeId() {
return staffGradeId; // return staffGradeId;
} // }
//
public void setStaffGradeId(Integer staffGradeId) { // public void setStaffGradeId(Integer staffGradeId) {
this.staffGradeId = staffGradeId; // this.staffGradeId = staffGradeId;
} // }
//
public Integer getStaffProfessionalArchitectureId() { // public Integer getStaffProfessionalArchitectureId() {
return staffProfessionalArchitectureId; // return staffProfessionalArchitectureId;
} // }
//
public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) { // public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) {
this.staffProfessionalArchitectureId = staffProfessionalArchitectureId; // this.staffProfessionalArchitectureId = staffProfessionalArchitectureId;
} // }
//
public String getStaffProfessionalArchitectureName() { // public String getStaffProfessionalArchitectureName() {
return staffProfessionalArchitectureName; // return staffProfessionalArchitectureName;
} // }
//
public void setStaffProfessionalArchitectureName(String staffProfessionalArchitectureName) { // public void setStaffProfessionalArchitectureName(String staffProfessionalArchitectureName) {
this.staffProfessionalArchitectureName = staffProfessionalArchitectureName; // this.staffProfessionalArchitectureName = staffProfessionalArchitectureName;
} // }
//
public Integer getRoleId() { // public Integer getRoleId() {
return roleId; // return roleId;
} // }
//
public void setRoleId(Integer roleId) { // public void setRoleId(Integer roleId) {
this.roleId = roleId; // this.roleId = roleId;
} // }
//
public String getStaffGradeName() { // public String getStaffGradeName() {
return staffGradeName; // return staffGradeName;
} // }
//
public void setStaffGradeName(String staffGradeName) { // public void setStaffGradeName(String staffGradeName) {
this.staffGradeName = staffGradeName; // this.staffGradeName = staffGradeName;
} // }
//
public String getUniqueIdentificationAccount() { // public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount; // return uniqueIdentificationAccount;
} // }
//
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { // public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount; // this.uniqueIdentificationAccount = uniqueIdentificationAccount;
} // }
//
public Integer getSchoolId() { // public Integer getSchoolId() {
return schoolId; // return schoolId;
} // }
//
public void setSchoolId(Integer schoolId) { // public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId; // this.schoolId = schoolId;
} // }
//
public Integer getProfessionalId() { // public Integer getProfessionalId() {
return professionalId; // return professionalId;
} // }
//
public void setProfessionalId(Integer professionalId) { // public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId; // this.professionalId = professionalId;
} // }
//
public Integer getGradeId() { // public Integer getGradeId() {
return gradeId; // return gradeId;
} // }
//
public void setGradeId(Integer gradeId) { // public void setGradeId(Integer gradeId) {
this.gradeId = gradeId; // this.gradeId = gradeId;
} // }
//
public Integer getClassId() { // public Integer getClassId() {
return classId; // return classId;
} // }
//
public void setClassId(Integer classId) { // public void setClassId(Integer classId) {
this.classId = classId; // this.classId = classId;
} // }
//
public String getProfessionalName() { // public String getProfessionalName() {
return professionalName; // return professionalName;
} // }
//
public void setProfessionalName(String professionalName) { // public void setProfessionalName(String professionalName) {
this.professionalName = professionalName; // this.professionalName = professionalName;
} // }
//
public String getGradeName() { // public String getGradeName() {
return gradeName; // return gradeName;
} // }
//
public void setGradeName(String gradeName) { // public void setGradeName(String gradeName) {
this.gradeName = gradeName; // this.gradeName = gradeName;
} // }
//
public String getClassName() { // public String getClassName() {
return className; // return className;
} // }
//
public void setClassName(String className) { // public void setClassName(String className) {
this.className = className; // this.className = className;
} // }
} //}

@ -28,8 +28,8 @@ public class UserInfo {
private String creationTime; private String creationTime;
//登陆次数 //登陆次数
private Integer logInNumber; private Integer logInNumber;
//上次登陆时间 //最后登陆时间
private String lastTimeOfLanding; private String lastLoginTime;
//性别 //性别
private Integer sex; private Integer sex;
//证件类型(1、身份证) //证件类型(1、身份证)
@ -92,6 +92,26 @@ public class UserInfo {
private String oneDepartmentName; private String oneDepartmentName;
//二级部门名称 //二级部门名称
private String twoDepartmentName; private String twoDepartmentName;
//是否新用户
private Integer isNewUser;
//组织架构id
private Integer organizationRelationshipId;
public Integer getOrganizationRelationshipId() {
return organizationRelationshipId;
}
public void setOrganizationRelationshipId(Integer organizationRelationshipId) {
this.organizationRelationshipId = organizationRelationshipId;
}
public Integer getIsNewUser() {
return isNewUser;
}
public void setIsNewUser(Integer isNewUser) {
this.isNewUser = isNewUser;
}
public String getWorkNumber() { public String getWorkNumber() {
return workNumber; return workNumber;
@ -221,12 +241,12 @@ public class UserInfo {
this.logInNumber = logInNumber; this.logInNumber = logInNumber;
} }
public String getLastTimeOfLanding() { public String getLastLoginTime() {
return lastTimeOfLanding; return lastLoginTime;
} }
public void setLastTimeOfLanding(String lastTimeOfLanding) { public void setLastLoginTime(String lastLoginTime) {
this.lastTimeOfLanding = lastTimeOfLanding; this.lastLoginTime = lastLoginTime;
} }
public Integer getSex() { public Integer getSex() {
@ -429,44 +449,4 @@ public class UserInfo {
this.roleId = roleId; this.roleId = roleId;
} }
@Override
public String toString() {
return "UserInfo{" +
"userId=" + userId +
", roleId=" + roleId +
", userName='" + userName + '\'' +
", account='" + account + '\'' +
", password='" + password + '\'' +
", countries='" + countries + '\'' +
", provinceId=" + provinceId +
", cityId=" + cityId +
", creationTime='" + creationTime + '\'' +
", logInNumber=" + logInNumber +
", lastTimeOfLanding='" + lastTimeOfLanding + '\'' +
", sex=" + sex +
", documentType=" + documentType +
", IDNumber='" + IDNumber + '\'' +
", educationDegree=" + educationDegree +
", phone='" + phone + '\'' +
", WeChatID='" + WeChatID + '\'' +
", dateBirth='" + dateBirth + '\'' +
", email='" + email + '\'' +
", schoolId=" + schoolId +
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
", searchContent='" + searchContent + '\'' +
", user=" + user +
", userAvatars='" + userAvatars + '\'' +
", schoolName='" + schoolName + '\'' +
", provinceName='" + provinceName + '\'' +
", cityName='" + cityName + '\'' +
", month=" + month +
", endTime='" + endTime + '\'' +
", professionalClassId=" + professionalClassId +
", professionalClassName='" + professionalClassName + '\'' +
", disciplineId=" + disciplineId +
", disciplineName='" + disciplineName + '\'' +
", professionalId=" + professionalId +
", professionalName='" + professionalName + '\'' +
'}';
}
} }

@ -17,7 +17,7 @@ public interface StaffMapper {
void addStaff(Staff staff); void addStaff(Staff staff);
@Select({"<script>", @Select({"<script>",
"SELECT hui.userName,hor.workNumber,hor.oneDepartmentId,hor.twoDepartmentId,hor.roleId,hui.logInNumber as logInNumber,hui.lastLoginTime as lastTimeOfLanding FROM hr_user_info hui,hr_organization_relationship hor WHERE hui.userId = hor.userId and hor.roleId != 1 and hor.roleId !=4 and hor.schoolId = #{schoolId}", "SELECT hui.lastLoginTime,hor.userId,hor.organizationRelationshipId,hui.userName,hor.workNumber,hor.oneDepartmentId,hor.oneDepartmentName,hor.twoDepartmentId,hor.twoDepartmentName,hor.roleId,hui.logInNumber as logInNumber,hui.lastLoginTime as lastTimeOfLanding FROM hr_user_info hui,hr_organization_relationship hor WHERE hui.userId = hor.userId and hor.roleId != 1 and hor.roleId !=4 and hor.schoolId = #{schoolId} and hor.isdel=0",
" <if test='searchContent!=null'> and hui.userName like CONCAT('%',#{searchContent},'%') or hor.workNumber like CONCAT('%',#{searchContent},'%')</if>", " <if test='searchContent!=null'> and hui.userName like CONCAT('%',#{searchContent},'%') or hor.workNumber like CONCAT('%',#{searchContent},'%')</if>",
" <if test='oneDepartmentIds!=null'>and FIND_IN_SET(hor.oneDepartmentId,#{oneDepartmentIds})</if>", " <if test='oneDepartmentIds!=null'>and FIND_IN_SET(hor.oneDepartmentId,#{oneDepartmentIds})</if>",
" <if test='twoDepartmentIds!=null'> and FIND_IN_SET(hor.twoDepartmentId,#{twoDepartmentIds}) </if>", " <if test='twoDepartmentIds!=null'> and FIND_IN_SET(hor.twoDepartmentId,#{twoDepartmentIds}) </if>",
@ -26,9 +26,9 @@ public interface StaffMapper {
List<UserInfo> queryStaff(UserInfo userInfo); List<UserInfo> queryStaff(UserInfo userInfo);
@Update({"<script>", @Update({"<script>",
"UPDATE staff SET isdel = 1 where staffId = #{staffId}", "UPDATE hr_organization_relationship SET isdel = 1 where organizationRelationshipId = #{organizationRelationshipId}",
"</script> "}) "</script> "})
void deleteStaff(Integer staffId); void deleteStaff(Integer organizationRelationshipId);
@Update({"<script>", @Update({"<script>",
"UPDATE user SET isdel = 1 where phone = #{phone}", "UPDATE user SET isdel = 1 where phone = #{phone}",
@ -36,25 +36,21 @@ public interface StaffMapper {
void deleteUser(String phone); void deleteUser(String phone);
@Select({"<script>", @Select({"<script>",
"SELECT staffId,staffName,staffWorkNumber,phone,email,logNumber,lastTimeOfLanding,staffGradeId,staffProfessionalArchitectureId,roleId,uniqueIdentificationAccount,schoolId from staff where isdel = 0 and staffId = #{staffId}", "SELECT roleId,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,workNumber from hr_organization_relationship where userId = #{userId} and roleId = #{roleId}",
"</script> "}) "</script> "})
List<Staff> queryStaffDetails(Integer staffId); List<OrganizationRelationship> queryStaffDetails(Integer userId,Integer roleId);
//查询学生详情 //查询员工用户详情
@Select({ "<script>", @Select({ "<script>",
"SELECT * from staff where isdel = 0 and staffId = #{staffId}", "SELECT userId,userName,uniqueIdentificationAccount,account,phone,email from hr_user_info where isdel = 0 and userId = #{userId}",
"</script> " }) "</script> " })
@Results({ List<UserInfo> queryStaffDetailsU(Integer userId);
@Result(property = "staff", column = "staffId",one = @One(select = "com.yipin.liuwanr.mapper.StaffMapper.queryStaffDetails")),
@Result(property = "user", column = "staffId",one = @One(select = "com.yipin.liuwanr.mapper.StaffMapper.queryStaffDetailsU"))
})
List<UserVO> queryStaffDetailsUser(Integer staffId);
//查询学生详情 //查询用户角色
@Select({ "<script>", @Select({ "<script>",
"SELECT s.phone,s.staffId,u.* from staff s,user u where u.isdel = 0 and s.staffId = #{staffId} and s.phone = u.phone", "SELECT roleId from hr_organization_relationship where userId = #{userId}",
"</script> " }) "</script> " })
List<UserM> queryStaffDetailsU(Integer staffId); List<OrganizationRelationship> queryRole(Integer userId);
//修改员工 //修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId}," @Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
@ -65,6 +61,15 @@ public interface StaffMapper {
@Update("UPDATE user SET phone = #{phone},name = #{name},userAccount = #{userAccount},workNumber = #{workNumber},provinceId = #{provinceId},cityId = #{cityId},email = #{email},schoolId = #{schoolId},uniqueIdentificationAccount = #{uniqueIdentificationAccount},disciplineId = #{disciplineId},professionalClassId = #{professionalClassId},professionalId = #{professionalId} where phone = #{phone}") @Update("UPDATE user SET phone = #{phone},name = #{name},userAccount = #{userAccount},workNumber = #{workNumber},provinceId = #{provinceId},cityId = #{cityId},email = #{email},schoolId = #{schoolId},uniqueIdentificationAccount = #{uniqueIdentificationAccount},disciplineId = #{disciplineId},professionalClassId = #{professionalClassId},professionalId = #{professionalId} where phone = #{phone}")
void updateUser(UserM user); void updateUser(UserM user);
//修改员工
@Update("UPDATE hr_organization_relationship SET oneDepartmentId = #{oneDepartmentId},oneDepartmentName = #{oneDepartmentName},twoDepartmentId = #{twoDepartmentId},twoDepartmentName = #{twoDepartmentName},workNumber = #{workNumber}"
+ "where organizationRelationshipId = #{organizationRelationshipId}")
void updateNewStaff(OrganizationRelationship organizationRelationship);
//修改用户
@Update("UPDATE hr_user_info SET userName = #{userName},uniqueIdentificationAccount = #{uniqueIdentificationAccount},account = #{account},phone = #{phone},email = #{email} where userId = #{userId}")
void updateNewUser(UserInfo userInfo);
/** /**
* 得到所有未删除的部门信息 * 得到所有未删除的部门信息
* @return * @return

@ -150,8 +150,8 @@ public interface UserInfoMapper{
List<Platform> queryUserPlatform(Integer userId); List<Platform> queryUserPlatform(Integer userId);
//查询用户手机 //查询用户手机
@Select("SELECT u.* from user u where isdel=0 and phone = #{phone}") @Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}")
List<UserM> queryPhone(String phone); List<UserInfo> queryPhone(String phone);
//查询用户详情 //查询用户详情
@Select({"<script>", @Select({"<script>",
@ -219,9 +219,13 @@ public interface UserInfoMapper{
void updateStaffLogInNumber(UserM user); void updateStaffLogInNumber(UserM user);
//查询账号是否存在 //查询账号是否存在
@Select("SELECT userId,account from hr_user_info where isdel = 0 and account = #{account}") @Select("SELECT account,email,userName,userId,uniqueIdentificationAccount,phone from hr_user_info where isdel = 0 and account = #{account}")
List<UserInfo> queryAccountIsExist(String account); List<UserInfo> queryAccountIsExist(String account);
//查询账号是否存在
@Select("SELECT hor.* from hr_organization_relationship hor,hr_user_info hui where hor.isdel = 0 and hui.account = #{account} and hor.userId = hui.userId and hor.schoolId = #{schoolId}")
List<OrganizationRelationship> queryAccountIsExistOR(String account,Integer schoolId);
//查询学号、工号是否存在 //查询学号、工号是否存在
@Select("SELECT userId,workNumber,schoolId,roleId from hr_organization_relationship where workNumber = #{workNumber} and roleId = #{roleId} and schoolId = #{schoolId}") @Select("SELECT userId,workNumber,schoolId,roleId from hr_organization_relationship where workNumber = #{workNumber} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryWorkNumberIsExist(String workNumber,Integer roleId,Integer schoolId); List<OrganizationRelationship> queryWorkNumberIsExist(String workNumber,Integer roleId,Integer schoolId);

@ -144,11 +144,14 @@ public class StaffService {
// } // }
//删除员工 //删除员工
public HashMap<String, Object> deleteStaff(Integer staffId,String phone){ public HashMap<String, Object> deleteStaff(List<OrganizationRelationship> OrganizationRelationshipList){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
staffMapper.deleteStaff(staffId); Integer size = OrganizationRelationshipList.size();
staffMapper.deleteUser(phone); for (int i = 0;i<size;i++){
Integer organizationRelationshipId = OrganizationRelationshipList.get(i).getOrganizationRelationshipId();
staffMapper.deleteStaff(organizationRelationshipId);
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -160,10 +163,14 @@ public class StaffService {
} }
//查询员工详情 //查询员工详情
public HashMap<String, Object> queryStaffDetails(Integer staffId){ public HashMap<String, Object> queryStaffDetails(Integer userId,Integer roleId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try { try {
resp.put("retvalue", staffMapper.queryStaffDetailsUser(staffId)); obj.put("staff", staffMapper.queryStaffDetails(userId,roleId));
obj.put("user", staffMapper.queryStaffDetailsU(userId));
obj.put("roleId", staffMapper.queryRole(userId));
resp.put("retvalue",obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -192,6 +199,25 @@ public class StaffService {
return resp; return resp;
} }
//修改员工
@Transactional
public HashMap<String, Object> updateNewStaff(UserInfoVO vo){
HashMap<String, Object> resp = new HashMap<String, Object>();
OrganizationRelationship OR = vo.getOrganizationRelationship();
UserInfo userInfo = vo.getUserInfo();
try {
staffMapper.updateNewStaff(OR);
staffMapper.updateNewUser(userInfo);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "修改员工失败!");
throw new RuntimeException();
}
return resp;
}
//查询员工 //查询员工
public HashMap<String, Object> queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){ public HashMap<String, Object> queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();

@ -391,15 +391,15 @@ public class UserInfoService {
try { try {
UserInfo user=userInfoMapper.loginsAP(userInfo); UserInfo user=userInfoMapper.loginsAP(userInfo);
// obj.put("user",user); // obj.put("user",user);
if(user!=null) {
Integer userId = user.getUserId(); Integer userId = user.getUserId();
if(userId!=null) {
List<OrganizationRelationship> organizationRelationship = userInfoMapper.queryOrganizationRelationship(userId); List<OrganizationRelationship> organizationRelationship = userInfoMapper.queryOrganizationRelationship(userId);
obj.put("organizationRelationship",organizationRelationship); obj.put("organizationRelationship",organizationRelationship);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", obj); resp.put("retvalue", obj);
}else { }else {
resp.put("retcode", 300); resp.put("retcode", 300);
resp.put("retvalue", "登录失败,账号密码有误或不存在!"); resp.put("retvalue", "登录失败,账号密码有误!");
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -584,10 +584,28 @@ public class UserInfoService {
} }
//查询账号是否存在 //查询账号是否存在
public HashMap<String, Object> queryAccountIsExist(String account){ public HashMap<String, Object> queryAccountIsExist(String account,Integer schoolId){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
obj.put("user", userInfoMapper.queryAccountIsExist(account));
obj.put("OR", userInfoMapper.queryAccountIsExistOR(account,schoolId));
resp.put("retcode", 200);
resp.put("retvalue",obj);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询账号是否存在失败!");
return resp;
}
return resp;
}
//后端查询账号是否存在
public HashMap<String, Object> queryServerAccountIsExist(String account){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", userInfoMapper.queryAccountIsExist(account)); resp.put("retvalue",userInfoMapper.queryAccountIsExist(account));
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());

@ -26,7 +26,6 @@ public class UserInfoVO {
private List<Student> studentList; private List<Student> studentList;
private List<Staff> staffList; private List<Staff> staffList;
private List<UserProfiles> userProfilesList; private List<UserProfiles> userProfilesList;
private List<StuStaff> stuStaffList;
public OrganizationRelationship getOrganizationRelationship() { public OrganizationRelationship getOrganizationRelationship() {
return organizationRelationship; return organizationRelationship;
@ -44,14 +43,6 @@ public class UserInfoVO {
this.organizationRelationshipList = organizationRelationshipList; this.organizationRelationshipList = organizationRelationshipList;
} }
public List<StuStaff> getStuStaffList() {
return stuStaffList;
}
public void setStuStaffList(List<StuStaff> stuStaffList) {
this.stuStaffList = stuStaffList;
}
public UserProfiles getUserProfiles() { public UserProfiles getUserProfiles() {
return userProfiles; return userProfiles;
} }

@ -17,7 +17,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
/** /**
* @auther River * @auther River
@ -132,9 +134,8 @@ public class StaffServiceTest {
@Test @Test
@Transactional @Transactional
public void deleteStaffTest(){ public void deleteStaffTest(){
Integer staffId = 118; List<OrganizationRelationship> OrganizationRelationshipList = new ArrayList<>();
String phone = "13137366427"; HashMap<String, Object> deleteStaff = staffService.deleteStaff(OrganizationRelationshipList);
HashMap<String, Object> deleteStaff = staffService.deleteStaff(staffId, phone);
for (String s : deleteStaff.keySet()) { for (String s : deleteStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + deleteStaff.get(s)); System.out.println("key:" + s + "," + "value:" + deleteStaff.get(s));
} }
@ -146,8 +147,9 @@ public class StaffServiceTest {
@Test @Test
@Transactional @Transactional
public void queryStaffDetailsTest(){ public void queryStaffDetailsTest(){
Integer staffId = 118; Integer userId = 2;
HashMap<String, Object> staffDetails = staffService.queryStaffDetails(staffId); Integer roleId = 3;
HashMap<String, Object> staffDetails = staffService.queryStaffDetails(userId,roleId);
for (String s : staffDetails.keySet()) { for (String s : staffDetails.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffDetails.get(s)); System.out.println("key:" + s + "," + "value:" + staffDetails.get(s));
} }

Loading…
Cancel
Save