|
@@ -146,16 +146,16 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
SopRoleTypeEnum sopRoleType = allocationParam.getSopRoleType();
|
|
|
String remark = allocationParam.getRemark();
|
|
|
// 本次要分配的人员档案id集合
|
|
|
- List<Long> archivesIdList = allocationParam.getArchivesIdList();
|
|
|
+ List<Long> userIdList = allocationParam.getUserIdList();
|
|
|
|
|
|
List<TBUserArchivesAllocation> allocatedList = allocatedDatasource.stream()
|
|
|
.filter(e -> e.getSopRoleType().equals(sopRoleType)).collect(Collectors.toList());
|
|
|
// 之前已分配的人员档案id集合
|
|
|
- List<Long> allocatedIdList = allocatedList.stream().map(TBUserArchivesAllocation::getArchivesId).distinct()
|
|
|
+ List<Long> allocatedIdList = allocatedList.stream().map(TBUserArchivesAllocation::getUserId).distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// 经过对比要删除的人员档案id集合
|
|
|
- List<Long> removeList = allocatedIdList.stream().filter(e -> !archivesIdList.contains(e)).distinct()
|
|
|
+ List<Long> removeList = allocatedIdList.stream().filter(e -> !userIdList.contains(e)).distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
// 如果是发布状态
|
|
|
if (CrmStatusEnum.PUBLISH.equals(crmStatus)) {
|
|
@@ -173,12 +173,12 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
// 对删除的档案人员添加历史记录
|
|
|
List<TBUserArchivesAllocationLog> historicList = removeList.stream().flatMap(e -> {
|
|
|
UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(
|
|
|
- e, null);
|
|
|
+ null, e);
|
|
|
TBUserArchivesAllocationLog historic = new TBUserArchivesAllocationLog();
|
|
|
historic.setCrmDetailId(crmDetailId);
|
|
|
historic.setSopRoleType(sopRoleType);
|
|
|
- historic.setUserId(userArchivesResult.getUserId());
|
|
|
- historic.setArchivesId(e);
|
|
|
+ historic.setUserId(e);
|
|
|
+ historic.setArchivesId(userArchivesResult.getUserArchivesId());
|
|
|
historic.setArchivesName(userArchivesResult.getName());
|
|
|
historic.setSupplierName(userArchivesResult.getSupplierName());
|
|
|
historic.setCity(userArchivesResult.getCity());
|
|
@@ -189,23 +189,22 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
}
|
|
|
if (CollectionUtils.isNotEmpty(removeList)){
|
|
|
this.remove(new QueryWrapper<TBUserArchivesAllocation>().lambda()
|
|
|
- .in(TBUserArchivesAllocation::getArchivesId, removeList)
|
|
|
+ .in(TBUserArchivesAllocation::getUserId, removeList)
|
|
|
.eq(TBUserArchivesAllocation::getCrmDetailId, crmDetailId));
|
|
|
}
|
|
|
|
|
|
|
|
|
// 经过对比要新增的人员档案id集合
|
|
|
- List<Long> addList = archivesIdList.stream().filter(e -> !allocatedIdList.contains(e)).distinct()
|
|
|
+ List<Long> addList = userIdList.stream().filter(e -> !allocatedIdList.contains(e)).distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
List<TBUserArchivesAllocation> addListData = addList.stream().flatMap(e -> {
|
|
|
TBUserArchivesAllocation allocation = new TBUserArchivesAllocation();
|
|
|
allocation.setCrmDetailId(crmDetailId);
|
|
|
- allocation.setArchivesId(e);
|
|
|
allocation.setServiceId(tbCrm.getServiceId());
|
|
|
allocation.setCrmNo(crmNo);
|
|
|
allocation.setSopRoleType(sopRoleType);
|
|
|
- allocation.setUserId(sysUserService.findByArchivesId(e).getId());
|
|
|
- allocation.setArchivesId(e);
|
|
|
+ allocation.setUserId(e);
|
|
|
+ allocation.setArchivesId(tbUserArchivesService.findByUserId(e).getId());
|
|
|
if (remark != null && remark.length() > 0) {
|
|
|
allocation.setRemark(remark);
|
|
|
}
|