ソースを参照

add: 人员配置保存统一使用userId

caozixuan 1 年間 前
コミット
5ad22cdce9

+ 9 - 9
sop-business/src/main/java/com/qmth/sop/business/bean/params/AllocationParam.java

@@ -25,7 +25,7 @@ public class AllocationParam {
 
     @ApiModelProperty("档案id集合")
     @NotEmpty(message = "请提供调配的档案id")
-    private List<Long> archivesIdList;
+    private List<Long> userIdList;
 
     @ApiModelProperty("备注(为同批次新增全部人员赋值备注信息)")
     private String remark;
@@ -34,15 +34,15 @@ public class AllocationParam {
 
     }
 
-    public AllocationParam(SopRoleTypeEnum sopRoleType, List<Long> archivesIdList, String remark) {
+    public AllocationParam(SopRoleTypeEnum sopRoleType, List<Long> userIdList, String remark) {
         this.sopRoleType = sopRoleType;
-        this.archivesIdList = archivesIdList;
+        this.userIdList = userIdList;
         this.remark = remark;
     }
 
-    public AllocationParam(SopRoleTypeEnum sopRoleType, List<Long> archivesIdList) {
+    public AllocationParam(SopRoleTypeEnum sopRoleType, List<Long> userIdList) {
         this.sopRoleType = sopRoleType;
-        this.archivesIdList = archivesIdList;
+        this.userIdList = userIdList;
     }
 
     public SopRoleTypeEnum getSopRoleType() {
@@ -53,12 +53,12 @@ public class AllocationParam {
         this.sopRoleType = sopRoleType;
     }
 
-    public List<Long> getArchivesIdList() {
-        return archivesIdList;
+    public List<Long> getUserIdList() {
+        return userIdList;
     }
 
-    public void setArchivesIdList(List<Long> archivesIdList) {
-        this.archivesIdList = archivesIdList;
+    public void setUserIdList(List<Long> userIdList) {
+        this.userIdList = userIdList;
     }
 
     public String getRemark() {

+ 4 - 4
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -446,11 +446,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             if (!CollectionUtils.isEmpty(allocationParamList)) {
                 for (AllocationParam a : allocationParamList) {
                     if (a.getSopRoleType() == SopRoleTypeEnum.PROJECT_MANAGER) {
-                        activitiService.taskApproverExchange(a.getArchivesIdList().get(0),
+                        activitiService.taskApproverExchange(a.getUserIdList().get(0),
                                 Long.parseLong(task.getId()));
                     } else if (a.getSopRoleType() == SopRoleTypeEnum.ENGINEER) {
                         //修改流程one里面的工程师
-                        List<String> engineerUserIdList = a.getArchivesIdList().stream().map(s -> s.toString())
+                        List<String> engineerUserIdList = a.getUserIdList().stream().map(s -> s.toString())
                                 .collect(Collectors.toList());
                         tbSopInfoService.updateFlowSetupOne(tfCustomFlowEntity.getFlowId(), tbCrmDetail.getId(),
                                 engineerUserIdList);
@@ -501,10 +501,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         if (!CollectionUtils.isEmpty(allocationParamList)) {
             for (AllocationParam a : allocationParamList) {
                 if (a.getSopRoleType() == SopRoleTypeEnum.PROJECT_MANAGER) {
-                    activitiService.taskApproverExchange(a.getArchivesIdList().get(0), Long.parseLong(task.getId()));
+                    activitiService.taskApproverExchange(a.getUserIdList().get(0), Long.parseLong(task.getId()));
                 } else if (a.getSopRoleType() == SopRoleTypeEnum.ENGINEER) {
                     //修改流程one里面的工程师
-                    List<String> engineerUserIdList = a.getArchivesIdList().stream().map(s -> s.toString())
+                    List<String> engineerUserIdList = a.getUserIdList().stream().map(s -> s.toString())
                             .collect(Collectors.toList());
                     tbSopInfoService.updateFlowSetupOne(tfCustomFlowEntity.getFlowId(), tbCrmDetail.getId(),
                             engineerUserIdList);

+ 10 - 11
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationServiceImpl.java

@@ -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);
                 }