上传代码

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. 111
      src/main/java/com/yipin/liuwanr/controller/StaffController.java
  4. 62
      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. 24
      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>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<!--<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>-->
</exclusions>
</dependency>
<dependency>
@ -241,7 +245,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
@ -249,10 +253,24 @@
<version>1.4</version>
<scope>test</scope>
</dependency>
<!--添加servlet-api的依赖,用来打war包 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
<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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>

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

@ -293,25 +293,40 @@ public class StaffController {
@PostMapping("/addStaff")
Response addStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
UserInfo userInfo = vo.getUserInfo();
Integer userId = userInfo.getUserId();
String account = userInfo.getAccount();
Integer isNewUser = userInfo.getIsNewUser();
if (account==null||account=="") {
resp.setStatus(300);
resp.setErrmessage("账号为空添加失败!");
} else {
HashMap<String, Object> ret = userInfoService.logins(userInfo);
int status = (int) ret.get("retcode");
if (200 == status) {
if (isNewUser==0){
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int status = (int) sta.get("retcode");
if (status == 200){
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> ret1 = userInfoService.addUser(userInfo);
int status1 = (int) ret1.get("retcode");
resp.setMessage(sta.get("retvalue"));
}else{
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){
resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue"));
resp.setMessage(sta.get("retvalue"));
}else{
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}else{
@ -319,6 +334,86 @@ public class StaffController {
resp.setErrmessage(ret.get("retvalue").toString());
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;
}
/**
* 查询员工详情
*/
@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;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.helper.QueryStudentUtils;
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.vo.UserInfoVO;
import jdk.nashorn.internal.ir.IfNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -167,33 +164,24 @@ public class UserInfoController {
Response resp = new Response();
//个人档案实体
List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//学生员工实体list
List<StuStaff> stuStaffList = vo.getStuStaffList();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
//用户实体
UserInfo user = vo.getUserInfo();
//用户手机号
String phone = user.getPhone();
String account = user.getAccount();
//用户名称
String name = user.getUserName();
//省份id
Integer provinceId = user.getProvinceId();
//用户角色id
Integer roleId = user.getRoleId();
//城市id
Integer cityId = user.getCityId();
//学校id
Integer schoolId = user.getSchoolId();
if(name==null||name==""){
resp.setStatus(300);
resp.setErrmessage("姓名不能为空!");
} else if (provinceId == null) {
resp.setStatus(300);
resp.setErrmessage("省份不能为空!");
} else if (cityId == null) {
}else if(account==null||account==""){
resp.setStatus(300);
resp.setErrmessage("城市不能为空!");
resp.setErrmessage("账号不能为空!");
}else if(schoolId==null){
resp.setStatus(300);
resp.setErrmessage("学校不能为空!");
@ -266,8 +254,7 @@ public class UserInfoController {
}
//月份
if (month!=null) {
userInfo.setMonth(month);
;
userInfo.setMonth(month);;
}
//创建时间
if (creationTime!=null&&creationTime!="") {
@ -446,7 +433,8 @@ public class UserInfoController {
}else if(roleId ==null) {
resp.setStatus(300);
resp.setErrmessage("用户角色id为空,登录失败!");
} else {
}
else{
userInfo.setRoleId(roleId);
userInfo.setUserId(userId);
userInfo.setSchoolId(schoolId);
@ -616,7 +604,6 @@ public class UserInfoController {
}
return resp;
}
/**
* 用户模块查询客户
*/
@ -639,13 +626,40 @@ public class UserInfoController {
* 查询账号是否存在
*/
@GetMapping("/queryAccountIsExist")
Response queryAccountIsExist(@RequestParam String account) {
Response queryAccountIsExist(@RequestParam String account,Integer schoolId) {
Response resp = new Response();
if (account == null && account == "") {
resp.setStatus(300);
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 {
HashMap<String, Object> ret = userInfoService.queryAccountIsExist(account);
HashMap<String, Object> ret = userInfoService.queryServerAccountIsExist(account);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -670,7 +684,8 @@ public class UserInfoController {
}else if (roleId==null){
resp.setStatus(300);
resp.setErrmessage("角色id为空!");
} else {
}
else {
HashMap<String, Object> ret = userInfoService.queryWorkNumberIsExist(workNumber,roleId,schoolId);
int status = (int) ret.get("retcode");
if (200 == status) {
@ -724,7 +739,8 @@ public class UserInfoController {
}else if(userId==null){
resp.setStatus(300);
resp.setErrmessage("用户id为空!");
} else {
}
else{
HashMap<String, Object> ret = userInfoService.deletePlatform(platformId,userId);
int status = (int) ret.get("retcode");
if (200 == status) {

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

@ -28,8 +28,8 @@ public class UserInfo {
private String creationTime;
//登陆次数
private Integer logInNumber;
//上次登陆时间
private String lastTimeOfLanding;
//最后登陆时间
private String lastLoginTime;
//性别
private Integer sex;
//证件类型(1、身份证)
@ -92,6 +92,26 @@ public class UserInfo {
private String oneDepartmentName;
//二级部门名称
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() {
return workNumber;
@ -221,12 +241,12 @@ public class UserInfo {
this.logInNumber = logInNumber;
}
public String getLastTimeOfLanding() {
return lastTimeOfLanding;
public String getLastLoginTime() {
return lastLoginTime;
}
public void setLastTimeOfLanding(String lastTimeOfLanding) {
this.lastTimeOfLanding = lastTimeOfLanding;
public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public Integer getSex() {
@ -429,44 +449,4 @@ public class UserInfo {
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);
@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='oneDepartmentIds!=null'>and FIND_IN_SET(hor.oneDepartmentId,#{oneDepartmentIds})</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);
@Update({"<script>",
"UPDATE staff SET isdel = 1 where staffId = #{staffId}",
"UPDATE hr_organization_relationship SET isdel = 1 where organizationRelationshipId = #{organizationRelationshipId}",
"</script> "})
void deleteStaff(Integer staffId);
void deleteStaff(Integer organizationRelationshipId);
@Update({"<script>",
"UPDATE user SET isdel = 1 where phone = #{phone}",
@ -36,25 +36,21 @@ public interface StaffMapper {
void deleteUser(String phone);
@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> "})
List<Staff> queryStaffDetails(Integer staffId);
List<OrganizationRelationship> queryStaffDetails(Integer userId,Integer roleId);
//查询学生详情
//查询员工用户详情
@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> " })
@Results({
@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);
List<UserInfo> queryStaffDetailsU(Integer userId);
//查询学生详情
//查询用户角色
@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> " })
List<UserM> queryStaffDetailsU(Integer staffId);
List<OrganizationRelationship> queryRole(Integer userId);
//修改员工
@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}")
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

@ -150,8 +150,8 @@ public interface UserInfoMapper{
List<Platform> queryUserPlatform(Integer userId);
//查询用户手机
@Select("SELECT u.* from user u where isdel=0 and phone = #{phone}")
List<UserM> queryPhone(String phone);
@Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}")
List<UserInfo> queryPhone(String phone);
//查询用户详情
@Select({"<script>",
@ -219,9 +219,13 @@ public interface UserInfoMapper{
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);
//查询账号是否存在
@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}")
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>();
try {
staffMapper.deleteStaff(staffId);
staffMapper.deleteUser(phone);
Integer size = OrganizationRelationshipList.size();
for (int i = 0;i<size;i++){
Integer organizationRelationshipId = OrganizationRelationshipList.get(i).getOrganizationRelationshipId();
staffMapper.deleteStaff(organizationRelationshipId);
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
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> obj = new HashMap<String, Object>();
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);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -192,6 +199,25 @@ public class StaffService {
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){
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -391,15 +391,15 @@ public class UserInfoService {
try {
UserInfo user=userInfoMapper.loginsAP(userInfo);
// obj.put("user",user);
if(user!=null) {
Integer userId = user.getUserId();
if(userId!=null) {
List<OrganizationRelationship> organizationRelationship = userInfoMapper.queryOrganizationRelationship(userId);
obj.put("organizationRelationship",organizationRelationship);
resp.put("retcode", 200);
resp.put("retvalue", obj);
}else {
resp.put("retcode", 300);
resp.put("retvalue", "登录失败,账号密码有误或不存在!");
resp.put("retvalue", "登录失败,账号密码有误!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -584,7 +584,25 @@ 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>();
try {
resp.put("retvalue",userInfoMapper.queryAccountIsExist(account));

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

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

Loading…
Cancel
Save