feat(REQ-3714): 提交删除人员前置请求
This commit is contained in:
parent
15997039a8
commit
de4f798cc0
@ -210,18 +210,22 @@ public class NodeUserCheckServiceImpl implements NodeUserCheckService {
|
|||||||
// 查询当前登录及待删除人员在当前项目中的参与记录(仅限当前登录单位)
|
// 查询当前登录及待删除人员在当前项目中的参与记录(仅限当前登录单位)
|
||||||
List<NodeUserDTO> nodeUsers = nodeUserService.list(query);
|
List<NodeUserDTO> nodeUsers = nodeUserService.list(query);
|
||||||
// 校验当前入参
|
// 校验当前入参
|
||||||
checkPermission(nodeUsers, personId);
|
checkPermission(nodeUsers, personId, failInfoMap);
|
||||||
// 过滤当前操作人员
|
// 过滤当前操作人员
|
||||||
nodeUsers = nodeUsers.stream()
|
nodeUsers = nodeUsers.stream()
|
||||||
.filter(e -> !req.getPersonIds().contains(personId))
|
.filter(e -> !Objects.equals(e.getPersonId(), personId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (CollectionUtil.isEmpty(nodeUsers)) {
|
if (CollUtil.isEmpty(nodeUsers)) {
|
||||||
req.getPersonIds().forEach(e -> {
|
req.getPersonIds().forEach(e -> {
|
||||||
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
|
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
|
||||||
checkFailInfo.setType(CheckInfoTypeEnum.NOT_IN_JURISDICTION);
|
checkFailInfo.setType(CheckInfoTypeEnum.NOT_IN_JURISDICTION);
|
||||||
addFailInfo(failInfoMap, e, checkFailInfo);
|
addFailInfo(failInfoMap, e, checkFailInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isEmpty(nodeUsers)) {
|
||||||
|
transformFailMap(failInfoMap, resultList);
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
nodeUsers.stream().filter(e -> e.getIdentityType().equals(IdentityType.WORKER_LEADER.getCode())).findAny().ifPresent(e -> {
|
nodeUsers.stream().filter(e -> e.getIdentityType().equals(IdentityType.WORKER_LEADER.getCode())).findAny().ifPresent(e -> {
|
||||||
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
|
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
|
||||||
checkFailInfo.setType(CheckInfoTypeEnum.TEAM_LEADER);
|
checkFailInfo.setType(CheckInfoTypeEnum.TEAM_LEADER);
|
||||||
@ -328,10 +332,10 @@ public class NodeUserCheckServiceImpl implements NodeUserCheckService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPermission(List<NodeUserDTO> nodeUsers, Long personId) {
|
private void checkPermission(List<NodeUserDTO> nodeUsers, Long personId, Map<Long, List<BatchDeleteNodeUserCheckResp.CheckFailInfo>> failInfoMap) {
|
||||||
if (CollUtil.isEmpty(nodeUsers)
|
if (CollUtil.isEmpty(nodeUsers)
|
||||||
|| nodeUsers.stream().noneMatch(e -> Objects.equals(e.getPersonId(), personId))) {
|
|| nodeUsers.stream().noneMatch(e -> Objects.equals(e.getPersonId(), personId))) {
|
||||||
throw ResultCode.INVALID_PARAMS.toException("你已被移除当前项目");
|
throw ResultCode.INVALID_PARAMS.toException("你已被移除当前项目,请刷新后重试当前操作!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user