上传代码

master
zhiyong.ning 4 years ago
parent 82a8abb906
commit 0b683ac3ee
  1. 2
      src/main/java/com/yipin/liuwanr/controller/CourseController.java
  2. 23
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  3. 420
      src/main/java/com/yipin/liuwanr/controller/StaffController.java
  4. 197
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  5. 30
      src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java
  6. 54
      src/main/java/com/yipin/liuwanr/entity/Platform.java
  7. 72
      src/main/java/com/yipin/liuwanr/entity/UserInfo.java
  8. 4
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  9. 22
      src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
  10. 154
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  11. 15
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  12. 128
      src/main/java/com/yipin/liuwanr/service/StaffService.java
  13. 175
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  14. 2
      src/main/resources/application.properties
  15. 8
      src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java

@ -350,8 +350,6 @@ public class CourseController {
Response queryCourseProfessional(@RequestParam Integer professionalClassId) {
Response resp = new Response();
HashMap<String, Object> ret = courseService.queryCourseProfessional(professionalClassId);
resp.setStatus(200);
resp.setErrmessage("Parameter effective");
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);

@ -164,6 +164,29 @@ public class ExperimentalClassController {
return resp;
}
/**
* 实验班级删除学生
*/
@PostMapping("/experimentClassUpdatePN")
Response experimentClassUpdatePN(@RequestParam Integer classSize,Integer experimentalClassId) {
Response resp = new Response();
if (classSize==null) {
resp.setStatus(300);
resp.setErrmessage("班级人数为空!");
}else {
HashMap<String, Object> ret = classService.experimentClassUpdatePN(classSize,experimentalClassId);
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;
}
/**
* 修改实验班级名称
*/

@ -3,7 +3,13 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.entity.Response;
import com.yipin.liuwanr.service.OrganizationRelationshipService;
import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO;
import org.aspectj.weaver.ast.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
@ -16,9 +22,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.yipin.liuwanr.entity.Response;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.UserService;
@ -32,90 +35,245 @@ public class StaffController {
private StaffService staffService;
@Autowired
private UserService userService;
private UserInfoService userInfoService;
@Autowired
RedisHelper redisHelper;
@PostMapping("/readStaff")
Response readStaff(MultipartFile file,Integer schoolId){
Response resp = new Response();
if(StringUtils.isEmpty(schoolId)) {
resp.setStatus(300);
resp.setMessage("schoolId is not empty");
return resp;
}
HashMap<String, Object> ret =staffService.readStaff(file,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;
}
/**
* 添加员工
*/
@Transactional
@PostMapping("/addStaff")
Response addStaff(@RequestBody UserVO vo) {
Response resp = new Response();
Staff staff = vo.getStaff();
UserM user = vo.getUser();
if (staff.getPhone()==null) {
resp.setStatus(300);
resp.setErrmessage("电话为空添加失败!");
} else {
HashMap<String, Object> ret = staffService.addStaff(staff);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> ret1 = userService.addUser(user);
int status1 = (int) ret1.get("retcode");
if (status1 == 200){
resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue"));
}else{
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
throw new RuntimeException();
}
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
}
return resp;
}
// @PostMapping("/readStaff")
// Response readStaff(MultipartFile file,Integer schoolId){
// Response resp = new Response();
// if(StringUtils.isEmpty(schoolId)) {
// resp.setStatus(300);
// resp.setMessage("schoolId is not empty");
// return resp;
// }
// HashMap<String, Object> ret =staffService.readStaff(file,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;
//}
//
// /**
// * 添加员工
// */
// @Transactional
// @PostMapping("/addStaff")
// Response addStaff(@RequestBody UserVO vo) {
// Response resp = new Response();
// Staff staff = vo.getStaff();
// UserM user = vo.getUser();
// if (staff.getPhone()==null) {
// resp.setStatus(300);
// resp.setErrmessage("电话为空添加失败!");
// } else {
// HashMap<String, Object> ret = staffService.addStaff(staff);
// int status = (int) ret.get("retcode");
// if (200 == status) {
// resp.setStatus(status);
// resp.setMessage(ret.get("retvalue"));
// HashMap<String, Object> ret1 = userService.addUser(user);
// int status1 = (int) ret1.get("retcode");
// if (status1 == 200){
// resp.setStatus(status1);
// resp.setMessage(ret1.get("retvalue"));
// }else{
// resp.setStatus(status1);
// resp.setErrmessage(ret1.get("retvalue").toString());
// throw new RuntimeException();
// }
// } else {
// resp.setStatus(status);
// resp.setErrmessage(ret.get("retvalue").toString());
// throw new RuntimeException();
// }
// }
// return resp;
// }
//
// /**
// * 查询员工
// */
// @GetMapping("/queryStaff")
// Response queryStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) {
// Response resp = new Response();
// Staff staff = new Staff();
// if (schoolId==null){
// resp.setStatus(300);
// resp.setErrmessage("学校id为空,查询失败!");
// }else {
// if (nameAndNumber!=null&&nameAndNumber!="") {
// staff.setNameAndNumber(nameAndNumber);
// }
// if (staffProfessionalArchitectureIds!=null&&staffProfessionalArchitectureIds!="") {
// staff.setStaffProfessionalArchitectureIds(staffProfessionalArchitectureIds);
// }
// if (staffGradeIds!=null&&staffGradeIds!="") {
// staff.setStaffGradeIds(staffGradeIds);
// }
// staff.setSchoolId(schoolId);
// HashMap<String, Object> ret = staffService.queryStaff(staff,pageNo,pageSize);
// 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 staffId) {
// Response resp = new Response();
// if (staffId==null) {
// resp.setStatus(300);
// resp.setErrmessage("Parameter Invalid");
// }else {
// HashMap<String, Object> ret = staffService.queryStaffDetails(staffId);
// 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("/getStaff")
// Response getStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) {
// Response resp = new Response();
// Staff staff = new Staff();
// if (schoolId==null){
// resp.setStatus(300);
// resp.setErrmessage("学校id为空,查询失败!");
// }else {
// if (nameAndNumber!=null&&nameAndNumber!="") {
// staff.setNameAndNumber(nameAndNumber);
// }
// if (staffProfessionalArchitectureIds!=null&&staffProfessionalArchitectureIds!="") {
// staff.setStaffProfessionalArchitectureIds(staffProfessionalArchitectureIds);
// }
// if (staffGradeIds!=null&&staffGradeIds!="") {
// staff.setStaffGradeIds(staffGradeIds);
// }
// staff.setSchoolId(schoolId);
// HashMap<String, Object> ret = staffService.queryStaff(staff,pageNo,pageSize);
// 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<Staff> staffList) {
// Response resp = new Response();
// int size = staffList.size();
// for(int i=0;i<size;i++) {
// Staff staff = staffList.get(i);
// Integer staffId = staff.getStaffId();
// String phone = staff.getPhone();
// if (staffId==null) {
// resp.setStatus(300);
// resp.setErrmessage("员工id为空,删除失败!");
// }else if (phone == null ||phone == ""){
// resp.setStatus(300);
// resp.setErrmessage("员工电话为空,删除失败!");
// }
// else {
// HashMap<String, Object> ret = staffService.deleteStaff(staffId,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;
// }
//
// /**
// * 更新员工
// */
// @PostMapping("/updateStaff")
// Response updateStaff(@RequestBody UserVO vo) {
// Response resp = new Response();
// Staff staff = vo.getStaff();
// Integer staffId = staff.getStaffId();
// UserM user = vo.getUser();
// String phone = user.getPhone();
// if (staffId==null) {
// resp.setStatus(300);
// resp.setErrmessage("员工id为空,修改失败!");
// }else if (phone==null||phone==""){
// resp.setStatus(300);
// resp.setErrmessage("电话为空,修改失败!");
// }
// else {
// HashMap<String, Object> ret = staffService.updateStaff(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;
// }
/**
* 查询员工
*/
@GetMapping("/queryStaff")
Response queryStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) {
Response queryStaff(@RequestParam Integer schoolId,String searchContent,Integer pageNo,Integer pageSize,String oneDepartmentIds,String twoDepartmentIds) {
Response resp = new Response();
Staff staff = new Staff();
UserInfo userInfo = new UserInfo();
if (schoolId==null){
resp.setStatus(300);
resp.setErrmessage("学校id为空,查询失败!");
}else {
if (nameAndNumber!=null&&nameAndNumber!="") {
staff.setNameAndNumber(nameAndNumber);
if (searchContent!=null&&searchContent!="") {
userInfo.setSearchContent(searchContent);
}
if (staffProfessionalArchitectureIds!=null&&staffProfessionalArchitectureIds!="") {
staff.setStaffProfessionalArchitectureIds(staffProfessionalArchitectureIds);
if (oneDepartmentIds!=null&&oneDepartmentIds!="") {
userInfo.setOneDepartmentIds(oneDepartmentIds);
}
if (staffGradeIds!=null&&staffGradeIds!="") {
staff.setStaffGradeIds(staffGradeIds);
if (twoDepartmentIds!=null&&twoDepartmentIds!="") {
userInfo.setTwoDepartmentIds(twoDepartmentIds);
}
staff.setSchoolId(schoolId);
HashMap<String, Object> ret = staffService.queryStaff(staff,pageNo,pageSize);
userInfo.setSchoolId(schoolId);
HashMap<String, Object> ret = staffService.queryStaff(userInfo,pageNo,pageSize);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -129,121 +287,37 @@ public class StaffController {
}
/**
* 查询员工详情
*/
@GetMapping("/queryStaffDetails")
Response queryStaffDetails(@RequestParam Integer staffId) {
Response resp = new Response();
if (staffId==null) {
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
}else {
HashMap<String, Object> ret = staffService.queryStaffDetails(staffId);
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("/getStaff")
Response getStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) {
@Transactional
@PostMapping("/addStaff")
Response addStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response();
Staff staff = new Staff();
if (schoolId==null){
UserInfo userInfo = vo.getUserInfo();
String account = userInfo.getAccount();
if (account==null||account=="") {
resp.setStatus(300);
resp.setErrmessage("学校id为空,查询失败!");
}else {
if (nameAndNumber!=null&&nameAndNumber!="") {
staff.setNameAndNumber(nameAndNumber);
}
if (staffProfessionalArchitectureIds!=null&&staffProfessionalArchitectureIds!="") {
staff.setStaffProfessionalArchitectureIds(staffProfessionalArchitectureIds);
}
if (staffGradeIds!=null&&staffGradeIds!="") {
staff.setStaffGradeIds(staffGradeIds);
}
staff.setSchoolId(schoolId);
HashMap<String, Object> ret = staffService.queryStaff(staff,pageNo,pageSize);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
resp.setErrmessage("账号为空添加失败!");
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
/**
* 删除员工
*/
@PostMapping("/deleteStaff")
Response deleteStaff(@RequestBody List<Staff> staffList) {
Response resp = new Response();
int size = staffList.size();
for(int i=0;i<size;i++) {
Staff staff = staffList.get(i);
Integer staffId = staff.getStaffId();
String phone = staff.getPhone();
if (staffId==null) {
resp.setStatus(300);
resp.setErrmessage("员工id为空,删除失败!");
}else if (phone == null ||phone == ""){
resp.setStatus(300);
resp.setErrmessage("员工电话为空,删除失败!");
}
else {
HashMap<String, Object> ret = staffService.deleteStaff(staffId,phone);
HashMap<String, Object> ret = userInfoService.logins(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;
}
/**
* 更新员工
*/
@PostMapping("/updateStaff")
Response updateStaff(@RequestBody UserVO vo) {
Response resp = new Response();
Staff staff = vo.getStaff();
Integer staffId = staff.getStaffId();
UserM user = vo.getUser();
String phone = user.getPhone();
if (staffId==null) {
resp.setStatus(300);
resp.setErrmessage("员工id为空,修改失败!");
}else if (phone==null||phone==""){
resp.setStatus(300);
resp.setErrmessage("电话为空,修改失败!");
HashMap<String, Object> ret1 = userInfoService.addUser(userInfo);
int status1 = (int) ret1.get("retcode");
if (status1 == 200){
resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue"));
}else{
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
throw new RuntimeException();
}
else {
HashMap<String, Object> ret = staffService.updateStaff(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());
throw new RuntimeException();
}
}
return resp;

@ -43,6 +43,8 @@ public class UserInfoController {
List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//学生员工实体list
List<StuStaff> stuStaffList = vo.getStuStaffList();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
//用户实体
UserInfo user = vo.getUserInfo();
//用户手机号
@ -63,9 +65,6 @@ public class UserInfoController {
}else if(provinceId==null){
resp.setStatus(300);
resp.setErrmessage("省份不能为空!");
}else if(roleId==null){
resp.setStatus(300);
resp.setErrmessage("用户角色不能为空!");
}else if(cityId==null){
resp.setStatus(300);
resp.setErrmessage("城市不能为空!");
@ -89,7 +88,7 @@ public class UserInfoController {
resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException();
}
HashMap<String, Object> sta = userInfoService.addStuStaff(stuStaffList,userId);
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int staStatus = (int) sta.get("retcode");
if (staStatus == 200){
resp.setStatus(staStatus);
@ -168,41 +167,22 @@ public class UserInfoController {
*/
@Transactional
@PostMapping("/deleteUserInfo")
public Response deleteUserInfo(@RequestBody List<UserInfo> userList) {
public Response deleteUserInfo(@RequestBody List<Integer> userIdList) {
Response resp = new Response();
int size = userList.size();
for(int i=0;i<size;i++){
UserInfo user = userList.get(i);
Integer userId = user.getUserId();
//修改成账号
String account = user.getAccount();
if (userId==null) {
if (userIdList==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,删除用户失败!");
}else if (account==null||account==""){
resp.setStatus(300);
resp.setErrmessage("用户账号为空,删除用户失败!");
} else {
HashMap<String, Object> ret = userInfoService.deleteUserInfo(userId);
HashMap<String, Object> ret = userInfoService.deleteUserInfo(userIdList);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> sta = userInfoService.deleteStaff(user);
HashMap<String, Object> sta = userInfoService.deleteOrganizationRelationship(userIdList);
int staStatus = (int) sta.get("retcode");
if (200 == staStatus) {
resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue"));
HashMap<String, Object> stu = userInfoService.deleteStudent(user);
int stuStatus = (int) stu.get("retcode");
if (200 == stuStatus) {
resp.setStatus(stuStatus);
resp.setMessage(stu.get("retvalue"));
}else{
resp.setStatus(stuStatus);
resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException();
}
}else{
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
@ -214,7 +194,6 @@ public class UserInfoController {
throw new RuntimeException();
}
}
}
return resp;
}
@ -251,6 +230,7 @@ public class UserInfoController {
@PostMapping("/updateUserProfiles")
public Response updateUserProfiles(@RequestBody List<UserProfiles> userProfilesList) {
Response resp = new Response();
// Integer userId = userProfilesList.get(0).getUserId();
if (userProfilesList.isEmpty()) {
resp.setStatus(300);
resp.setErrmessage("用户个人档案为空,修改失败!");
@ -288,19 +268,19 @@ public class UserInfoController {
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException("修改用户失败!");
throw new RuntimeException("修改用户组织关系失败!");
}
}
return resp;
}
/**
* 登陆(前台传来的key必须是phonepassword)
* 登陆查询学校
*/
@GetMapping("/logins")
Response logins(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) {
@GetMapping("/loginSchool")
Response loginSchool(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
UserInfo user = new UserInfo();
UserInfo userInfo = new UserInfo();
if (account == null || account=="") {
resp.setStatus(300);
resp.setErrmessage("用户账号为空,登录失败!");
@ -308,9 +288,43 @@ public class UserInfoController {
resp.setStatus(300);
resp.setErrmessage("用户密码为空,登录失败!");
}else{
user.setAccount(account);
user.setPassword(password);
HashMap<String, Object> ret = userInfoService.logins(user);
userInfo.setAccount(account);
userInfo.setPassword(password);
HashMap<String, Object> ret = userInfoService.loginSchool(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;
}
/**
* 登陆
*/
@GetMapping("/logins")
Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId,@RequestParam("roleId") Integer roleId, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
if (userId == null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!");
}else if(schoolId ==null) {
resp.setStatus(300);
resp.setErrmessage("用户学校id为空,登录失败!");
}else if(roleId ==null) {
resp.setStatus(300);
resp.setErrmessage("用户角色id为空,登录失败!");
}
else{
userInfo.setRoleId(roleId);
userInfo.setUserId(userId);
userInfo.setSchoolId(schoolId);
HashMap<String, Object> ret = userInfoService.logins(userInfo);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -323,6 +337,34 @@ public class UserInfoController {
return resp;
}
/**
* 登陆查询角色
*/
@GetMapping("/loginRole")
Response loginRole(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
OrganizationRelationship OR = new OrganizationRelationship();
if (userId == null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!");
}else if(schoolId ==null) {
resp.setStatus(300);
resp.setErrmessage("角色id为空,登录失败!");
}else{
OR.setUserId(userId);
OR.setSchoolId(schoolId);
HashMap<String, Object> ret = userInfoService.loginRole(OR);
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;
}
/**
* 查询用户详情(ID)
@ -348,7 +390,33 @@ public class UserInfoController {
}
/**
* 查询用户详情(ID)
* 查询用户组织架构OR(organization relationship)
*/
@GetMapping("/queryUserOR")
Response queryUserOR(@RequestParam Integer userId,Integer platformId) {
Response resp = new Response();
if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!");
}else if (platformId==null){
resp.setStatus(300);
resp.setErrmessage("平台id为空!查询失败!");
} else {
HashMap<String, Object> ret = userInfoService.queryUserOR(userId,platformId);
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("/queryUserProfiles")
Response queryUserProfiles(@RequestParam Integer userId) {
@ -446,7 +514,7 @@ public class UserInfoController {
@GetMapping("/queryAccountIsExist")
Response queryAccountIsExist(@RequestParam String account) {
Response resp = new Response();
if (account==null) {
if (account==null&&account=="") {
resp.setStatus(300);
resp.setErrmessage("账号为空!");
}else {
@ -490,5 +558,58 @@ public class UserInfoController {
return resp;
}
/**
* 查询平台
*/
@GetMapping("/queryPlatform")
Response queryPlatform(@RequestParam String platformId) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
//平台id
if (platformId==null&&platformId=="") {
resp.setStatus(300);
resp.setErrmessage("平台id为空!");
}else{
HashMap<String, Object> ret = userInfoService.queryPlatform(platformId);
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("/deletePlatform")
Response deletePlatform(@RequestBody OrganizationRelationship OR) {
Response resp = new Response();
Integer platformId = OR.getPlatformId();
Integer userId = OR.getUserId();
//平台id
if (platformId==null) {
resp.setStatus(300);
resp.setErrmessage("平台id为空!");
}else if(userId==null){
resp.setStatus(300);
resp.setErrmessage("用户id为空!");
}
else{
HashMap<String, Object> ret = userInfoService.deletePlatform(platformId,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;
}
}

@ -17,8 +17,12 @@ public class OrganizationRelationship {
private String workNumber;
//一级部门ID
private Integer oneDepartmentId;
//一级部门ID
private String oneDepartmentIds;
//二级部门ID
private Integer twoDepartmentId;
//二级部门ID
private String twoDepartmentIds;
//一级部门名称
private String oneDepartmentName;
//二级部门名称
@ -35,6 +39,32 @@ public class OrganizationRelationship {
private Integer classId;
//班级名称
private String className;
//客户ID
private Integer customerId;
public String getOneDepartmentIds() {
return oneDepartmentIds;
}
public void setOneDepartmentIds(String oneDepartmentIds) {
this.oneDepartmentIds = oneDepartmentIds;
}
public String getTwoDepartmentIds() {
return twoDepartmentIds;
}
public void setTwoDepartmentIds(String twoDepartmentIds) {
this.twoDepartmentIds = twoDepartmentIds;
}
public Integer getCustomerId() {
return customerId;
}
public void setCustomerId(Integer customerId) {
this.customerId = customerId;
}
public Integer getOrganizationRelationshipId() {
return organizationRelationshipId;

@ -0,0 +1,54 @@
package com.yipin.liuwanr.entity;
public class Platform {
private Integer platformId;
private String platformName;
private String domainName;
private String createTime;
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "Platform{" +
"platformId=" + platformId +
", platformName='" + platformName + '\'' +
", domainName='" + domainName + '\'' +
", createTime='" + createTime + '\'' +
'}';
}
}

@ -55,7 +55,7 @@ public class UserInfo {
private List<UserInfo> user;
//用户头像路径
private String userAvatars;
//------------------------------------------------
//---------------------------------------------与用户关联实体
//学校名称
private String schoolName;
//省份名称
@ -78,6 +78,76 @@ public class UserInfo {
private Integer professionalId;
//专业名称
private String professionalName;
//工号学号
private String workNumber;
//一级部门ID
private Integer oneDepartmentId;
//一级部门ID
private String oneDepartmentIds;
//二级部门ID
private Integer twoDepartmentId;
//二级部门ID
private String twoDepartmentIds;
//一级部门名称
private String oneDepartmentName;
//二级部门名称
private String twoDepartmentName;
public String getWorkNumber() {
return workNumber;
}
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getOneDepartmentIds() {
return oneDepartmentIds;
}
public void setOneDepartmentIds(String oneDepartmentIds) {
this.oneDepartmentIds = oneDepartmentIds;
}
public String getTwoDepartmentIds() {
return twoDepartmentIds;
}
public void setTwoDepartmentIds(String twoDepartmentIds) {
this.twoDepartmentIds = twoDepartmentIds;
}
public String getOneDepartmentName() {
return oneDepartmentName;
}
public void setOneDepartmentName(String oneDepartmentName) {
this.oneDepartmentName = oneDepartmentName;
}
public String getTwoDepartmentName() {
return twoDepartmentName;
}
public void setTwoDepartmentName(String twoDepartmentName) {
this.twoDepartmentName = twoDepartmentName;
}
public Integer getOneDepartmentId() {
return oneDepartmentId;
}
public void setOneDepartmentId(Integer oneDepartmentId) {
this.oneDepartmentId = oneDepartmentId;
}
public Integer getTwoDepartmentId() {
return twoDepartmentId;
}
public void setTwoDepartmentId(Integer twoDepartmentId) {
this.twoDepartmentId = twoDepartmentId;
}
public Integer getUserId() {
return userId;

@ -25,6 +25,10 @@ public interface ExperimentalClassMapper {
@Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}")
void experimentClassDeleteStudent(Student student);
//实验班级更新人数
@Update("Update experimental_class_ning Set classSize = #{classSize} where experimentalClassId = #{experimentalClassId}")
void experimentClassUpdatePN(Integer classSize,Integer experimentalClassId);
//创建实验班级
@Insert("INSERT INTO experimental_class_ning(experimentalClassName,classSize,creationTime,founder,courseId,isdel,userId,schoolId)"
+ "VALUES(#{experimentalClassName},#{classSize},now(),#{founder},#{courseId},0,#{userId},#{schoolId})")

@ -2,28 +2,28 @@ package com.yipin.liuwanr.mapper;
import java.util.List;
import com.yipin.liuwanr.entity.UserInfo;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.StaffGrade;
import io.lettuce.core.dynamic.annotation.Param;
public interface StaffMapper {
// @Insert("INSERT INTO staff(staffName,staffWorkNumber,phone,email,staffProfessionalArchitectureId,staffGradeId,roleId,isdel,uniqueIdentificationAccount,schoolId)VALUES(#{staffName},#{staffWorkNumber},#{phone},#{email},#{staffProfessionalArchitectureId},#{staffGradeId},#{roleId},0,#{uniqueIdentificationAccount},#{schoolId})")
// void addStaff(Staff staff);
//添加员工
@Insert("INSERT INTO staff(staffName,staffWorkNumber,phone,email,staffProfessionalArchitectureId,staffGradeId,roleId,isdel,uniqueIdentificationAccount,schoolId)VALUES(#{staffName},#{staffWorkNumber},#{phone},#{email},#{staffProfessionalArchitectureId},#{staffGradeId},#{roleId},0,#{uniqueIdentificationAccount},#{schoolId})")
void addStaff(Staff staff);
@Select({"<script>",
"SELECT sta.uniqueIdentificationAccount,sta.staffId,sta.staffName,sta.staffWorkNumber,sta.phone,sta.email,sta.logNumber,sta.lastTimeOfLanding,sta.staffGradeId,sta.staffProfessionalArchitectureId,sta.roleId,gra.staffGradeName,pro.staffProfessionalArchitectureName from staff sta,staff_grade gra,staff_professional_architecture pro where sta.isdel = 0 and sta.staffGradeId = gra.staffGradeId and pro.staffProfessionalArchitectureId = sta.staffProfessionalArchitectureId and sta.roleId != 1 and sta.roleId !=2 and sta.schoolId = #{schoolId}",
// " <if test='nameAndNumber!=null'> and sta.staffName like CONCAT('%',#{nameAndNumber},'%') or sta.staffWorkNumber like CONCAT('%',#{nameAndNumber},'%') GROUP BY sta.staffId</if>",
" <if test='nameAndNumber!=null'> and sta.staffName like CONCAT('%',#{nameAndNumber},'%')</if>",
" <if test='staffProfessionalArchitectureIds!=null'>and FIND_IN_SET(sta.staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds})</if>",
" <if test='staffGradeIds!=null'> and FIND_IN_SET(sta.staffGradeId,#{staffGradeIds}) </if>",
"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}",
" <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>",
"GROUP BY hui.userId",
"</script> "})
List<Staff> queryStaff(Staff staff);
List<UserInfo> queryStaff(UserInfo userInfo);
@Update({"<script>",
"UPDATE staff SET isdel = 1 where staffId = #{staffId}",

@ -32,13 +32,13 @@ public interface UserInfoMapper {
void addUser(UserInfo user);
@Select({"<script>",
"SELECT s.schoolName,s.provinceId,s.cityId,s.provinceName,s.cityName,u.userId,u.userName,u.countries,u.creationTime,u.account,u.logInNumber,hor.schoolId,hor.platformId,hor.roleId FROM hr_user_info u,hr_organization_relationship hor,school s WHERE u.userId = hor.userId and hor.schoolId = s.schoolId and s.isdel = 0",
"SELECT u.userId,u.userName,s.schoolName,s.provinceId,s.cityId,s.provinceName,s.cityName,u.countries,u.creationTime,u.account,u.logInNumber,u.schoolId,hor.platformId,hor.roleId FROM hr_user_info u,hr_organization_relationship hor,school s WHERE u.userId = hor.userId and u.schoolId = s.schoolId and u.isdel = 0 and hor.isdel = 0",
" <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and s.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null and schoolId !=\"\"'>and u.schoolId = #{schoolId} </if>",
" <if test='cityId!=null and cityId !=\"\" '>and u.cityId = #{cityId} </if>",
" <if test='roleId!=null and roleId !=\"\" '>and u.roleId = #{roleId} </if>",
// " <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='cityId!=null and cityId !=\"\" '>and s.cityId = #{cityId} </if>",
" <if test='roleId!=null and roleId !=\"\" '>and hor.roleId = #{roleId} </if>",
" <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.userName, s.schoolName,u.account) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",
" <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>",
@ -48,65 +48,43 @@ public interface UserInfoMapper {
"</script> "})
List<UserInfo> queryUserInfo(UserInfo userInfo);
@Update("UPDATE hr_user_info SET isdel = 1 where userId = #{userId}")
void deleteUser(Integer userId);
//批量删除员工
@Update({ "<script>",
"UPDATE staff SET isdel = 1 where account = #{account} ",
"</script>" })
void deleteStaff(UserInfo user);
//批量删除学生
@Update({ "<script>",
"UPDATE student SET isdel = 1 where account = #{account} ",
@Update( {"<script>",
"UPDATE hr_user_info set isdel=1 where userId = #{userId}",
"</script>" })
void deleteStudent(UserInfo user);
void deleteUser(Integer userId);
//修改用户
@Update("UPDATE hr_user_info SET userName = #{userName},uniqueIdentificationAccount = #{uniqueIdentificationAccount},documentType = #{documentType},IDNumber = #{IDNumber},provinceId = #{provinceId},"
+ "cityId = #{cityId},countries = #{countries},dateBirth = #{dateBirth},educationDegree = #{educationDegree},schoolId = #{schoolId},"
+ "phone = #{phone},weChatID = #{weChatID},email = #{email},account = #{account},creationTime = #{creationTime},logInNumber = #{logInNumber},sex = #{sex},userAvatars = #{userAvatars} where userId = #{userId}")
+ "phone = #{phone},weChatID = #{weChatID},email = #{email},account = #{account},sex = #{sex},userAvatars = #{userAvatars} where userId = #{userId}")
void updateUser(UserInfo user);
//修改用户个人档案
@Update({ "<script>",
"UPDATE hr_personal_file SET ",
"<when test='personalCareerId!=null'>", "personalCareerId = #{personalCareerId},", "</when>",
"<when test='schoolId!=null'>", "schoolId = #{schoolId},", "</when>",
"<when test='schoolName!=null'>", "schoolName = #{schoolName},", "</when>",
"<when test='disciplineId!=null'>", "disciplineId = #{disciplineId},", "</when>",
"<when test='disciplineName!=null'>", "disciplineName = #{disciplineName},", "</when>",
"<when test='professionalClassId!=null'>", "professionalClassId = #{professionalClassId},", "</when>",
"<when test='professionalClassName!=null'>", "professionalClassName = #{professionalClassName},", "</when>",
"<when test='professionalId!=null'>", "professionalId = #{professionalId},", "</when>",
"<when test='professionalName!=null'>", "professionalName = #{professionalName},", "</when>",
"updatetime=now() where personalFileId = #{personalFileId}",
//修改个人档案添加功能(删除后添加用户个人档案)
@Insert({ "<script>",
"INSERT INTO hr_personal_file(personalCareerId,schoolId,schoolName,disciplineId,disciplineName,professionalClassId,professionalClassName,professionalId,professionalName,userId,updatetime) values " +
"(#{personalCareerId},#{schoolId},#{schoolName},#{disciplineId},#{disciplineName},#{professionalClassId},#{professionalClassName},#{professionalId},#{professionalName},#{userId},now())",
"</script>" })
void updateUserProfiles(UserProfiles userProfiles);
//修改用户组织关系
@Update({ "<script>",
"UPDATE hr_organization_relationship SET ",
"<when test='platformId!=null'>", "platformId = #{platformId},", "</when>",
"<when test='schoolId!=null'>", "schoolId = #{schoolId},", "</when>",
"<when test='schoolName!=null'>", "schoolName = #{schoolName},", "</when>",
"<when test='roleId!=null'>", "roleId = #{roleId},", "</when>",
"<when test='workNumber!=null'>", "workNumber = #{workNumber},", "</when>",
"<when test='oneDepartmentId!=null'>", "oneDepartmentId = #{oneDepartmentId},", "</when>",
"<when test='oneDepartmentName!=null'>", "oneDepartmentName = #{oneDepartmentName},", "</when>",
"<when test='twoDepartmentId!=null'>", "twoDepartmentId = #{twoDepartmentId},", "</when>",
"<when test='twoDepartmentName!=null'>", "twoDepartmentName = #{twoDepartmentName},", "</when>",
"<when test='professionalId!=null'>", "professionalId = #{professionalId},", "</when>",
"<when test='professionalName!=null'>", "professionalName = #{professionalName},", "</when>",
"<when test='gradeId!=null'>", "gradeId = #{gradeId},", "</when>",
"<when test='gradeName!=null'>", "gradeName = #{gradeName},", "</when>",
"<when test='classId!=null'>", "classId = #{classId},", "</when>",
"<when test='className!=null'>", "className = #{className},", "</when>",
"updatetime=now() where organizationRelationshipId = #{organizationRelationshipId}",
//修改个人档案删除功能
@Delete( {"<script>",
"Delete from hr_personal_file where userId = #{userId}",
"</script>" })
void deleteUserProfiles(Integer userId);
//修改用户组织关系添加功能
@Insert({ "<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId})",
"</script>" })
void updateOrganizationRelationship(OrganizationRelationship organizationRelationship);
//修改用户组织架构删除功能
@Delete( {"<script>",
"Delete from hr_organization_relationship where userId = #{userId} and platformId = #{platformId}",
"</script>" })
void deleteOR(Integer userId,Integer platformId);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
+ "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where phone = #{phone}")
@ -118,13 +96,29 @@ public interface UserInfoMapper {
void updateStudent(Student student);
//登陆
@Select("SELECT hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.schoolId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.account = #{account} and hui.password = #{password}")
@Select("SELECT hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ")
UserInfo logins(UserInfo userInfo);
//登陆账号密码
@Select("SELECT hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.account = #{account} and password = #{password} ")
UserInfo loginsAP(UserInfo userInfo);
//查询用户角色
@Select("SELECT userId,roleId from hr_organization_relationship where userId = #{userId} and schoolId = #{schoolId}")
List<OrganizationRelationship> loginRole(Integer userId,Integer schoolId);
//查询用户组织关系
@Select("SELECT * from hr_organization_relationship where userId = #{userId}")
@Select("SELECT schoolId,schoolName,userId from hr_organization_relationship where userId = #{userId} GROUP BY schoolId")
List<OrganizationRelationship> queryOrganizationRelationship(Integer userId);
//查询用户组织关系
@Select("SELECT * from hr_organization_relationship where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryOrganizationRelationshipAll(Integer userId,Integer roleId,Integer schoolId);
//查询用户绑定平台信息
@Select("SELECT hp.* FROM hr_platform hp,hr_organization_relationship hor WHERE hor.platformId = hp.platformId and hor.userId = #{userId} and hor.isdel = 0 GROUP BY platformId")
List<Platform> queryUserPlatform(Integer userId);
//查询用户手机
@Select("SELECT u.* from user u where isdel=0 and phone = #{phone}")
List<UserM> queryPhone(String phone);
@ -141,6 +135,18 @@ public interface UserInfoMapper {
"</script> "})
List<UserProfiles> queryUserProfiles(Integer userId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId} and platformId = #{platformId}",
"</script> "})
List<OrganizationRelationship> queryUserOR(Integer userId,Integer platformId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId}",
"</script> "})
List<OrganizationRelationship> queryUserIdOR(Integer userId);
//模糊查询客户
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0",
@ -174,22 +180,30 @@ public interface UserInfoMapper {
@Update({ "UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"})
void updateLogInNumber(UserM user);
//更新用户登录次数和最后一次登录时间
//更新学生登录次数和最后一次登录时间
@Update({ "UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE phone=#{phone}"})
void updateStudentLogInNumber(UserM user);
//更新用户登录次数和最后一次登录时间
//更新员工登录次数和最后一次登录时间
@Update({ "UPDATE staff SET logNumber=logNumber+1, lastTimeOfLanding=now() WHERE phone=#{phone}"})
void updateStaffLogInNumber(UserM user);
//查询账号是否存在
@Select("SELECT userId,account from user where isdel = 0 and account = #{account}")
@Select("SELECT userId,account from hr_user_info where isdel = 0 and account = #{account}")
List<UserInfo> queryAccountIsExist(String account);
//查询学号、工号是否存在
@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);
//查询平台
@Select("SELECT platformId,platformName,domainName,createTime from hr_platform where FIND_IN_SET (platformId,#{platformId})")
List<Platform> queryPlatform(String platformId);
//删除平台
@Select("Update hr_organization_relationship set isdel = 1 where platformId = #{platformId} and userId = #{userId}")
void deletePlatform(Integer platformId,Integer userId);
//========全承珠
@Select("select userId,password,accountRole,logInNumber,workNumber,phone,uniqueIdentificationAccount,schoolId from user "
+ " where isdel=0 and password=#{password} and (phone=#{userAccount} or workNumber=#{userAccount} or uniqueIdentificationAccount=#{userAccount})")
@ -204,22 +218,22 @@ public interface UserInfoMapper {
*/
@Insert({
"<script>",
"insert into hr_personal_file(personalCareerId,schoolId,disciplineId,professionalClassId,professionalId,userId) values ",
"<foreach collection='list' item='list' index='index' separator=','>",
"(#{list.personalCareerId}, #{list.schoolId}, #{list.disciplineId}, #{list.professionalClassId} ,#{list.professionalId},#{list.userId})",
"</foreach>",
"insert into hr_personal_file(personalCareerId,schoolId,disciplineId,professionalClassId,professionalId,userId,schoolName,disciplineName,professionalClassName,professionalName) values ",
"(#{personalCareerId}, #{schoolId}, #{disciplineId}, #{professionalClassId} ,#{professionalId},#{userId},#{schoolName},#{disciplineName},#{professionalClassName},#{professionalName})",
"</script>"
})
void addPersonalFile(List<UserProfiles> list);
//添加学生
@Insert("INSERT INTO student(account,userId,studentName,roleId,studentNumber,phone,email,professionalId,gradeId,classId,professionalName,gradeName,className,uniqueIdentificationAccount,schoolId,isdel)"
+ " VALUES(#{account},#{userId},#{name},#{roleId},#{workNumber},#{phone},#{email},#{professionalId},#{gradeId},#{classId},#{professionalName},#{gradeName},#{className},#{uniqueIdentificationAccount},#{schoolId},0)")
void addStudent(StuStaff stuStaff);
void addPersonalFile(UserProfiles userProfiles);
//添加员工
@Insert("INSERT INTO staff(account,userId,staffName,roleId,staffWorkNumber,phone,email,staffGradeId,staffProfessionalArchitectureId,staffProfessionalArchitectureName,staffGradeName,uniqueIdentificationAccount,schoolId,isdel)"
+ " VALUES(#{account},#{userId},#{name},#{roleId},#{workNumber},#{phone},#{email},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffProfessionalArchitectureName},#{staffGradeName},#{uniqueIdentificationAccount},#{schoolId},0)")
void addStaff(StuStaff stuStaff);
//添加用户组织关系
@Insert({ "<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId})",
"</script>" })
void addOrganizationRelationship(OrganizationRelationship organizationRelationship);
//删除用户组织架构关系
@Update( {"<script>",
"UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}",
"</script>" })
void deleteOrganizationRelationship(Integer userId);
}

@ -74,6 +74,21 @@ public class ExperimentalClassService {
return resp;
}
//实验班级更新人数
public HashMap<String, Object> experimentClassUpdatePN(Integer classSize,Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.experimentClassUpdatePN(classSize,experimentalClassId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新实验班级人数失败!");
return resp;
}
return resp;
}
//创建实验班级
public HashMap<String, Object> addExperimentalClass(ExperimentalClass experimentalClass) {
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,10 +15,6 @@ import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yipin.liuwanr.entity.PageResult;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.StaffGrade;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.helper.ExcelImportHelper;
import com.yipin.liuwanr.mapper.StaffMapper;
import com.yipin.liuwanr.mapper.UserMapper;
@ -99,42 +97,74 @@ public class StaffService {
return resp;
}
public HashMap<String, Object> addStaff(Staff staff){
// //添加员工
// public HashMap<String, Object> addStaff(Staff staff){
// HashMap<String, Object> resp = new HashMap<String, Object>();
// try {
// staffMapper.addStaff(staff);
// resp.put("retcode", 200);
// } catch (RuntimeException e) {
// logger.error(e.getMessage());
// resp.put("retcode", 500);
// resp.put("retvalue", "Inquiry Failed");
// return resp;
// }
// return resp;
// }
//
// //查询员工
// public HashMap<String, Object> queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){
// HashMap<String, Object> resp = new HashMap<String, Object>();
// try {
// if(pageNo!=null&&pageSize!=null) {
// PageHelper.startPage(pageNo, pageSize);
// List<UserInfo> list = staffMapper.queryStaff(userInfo);
// PageInfo<UserInfo> info=new PageInfo<UserInfo>(list);
// int total1 = (int) info.getTotal();
// int totalPages;
// totalPages = total1 / pageSize;
// if (total1 % pageSize != 0){
// totalPages ++;
// }
// long total = total1;
// resp.put("retvalue", new PageResult(total, list,totalPages));
// resp.put("retcode", 200);
// }else {
// List<UserInfo> list = staffMapper.queryStaff(userInfo);
// resp.put("retvalue", list);
// resp.put("retcode", 200);
// }
// } catch (RuntimeException e) {
// logger.error(e.getMessage());
// resp.put("retcode", 500);
// resp.put("retvalue", "Inquiry Failed");
// return resp;
// }
// return resp;
// }
//删除员工
public HashMap<String, Object> deleteStaff(Integer staffId,String phone){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
staffMapper.addStaff(staff);
staffMapper.deleteStaff(staffId);
staffMapper.deleteUser(phone);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "删除员工失败!");
return resp;
}
return resp;
}
//查询员工
public HashMap<String, Object> queryStaff(Staff staff,Integer pageNo,Integer pageSize){
//查询员工详情
public HashMap<String, Object> queryStaffDetails(Integer staffId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(pageNo!=null&&pageSize!=null) {
PageHelper.startPage(pageNo, pageSize);
List<Staff> list = staffMapper.queryStaff(staff);
PageInfo<Staff> info=new PageInfo<Staff>(list);
int total1 = (int) info.getTotal();
int totalPages;
totalPages = total1 / pageSize;
if (total1 % pageSize != 0){
totalPages ++;
}
long total = total1;
resp.put("retvalue", new PageResult(total, list,totalPages));
resp.put("retcode", 200);
}else {
List<Staff> list = staffMapper.queryStaff(staff);
resp.put("retvalue", list);
resp.put("retvalue", staffMapper.queryStaffDetailsUser(staffId));
resp.put("retcode", 200);
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
@ -144,28 +174,46 @@ public class StaffService {
return resp;
}
//删除员工
public HashMap<String, Object> deleteStaff(Integer staffId,String phone){
//修改员工
public HashMap<String, Object> updateStaff(UserVO vo){
HashMap<String, Object> resp = new HashMap<String, Object>();
Staff staff = vo.getStaff();
UserM user = vo.getUser();
try {
staffMapper.deleteStaff(staffId);
staffMapper.deleteUser(phone);
staffMapper.updateStaff(staff);
staffMapper.updateUser(user);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除员工失败!");
resp.put("retvalue", "修改员工失败!");
return resp;
}
return resp;
}
//查询员工详情
public HashMap<String, Object> queryStaffDetails(Integer staffId){
//查询员工
public HashMap<String, Object> queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", staffMapper.queryStaffDetailsUser(staffId));
if(pageNo!=null&&pageSize!=null) {
PageHelper.startPage(pageNo, pageSize);
List<UserInfo> list = staffMapper.queryStaff(userInfo);
PageInfo<UserInfo> info=new PageInfo<UserInfo>(list);
int total1 = (int) info.getTotal();
int totalPages;
totalPages = total1 / pageSize;
if (total1 % pageSize != 0){
totalPages ++;
}
long total = total1;
resp.put("retvalue", new PageResult(total, list,totalPages));
resp.put("retcode", 200);
}else {
List<UserInfo> list = staffMapper.queryStaff(userInfo);
resp.put("retvalue", list);
resp.put("retcode", 200);
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
@ -175,22 +223,18 @@ public class StaffService {
return resp;
}
//修改员工
public HashMap<String, Object> updateStaff(UserVO vo){
//添加员工
public HashMap<String, Object> addStaff(Staff staff){
HashMap<String, Object> resp = new HashMap<String, Object>();
Staff staff = vo.getStaff();
UserM user = vo.getUser();
try {
staffMapper.updateStaff(staff);
staffMapper.updateUser(user);
staffMapper.addStaff(staff);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "修改员工失败!");
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
}

@ -136,10 +136,14 @@ public class UserInfoService {
return resp;
}
//删除用户
public HashMap<String, Object> deleteUserInfo(Integer userId){
public HashMap<String, Object> deleteUserInfo(List<Integer> userIdList){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
int size = userIdList.size();
for (int i=0;i<size;i++){
Integer userId=userIdList.get(i);
userInfoMapper.deleteUser(userId);
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -150,26 +154,15 @@ public class UserInfoService {
return resp;
}
//批量删除员工
public HashMap<String, Object> deleteStaff(UserInfo user){
//删除用户组织架构
public HashMap<String, Object> deleteOrganizationRelationship(List<Integer> userIdList){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deleteStaff(user);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除员工失败");
return resp;
}
return resp;
int size = userIdList.size();
for (int i=0;i<size;i++){
Integer userId=userIdList.get(i);
userInfoMapper.deleteOrganizationRelationship(userId);
}
//批量删除学生
public HashMap<String, Object> deleteStudent(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deleteStudent(user);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -202,6 +195,8 @@ public class UserInfoService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer size = userProfilesList.size();
Integer userId = userProfilesList.get(0).getUserId();
userInfoMapper.deleteUserProfiles(userId);
for (int i=0; i<size; i++){
UserProfiles userProfiles = userProfilesList.get(i);
userInfoMapper.updateUserProfiles(userProfiles);
@ -222,6 +217,9 @@ public class UserInfoService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer size = OrganizationRelationshipList.size();
Integer userId = OrganizationRelationshipList.get(0).getUserId();
Integer platformId = OrganizationRelationshipList.get(0).getPlatformId();
userInfoMapper.deleteOR(userId,platformId);
for (int i=0; i<size; i++){
OrganizationRelationship organizationRelationship = OrganizationRelationshipList.get(i);
userInfoMapper.updateOrganizationRelationship(organizationRelationship);
@ -268,18 +266,44 @@ public class UserInfoService {
return resp;
}
//登陆获取学校
public HashMap<String, Object> loginSchool(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
UserInfo user=userInfoMapper.loginsAP(userInfo);
// obj.put("user",user);
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", "登录失败,账号密码有误或不存在!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "登录异常,请稍后再试!");
return resp;
}
return resp;
}
//登陆
public HashMap<String, Object> logins(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
Student student;
Staff staff;
Integer userId = userInfo.getUserId();
Integer roleId = userInfo.getRoleId();
Integer schoolId = userInfo.getSchoolId();
try {
UserInfo user=userInfoMapper.logins(userInfo);
obj.put("user",user);
if(user!=null) {
Integer userId = user.getUserId();
List<OrganizationRelationship> organizationRelationship = userInfoMapper.queryOrganizationRelationship(userId);
if(userId!=null) {
List<OrganizationRelationship> organizationRelationship = userInfoMapper.queryOrganizationRelationshipAll(userId,roleId,schoolId);
obj.put("organizationRelationship",organizationRelationship);
resp.put("retcode", 200);
resp.put("retvalue", obj);
@ -296,6 +320,31 @@ public class UserInfoService {
return resp;
}
//登陆获取角色
public HashMap<String, Object> loginRole(OrganizationRelationship OR){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
if(OR!=null) {
Integer userId = OR.getUserId();
Integer schoolId = OR.getSchoolId();
List<OrganizationRelationship> organizationRelationship = userInfoMapper.loginRole(userId,schoolId);
obj.put("organizationRelationship",organizationRelationship);
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;
}
return resp;
}
//查询用户详情
public HashMap<String, Object> queryUserInfoDetails(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -306,11 +355,32 @@ public class UserInfoService {
if (userInfo!=null){
List<UserProfiles> userProfiles = userInfoMapper.queryUserProfiles(userId);
obj.put("userProfilesList",userProfiles);
List<OrganizationRelationship> organizationRelationshipsList = userInfoMapper.queryOrganizationRelationship(userId);
obj.put("organizationRelationshipsList",organizationRelationshipsList);
List<Platform> platformList = userInfoMapper.queryUserPlatform(userId);
obj.put("platformList",platformList);
List<OrganizationRelationship> ORList = userInfoMapper.queryUserIdOR(userId);
obj.put("ORList",ORList);
resp.put("retvalue", obj);
resp.put("retcode", 200);
}else {
resp.put("retcode", 500);
resp.put("retvalue", "用户不存在!,查询用户详情失败!");
return resp;
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询用户详情失败!");
return resp;
}
return resp;
}
//查询用户组织架构详情
public HashMap<String, Object> queryUserOR(Integer userId,Integer platformId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryUserOR(userId,platformId));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
@ -404,7 +474,7 @@ public class UserInfoService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "查询账号是否存在失败!");
return resp;
}
return resp;
@ -433,8 +503,8 @@ public class UserInfoService {
for (int i = 0; i < size; i++){
UserProfiles userProfiles = userProfilesList.get(i);
userProfiles.setUserId(userId);
userInfoMapper.addPersonalFile(userProfiles);
}
userInfoMapper.addPersonalFile(userProfilesList);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -447,34 +517,51 @@ public class UserInfoService {
//添加学生和员工信息
@Transactional
public HashMap<String, Object> addStuStaff(List<StuStaff> stuStaffList,Integer userId) {
public HashMap<String, Object> addStuStaff(List<OrganizationRelationship> ORList,Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
int size = stuStaffList.size();
int size = ORList.size();
for (int i=0;i<size;i++){
StuStaff stuStaff = stuStaffList.get(i);
stuStaff.setUserId(userId);
Integer roleId = stuStaff.getRoleId();
if (roleId == 2 || roleId == 3){
//添加老师和管理员sql
userInfoMapper.addStaff(stuStaff);
OrganizationRelationship organizationRelationship = ORList.get(i);
organizationRelationship.setUserId(userId);
userInfoMapper.addOrganizationRelationship(organizationRelationship);
}
resp.put("retcode", 200);
}else if (roleId == 4){
//添加学生sql
userInfoMapper.addStudent(stuStaff);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!");
throw new RuntimeException("添加学生和员工信息失败!");
}
return resp;
}
//查询平台
public HashMap<String, Object> queryPlatform(String platformId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryPlatform(platformId));
resp.put("retcode", 200);
}else{
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!,角色id有误!");
throw new RuntimeException("添加学生和员工信息失败!,角色id有误!");
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
//删除平台
public HashMap<String, Object> deletePlatform(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deletePlatform(platformId,userId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!");
throw new RuntimeException("添加学生和员工信息失败!");
// return resp;
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}

@ -7,7 +7,7 @@ logging.level.jdbc.sqltiming=DEBUG
logging.level.jdbc.resultsettable=DEBUG
logging.level.com.yipin.liuwar.mapper=DEBUG
spring.datasource.url=jdbc:mysql://www.liuwanr.cn:3306/huoran?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true
spring.datasource.url=jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true
spring.datasource.username=super
spring.datasource.password=huoran888
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

@ -1,6 +1,8 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.OrganizationRelationship;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.UserInfo;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.vo.UserVO;
import org.apache.commons.io.IOUtils;
@ -114,11 +116,11 @@ public class StaffServiceTest {
@Test
@Transactional
public void queryStaffTest(){
Staff staff = new Staff();
UserInfo userInfo = new UserInfo();
Integer pageNo = 1;
Integer pageSize = 10;
staff.setSchoolId(2043);
HashMap<String, Object> queryStaff = staffService.queryStaff(staff, pageNo, pageSize);
userInfo.setSchoolId(2043);
HashMap<String, Object> queryStaff = staffService.queryStaff(userInfo, pageNo, pageSize);
for (String s : queryStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + queryStaff.get(s));
}

Loading…
Cancel
Save