wangliang vor 1 Jahr
Ursprung
Commit
f2191eef52

+ 55 - 24
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -21,11 +22,9 @@ import com.qmth.sop.business.service.TFCustomFlowEntityService;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.util.GsonUtil;
-import com.qmth.sop.common.util.JacksonUtil;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.Task;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -189,13 +188,25 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
     public List<String> getApproveUserIds(FlowTaskResult flowTaskResult, Integer setup, List<String> approveUserIds) {
         List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
         for (FlowFormWidgetResult f : formProperty) {
-            if (setup.intValue() == 2 && f.getFormId().contains(SystemConstant.APPROVE_CHECK_USERS) && Objects.nonNull(f.getValue())) {//获取甲方复核人员
-                String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
-                approveUserIds = Arrays.asList(StringUtils.split(string, ","));
+            if (setup.intValue() == 2 && f.getFormId().contains(SystemConstant.APPROVE_CHECK_USERS) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//获取甲方复核人员
+//                String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
+//                approveUserIds = Arrays.asList(StringUtils.split(string, ","));
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                StringJoiner stringJoiner = new StringJoiner(",");
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    approveUserIds.add(jsonArray.getString(i));
+                }
                 break;
-            } else if (setup.intValue() == 3 && f.getFormId().contains(SystemConstant.APPROVE_CHECK_THIRD_USERS) && Objects.nonNull(f.getValue())) {//获取已方复核人员
-                String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
-                approveUserIds = Arrays.asList(StringUtils.split(string, ","));
+            } else if (setup.intValue() == 3 && f.getFormId().contains(SystemConstant.APPROVE_CHECK_THIRD_USERS) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//获取已方复核人员
+//                String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
+//                approveUserIds = Arrays.asList(StringUtils.split(string, ","));
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                StringJoiner stringJoiner = new StringJoiner(",");
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    approveUserIds.add(jsonArray.getString(i));
+                }
                 break;
             }
         }
@@ -218,28 +229,48 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
         List<FlowFormWidgetResult> formWidgetResultList = currFlowTaskResult.getFormProperty();
         if (!CollectionUtils.isEmpty(formWidgetResultList)) {//更新字段
             for (FlowFormWidgetResult f : formWidgetResultList) {
-                if (f.getFormId().contains(SystemConstant.PROBLEM_POINT)) {//问题简要
-                    tbQualityProblemApply.setSummary(f.getValue());
+                if (f.getFormId().contains(SystemConstant.PROBLEM_POINT) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//问题简要
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    String value = jsonObject.getString(SystemConstant.VALUE);
+                    tbQualityProblemApply.setSummary(value);
                 }
-                if (f.getFormId().contains(SystemConstant.PROBLEM_REMARK)) {//问题情况说明
-                    tbQualityProblemApply.setRemark(f.getValue());
+                if (f.getFormId().contains(SystemConstant.PROBLEM_REMARK) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//问题情况说明
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    String value = jsonObject.getString(SystemConstant.VALUE);
+                    tbQualityProblemApply.setRemark(value);
                 }
-                if (f.getFormId().contains(SystemConstant.ATTACHMENT_INFO)) {//附件id数组
-                    String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
-                    tbQualityProblemApply.setAttachmentIds(StringUtils.join(Arrays.asList(string), SystemConstant.LIST_JOIN_SPLIT));
+                if (f.getFormId().contains(SystemConstant.ATTACHMENT_INFO) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//附件id数组
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                    StringJoiner stringJoiner = new StringJoiner(",");
+                    for (int i = 0; i < jsonArray.size(); i++) {
+                        stringJoiner.add(jsonArray.getString(i));
+                    }
+                    tbQualityProblemApply.setAttachmentIds(stringJoiner.toString());
                 }
-                if (f.getFormId().contains(SystemConstant.PROBLEM_TYPE)) {//质量问题类型
-                    tbQualityProblemApply.setType(QualityProblemTypeEnum.valueOf(f.getValue()));
+                if (f.getFormId().contains(SystemConstant.PROBLEM_TYPE) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//质量问题类型
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    String value = jsonObject.getString(SystemConstant.VALUE);
+                    tbQualityProblemApply.setType(QualityProblemTypeEnum.valueOf(value));
                 }
-                if (f.getFormId().contains(SystemConstant.PROBLEM_REASON_RADIO)) {//问题归因
-                    tbQualityProblemApply.setReason(QualityProblemReasonEnum.valueOf(f.getValue()));
+                if (f.getFormId().contains(SystemConstant.PROBLEM_REASON_RADIO) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//问题归因
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    String value = jsonObject.getString(SystemConstant.VALUE);
+                    tbQualityProblemApply.setReason(QualityProblemReasonEnum.valueOf(value));
                 }
-                if (f.getFormId().contains(SystemConstant.PROBLEM_DEGREE_RADIO)) {//问题影响度
-                    tbQualityProblemApply.setInfluenceDegree(InfluenceDegreeEnum.valueOf(f.getValue()));
+                if (f.getFormId().contains(SystemConstant.PROBLEM_DEGREE_RADIO) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//问题影响度
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    String value = jsonObject.getString(SystemConstant.VALUE);
+                    tbQualityProblemApply.setInfluenceDegree(InfluenceDegreeEnum.valueOf(value));
                 }
-                if (f.getFormId().contains(SystemConstant.PROBLEM_USERS)) {//责任人
-                    String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
-                    tbQualityProblemApply.setUserIds(StringUtils.join(Arrays.asList(string), SystemConstant.LIST_JOIN_SPLIT));
+                if (f.getFormId().contains(SystemConstant.PROBLEM_USERS) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {//责任人
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                    StringJoiner stringJoiner = new StringJoiner(",");
+                    for (int i = 0; i < jsonArray.size(); i++) {
+                        stringJoiner.add(jsonArray.getString(i));
+                    }
+                    tbQualityProblemApply.setUserIds(stringJoiner.toString());
                 }
             }
         }

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

@@ -102,13 +102,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                     && f.getCode() != WidgetCodeEnum.LABEL && f.getCode() != WidgetCodeEnum.SIGN
                     && f.getCode() != WidgetCodeEnum.OTHER) {
                 if (f.getInputType() != WidgetInputTypeEnum.ARRAY) {
-                    if (!f.getValue().contains("null")) {
+                    if (Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
                         JSONObject jsonObject = JSONObject.parseObject(f.getValue());
                         String value = jsonObject.getString(SystemConstant.VALUE);
                         formFieldMap.put(f.getFormId(), value);
                     }
                 } else {
-                    if (!f.getValue().contains("null")) {
+                    if (Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
                         JSONObject jsonObject = JSONObject.parseObject(f.getValue());
                         JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
                         StringJoiner stringJoiner = new StringJoiner(",");
@@ -480,32 +480,26 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         String assistantEngineerUserIds = null;
         List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
         for (FlowFormWidgetResult f : formProperty) {
-            if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue())) {
-                if (f.getInputType() == WidgetInputTypeEnum.STRING || f.getInputType() == WidgetInputTypeEnum.LONG) {
-                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                    String value = jsonObject.getString(SystemConstant.VALUE);
-                    regionUserId = Long.parseLong(value);
-                }
+            if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                regionUserId = Long.parseLong(value);
             }
-            if (f.getFormId().contains(SystemConstant.ENGINEER_USER_ID) && Objects.nonNull(f.getValue())) {
-                if (f.getInputType() == WidgetInputTypeEnum.STRING || f.getInputType() == WidgetInputTypeEnum.LONG) {
-                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                    String value = jsonObject.getString(SystemConstant.VALUE);
-                    engineerUserId = Long.parseLong(value);
-                }
+            if ((f.getFormId().contains(SystemConstant.ENGINEER_USER_ID) && Objects.nonNull(f.getValue())) && !f.getValue().contains("null")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                engineerUserId = Long.parseLong(value);
             }
-            if (f.getFormId().contains(SystemConstant.ASSISTANT_ENGINEER_USER_ID) && Objects.nonNull(f.getValue())) {
+            if (f.getFormId().contains(SystemConstant.ASSISTANT_ENGINEER_USER_ID) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
 //                String string = f.getValue().replaceAll("\\[", "").replaceAll("\\]", "");
 //                assistantEngineerUserIds = StringUtils.join(Arrays.asList(string), SystemConstant.LIST_JOIN_SPLIT);
-                if (f.getInputType() == WidgetInputTypeEnum.ARRAY && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
-                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                    JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
-                    StringJoiner stringJoiner = new StringJoiner(",");
-                    for (int i = 0; i < jsonArray.size(); i++) {
-                        stringJoiner.add(jsonArray.getString(i));
-                    }
-                    assistantEngineerUserIds = stringJoiner.toString();
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
+                StringJoiner stringJoiner = new StringJoiner(",");
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    stringJoiner.add(jsonArray.getString(i));
                 }
+                assistantEngineerUserIds = stringJoiner.toString();
             }
             if (Objects.nonNull(regionUserId) && Objects.nonNull(engineerUserId) && Objects.nonNull(assistantEngineerUserIds)) {
                 break;
@@ -813,12 +807,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         Long processLimitedTime = null;
         List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
         for (FlowFormWidgetResult f : formProperty) {
-            if (f.getFormId().contains(fieldId) && Objects.nonNull(f.getValue())) {
-                if (!f.getValue().contains("null")) {
-                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
-                    String value = jsonObject.getString(SystemConstant.VALUE);
-                    processLimitedTime = Long.parseLong(value);
-                }
+            if (f.getFormId().contains(fieldId) && Objects.nonNull(f.getValue()) && !f.getValue().contains("null")) {
+                JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                String value = jsonObject.getString(SystemConstant.VALUE);
+                processLimitedTime = Long.parseLong(value);
                 break;
             }
         }