diff --git a/src/main/java/com/yipin/liuwanr/controller/CourseController.java b/src/main/java/com/yipin/liuwanr/controller/CourseController.java index 314803d..99b31d1 100644 --- a/src/main/java/com/yipin/liuwanr/controller/CourseController.java +++ b/src/main/java/com/yipin/liuwanr/controller/CourseController.java @@ -350,8 +350,6 @@ public class CourseController { Response queryCourseProfessional(@RequestParam Integer professionalClassId) { Response resp = new Response(); HashMap ret = courseService.queryCourseProfessional(professionalClassId); - resp.setStatus(200); - resp.setErrmessage("Parameter effective"); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -359,7 +357,7 @@ public class CourseController { } else { resp.setStatus(status); resp.setErrmessage(ret.get("retvalue").toString()); - } + } return resp; } diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 0c04329..ea1811d 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -163,6 +163,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 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; + } /** * 修改实验班级名称 diff --git a/src/main/java/com/yipin/liuwanr/controller/StaffController.java b/src/main/java/com/yipin/liuwanr/controller/StaffController.java index 014033b..157a1ec 100644 --- a/src/main/java/com/yipin/liuwanr/controller/StaffController.java +++ b/src/main/java/com/yipin/liuwanr/controller/StaffController.java @@ -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; @@ -30,92 +33,247 @@ public class StaffController { @Autowired 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 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; -} +// @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 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 ret = staffService.addStaff(staff); +// int status = (int) ret.get("retcode"); +// if (200 == status) { +// resp.setStatus(status); +// resp.setMessage(ret.get("retvalue")); +// HashMap 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 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 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 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 staffList) { +// Response resp = new Response(); +// int size = staffList.size(); +// for(int i=0;i 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 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; +// } - /** - * 添加员工 - */ - @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 ret = staffService.addStaff(staff); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - HashMap 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 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 ret = staffService.queryStaff(staff,pageNo,pageSize); + userInfo.setSchoolId(schoolId); + HashMap ret = staffService.queryStaff(userInfo,pageNo,pageSize); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -127,123 +285,39 @@ public class StaffController { } 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 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 ret = staffService.queryStaff(staff,pageNo,pageSize); + resp.setErrmessage("账号为空添加失败!"); + } else { + HashMap 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("/deleteStaff") - Response deleteStaff(@RequestBody List staffList) { - Response resp = new Response(); - int size = staffList.size(); - for(int i=0;i 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()); + HashMap 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(); } - } - } - 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 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; diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index a3986b9..d8f84f0 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -43,6 +43,8 @@ public class UserInfoController { List userProfilesList = vo.getUserProfilesList(); //学生员工实体list List stuStaffList = vo.getStuStaffList(); + //组织架构list + List 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 sta = userInfoService.addStuStaff(stuStaffList,userId); + HashMap 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 userList) { + public Response deleteUserInfo(@RequestBody List userIdList) { Response resp = new Response(); - int size = userList.size(); - for(int i=0;i ret = userInfoService.deleteUserInfo(userId); + HashMap ret = userInfoService.deleteUserInfo(userIdList); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); - HashMap sta = userInfoService.deleteStaff(user); + HashMap sta = userInfoService.deleteOrganizationRelationship(userIdList); int staStatus = (int) sta.get("retcode"); if (200 == staStatus) { resp.setStatus(staStatus); resp.setMessage(sta.get("retvalue")); - HashMap 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 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必须是phone、password) + * 登陆查询学校 */ - @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,9 @@ public class UserInfoController { resp.setStatus(300); resp.setErrmessage("用户密码为空,登录失败!"); }else{ - user.setAccount(account); - user.setPassword(password); - HashMap ret = userInfoService.logins(user); + userInfo.setAccount(account); + userInfo.setPassword(password); + HashMap ret = userInfoService.loginSchool(userInfo); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -323,6 +303,68 @@ public class UserInfoController { 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 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; + } + + /** + * 登陆查询角色 + */ + @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 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 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 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 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; + } } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java index ff5aac8..3328525 100644 --- a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java +++ b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java @@ -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; diff --git a/src/main/java/com/yipin/liuwanr/entity/Platform.java b/src/main/java/com/yipin/liuwanr/entity/Platform.java new file mode 100644 index 0000000..5492d52 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/Platform.java @@ -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 + '\'' + + '}'; + } +} diff --git a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java index 0762b68..c43d0d6 100644 --- a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java +++ b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java @@ -55,7 +55,7 @@ public class UserInfo { private List 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; diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java index 618feab..6b2624a 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java @@ -24,7 +24,11 @@ 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})") diff --git a/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java b/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java index ba54e30..5efd317 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java @@ -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({" "}) - List queryStaff(Staff staff); + List queryStaff(UserInfo userInfo); @Update({"" }) void updateStudentisAssess(List students, Integer isAssess); diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index 9a3d442..8c04ffb 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -32,13 +32,13 @@ public interface UserInfoMapper { void addUser(UserInfo user); @Select({" "}) List queryUserInfo(UserInfo userInfo); - @Update("UPDATE hr_user_info SET isdel = 1 where userId = #{userId}") - void deleteUser(Integer userId); - - //批量删除员工 - @Update({ "" }) - void deleteStaff(UserInfo user); - - //批量删除学生 - @Update({ "" }) - 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({ "" }) void updateUserProfiles(UserProfiles userProfiles); - //修改用户组织关系 - @Update({ "" }) + void deleteUserProfiles(Integer userId); + + //修改用户组织关系添加功能 + @Insert({ "" }) void updateOrganizationRelationship(OrganizationRelationship organizationRelationship); + //修改用户组织架构删除功能 + @Delete( {"" }) + 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 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 queryOrganizationRelationship(Integer userId); + //查询用户组织关系 + @Select("SELECT * from hr_organization_relationship where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}") + List 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 queryUserPlatform(Integer userId); + //查询用户手机 @Select("SELECT u.* from user u where isdel=0 and phone = #{phone}") List queryPhone(String phone); @@ -141,6 +135,18 @@ public interface UserInfoMapper { " "}) List queryUserProfiles(Integer userId); + //查询用户组织架构详情 + @Select({" "}) + List queryUserOR(Integer userId,Integer platformId); + + //查询用户组织架构详情 + @Select({" "}) + List queryUserIdOR(Integer userId); + //模糊查询客户 @Select({"" }) - void addPersonalFile(List 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({ "" }) + void addOrganizationRelationship(OrganizationRelationship organizationRelationship); + //删除用户组织架构关系 + @Update( {"" }) + void deleteOrganizationRelationship(Integer userId); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java index 2046b0c..4e33f32 100644 --- a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java +++ b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java @@ -74,6 +74,21 @@ public class ExperimentalClassService { return resp; } + //实验班级更新人数 + public HashMap experimentClassUpdatePN(Integer classSize,Integer experimentalClassId) { + HashMap resp = new HashMap(); + 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 addExperimentalClass(ExperimentalClass experimentalClass) { HashMap resp = new HashMap(); diff --git a/src/main/java/com/yipin/liuwanr/service/StaffService.java b/src/main/java/com/yipin/liuwanr/service/StaffService.java index 277e59f..b932432 100644 --- a/src/main/java/com/yipin/liuwanr/service/StaffService.java +++ b/src/main/java/com/yipin/liuwanr/service/StaffService.java @@ -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; @@ -34,7 +32,7 @@ public class StaffService { private UserMapper userMapper; /** - * 读取员工表 + * 读取员工表 * @param file * @return */ @@ -42,7 +40,7 @@ public class StaffService { public HashMap readStaff(MultipartFile file,Integer schoolId){ HashMap resp = new HashMap(); try { - + //读取excel文件中的员工信息 List staffs = ExcelImportHelper.readStaff(file); List users = new ArrayList(); @@ -50,14 +48,14 @@ public class StaffService { for (int i = 0; i < staffs.size(); i++) { Staff staff=staffs.get(i); staff.setSchoolId(schoolId); - + Staff sta=staffMapper.getStaff(staff); if(sta!=null) { //专业 staff.setStaffProfessionalArchitectureId(sta.getStaffProfessionalArchitectureId()); //部门 staff.setStaffGradeId(sta.getStaffGradeId()); - + UserM user=new UserM(); //用户名称 user.setName(staff.getStaffName()); @@ -79,16 +77,16 @@ public class StaffService { }else { staffs.remove(i); i--; - } - + } + } if(!staffs.isEmpty()&&staffs.size()>0) { //批量插入读取的员工信息 staffMapper.batchAddStaff(staffs); //批量插入用户信息 - userMapper.addUserM(users); + userMapper.addUserM(users); } - + resp.put("retcode", 200); } catch (RuntimeException e) { logger.error(e.getMessage()); @@ -99,42 +97,74 @@ public class StaffService { return resp; } - public HashMap addStaff(Staff staff){ +// //添加员工 +// public HashMap addStaff(Staff staff){ +// HashMap resp = new HashMap(); +// 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 queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){ +// HashMap resp = new HashMap(); +// try { +// if(pageNo!=null&&pageSize!=null) { +// PageHelper.startPage(pageNo, pageSize); +// List list = staffMapper.queryStaff(userInfo); +// PageInfo info=new PageInfo(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 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 deleteStaff(Integer staffId,String phone){ HashMap resp = new HashMap(); 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 queryStaff(Staff staff,Integer pageNo,Integer pageSize){ + //查询员工详情 + public HashMap queryStaffDetails(Integer staffId){ HashMap resp = new HashMap(); try { - if(pageNo!=null&&pageSize!=null) { - PageHelper.startPage(pageNo, pageSize); - List list = staffMapper.queryStaff(staff); - PageInfo info=new PageInfo(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 list = staffMapper.queryStaff(staff); - resp.put("retvalue", list); - resp.put("retcode", 200); - } + resp.put("retvalue", staffMapper.queryStaffDetailsUser(staffId)); + resp.put("retcode", 200); } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); @@ -144,30 +174,48 @@ public class StaffService { return resp; } - //删除员工 - public HashMap deleteStaff(Integer staffId,String phone){ + //修改员工 + public HashMap updateStaff(UserVO vo){ HashMap resp = new HashMap(); + 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 queryStaffDetails(Integer staffId){ + //查询员工 + public HashMap queryStaff(UserInfo userInfo, Integer pageNo, Integer pageSize){ HashMap resp = new HashMap(); try { - resp.put("retvalue", staffMapper.queryStaffDetailsUser(staffId)); - resp.put("retcode", 200); + if(pageNo!=null&&pageSize!=null) { + PageHelper.startPage(pageNo, pageSize); + List list = staffMapper.queryStaff(userInfo); + PageInfo info=new PageInfo(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 list = staffMapper.queryStaff(userInfo); + resp.put("retvalue", list); + resp.put("retcode", 200); + } } catch (RuntimeException e) { - logger.error(e.getMessage()); + logger.error(e.getMessage()); resp.put("retcode", 500); resp.put("retvalue", "Inquiry Failed"); return resp; @@ -175,22 +223,18 @@ public class StaffService { return resp; } - //修改员工 - public HashMap updateStaff(UserVO vo){ + //添加员工 + public HashMap addStaff(Staff staff){ HashMap resp = new HashMap(); - 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; } - } diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java index cdbca2e..56f6418 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java @@ -136,10 +136,14 @@ public class UserInfoService { return resp; } //删除用户 - public HashMap deleteUserInfo(Integer userId){ + public HashMap deleteUserInfo(List userIdList){ HashMap resp = new HashMap(); try { - userInfoMapper.deleteUser(userId); + int size = userIdList.size(); + for (int i=0;i deleteStaff(UserInfo user){ - HashMap resp = new HashMap(); - 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; - } - - //批量删除学生 - public HashMap deleteStudent(UserInfo user){ + //删除用户组织架构 + public HashMap deleteOrganizationRelationship(List userIdList){ HashMap resp = new HashMap(); try { - userInfoMapper.deleteStudent(user); + int size = userIdList.size(); + for (int i=0;i resp = new HashMap(); try { Integer size = userProfilesList.size(); + Integer userId = userProfilesList.get(0).getUserId(); + userInfoMapper.deleteUserProfiles(userId); for (int i=0; i resp = new HashMap(); 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 loginSchool(UserInfo userInfo){ + HashMap resp = new HashMap(); + HashMap obj = new HashMap(); + try { + UserInfo user=userInfoMapper.loginsAP(userInfo); +// obj.put("user",user); + Integer userId = user.getUserId(); + if(userId!=null) { + List 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 logins(UserInfo userInfo){ HashMap resp = new HashMap(); - HashMap obj = new HashMap(); - Student student; - Staff staff; + HashMap obj = new HashMap(); + 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 = userInfoMapper.queryOrganizationRelationship(userId); + if(userId!=null) { + List 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 loginRole(OrganizationRelationship OR){ + HashMap resp = new HashMap(); + HashMap obj = new HashMap(); + try { + if(OR!=null) { + Integer userId = OR.getUserId(); + Integer schoolId = OR.getSchoolId(); + List 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 queryUserInfoDetails(Integer userId){ HashMap resp = new HashMap(); @@ -306,10 +355,16 @@ public class UserInfoService { if (userInfo!=null){ List userProfiles = userInfoMapper.queryUserProfiles(userId); obj.put("userProfilesList",userProfiles); - List organizationRelationshipsList = userInfoMapper.queryOrganizationRelationship(userId); - obj.put("organizationRelationshipsList",organizationRelationshipsList); + List platformList = userInfoMapper.queryUserPlatform(userId); + obj.put("platformList",platformList); + List 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()); @@ -320,6 +375,21 @@ public class UserInfoService { return resp; } + //查询用户组织架构详情 + public HashMap queryUserOR(Integer userId,Integer platformId){ + HashMap resp = new HashMap(); + try { + resp.put("retvalue", userInfoMapper.queryUserOR(userId,platformId)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "查询用户详情失败!"); + return resp; + } + return resp; + } + //查询用户档案 public HashMap queryUserProfiles(Integer userId){ HashMap resp = new HashMap(); @@ -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 addStuStaff(List stuStaffList,Integer userId) { + public HashMap addStuStaff(List ORList,Integer userId) { HashMap resp = new HashMap(); try { - int size = stuStaffList.size(); + int size = ORList.size(); for (int i=0;i queryPlatform(String platformId){ + HashMap resp = new HashMap(); + try { + resp.put("retvalue", userInfoMapper.queryPlatform(platformId)); + 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 deletePlatform(Integer platformId,Integer userId){ + HashMap resp = new HashMap(); + try { + userInfoMapper.deletePlatform(platformId,userId); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; } return resp; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a555ae5..9414e43 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 diff --git a/src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java b/src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java index 34cf31c..0ebbfc6 100644 --- a/src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java +++ b/src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java @@ -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 queryStaff = staffService.queryStaff(staff, pageNo, pageSize); + userInfo.setSchoolId(2043); + HashMap queryStaff = staffService.queryStaff(userInfo, pageNo, pageSize); for (String s : queryStaff.keySet()) { System.out.println("key:" + s + "," + "value:" + queryStaff.get(s)); }