wangliang 1 жил өмнө
parent
commit
bae7c15d97

+ 8 - 8
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -700,20 +700,20 @@ public class ActivitiServiceImpl implements ActivitiService {
             TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
             Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
 
-            FlowTaskResult flowTaskResultOne = tbSopInfoService.getFormProperties(tfCustomFlowEntity, 1);
-            ServiceScopeEnum scopeEnum = tbSopInfoService.findServiceScope(tfCustomFlow.getType(), flowTaskResultOne);
+//            FlowTaskResult flowTaskResultOne = tbSopInfoService.getFormProperties(tfCustomFlowEntity, 1);
+//            ServiceScopeEnum scopeEnum = tbSopInfoService.findServiceScope(tfCustomFlow.getType(), flowTaskResultOne);
 
             FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
             LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
             FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
                     GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())), FlowTaskResult.class);
 
-            if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop流程待审核人
-                if (Objects.nonNull(scopeEnum) && scopeEnum == ServiceScopeEnum.SCAN
-                        && currFlowTaskResult.getSetup().intValue() > 3) {
-                    return true;
-                }
-            }
+//            if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop流程待审核人
+//                if (Objects.nonNull(scopeEnum) && scopeEnum == ServiceScopeEnum.SCAN
+//                        && currFlowTaskResult.getSetup().intValue() > 3) {
+//                    return true;
+//                }
+//            }
 
             BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
             FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(task.getTaskDefinitionKey());

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

@@ -1205,7 +1205,40 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
 
         TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
         Objects.requireNonNull(tbCrmDetail, "未找到派单sop信息");
+
+        List<Long> enginessUserIds = new ArrayList<>();
         FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
+        List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
+        for (FlowFormWidgetResult f : flowFormWidgetResultList) {
+            if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey()) && Objects.nonNull(f.getValue())
+                    && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                tbCrmDetail.setScanStartTime(Long.parseLong(value));
+            } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
+                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                tbCrmDetail.setScanEndTime(Long.parseLong(value));
+            } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey()) && Objects.nonNull(
+                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                tbCrmDetail.setMarkPaperStartTime(Long.parseLong(value));
+            } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey()) && Objects.nonNull(
+                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                tbCrmDetail.setMarkPaperEndTime(Long.parseLong(value));
+            } else if (f.getFormId().contains(ProcessLimitedEnum.ENGINEER_USERS_ID.getKey()) && Objects.nonNull(
+                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    enginessUserIds.add(Long.parseLong(jsonArray.getString(i)));
+                }
+            }
+        }
         if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END) {
             Map<String, Object> map = new HashMap<>();
             CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectInfo(tfCustomFlowEntity.getCode(),
@@ -1236,32 +1269,28 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                 tbSopLogService.save(tbSopLog);
             }
 
-            tbDingService.resetDingExceptionBySopNo(tbSopInfo.getSopNo());
-        }
-        List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
-        for (FlowFormWidgetResult f : flowFormWidgetResultList) {
-            if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey()) && Objects.nonNull(f.getValue())
-                    && !Objects.equals(f.getValue(), "{\"value\":null}")) {
-                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                String value = jsonObject.getString(SystemConstant.VALUE);
-                tbCrmDetail.setScanStartTime(Long.parseLong(value));
-            } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
-                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
-                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                String value = jsonObject.getString(SystemConstant.VALUE);
-                tbCrmDetail.setScanEndTime(Long.parseLong(value));
-            } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey()) && Objects.nonNull(
-                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
-                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                String value = jsonObject.getString(SystemConstant.VALUE);
-                tbCrmDetail.setMarkPaperStartTime(Long.parseLong(value));
-            } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey()) && Objects.nonNull(
-                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
-                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                String value = jsonObject.getString(SystemConstant.VALUE);
-                tbCrmDetail.setMarkPaperEndTime(Long.parseLong(value));
+            ServiceScopeEnum scopeEnum = tbSopInfoService.findServiceScope(tfCustomFlow.getType(), flowTaskResult);
+            if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop流程待审核人
+                List<AllocationParam> allocationParams = new ArrayList<>();
+                if (Objects.nonNull(scopeEnum) && scopeEnum == ServiceScopeEnum.SCAN
+                        && tfFlowApprove.getSetup().intValue() > 3) {
+                    allocationParams.add(new AllocationParam(SopRoleTypeEnum.PROJECT_MANAGER,
+                            Arrays.asList(crmProjectResult.getRegionManagerId()), "[系统]"));
+                } else if (Objects.nonNull(scopeEnum) && scopeEnum == ServiceScopeEnum.SCAN_MARK) {
+                    allocationParams.add(new AllocationParam(SopRoleTypeEnum.PROJECT_MANAGER,
+                            Arrays.asList(crmProjectResult.getProjectManagerList().get(0).getUserId()), "[系统]"));
+                }
+                if (!CollectionUtils.isEmpty(allocationParams)) {
+                    tbSopInfoService.sopApproverExchange(tbCrmDetail.getId(), new SopAllocationParam(
+                            new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId())));
+                    allocationParams.add(new AllocationParam(SopRoleTypeEnum.ENGINEER, enginessUserIds, "[系统]"));
+                    tbUserArchivesAllocationService.editCrmAllocation(
+                            new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId()));
+                }
             }
+            tbDingService.resetDingExceptionBySopNo(tbSopInfo.getSopNo());
         }
+
         tbCrmDetailService.updateById(tbCrmDetail);
         return tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
     }