feat(REQ-3714): 处理项目内工人退场
This commit is contained in:
parent
25e1513168
commit
a3bce5367e
@ -188,6 +188,8 @@ public class NodeUserFoundationServiceImpl implements NodeUserFoundationService
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
Map<Long, Set<Long>> ouPersonIdsMap = list.stream().collect(Collectors.groupingBy(NodeUserQueryRepository.NodeUserResp::getOrganizationalUnitId,
|
||||
Collectors.mapping(OrganizationalNodeUser::getPersonId, Collectors.toSet())));
|
||||
//批量删除node_user
|
||||
nodeUserUpsertRepository.batchDelete(list.stream().map(NodeUserQueryRepository.NodeUserResp::getId).collect(Collectors.toSet()));
|
||||
List<OrganizationalNodeUser> nodeUserList = list.stream().map(e -> BeanUtil.toBean(e, OrganizationalNodeUser.class)).collect(Collectors.toList());
|
||||
@ -199,12 +201,18 @@ public class NodeUserFoundationServiceImpl implements NodeUserFoundationService
|
||||
OrgUserWithdrawOrQuitReq quitReq = new OrgUserWithdrawOrQuitReq();
|
||||
quitReq.setUnitUpdate(req.isUnitDelete());
|
||||
quitReq.setWorkspaceId(req.getWorkspaceId());
|
||||
quitReq.setTopNodeIdAndPersonIds(quitMap);
|
||||
if (req.isUnitDelete()) {
|
||||
quitReq.setOuId(req.getOuId());
|
||||
quitReq.setWorkspaceId(nodeUserList.get(0).getWorkspaceId());
|
||||
}
|
||||
quitReq.setTopNodeIdAndPersonIds(quitMap);
|
||||
orgUserFoundationService.batchWithdrawOrQuit(quitReq);
|
||||
} else {
|
||||
for (Map.Entry<Long, Set<Long>> unitPersonIds : ouPersonIdsMap.entrySet()) {
|
||||
quitReq.setOuId(unitPersonIds.getKey());
|
||||
quitReq.setPersonIds(unitPersonIds.getValue());
|
||||
orgUserFoundationService.batchWithdrawOrQuit(quitReq);
|
||||
}
|
||||
}
|
||||
|
||||
//项目内工人退场
|
||||
OrgProjectWorkerWithdrawReq workerReq = new OrgProjectWorkerWithdrawReq();
|
||||
|
||||
@ -60,6 +60,9 @@ public class OrgUserFoundationServiceImpl implements OrgUserFoundationService {
|
||||
listOrgUserReq.setWorkspaceId(req.getWorkspaceId());
|
||||
Set<Long> personIds = req.getTopNodeIdAndPersonIds().values().stream().flatMap(Set::stream).collect(Collectors.toSet());
|
||||
listOrgUserReq.setPersonIds(personIds);
|
||||
if (CollUtil.isNotEmpty(req.getPersonIds())) {
|
||||
listOrgUserReq.setPersonIds(req.getPersonIds());
|
||||
}
|
||||
List<OrgUserQueryRepository.OrgUserResp> list = orgUserQueryRepository.list(listOrgUserReq);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
|
||||
@ -18,6 +18,8 @@ public class OrgUserWithdrawOrQuitReq {
|
||||
|
||||
private Map<Long, Set<Long>> topNodeIdAndPersonIds;
|
||||
|
||||
private Set<Long> personIds;
|
||||
|
||||
/**
|
||||
* 是否单位更新
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user