Procházet zdrojové kódy

新增质量问题反馈甲乙方审核历史

wangliang před 1 rokem
rodič
revize
b509780bdc

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

@@ -802,6 +802,9 @@ public class ActivitiServiceImpl implements ActivitiService {
         Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
         flowId = Objects.isNull(flowId) ? tfCustomFlowEntity.getFlowId() : flowId;
 
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
+        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+
         //获取当前流程节点
         TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, flowId));
         Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
@@ -815,6 +818,9 @@ public class ActivitiServiceImpl implements ActivitiService {
 
         List<TFFlowViewLogResult> flowApproveHistoryList = null;
         Map<Integer, Integer> approveSetupMap = new HashMap<>();
+
+        List<FlowFormSuggestionJiaResult> flowFormSuggestionJiaResultList = new ArrayList<>();
+        List<FlowFormSuggestionYiResult> flowFormSuggestionYiResultList = new ArrayList<>();
         //获取流程审批历史
         List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByObjectId(tfCustomFlowEntity.getId());
         if (!CollectionUtils.isEmpty(tfFlowLogResultList)) {
@@ -823,11 +829,36 @@ public class ActivitiServiceImpl implements ActivitiService {
             for (TFFlowViewLogResult t : flowApproveHistoryList) {
                 t.setMessageType(FlowMsgTypeEnum.STANDARD);
                 approveSetupMap.put(t.getApproveSetup(), t.getApproveSetup());
+                if (Objects.nonNull(t.getApproveRemark()) && t.getApproveRemark().contains(";") && tfCustomFlow.getType() == TFCustomTypeEnum.QUALITY_PROBLEM_FLOW
+                        && (t.getApproveSetup().intValue() == 3 || t.getApproveSetup().intValue() == 4)) {
+                    String[] strs = t.getApproveRemark().split(";");
+                    StringJoiner stringJoiner = new StringJoiner("");
+                    for (int i = 1; i < strs.length; i++) {
+                        stringJoiner.add(strs[i]);
+                    }
+                    t.setApproveFormSuggestion(stringJoiner.toString());
+                    if (t.getApproveSetup().intValue() == 3) {
+                        flowFormSuggestionJiaResultList.add(new FlowFormSuggestionJiaResult(t.getCreateTime(), t.getApproveUserName(),
+                                t.getApproveOperation() == FlowApproveOperationEnum.APPROVE ? "同意" : "不同意", t.getApproveFormSuggestion(),
+                                strs[0]));
+                    } else {
+                        flowFormSuggestionYiResultList.add(new FlowFormSuggestionYiResult(t.getCreateTime(), t.getApproveUserName(),
+                                t.getApproveOperation() == FlowApproveOperationEnum.APPROVE ? "同意" : "不同意", t.getApproveFormSuggestion(),
+                                strs[0]));
+                    }
+                }
                 if (Objects.nonNull(t.getApproveOperation())) {
                     t.setApproveRemark(t.getApproveOperation().getTitle());
                 }
             }
         }
+        if (tfCustomFlow.getType() != TFCustomTypeEnum.QUALITY_PROBLEM_FLOW) {
+            flowFormSuggestionJiaResultList = null;
+            flowFormSuggestionYiResultList = null;
+        } else {
+            Collections.sort(flowFormSuggestionJiaResultList);
+            Collections.sort(flowFormSuggestionYiResultList);
+        }
         for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
             FlowTaskResult flowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(entry.getValue()), FlowTaskResult.class);
             if (flowTaskResult.getSetup() > 0) {
@@ -845,8 +876,6 @@ public class ActivitiServiceImpl implements ActivitiService {
             }
         }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_DEPLOYMENT_NO_DATA.exception());
         if ((tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW ||
                 tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW)) {
             if (Objects.nonNull(currFlowTaskResult) && currFlowTaskResult.getSetup().intValue() == 3) {
@@ -930,7 +959,7 @@ public class ActivitiServiceImpl implements ActivitiService {
         if (Objects.nonNull(tfCustomFlowEntity.getCrmNo())) {
             crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
         }
-        return new FlowViewResult(flowId, tfFlowApprove.getStatus(), tfCustomFlowEntity.getCode(), taskIdList, flowTaskHistoryList, currFlowTaskResult, flowApproveHistoryList, crmProjectResult);
+        return new FlowViewResult(flowId, tfFlowApprove.getStatus(), tfCustomFlowEntity.getCode(), taskIdList, flowTaskHistoryList, currFlowTaskResult, flowApproveHistoryList, crmProjectResult, flowFormSuggestionJiaResultList, flowFormSuggestionYiResultList);
     }
 
     /**

+ 94 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/FlowFormSuggestionJiaResult.java

@@ -0,0 +1,94 @@
+package com.qmth.sop.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 甲方审核意见 result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/8/6
+ */
+public class FlowFormSuggestionJiaResult implements Serializable, Comparable<FlowFormSuggestionJiaResult> {
+
+    @ApiModelProperty(value = "时间")
+    private Long createTime;
+
+    @ApiModelProperty(value = "审核人")
+    private String approveUserName;
+
+    @ApiModelProperty(value = "审核操作")
+    private String approveOperation;
+
+    @ApiModelProperty(value = "表单审核意见")
+    private String approveFormSuggestion;
+
+    @ApiModelProperty(value = "表单审核签名")
+    private String approveFormSign;
+
+    public FlowFormSuggestionJiaResult() {
+
+    }
+
+    public FlowFormSuggestionJiaResult(Long createTime, String approveUserName, String approveOperation, String approveFormSuggestion, String approveFormSign) {
+        this.createTime = createTime;
+        this.approveUserName = approveUserName;
+        this.approveOperation = approveOperation;
+        this.approveFormSuggestion = approveFormSuggestion;
+        this.approveFormSign = approveFormSign;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getApproveUserName() {
+        return approveUserName;
+    }
+
+    public void setApproveUserName(String approveUserName) {
+        this.approveUserName = approveUserName;
+    }
+
+    public String getApproveOperation() {
+        return approveOperation;
+    }
+
+    public void setApproveOperation(String approveOperation) {
+        this.approveOperation = approveOperation;
+    }
+
+    public String getApproveFormSuggestion() {
+        return approveFormSuggestion;
+    }
+
+    public void setApproveFormSuggestion(String approveFormSuggestion) {
+        this.approveFormSuggestion = approveFormSuggestion;
+    }
+
+    public String getApproveFormSign() {
+        return approveFormSign;
+    }
+
+    public void setApproveFormSign(String approveFormSign) {
+        this.approveFormSign = approveFormSign;
+    }
+
+    @Override
+    public int compareTo(@NotNull FlowFormSuggestionJiaResult o) {
+        if (o.getCreateTime() < this.getCreateTime()) {
+            return 1;
+        } else if (o.getCreateTime() > this.getCreateTime()) {
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+}

+ 25 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/FlowFormSuggestionYiResult.java

@@ -0,0 +1,25 @@
+package com.qmth.sop.business.bean.result;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 乙方审核意见 result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/8/6
+ */
+public class FlowFormSuggestionYiResult extends FlowFormSuggestionJiaResult implements Serializable {
+
+    public FlowFormSuggestionYiResult() {
+
+    }
+
+    public FlowFormSuggestionYiResult(Long createTime, String approveUserName, String approveOperation, String approveFormSuggestion, String approveFormSign) {
+        setCreateTime(createTime);
+        setApproveUserName(approveUserName);
+        setApproveOperation(approveOperation);
+        setApproveFormSuggestion(approveFormSuggestion);
+        setApproveFormSign(approveFormSign);
+    }
+}

+ 29 - 1
sop-business/src/main/java/com/qmth/sop/business/bean/result/FlowViewResult.java

@@ -50,6 +50,28 @@ public class FlowViewResult extends BaseFlowData implements Serializable {
     @ApiModelProperty(value = "crm信息")
     CrmProjectResult crmInfo;
 
+    @ApiModelProperty(value = "甲方审核意见集合")
+    List<FlowFormSuggestionJiaResult> flowFormSuggestionJiaResultList;
+
+    @ApiModelProperty(value = "甲方审核意见集合")
+    List<FlowFormSuggestionYiResult> flowFormSuggestionYiResultList;
+
+    public List<FlowFormSuggestionJiaResult> getFlowFormSuggestionJiaResultList() {
+        return flowFormSuggestionJiaResultList;
+    }
+
+    public void setFlowFormSuggestionJiaResultList(List<FlowFormSuggestionJiaResult> flowFormSuggestionJiaResultList) {
+        this.flowFormSuggestionJiaResultList = flowFormSuggestionJiaResultList;
+    }
+
+    public List<FlowFormSuggestionYiResult> getFlowFormSuggestionYiResultList() {
+        return flowFormSuggestionYiResultList;
+    }
+
+    public void setFlowFormSuggestionYiResultList(List<FlowFormSuggestionYiResult> flowFormSuggestionYiResultList) {
+        this.flowFormSuggestionYiResultList = flowFormSuggestionYiResultList;
+    }
+
     public CrmProjectResult getCrmInfo() {
         return crmInfo;
     }
@@ -62,7 +84,11 @@ public class FlowViewResult extends BaseFlowData implements Serializable {
 
     }
 
-    public FlowViewResult(Long flowId, FlowStatusEnum status, String sopNo, List<Long> taskIdList, List<FlowTaskResult> flowTaskHistoryList, FlowTaskResult currFlowTaskResult, List<TFFlowViewLogResult> flowApproveHistoryList, CrmProjectResult crmInfo) {
+    public FlowViewResult(Long flowId, FlowStatusEnum status, String sopNo, List<Long> taskIdList,
+                          List<FlowTaskResult> flowTaskHistoryList, FlowTaskResult currFlowTaskResult,
+                          List<TFFlowViewLogResult> flowApproveHistoryList, CrmProjectResult crmInfo,
+                          List<FlowFormSuggestionJiaResult> flowFormSuggestionJiaResultList,
+                          List<FlowFormSuggestionYiResult> flowFormSuggestionYiResultList) {
         this.flowId = flowId;
         this.status = status;
         this.sopNo = sopNo;
@@ -71,6 +97,8 @@ public class FlowViewResult extends BaseFlowData implements Serializable {
         this.flowApproveHistoryList = flowApproveHistoryList;
         this.currFlowTaskResult = currFlowTaskResult;
         this.crmInfo = crmInfo;
+        this.flowFormSuggestionJiaResultList = flowFormSuggestionJiaResultList;
+        this.flowFormSuggestionYiResultList = flowFormSuggestionYiResultList;
     }
 
     public Long getFlowId() {

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/TFFlowLogResult.java

@@ -41,6 +41,9 @@ public class TFFlowLogResult extends ApproveUserResult implements Serializable {
     @ApiModelProperty(value = "审批操作,START:提交,DRAFT:草稿,APPROVE:审批,REJECT:驳回,END:终止,CANCEL:撤销,EXCHANGE:转他人审批,FINISH:结束")
     private FlowApproveOperationEnum approveOperation;
 
+    @ApiModelProperty(value = "表单审批意见")
+    private String approveFormSuggestion;
+
     @ApiModelProperty(value = "待审核人id")
     private String pendApproveId;
 
@@ -60,6 +63,14 @@ public class TFFlowLogResult extends ApproveUserResult implements Serializable {
     @ApiModelProperty(value = "流程审核节点")
     private String taskName;
 
+    public String getApproveFormSuggestion() {
+        return approveFormSuggestion;
+    }
+
+    public void setApproveFormSuggestion(String approveFormSuggestion) {
+        this.approveFormSuggestion = approveFormSuggestion;
+    }
+
     public String getTaskName() {
         return taskName;
     }

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/TFFlowViewLogResult.java

@@ -38,6 +38,9 @@ public class TFFlowViewLogResult extends BaseFlowData implements Serializable {
     @ApiModelProperty(value = "审批操作,START:提交,DRAFT:草稿,APPROVE:审批,REJECT:驳回,END:终止,CANCEL:撤销,EXCHANGE:转他人审批,FINISH:结束")
     private FlowApproveOperationEnum approveOperation;
 
+    @ApiModelProperty(value = "表单审批意见")
+    private String approveFormSuggestion;
+
     @ApiModelProperty(value = "待审核人id")
     private String pendApproveId;
 
@@ -53,6 +56,14 @@ public class TFFlowViewLogResult extends BaseFlowData implements Serializable {
     @ApiModelProperty(value = "流程审核节点")
     private String taskName;
 
+    public String getApproveFormSuggestion() {
+        return approveFormSuggestion;
+    }
+
+    public void setApproveFormSuggestion(String approveFormSuggestion) {
+        this.approveFormSuggestion = approveFormSuggestion;
+    }
+
     public String getTaskName() {
         return taskName;
     }

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

@@ -200,8 +200,31 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
         tbQualityProblemApply = this.updateFieldValue(currFlowTaskResult, tbQualityProblemApply);
         approveUserIds = !CollectionUtils.isEmpty(approveUserIds) ? approveUserIds : Arrays.asList(String.valueOf(sysUser.getId()));
         flowApproveParam.setApproveUserIds(approveUserIds);
-        activitiService.taskApprove(flowApproveParam);
 
+        if (currFlowTaskResult.getSetup().intValue() == 3 || currFlowTaskResult.getSetup().intValue() == 4) {
+            flowApproveParam.setApproveRemark("无");
+            List<FlowFormWidgetResult> flowFormWidgetResultList = currFlowTaskResult.getFormProperty();
+            StringJoiner stringJoiner = new StringJoiner(";");
+            for (FlowFormWidgetResult f : flowFormWidgetResultList) {
+                if (f.getFormId().contains(SystemConstant.SIGN)) {
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    if (Objects.nonNull(jsonObject.get(SystemConstant.VALUE))) {
+                        String value = jsonObject.getString(SystemConstant.VALUE);
+                        stringJoiner.add(value);
+                    }
+                } else if (f.getFormId().contains("approve_remark")) {
+                    JSONObject jsonObject = JSONObject.parseObject(f.getValue());
+                    if (Objects.nonNull(jsonObject.get(SystemConstant.VALUE))) {
+                        String value = jsonObject.getString(SystemConstant.VALUE);
+                        stringJoiner.add(value);
+                    }
+                }
+            }
+            if (stringJoiner.toString().length() > 1) {
+                flowApproveParam.setApproveRemark(stringJoiner.toString());
+            }
+        }
+        activitiService.taskApprove(flowApproveParam);
         tbQualityProblemApply.updateInfo(sysUser.getId());
         return this.updateById(tbQualityProblemApply);
     }