|
@@ -135,6 +135,7 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
if (Objects.isNull(crmDetail)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到派单详情");
|
|
|
}
|
|
|
+ CrmStatusEnum crmStatus = crmDetail.getStatus();
|
|
|
|
|
|
String crmNo = crmDetail.getCrmNo();
|
|
|
TBCrm tbCrm = tbCrmService.findByCrmNo(crmNo);
|
|
@@ -156,22 +157,24 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
|
|
|
// 经过对比要删除的人员档案id集合
|
|
|
List<Long> removeList = allocatedIdList.stream().filter(e -> !archivesIdList.contains(e)).distinct().collect(Collectors.toList());
|
|
|
- // 对删除的档案人员添加历史记录
|
|
|
- List<TBUserArchivesAllocationLog> historicList = removeList.stream().flatMap(e -> {
|
|
|
- UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(e,
|
|
|
- null);
|
|
|
- TBUserArchivesAllocationLog historic = new TBUserArchivesAllocationLog();
|
|
|
- historic.setCrmDetailId(crmDetailId);
|
|
|
- historic.setSopRoleType(sopRoleType);
|
|
|
- historic.setUserId(userArchivesResult.getUserId());
|
|
|
- historic.setArchivesId(e);
|
|
|
- historic.setArchivesName(userArchivesResult.getName());
|
|
|
- historic.setSupplierName(userArchivesResult.getSupplierName());
|
|
|
- historic.setCity(userArchivesResult.getCity());
|
|
|
- historic.insertInfo(requestUser.getId());
|
|
|
- return Stream.of(historic);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- tbUserArchivesAllocationLogService.saveBatch(historicList);
|
|
|
+ // 对删除的档案人员添加历史记录 (*发布的才记录历史)
|
|
|
+ if (CrmStatusEnum.PUBLISH.equals(crmStatus)) {
|
|
|
+ List<TBUserArchivesAllocationLog> historicList = removeList.stream().flatMap(e -> {
|
|
|
+ UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(e,
|
|
|
+ null);
|
|
|
+ TBUserArchivesAllocationLog historic = new TBUserArchivesAllocationLog();
|
|
|
+ historic.setCrmDetailId(crmDetailId);
|
|
|
+ historic.setSopRoleType(sopRoleType);
|
|
|
+ historic.setUserId(userArchivesResult.getUserId());
|
|
|
+ historic.setArchivesId(e);
|
|
|
+ historic.setArchivesName(userArchivesResult.getName());
|
|
|
+ historic.setSupplierName(userArchivesResult.getSupplierName());
|
|
|
+ historic.setCity(userArchivesResult.getCity());
|
|
|
+ historic.insertInfo(requestUser.getId());
|
|
|
+ return Stream.of(historic);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ tbUserArchivesAllocationLogService.saveBatch(historicList);
|
|
|
+ }
|
|
|
this.remove(new QueryWrapper<TBUserArchivesAllocation>().lambda()
|
|
|
.eq(TBUserArchivesAllocation::getArchivesId, removeList)
|
|
|
.eq(TBUserArchivesAllocation::getCrmDetailId, crmDetailId));
|
|
@@ -197,7 +200,20 @@ public class TBUserArchivesAllocationServiceImpl
|
|
|
}).collect(Collectors.toList());
|
|
|
this.saveBatch(addListData);
|
|
|
|
|
|
- tbSopInfoService.sopApproverExchange(crmDetailId);
|
|
|
+ if (CrmStatusEnum.PUBLISH.equals(crmStatus)) {
|
|
|
+ String sopNo = crmDetail.getSopNo();
|
|
|
+ if (sopNo == null || sopNo.length() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到sopNo");
|
|
|
+ }
|
|
|
+ TBSopInfo tbSopInfo = tbSopInfoService.getOne(
|
|
|
+ new QueryWrapper<TBSopInfo>().lambda().eq(TBSopInfo::getSopNo, sopNo).last(SystemConstant.LIMIT1));
|
|
|
+ if (Objects.isNull(tbSopInfo)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到sop信息");
|
|
|
+ }
|
|
|
+ if (SopStatusEnum.DRAFT.equals(tbSopInfo.getStatus())) {
|
|
|
+ tbSopInfoService.sopApproverExchange(crmDetailId);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|