Преглед изворни кода

新增根据crmNo终止流程

wangliang пре 1 година
родитељ
комит
3f9835d66a

+ 15 - 9
sop-business/src/main/java/com/qmth/sop/business/activiti/listener/ProcessEventListener.java

@@ -109,31 +109,33 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
                         SysUser sysUser = (SysUser) taskService.getVariable(task.getId(), SystemConstant.FLOW_SYS_USER);
                         Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
 
-                        Map<String, Object> map = (Map) taskService.getVariable(task.getId(), SystemConstant.APPROVE_MAP_VAR);
+//                        Map<String, Object> map = (Map) taskService.getVariable(task.getId(), SystemConstant.APPROVE_MAP_VAR);
 
                         //此处统一流程节点保存延期预警任务
-                        if (tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.DRAFT
+                        if ((tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW)
+                                && tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.DRAFT
                                 && tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.END
                                 && tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.FINISH) {
                             List<TSJobRemind> tsJobRemindArrayList = new ArrayList<>();
                             if (Objects.nonNull(task.getAssignee())) {
                                 tsJobRemindArrayList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), sysUser.getId()));
-                                if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
+//                                if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
                                     this.sendSopFlowDoneSms(tfCustomFlow.getType(), tfCustomFlowEntity, task.getName(), Long.parseLong(task.getAssignee()));
-                                    jobRemindService.saveJobRemind(tsJobRemindArrayList);
-                                }
+//                                    jobRemindService.saveJobRemind(tsJobRemindArrayList);
+//                                }
                             } else {
                                 List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
                                 if (!CollectionUtils.isEmpty(identityLinkList)) {
                                     for (IdentityLink i : identityLinkList) {
                                         tsJobRemindArrayList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), sysUser.getId()));
-                                        if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
+//                                        if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
                                             this.sendSopFlowDoneSms(tfCustomFlow.getType(), tfCustomFlowEntity, task.getName(), Long.parseLong(i.getUserId()));
-                                            jobRemindService.saveJobRemind(tsJobRemindArrayList);
-                                        }
+//                                            jobRemindService.saveJobRemind(tsJobRemindArrayList);
+//                                        }
                                     }
                                 }
                             }
+                            jobRemindService.saveJobRemind(tsJobRemindArrayList);
                         }
                     }
                 }
@@ -147,10 +149,14 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
                 if (activitiEntityEvent.getEntity() instanceof Task) {
                     Task task = (Task) activitiEntityEvent.getEntity();
                     if (Objects.nonNull(task)) {
+                        TFCustomFlow tfCustomFlow = (TFCustomFlow) taskService.getVariable(task.getId(), SystemConstant.FLOW_CUSTOM);
+                        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+
                         TFFlowLog tfFlowLog = (TFFlowLog) taskService.getVariable(task.getId(), SystemConstant.FLOW_APPROVE_LOG);
                         Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
 
-                        if (tfFlowLog.getApproveSetup().intValue() > 1) {//流程提交不需要提醒
+                        if ((tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW)
+                                && tfFlowLog.getApproveSetup().intValue() > 1) {//流程提交不需要提醒
                             //任务完成后统一设置延期预警任务enable为false
                             jobRemindService.updateJobRemind(Long.parseLong(task.getId()));
                         }

+ 8 - 0
sop-business/src/main/java/com/qmth/sop/business/activiti/service/ActivitiService.java

@@ -119,6 +119,14 @@ public interface ActivitiService {
      */
     public Boolean flowEnd(List<Long> flowIds);
 
+    /**
+     * 流程终止
+     *
+     * @param crmNo
+     * @return
+     */
+    public Boolean flowEnd(String crmNo);
+
     /**
      * 获取流程详细信息接口
      *

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

@@ -357,7 +357,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                         taskService.setVariable(task.getId(), SystemConstant.FLOW_ENTITY, tfCustomFlowEntity);
                         taskService.setVariable(task.getId(), SystemConstant.FLOW_APPROVE_LOG, tfFlowLog);
                         taskService.setVariable(task.getId(), SystemConstant.FLOW_SYS_USER, sysUser);
-                        taskService.setVariable(task.getId(), SystemConstant.APPROVE_MAP_VAR, flowApproveParam.getVar());
+//                        taskService.setVariable(task.getId(), SystemConstant.APPROVE_MAP_VAR, flowApproveParam.getVar());
                         taskService.complete(task.getId(), map);
                         if (flowApproveParam.getApprove() == FlowApprovePassEnum.START || flowApproveParam.getApprove() == FlowApprovePassEnum.PASS) {
                             List<Task> tasks = taskService.createTaskQuery().processInstanceId(processFlowId).list();
@@ -391,7 +391,7 @@ public class ActivitiServiceImpl implements ActivitiService {
             map.put(SystemConstant.FLOW_CUSTOM, tfCustomFlow);
             map.put(SystemConstant.FLOW_APPROVE, tfFlowApprove);
             map.put(SystemConstant.FLOW_ENTITY, tfCustomFlowEntity);
-            map.put(SystemConstant.APPROVE_MAP_VAR, flowApproveParam.getVar());
+//            map.put(SystemConstant.APPROVE_MAP_VAR, flowApproveParam.getVar());
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ApiException) {
@@ -689,6 +689,26 @@ public class ActivitiServiceImpl implements ActivitiService {
         return true;
     }
 
+    /**
+     * 流程终止
+     *
+     * @param crmNo
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean flowEnd(String crmNo) {
+        Optional.ofNullable(crmNo).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
+        List<Long> flowIdList = tfFlowApproveService.findFlowIdByCrmNo(crmNo);
+        if (!CollectionUtils.isEmpty(flowIdList)) {
+            ActivitiService activitiService = SpringContextHolder.getBean(ActivitiService.class);
+            for (Long l : flowIdList) {
+                activitiService.flowEnd(l);
+            }
+        }
+        return null;
+    }
+
     /**
      * 获取流程详细信息接口
      *

+ 15 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TSJobRemind.java

@@ -96,6 +96,21 @@ public class TSJobRemind implements Serializable {
         this.enable = true;
     }
 
+
+    public TSJobRemind(JobQuartzTypeEnum type, String code, Long objId, String objName, JobTypeEnum remindType, Long receiveUserId, FlowApproveOperationEnum approveOperation, Long createTime, Long userId) {
+        this.id = SystemConstant.getDbUuid();
+        this.type = type;
+        this.code = code;
+        this.objId = objId;
+        this.objName = objName;
+        this.remindType = remindType;
+        this.receiveUserId = receiveUserId;
+        this.approveOperation = approveOperation;
+        this.createId = userId;
+        this.createTime = createTime;
+        this.enable = true;
+    }
+
     public JobQuartzTypeEnum getType() {
         return type;
     }

+ 10 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/TFFlowApproveMapper.java

@@ -2,6 +2,9 @@ package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.sop.business.entity.TFFlowApprove;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,11 @@ import com.qmth.sop.business.entity.TFFlowApprove;
  */
 public interface TFFlowApproveMapper extends BaseMapper<TFFlowApprove> {
 
+    /**
+     * 根据crmNo查询flowId
+     *
+     * @param crmNo
+     * @return
+     */
+    List<Long> findFlowIdByCrmNo(@Param("crmNo") String crmNo);
 }

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

@@ -116,4 +116,11 @@ public interface TBSopInfoService extends IService<TBSopInfo> {
      * @param crmNo
      */
     public void sopSystemApprove(TFCustomFlow tfCustomFlow, TFCustomFlowEntity tfCustomFlowEntity, TFFlowApprove tfFlowApprove, TBSopInfoDetail tbSopInfoDetail, String crmNo) throws InterruptedException;
+
+    /**
+     * 保存提醒/延时任务
+     *
+     * @param map
+     */
+    public void saveJobRemind(Map<String, Object> map);
 }

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TFFlowApproveService.java

@@ -3,6 +3,8 @@ package com.qmth.sop.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.entity.TFFlowApprove;
 
+import java.util.List;
+
 /**
  * <p>
  * 流程审核表 服务类
@@ -13,4 +15,11 @@ import com.qmth.sop.business.entity.TFFlowApprove;
  */
 public interface TFFlowApproveService extends IService<TFFlowApprove> {
 
+    /**
+     * 根据crmNo查询flowId
+     *
+     * @param crmNo
+     * @return
+     */
+    List<Long> findFlowIdByCrmNo(String crmNo);
 }

+ 123 - 6
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -19,6 +19,7 @@ import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.util.JacksonUtil;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
+import org.activiti.engine.task.IdentityLink;
 import org.activiti.engine.task.Task;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
@@ -66,6 +67,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Resource
     TFFlowApproveService tfFlowApproveService;
 
+    @Resource
+    TSJobRemindService tsJobRemindService;
+
     /**
      * 查询动态sop表名是否存在
      *
@@ -273,14 +277,17 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         List<String> approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult, tbSopInfoDetail);
         flowApproveParam.setApproveUserIds(approveUserIds);
 
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-        if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW && flowApproveParam.getApprove() == FlowApprovePassEnum.PASS && tfFlowApprove.getSetup().intValue() == 2
-                && tbSopInfoDetail.getLeadId().longValue() == tbSopInfoDetail.getRegionUserId().longValue()) {
-            flowApproveParam.setVar(Collections.singletonMap(SystemConstant.APPROVE, SystemConstant.APPROVE_AUTO));
-        }
+//        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
+//        if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW && flowApproveParam.getApprove() == FlowApprovePassEnum.PASS && tfFlowApprove.getSetup().intValue() == 2
+//                && tbSopInfoDetail.getLeadId().longValue() == tbSopInfoDetail.getRegionUserId().longValue()) {
+//            flowApproveParam.setVar(Collections.singletonMap(SystemConstant.APPROVE, SystemConstant.APPROVE_AUTO));
+//        }
 
         Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
-        tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
+        if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT) {
+            tbSopInfoService.saveJobRemind(map);
+        }
+        TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
 
         tbSopInfo.updateInfo(sysUser.getId());
         this.updateById(tbSopInfo);
@@ -470,6 +477,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         }
 
         Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
+        if (approve != FlowApprovePassEnum.DRAFT) {
+            tbSopInfoService.saveJobRemind(map);
+        }
+
         tfCustomFlow = Objects.isNull(tfCustomFlow) ? (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM) : tfCustomFlow;
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
 
@@ -486,6 +497,112 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         return tbSopInfoService.save(tbSopInfo);
     }
 
+    /**
+     * 保存提醒/延时任务
+     *
+     * @param map
+     */
+    @Override
+    @Transactional
+    public void saveJobRemind(Map<String, Object> map) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        TFCustomFlow tfCustomFlow = (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM);
+        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+
+        TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
+        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+
+        TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
+        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+
+        TFFlowLog tfFlowLog = (TFFlowLog) map.get(SystemConstant.FLOW_APPROVE_LOG);
+        Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
+
+        Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).singleResult();
+        if (Objects.nonNull(task) && (tfFlowApprove.getStatus() != FlowStatusEnum.DRAFT && tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END)) {
+            Long processLimitedTime = null;
+            if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
+                if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.PROJECT_KEY_INFO_DATE);
+                } else if (tfFlowApprove.getSetup().intValue() == 3 || tfFlowApprove.getSetup().intValue() == 4) {//大区经理内审或工程师内审
+                    processLimitedTime = tfFlowApprove.getUpdateTime();
+                } else if (tfFlowApprove.getSetup().intValue() == 6) {//扫描准备
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.SCAN_START_TIME);
+                } else if (tfFlowApprove.getSetup().intValue() == 8) {//校验收尾
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.SCAN_END_TIME);
+                } else if (tfFlowApprove.getSetup().intValue() == 9) {//评卷准备
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.MARK_START_TIME);
+                } else if (tfFlowApprove.getSetup().intValue() == 10) {//评卷收尾
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.MARK_END_TIME);
+                } else if (tfFlowApprove.getSetup().intValue() == 11) {//设备入库登记
+                    FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
+                    processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.SERVICE_FINISH_PLAN_DATE);
+                }
+            } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
+
+            }
+            List<TSJobRemind> tsJobRemindList = new ArrayList<>();
+            if (Objects.nonNull(task.getAssignee())) {
+                tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.BEFORE, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), processLimitedTime, sysUser.getId()));
+                tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), processLimitedTime, sysUser.getId()));
+            } else {
+                List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
+                if (!CollectionUtils.isEmpty(identityLinkList)) {
+                    for (IdentityLink i : identityLinkList) {
+                        tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.BEFORE, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime, sysUser.getId()));
+                        tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime, sysUser.getId()));
+                    }
+                }
+            }
+            tsJobRemindService.saveJobRemind(tsJobRemindList);
+        }
+    }
+
+    /**
+     * 获取表单内容
+     *
+     * @param tfCustomFlowEntity
+     * @param setup
+     * @return
+     */
+    public FlowTaskResult getFormProperties(TFCustomFlowEntity tfCustomFlowEntity, Integer setup) {
+        FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
+        LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
+        FlowTaskResult flowTaskResult = null;
+        for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
+            if (entry.getValue().getSetup().intValue() == setup.intValue()) {
+                flowTaskResult = entry.getValue();
+                break;
+            }
+        }
+        return flowTaskResult;
+    }
+
+    /**
+     * 获取处理时限时间
+     *
+     * @param flowTaskResult
+     * @param fieldId
+     * @return
+     */
+    public Long getProcessLimitedTime(FlowTaskResult flowTaskResult, String fieldId) {
+        Long processLimitedTime = null;
+        List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
+        for (FlowFormWidgetResult f : formProperty) {
+            if (f.getFormId().contains(fieldId) && Objects.nonNull(f.getValue())) {
+                processLimitedTime = Long.parseLong(f.getValue());
+                break;
+            }
+        }
+        Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(fieldId + "处理时限时间为空"));
+        return processLimitedTime;
+    }
+
     /**
      * 根据crmNo查询在途的sop信息
      *

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TFFlowApproveServiceImpl.java

@@ -6,6 +6,8 @@ import com.qmth.sop.business.mapper.TFFlowApproveMapper;
 import com.qmth.sop.business.service.TFFlowApproveService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 流程审核表 服务实现类
@@ -17,4 +19,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class TFFlowApproveServiceImpl extends ServiceImpl<TFFlowApproveMapper, TFFlowApprove> implements TFFlowApproveService {
 
+    /**
+     * 根据crmNo查询flowId
+     *
+     * @param crmNo
+     * @return
+     */
+    @Override
+    public List<Long> findFlowIdByCrmNo(String crmNo) {
+        return this.baseMapper.findFlowIdByCrmNo(crmNo);
+    }
 }

+ 10 - 0
sop-business/src/main/resources/mapper/TFFlowApproveMapper.xml

@@ -2,4 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.TFFlowApproveMapper">
 
+    <select id="findFlowIdByCrmNo" resultType="java.lang.Long">
+        select tffa.flow_id from t_f_flow_approve tffa
+             join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
+        <where> 1 = 1
+            <if test="crmNo != null and crmNo != ''">
+                and tfcfe.crm_no = #{crmNo}
+            </if>
+                and tffa.status not in('FINISH','END')
+        </where>
+    </select>
 </mapper>

+ 12 - 2
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -100,8 +100,8 @@ public class SystemConstant {
     public static final String LIST_JOIN_SPLIT = ",";
     public static final String JOB_DATA = "jobData";
     public static final String AND = " and ";
-    public static final String APPROVE_MAP_VAR = "approve_map_var";
-    public static final String APPROVE_AUTO = "auto";
+//    public static final String APPROVE_MAP_VAR = "approve_map_var";
+//    public static final String APPROVE_AUTO = "auto";
     public static final String SYSTEM_AUTO_APPROVE = "系统自动审批";
 
     /**
@@ -119,6 +119,16 @@ public class SystemConstant {
     public static final String APPROVE_RADIO = "approve_radio";
     public static final String APPROVE_REMARK = "approve_remark";
 
+    /**
+     * 教务处SOP处理时限字段
+     */
+    public static final String PROJECT_KEY_INFO_DATE = "project_key_info_date";//项目关键信息提交截止时间
+    public static final String SCAN_START_TIME = "scan_start_time";//扫描开始时间
+    public static final String SCAN_END_TIME = "scan_end_time";//扫描结束时间
+    public static final String MARK_START_TIME = "mark_start_time";//评卷开始时间
+    public static final String MARK_END_TIME = "mark_end_time";//评卷结束时间
+    public static final String SERVICE_FINISH_PLAN_DATE = "service_finish_plan_date";//现场服务完成撤场计划时间
+
     //质量问题反馈
     public static final String PROBLEM_POINT = "problem_point";
     public static final String PROBLEM_REMARK = "problem_remark";