|
|
@ -190,40 +190,36 @@ public class CompanyController { |
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); |
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); |
|
|
Integer success = 0; |
|
|
Integer success = 0; |
|
|
if (map.containsKey("depositoryId")) { |
|
|
if (map.containsKey("depositoryId")) { |
|
|
for (int i = 0; i < userByPortList.size(); i++) { |
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("userId", userByPortList.get(i).getId()); |
|
|
param.put("userId", userByPort.getId()); |
|
|
param.put("depositoryId", map.get("depositoryId")); |
|
|
param.put("depositoryId", map.get("depositoryId")); |
|
|
param.put("classes", 2); |
|
|
param.put("classes", map.get("classes")); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
if (roleAndDepositoryByCondition.size() > 0) { |
|
|
if (roleAndDepositoryByCondition.size() <= 0) { |
|
|
continue; |
|
|
|
|
|
} else { |
|
|
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
insert.put("classes", 2); |
|
|
insert.put("classes", map.get("classes")); |
|
|
insert.put("authority", 0); |
|
|
insert.put("authority", 0); |
|
|
insert.put("depositoryId", map.get("depositoryId")); |
|
|
insert.put("depositoryId", map.get("depositoryId")); |
|
|
insert.put("userid", userByPortList.get(i).getId()); |
|
|
insert.put("userid", userByPort.getId()); |
|
|
success += roleService.addUserOrPostRoleAndDepository(insert); |
|
|
success += roleService.addUserOrPostRoleAndDepository(insert); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
List<Depository> depositoryAll = depositoryService.findDepositoryAll(); |
|
|
List<Depository> depositoryAll = depositoryService.findDepositoryAll(); |
|
|
for (int i = 0; i < depositoryAll.size(); i++) { |
|
|
for (Depository depository : depositoryAll) { |
|
|
for (int j = 0; j < userByPortList.size(); j++) { |
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("userId", userByPortList.get(j).getId()); |
|
|
param.put("userId", userByPort.getId()); |
|
|
param.put("depositoryId", depositoryAll.get(i).getId()); |
|
|
param.put("depositoryId", depository.getId()); |
|
|
param.put("classes", 2); |
|
|
param.put("classes", map.get("classes")); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
if (roleAndDepositoryByCondition.size() > 0) { |
|
|
if (roleAndDepositoryByCondition.size() <= 0) { |
|
|
continue; |
|
|
|
|
|
} else { |
|
|
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
insert.put("classes", 2); |
|
|
insert.put("classes", map.get("classes")); |
|
|
insert.put("authority", 0); |
|
|
insert.put("authority", 0); |
|
|
insert.put("depositoryId", depositoryAll.get(i).getId()); |
|
|
insert.put("depositoryId", depository.getId()); |
|
|
insert.put("userid", userByPortList.get(j).getId()); |
|
|
insert.put("userid", userByPort.getId()); |
|
|
success += roleService.addUserOrPostRoleAndDepository(insert); |
|
|
success += roleService.addUserOrPostRoleAndDepository(insert); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -272,11 +268,11 @@ public class CompanyController { |
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("classes", 2); |
|
|
param.put("classes", map.get("classes")); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
Integer success = 0; |
|
|
Integer success = 0; |
|
|
for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) { |
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
success += roleService.deleteRoleAndDepositoryById(roleAndDepositoryByCondition.get(i).getId()); |
|
|
success += roleService.deleteRoleAndDepositoryById(roleAndDepository.getId()); |
|
|
} |
|
|
} |
|
|
return CrudUtil.postHandle(success, roleAndDepositoryByCondition.size()); |
|
|
return CrudUtil.postHandle(success, roleAndDepositoryByCondition.size()); |
|
|
} else if (map.containsKey("depositoryIds")) { |
|
|
} else if (map.containsKey("depositoryIds")) { |
|
|
@ -284,15 +280,14 @@ public class CompanyController { |
|
|
List<Integer> depositoryIds = (List<Integer>) map.get("depositoryIds"); |
|
|
List<Integer> depositoryIds = (List<Integer>) map.get("depositoryIds"); |
|
|
Integer success = 0; |
|
|
Integer success = 0; |
|
|
Integer total = 0; |
|
|
Integer total = 0; |
|
|
for (int i = 0; i < depositoryIds.size(); i++) { |
|
|
for (Integer depositoryId : depositoryIds) { |
|
|
Integer depositoryId = depositoryIds.get(i); |
|
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("classes", 2); |
|
|
param.put("classes", map.get("classes")); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
total += roleAndDepositoryByCondition.size(); |
|
|
total += roleAndDepositoryByCondition.size(); |
|
|
for (int j = 0; j < roleAndDepositoryByCondition.size(); j++) { |
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
success += roleService.deleteRoleAndDepositoryById(roleAndDepositoryByCondition.get(j).getId()); |
|
|
success += roleService.deleteRoleAndDepositoryById(roleAndDepository.getId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return CrudUtil.postHandle(success, total); |
|
|
return CrudUtil.postHandle(success, total); |
|
|
@ -304,28 +299,29 @@ public class CompanyController { |
|
|
/** |
|
|
/** |
|
|
* 查询岗位对应的权限 |
|
|
* 查询岗位对应的权限 |
|
|
* |
|
|
* |
|
|
* @param postId 要查询的岗位id |
|
|
* @param map 要查询的调剂 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("/findPostRole") |
|
|
@GetMapping("/findPostRole") |
|
|
public RestResponse findPostRole(@RequestParam("postId") Integer postId, HttpServletRequest request) { |
|
|
public RestResponse findPostRole(@RequestParam Map<String,Object> map, HttpServletRequest request) { |
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
Map<String, Object> userParam = new HashMap<>(); |
|
|
Map<String, Object> userParam = new HashMap<>(); |
|
|
|
|
|
Integer postId = ObjectFormatUtil.toInteger(map.get("postId")); |
|
|
userParam.put("position", postId); |
|
|
userParam.put("position", postId); |
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); |
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); |
|
|
Post postById = LinkInterfaceUtil.findPostById(postId, userToken); |
|
|
Post postById = LinkInterfaceUtil.findPostById(postId, userToken); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = new ArrayList<>(); |
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = new ArrayList<>(); |
|
|
if (userByPortList.size() != 0) { |
|
|
if (userByPortList.size() != 0) { |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("classes", 2); |
|
|
param.put("classes", map.get("classes")); |
|
|
param.put("userId", userByPortList.get(0).getId()); |
|
|
param.put("userId", userByPortList.get(0).getId()); |
|
|
roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); |
|
|
} |
|
|
} |
|
|
List<PostP> postPS = new ArrayList<>(); |
|
|
List<PostP> postPS = new ArrayList<>(); |
|
|
for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) { |
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
PostP pp = new PostP(postById); |
|
|
PostP pp = new PostP(postById); |
|
|
pp.setDepositoryName(roleAndDepositoryByCondition.get(i).getDepositoryName()); |
|
|
pp.setDepositoryName(roleAndDepository.getDepositoryName()); |
|
|
pp.setDepositoryId(roleAndDepositoryByCondition.get(i).getDepositoryId()); |
|
|
pp.setDepositoryId(roleAndDepository.getDepositoryId()); |
|
|
postPS.add(pp); |
|
|
postPS.add(pp); |
|
|
} |
|
|
} |
|
|
return new RestResponse(postPS, postPS.size(), 200); |
|
|
return new RestResponse(postPS, postPS.size(), 200); |
|
|
|