소스 검색

新增sop计划时间查询

wangliang 1 년 전
부모
커밋
ba289ee24c

+ 15 - 46
sop-business/src/main/java/com/qmth/sop/business/bean/result/SopPlanTimeResult.java

@@ -19,35 +19,20 @@ public class SopPlanTimeResult implements Serializable {
     @ApiModelProperty(value = "sop类型")
     TFCustomTypeEnum type;
 
-    @ApiModelProperty(value = "扫描开始时间")
-    Long scanStartTime;
+    @ApiModelProperty(value = "计划开始时间")
+    Long beginTime;
 
-    @ApiModelProperty(value = "扫描结束时间")
-    Long scanEndTime;
-
-    @ApiModelProperty(value = "阅卷开始时间")
-    Long markStartTime;
-
-    @ApiModelProperty(value = "阅卷结束时间")
-    Long markEndTime;
+    @ApiModelProperty(value = "计划结束时间")
+    Long endTime;
 
     public SopPlanTimeResult() {
 
     }
 
-    public SopPlanTimeResult(TFCustomTypeEnum type, Long scanStartTime, Long scanEndTime, Long markStartTime,
-            Long markEndTime) {
+    public SopPlanTimeResult(TFCustomTypeEnum type, Long beginTime, Long endTime) {
         this.type = type;
-        this.scanStartTime = scanStartTime;
-        this.scanEndTime = scanEndTime;
-        this.markStartTime = markStartTime;
-        this.markEndTime = markEndTime;
-    }
-
-    public SopPlanTimeResult(TFCustomTypeEnum type, Long markStartTime, Long markEndTime) {
-        this.type = type;
-        this.markStartTime = markStartTime;
-        this.markEndTime = markEndTime;
+        this.beginTime = beginTime;
+        this.endTime = endTime;
     }
 
     public TFCustomTypeEnum getType() {
@@ -58,35 +43,19 @@ public class SopPlanTimeResult implements Serializable {
         this.type = type;
     }
 
-    public Long getScanStartTime() {
-        return scanStartTime;
-    }
-
-    public void setScanStartTime(Long scanStartTime) {
-        this.scanStartTime = scanStartTime;
-    }
-
-    public Long getScanEndTime() {
-        return scanEndTime;
-    }
-
-    public void setScanEndTime(Long scanEndTime) {
-        this.scanEndTime = scanEndTime;
-    }
-
-    public Long getMarkStartTime() {
-        return markStartTime;
+    public Long getBeginTime() {
+        return beginTime;
     }
 
-    public void setMarkStartTime(Long markStartTime) {
-        this.markStartTime = markStartTime;
+    public void setBeginTime(Long beginTime) {
+        this.beginTime = beginTime;
     }
 
-    public Long getMarkEndTime() {
-        return markEndTime;
+    public Long getEndTime() {
+        return endTime;
     }
 
-    public void setMarkEndTime(Long markEndTime) {
-        this.markEndTime = markEndTime;
+    public void setEndTime(Long endTime) {
+        this.endTime = endTime;
     }
 }

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

@@ -19,6 +19,7 @@ import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.lock.MemoryLock;
+import com.qmth.sop.common.util.GsonUtil;
 import com.qmth.sop.common.util.JacksonUtil;
 import com.qmth.sop.common.util.ResultUtil;
 import com.qmth.sop.common.util.ServletUtil;
@@ -331,36 +332,44 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                         if (flowFormWidgetResultMap.containsKey(f.getId())) {
                             f.setValue(flowFormWidgetResultMap.get(f.getId()).getValue());
                         } else if (Objects.nonNull(tbCrmDetail.getContacts()) && f.getFormId()
-                                .contains(ProcessLimitedEnum.CONTACTS.getKey())) {
+                                .contains(ProcessLimitedEnum.CONTACTS.getKey()) && Objects.nonNull(f.getValue())
+                                && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getContacts());
                             f.setValue(jsonObject.toJSONString());
                         } else if (Objects.nonNull(tbCrmDetail.getMobileNumber()) && f.getFormId()
-                                .contains(ProcessLimitedEnum.MOBILE_NUMBER.getKey())) {
+                                .contains(ProcessLimitedEnum.MOBILE_NUMBER.getKey()) && Objects.nonNull(f.getValue())
+                                && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMobileNumber());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.SERVICE_SCOPE_RADIO.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.SERVICE_SCOPE_RADIO.getKey())
+                                && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getServiceScope());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey())
+                                && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanStartTime());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
+                                f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanEndTime());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey())
+                                && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperStartTime());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey()) && Objects.nonNull(
+                                f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperEndTime());
                             f.setValue(jsonObject.toJSONString());
-                        } else if (f.getFormId().contains(ProcessLimitedEnum.ENGINEER_USERS_ID.getKey())) {
+                        } else if (f.getFormId().contains(ProcessLimitedEnum.ENGINEER_USERS_ID.getKey())
+                                && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
                             List<String> list = new ArrayList<>(crmProjectResult.getEngineerList().size());
                             crmProjectResult.getEngineerList().stream().peek(s -> list.add(s.getUserId().toString()))
                                     .collect(Collectors.toList());
@@ -1298,32 +1307,45 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
         Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
 
-        Long scanStartTime = null, scanEndTime = null, markStartTime = null, markEndTime = null;
+        Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId()))
+                .singleResult();
+
+        FlowTaskResult currFlowTaskResult = null;
+        if (Objects.nonNull(task)) {
+            FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
+            LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
+            currFlowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())),
+                    FlowTaskResult.class);
+        }
+
+        Long beginTime = null, endTime = null;
         FlowTaskResult flowTaskResult = tbSopInfoService.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}")) {
+                    && !Objects.equals(f.getValue(), "{\"value\":null}") && Objects.nonNull(currFlowTaskResult)
+                    && currFlowTaskResult.getSetup().intValue() <= 3) {
                 JSONObject jsonObject = JSONObject.parseObject(f.getValue());
                 String value = jsonObject.getString(SystemConstant.VALUE);
-                scanStartTime = Long.parseLong(value);
+                beginTime = Long.parseLong(value);
             } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
-                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
+                    f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}") && Objects.nonNull(
+                    currFlowTaskResult) && currFlowTaskResult.getSetup().intValue() <= 3) {
                 JSONObject jsonObject = JSONObject.parseObject(f.getValue());
                 String value = jsonObject.getString(SystemConstant.VALUE);
-                scanEndTime = Long.parseLong(value);
+                endTime = 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);
-                markStartTime = Long.parseLong(value);
+                beginTime = 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);
-                markEndTime = Long.parseLong(value);
+                endTime = Long.parseLong(value);
             }
         }
-        return new SopPlanTimeResult(tfCustomFlow.getType(), scanStartTime, scanEndTime, markStartTime, markEndTime);
+        return new SopPlanTimeResult(tfCustomFlow.getType(), beginTime, endTime);
     }
 }