feat(REQ-3714): 提交删除人员前置请求

This commit is contained in:
zhanghonghao 2025-03-11 13:38:22 +08:00
parent 15997039a8
commit de4f798cc0

View File

@ -210,18 +210,22 @@ public class NodeUserCheckServiceImpl implements NodeUserCheckService {
// 查询当前登录及待删除人员在当前项目中的参与记录仅限当前登录单位
List<NodeUserDTO> nodeUsers = nodeUserService.list(query);
// 校验当前入参
checkPermission(nodeUsers, personId);
checkPermission(nodeUsers, personId, failInfoMap);
// 过滤当前操作人员
nodeUsers = nodeUsers.stream()
.filter(e -> !req.getPersonIds().contains(personId))
.filter(e -> !Objects.equals(e.getPersonId(), personId))
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(nodeUsers)) {
if (CollUtil.isEmpty(nodeUsers)) {
req.getPersonIds().forEach(e -> {
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
checkFailInfo.setType(CheckInfoTypeEnum.NOT_IN_JURISDICTION);
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 -> {
BatchDeleteNodeUserCheckResp.CheckFailInfo checkFailInfo = new BatchDeleteNodeUserCheckResp.CheckFailInfo();
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)
|| nodeUsers.stream().noneMatch(e -> Objects.equals(e.getPersonId(), personId))) {
throw ResultCode.INVALID_PARAMS.toException("你已被移除当前项目");
throw ResultCode.INVALID_PARAMS.toException("你已被移除当前项目,请刷新后重试当前操作!");
}
}