Przeglądaj źródła

研究生流程人员分配修改

wangliang 10 miesięcy temu
rodzic
commit
6403ad5894

+ 4 - 1
sop-business/src/main/java/com/qmth/sop/business/service/TBSopInfoService.java

@@ -208,9 +208,12 @@ public interface TBSopInfoService extends IService<TBSopInfo> {
      * @param flowId
      * @param crmDetailId
      * @param engineerUserIdList
+     * @param regionCoordinatorUserId
+     * @param projectManagerUserId
      * @return
      */
-    Boolean updateFlowSetupOne(Long flowId, Long crmDetailId, List<String> engineerUserIdList);
+    Boolean updateFlowSetupOne(Long flowId, Long crmDetailId, List<String> engineerUserIdList,
+            String regionCoordinatorUserId, String projectManagerUserId);
 
     /**
      * 更新流程信息

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

@@ -539,11 +539,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
      * @param flowId
      * @param crmDetailId
      * @param engineerUserIdList
+     * @param regionCoordinatorUserId
+     * @param projectManagerUserId
      * @return
      */
     @Override
     @Transactional
-    public Boolean updateFlowSetupOne(Long flowId, Long crmDetailId, List<String> engineerUserIdList) {
+    public Boolean updateFlowSetupOne(Long flowId, Long crmDetailId, List<String> engineerUserIdList,
+            String regionCoordinatorUserId, String projectManagerUserId) {
         boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_PROPERTIES_PREFIX + crmDetailId, crmDetailId,
                 SystemConstant.LOCK_FLOW_TIME_OUT);
         if (!lock) {
@@ -562,7 +565,14 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, engineerUserIdList);
                             f.setValue(jsonObject.toJSONString());
-                            break;
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.PROJECT_MANAGER_ID.getKey())) {
+                            JSONObject jsonObject = new JSONObject();
+                            jsonObject.put(SystemConstant.VALUE, projectManagerUserId);
+                            f.setValue(jsonObject.toJSONString());
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.REGION_COORDINATOR_ID.getKey())) {
+                            JSONObject jsonObject = new JSONObject();
+                            jsonObject.put(SystemConstant.VALUE, regionCoordinatorUserId);
+                            f.setValue(jsonObject.toJSONString());
                         }
                     }
                 } else {
@@ -578,7 +588,19 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, list);
                             f.setValue(jsonObject.toJSONString());
-                            break;
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.PROJECT_MANAGER_ID.getKey())) {
+                            JSONObject jsonObject = new JSONObject();
+                            jsonObject.put(SystemConstant.VALUE,
+                                    crmProjectResult.getProjectManagerList().get(0).getUserId().toString());
+                            f.setValue(jsonObject.toJSONString());
+                        }
+                        if (f.getFormId().contains(ProcessLimitedEnum.REGION_COORDINATOR_ID.getKey())) {
+                            JSONObject jsonObject = new JSONObject();
+                            jsonObject.put(SystemConstant.VALUE,
+                                    !CollectionUtils.isEmpty(crmProjectResult.getRegionCoordinatorList()) ?
+                                            crmProjectResult.getRegionCoordinatorList().get(0).getUserId().toString() :
+                                            null);
+                            f.setValue(jsonObject.toJSONString());
                         }
                     }
                 }
@@ -621,8 +643,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             throw ExceptionResultEnum.FLOW_TASK_NO_DATA.exception();
         }
         if (!CollectionUtils.isEmpty(allocationParamList)) {
+            List<String> engineerUserIdList = new ArrayList<>();
+            String regionCoordinatorUserId = null, projectManagerUserId = null;
             for (AllocationParam a : allocationParamList) {
                 if (a.getSopRoleType() == SopRoleTypeEnum.PROJECT_MANAGER) {
+                    //修改流程里面的工程师
+                    projectManagerUserId = a.getUserIdList().get(0).toString();
                     if (taskList.size() == 1) {
                         activitiService.taskApproverExchange(a.getUserIdList().get(0),
                                 Long.parseLong(taskList.get(0).getId()));
@@ -639,13 +665,17 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                                 Long.parseLong(taskTempList.get(0).getId()));
                     }
                 } else if (a.getSopRoleType() == SopRoleTypeEnum.ENGINEER) {
-                    //修改流程one里面的工程师
-                    List<String> engineerUserIdList = a.getUserIdList().stream().map(s -> s.toString())
-                            .collect(Collectors.toList());
-                    tbSopInfoService.updateFlowSetupOne(tfCustomFlowEntity.getFlowId(), tbCrmDetail.getId(),
-                            engineerUserIdList);
+                    //修改流程里面的工程师
+                    engineerUserIdList = a.getUserIdList().stream().map(s -> s.toString()).collect(Collectors.toList());
+                } else if (a.getSopRoleType() == SopRoleTypeEnum.REGION_COORDINATOR) {
+                    //修改流程里面的区域协调人
+                    if (!CollectionUtils.isEmpty(a.getUserIdList())) {
+                        regionCoordinatorUserId = a.getUserIdList().get(0).toString();
+                    }
                 }
             }
+            tbSopInfoService.updateFlowSetupOne(tfCustomFlowEntity.getFlowId(), tbCrmDetail.getId(), engineerUserIdList,
+                    regionCoordinatorUserId, projectManagerUserId);
         }
         return true;
     }