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

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/bean/params/SopInfoListParam.java

@@ -58,7 +58,7 @@ public class SopInfoListParam extends TBSopInfo implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private List<Long> userIdList;
 
-    @ApiModelProperty(value = "大区经理")
+    @ApiModelProperty(value = "大区经理id")
     @JsonSerialize(using = ToStringSerializer.class)
     Long leadId;
 
@@ -68,7 +68,7 @@ public class SopInfoListParam extends TBSopInfo implements Serializable {
     @ApiModelProperty(value = "当前节点")
     String taskKey;
 
-    @ApiModelProperty(value = "客户经理")
+    @ApiModelProperty(value = "客户经理id")
     @JsonSerialize(using = ToStringSerializer.class)
     Long crmUserId;
 

+ 13 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TFCustomFlow.java

@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -66,6 +67,10 @@ public class TFCustomFlow extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "流程过程变量数据")
     private String flowProcessVar;
 
+    @ApiModelProperty(value = "流程步骤")
+    @TableField(exist = false)
+    private List<String> setupList;
+
     public TFCustomFlow() {
 
     }
@@ -79,6 +84,14 @@ public class TFCustomFlow extends BaseEntity implements Serializable {
         this.modelType = modelType;
     }
 
+    public List<String> getSetupList() {
+        return setupList;
+    }
+
+    public void setSetupList(List<String> setupList) {
+        this.setupList = setupList;
+    }
+
     public Long getOrgId() {
         return orgId;
     }

+ 7 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -111,6 +111,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Resource
     TBUserArchivesAllocationService tbUserArchivesAllocationService;
 
+    @Resource
+    TBDingService tbDingService;
+
     /**
      * 查询动态sop表名是否存在
      *
@@ -829,6 +832,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                 sopInfoListParam.getTaskKey(), sopInfoListParam.getCrmName(), sopInfoListParam.getSopNo());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         for (Map m : list.getRecords()) {
+            String sopNo = (String) m.get("sopNo");
+            m.put("dingException", tbDingService.checkDingExceptionBySopNo(sopNo));
             String engineerUsersId = (String) m.get("engineer_users_id");
             List<Long> userIdList = new ArrayList<>();
             Map<Long, String> map = new HashMap<>();
@@ -1148,6 +1153,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                         sysUser.getId());
                 tbSopLogService.save(tbSopLog);
             }
+
+            tbDingService.resetDingExceptionBySopNo(tbSopInfo.getSopNo());
         }
         return tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
     }

+ 28 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/TFCustomFlowServiceImpl.java

@@ -1,15 +1,19 @@
 package com.qmth.sop.business.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.bean.result.FlowResult;
+import com.qmth.sop.business.bean.result.FlowTaskResult;
 import com.qmth.sop.business.entity.TFCustomFlow;
 import com.qmth.sop.business.mapper.TFCustomFlowMapper;
 import com.qmth.sop.business.service.TFCustomFlowService;
 import com.qmth.sop.common.enums.TFCustomTypeEnum;
+import com.qmth.sop.common.util.GsonUtil;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * <p>
@@ -20,7 +24,8 @@ import java.util.Objects;
  * @since 2023-07-17
  */
 @Service
-public class TFCustomFlowServiceImpl extends ServiceImpl<TFCustomFlowMapper, TFCustomFlow> implements TFCustomFlowService {
+public class TFCustomFlowServiceImpl extends ServiceImpl<TFCustomFlowMapper, TFCustomFlow>
+        implements TFCustomFlowService {
 
     /**
      * 查询版本号
@@ -42,7 +47,24 @@ public class TFCustomFlowServiceImpl extends ServiceImpl<TFCustomFlowMapper, TFC
      */
     @Override
     public List<TFCustomFlow> findFlowDeploymentList() {
-        return this.baseMapper.findFlowDeploymentList();
+        List<TFCustomFlow> tfCustomFlowList = this.baseMapper.findFlowDeploymentList();
+        if (!CollectionUtils.isEmpty(tfCustomFlowList)) {
+            for (TFCustomFlow t : tfCustomFlowList) {
+                List<String> setupList = new ArrayList<>();
+                FlowResult flowResult = JSONObject.parseObject(t.getFlowProcessVar(), FlowResult.class);
+                LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
+                for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
+                    FlowTaskResult flowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(entry.getValue()),
+                            FlowTaskResult.class);
+                    if (flowTaskResult.getSetup().intValue() > 0) {
+                        setupList.add(flowTaskResult.getTaskName());
+                    }
+                }
+                setupList.add("已完结");
+                t.setSetupList(setupList);
+            }
+        }
+        return tfCustomFlowList;
     }
 
     /**
@@ -53,6 +75,7 @@ public class TFCustomFlowServiceImpl extends ServiceImpl<TFCustomFlowMapper, TFC
      */
     @Override
     public List<TFCustomFlow> findFlowVersion(TFCustomTypeEnum type) {
-        return this.list(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getType, type).orderByDesc(TFCustomFlow::getVersion));
+        return this.list(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getType, type)
+                .orderByDesc(TFCustomFlow::getVersion));
     }
 }

+ 12 - 6
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -188,18 +188,24 @@
     </select>
 
     <select id="findFlowPassageByCrmNo" resultType="java.lang.String">
-        select
-            tbsi.sop_no
-        from
-            t_b_sop_info tbsi
+        select t.sop_no from
+        (
+            select
+                tbsi.sop_no,
+                tbsi.status,
+                DATEDIFF(DATE_FORMAT(FROM_UNIXTIME(tffa.update_time / 1000), '%Y-%m-%d'), CURDATE()) as datediff
+            from
+                t_b_sop_info tbsi
             join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
             join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
         <where> 1 = 1
             <if test="crmNo != null and crmNo != ''">
                 and tbsi.crm_no = #{crmNo}
             </if>
-                and tbsi.status = 'START' and (tffa.status in ('START','DRAFT','AUDITING','REJECT','CANCEL') or (tffa.status = 'FINISH' and DATE_FORMAT(FROM_UNIXTIME(tffa.update_time  / 1000), '%Y-%m-%d') = CURDATE()))
-        </where>
+        </where>) t
+        join t_f_custom_flow_entity tfcfe on tfcfe.code = t.sop_no
+        join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
+        where t.status = 'START' and (tffa.status in ('START', 'DRAFT', 'AUDITING', 'REJECT', 'CANCEL') or (tffa.status = 'FINISH' and (t.datediff <![CDATA[ >= ]]> -1 and t.datediff <![CDATA[ <= ]]> 0)))
     </select>
 
     <select id="findFlowByServiceId" resultType="com.qmth.sop.business.bean.result.SopInfoResult">