wangliang 1 anno fa
parent
commit
ef174548ef

+ 16 - 53
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -244,9 +244,7 @@ public class ActivitiServiceImpl implements ActivitiService {
             Optional.ofNullable(flowApproveParam.getCrmNo())
                     .orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
 
-            tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda()
-                    .eq(TFCustomFlow::getFlowDeploymentId, flowApproveParam.getFlowDeploymentId()));
-            Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+            tfCustomFlow = tfCustomFlowService.findByFlowDeploymentId(flowApproveParam.getFlowDeploymentId());
             Optional.ofNullable(tfCustomFlow.getFlowProcessVar())
                     .orElseThrow(() -> ExceptionResultEnum.FLOW_PROCESS_VAR_NO_DATA.exception());
 
@@ -294,18 +292,10 @@ public class ActivitiServiceImpl implements ActivitiService {
             if (Objects.isNull(taskTemp)) {
                 taskList = taskService.createTaskQuery().processInstanceId(processFlowId).list();
             } else {
-                tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(processFlowId)));
-                Optional.ofNullable(tfCustomFlowEntity)
-                        .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+                tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(Long.parseLong(processFlowId));
                 flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
-
                 tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-
-                tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                        .eq(TFFlowApprove::getFlowId, Long.parseLong(processFlowId)));
-                Optional.ofNullable(tfFlowApprove)
-                        .orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+                tfFlowApprove = tfFlowApproveService.findByFlowId(Long.parseLong(processFlowId));
                 taskList.add(taskTemp);
             }
             List<TFFlowLog> tfFlowLogList = new ArrayList<>();
@@ -534,10 +524,7 @@ public class ActivitiServiceImpl implements ActivitiService {
         TFCustomFlow tfCustomFlow = null;
         List<Task> taskList = null;
         if (Objects.nonNull(flowDeploymentId)) {
-            tfCustomFlow = tfCustomFlowService.getOne(
-                    new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
-            Optional.ofNullable(tfCustomFlow)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_DEPLOYMENT_NO_DATA.exception());
+            tfCustomFlow = tfCustomFlowService.findByFlowDeploymentId(flowDeploymentId);
             if (Objects.isNull(tfCustomFlow.getFlowDefinitionId())) {
                 String processDefinitionId = this.findProcessDefinitionIdByDeploymentId(flowDeploymentId);
                 tfCustomFlow.setFlowDefinitionId(processDefinitionId);
@@ -705,15 +692,9 @@ public class ActivitiServiceImpl implements ActivitiService {
             throw ExceptionResultEnum.ERROR.exception("正在转审中,请稍候再试!");
         }
         try {
-            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda()
-                            .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
-            Optional.ofNullable(tfCustomFlowEntity)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-            TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-            Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
-
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(
+                    Long.parseLong(task.getProcessInstanceId()));
+            TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
             //            FlowTaskResult flowTaskResultOne = tbSopInfoService.getFormProperties(tfCustomFlowEntity, 1);
             //            ServiceScopeEnum scopeEnum = tbSopInfoService.findServiceScope(tfCustomFlow.getType(), flowTaskResultOne);
 
@@ -834,23 +815,15 @@ public class ActivitiServiceImpl implements ActivitiService {
             throw ExceptionResultEnum.ERROR.exception("正在终止中,请稍候再试!");
         }
         try {
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(
-                    new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, flowId));
-            Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
             if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH) {
                 throw ExceptionResultEnum.ERROR.exception("已结束的流程不能作废");
             } else if (tfFlowApprove.getStatus() == FlowStatusEnum.END) {
                 throw ExceptionResultEnum.ERROR.exception("该流程已作废");
             }
 
-            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
-            Optional.ofNullable(tfCustomFlowEntity)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-            TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-            Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(flowId);
+            TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
             if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW && tfFlowApprove.getSetup().intValue() >= 4
                     && tfFlowApprove.getSetup().intValue() < 8) {
@@ -949,23 +922,16 @@ public class ActivitiServiceImpl implements ActivitiService {
         }
         TFCustomFlowEntity tfCustomFlowEntity = null;
         if (Objects.nonNull(flowId)) {
-            tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
+            tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(flowId);
         } else {
-            tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, code));
+            tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(code);
         }
-        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());
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         //获取当前流程节点
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(
-                new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, flowId));
-        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
         FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
 
@@ -1098,11 +1064,8 @@ public class ActivitiServiceImpl implements ActivitiService {
             throw ExceptionResultEnum.ERROR.exception("流程任务数据为空!");
         }
         Long flowId = Long.parseLong(taskList.get(0).getProcessInstanceId());
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-        tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_DEPLOYMENT_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(flowId);
+        tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();

+ 26 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TFCustomFlowEntityService.java

@@ -5,6 +5,8 @@ import com.qmth.sop.business.bean.result.FlowTaskMsgResult;
 import com.qmth.sop.business.bean.result.FlowTaskSmsResult;
 import com.qmth.sop.business.entity.TFCustomFlowEntity;
 
+import java.util.List;
+
 /**
  * <p>
  * 自定义流程实体数据 服务类
@@ -41,4 +43,28 @@ public interface TFCustomFlowEntityService extends IService<TFCustomFlowEntity>
      * @return
      */
     FlowTaskSmsResult getFlowTaskRemindSmsInfo(String crmNo, Long userId);
+
+    /**
+     * 根据code查询数据
+     *
+     * @param code
+     * @return
+     */
+    TFCustomFlowEntity findByCode(String code);
+
+    /**
+     * 根据派单号查询数据
+     *
+     * @param crmNo
+     * @return
+     */
+    List<TFCustomFlowEntity> findByCrmNo(String crmNo);
+
+    /**
+     * 根据流程id查询数据
+     *
+     * @param flowId
+     * @return
+     */
+    TFCustomFlowEntity findByFlowId(Long flowId);
 }

+ 16 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TFCustomFlowService.java

@@ -40,4 +40,20 @@ public interface TFCustomFlowService extends IService<TFCustomFlow> {
      * @return
      */
     List<TFCustomFlow> findFlowVersion(TFCustomTypeEnum type);
+
+    /**
+     * 根据部署id查询数据
+     *
+     * @param flowDeploymentId
+     * @return
+     */
+    TFCustomFlow findByFlowDeploymentId(String flowDeploymentId);
+
+    /**
+     * 根据id查询数据
+     *
+     * @param id
+     * @return
+     */
+    TFCustomFlow findById(Long id);
 }

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

@@ -30,4 +30,12 @@ public interface TFFlowApproveService extends IService<TFFlowApprove> {
      * @return
      */
     int findFlowPassageSopByCrmNo(String crmNo);
+
+    /**
+     * 根据流程id查询数据
+     *
+     * @param flowId
+     * @return
+     */
+    TFFlowApprove findByFlowId(Long flowId);
 }

+ 8 - 28
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmDetailServiceImpl.java

@@ -286,15 +286,10 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
                             tbCrmDetail.getId(), tbCrmDetail.getCrmNo());
                     Objects.requireNonNull(crmProjectResult, "未找到派单信息");
 
-                    TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                            new QueryWrapper<TFCustomFlowEntity>().lambda()
-                                    .eq(TFCustomFlowEntity::getCode, tbCrmDetail.getSopNo()));
-                    Optional.ofNullable(tfCustomFlowEntity)
-                            .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+                    TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(
+                            tbCrmDetail.getSopNo());
 
-                    TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-                    Optional.ofNullable(tfCustomFlow)
-                            .orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+                    TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
                     FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(),
                             FlowResult.class);
@@ -403,11 +398,7 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
                 throw ExceptionResultEnum.ERROR.exception("该条sop状态已改变,请刷新页面");
             }
             if (Objects.nonNull(tbCrmDetail.getSopNo())) {
-                TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                        new QueryWrapper<TFCustomFlowEntity>().lambda()
-                                .eq(TFCustomFlowEntity::getCode, tbCrmDetail.getSopNo()));
-                Optional.ofNullable(tfCustomFlowEntity)
-                        .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+                TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbCrmDetail.getSopNo());
                 activitiService.flowEnd(tfCustomFlowEntity.getFlowId());
             }
         }
@@ -428,12 +419,8 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
      */
     @Override
     public TBCrmDetail findBySopNo(String sopNo) {
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, sopNo));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(sopNo);
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         TBCrmDetail tbCrmDetail = null;
         if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW
@@ -458,15 +445,8 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
 
         TFFlowApprove tfFlowApprove = null;
         if (tbCrmDetail.getStatus() == CrmStatusEnum.PUBLISH) {
-            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda()
-                            .eq(TFCustomFlowEntity::getCode, tbCrmDetail.getSopNo()));
-            Optional.ofNullable(tfCustomFlowEntity)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-            tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                    .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-            Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbCrmDetail.getSopNo());
+            tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
         }
         return Objects.nonNull(tfFlowApprove) ? tfFlowApprove.getStatus() : null;
     }

+ 28 - 25
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -86,6 +86,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     TBCrmDetailService tbCrmDetailService;
 
+    @Resource
+    TBDingStatisticService tbDingStatisticService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -135,6 +138,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         tbDingApply.setCode(tfCustomFlowEntity.getCode(), tbDingApply.getAttachmentIdList(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbDingApply.getId());
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
+        TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(sysUser.getId());
+        tbDingStatisticService.buildDingStatistic(sopNo, tbUserArchives.getId());
         return tbDingApplyService.save(tbDingApply);
     }
 
@@ -336,11 +341,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 if (CollectionUtils.isEmpty(sysRoleList)) {
                     throw ExceptionResultEnum.ERROR.exception("用户角色不存在");
                 }
-                TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                        new QueryWrapper<TFCustomFlowEntity>().lambda()
-                                .eq(TFCustomFlowEntity::getCode, tbDingApply.getSopNo()));
-                Optional.ofNullable(tfCustomFlowEntity).orElseThrow(ExceptionResultEnum.FLOW_ENTITY_NO_DATA::exception);
-
+                TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbDingApply.getSopNo());
                 TBUserArchives tbUserArchives = tbUserArchivesService.getOne(new QueryWrapper<TBUserArchives>().lambda()
                         .eq(TBUserArchives::getMobileNumber, sysUser.getMobileNumber()));
 
@@ -366,6 +367,18 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 tbDingService.save(tbDing);
                 tbDingApply.setDingId(tbDing.getId());
             }
+
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(
+                    tbDingApply.getDingExceptionNo());
+            List<Task> taskList = taskService.createTaskQuery()
+                    .processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
+            if (CollectionUtils.isEmpty(taskList)) {
+                TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(tbDingApply.getCreateId());
+                tbDingStatisticService.buildDingStatistic(tbDingApply.getSopNo(), tbUserArchives.getId());
+            }
+        } else {
+            TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(tbDingApply.getCreateId());
+            tbDingStatisticService.buildDingStatistic(tbDingApply.getSopNo(), tbUserArchives.getId());
         }
         tbDingApply.setApprove(dingExceptionApprove);
         return tbDingApplyService.updateById(tbDingApply);
@@ -417,11 +430,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             throw ExceptionResultEnum.FLOW_DATA_NOT_ME.exception();
         }
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(
+                Long.parseLong(task.getProcessInstanceId()));
         TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda()
                 .eq(TBDingApply::getDingExceptionNo, tfCustomFlowEntity.getCode()));
         Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
@@ -432,12 +442,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 Objects.nonNull(tbCrmDetail) ? tbCrmDetail.getId() : null, tfCustomFlowEntity.getCrmNo());
         Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
 
-//        List<UserArchivesDto> regionCoordinatorList = crmProjectResult.getRegionCoordinatorList();
-//        if (CollectionUtils.isEmpty(regionCoordinatorList)) {
-//            throw ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空");
-//        }
-//        Optional.ofNullable(regionCoordinatorList.get(0).getUserId())
-//                .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空"));
+        //        List<UserArchivesDto> regionCoordinatorList = crmProjectResult.getRegionCoordinatorList();
+        //        if (CollectionUtils.isEmpty(regionCoordinatorList)) {
+        //            throw ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空");
+        //        }
+        //        Optional.ofNullable(regionCoordinatorList.get(0).getUserId())
+        //                .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空"));
 
         List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(),
                 tbDingApply.getCreateId(), tbDingApply.getSopNo());
@@ -468,16 +478,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 Objects.nonNull(tbCrmDetail) ? tbCrmDetail.getId() : null, tbDingApply.getCrmNo());
         Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getCode, tbDingApply.getDingExceptionNo()));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbDingApply.getDingExceptionNo());
         //获取当前流程节点
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
         FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
         FlowTaskResult currFlowTaskResult = null;

+ 2 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBProjectExchangeServiceImpl.java

@@ -246,16 +246,10 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
                 Objects.nonNull(tbCrmDetail) ? tbCrmDetail.getId() : null, tbProjectExchange.getCrmNo());
         Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getCode, tbProjectExchange.getExchangeNo()));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbProjectExchange.getExchangeNo());
 
         //获取当前流程节点
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
         FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
         FlowTaskResult currFlowTaskResult = null;

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

@@ -204,10 +204,7 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
             throw ExceptionResultEnum.FLOW_DATA_NOT_ME.exception();
         }
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(Long.parseLong(task.getProcessInstanceId()));
 
         FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();

+ 14 - 48
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -278,9 +278,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             throw ExceptionResultEnum.ERROR.exception("只有发布状态的服务单元才能新增sop");
         }
 
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda()
-                .eq(TFCustomFlow::getFlowDeploymentId, sopPublishParam.getFlowDeploymentId()));
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findByFlowDeploymentId(sopPublishParam.getFlowDeploymentId());
         TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, tfCustomFlow.getType());
         Optional.ofNullable(maxTfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
         if (maxTfCustomFlow.getVersion().intValue() != tfCustomFlow.getVersion().intValue()) {//说明版本发生变化
@@ -435,11 +433,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                     throw ExceptionResultEnum.ERROR.exception("流程已结束,无法转审");
                 }
             }
-            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda()
-                            .eq(TFCustomFlowEntity::getCode, tbCrmDetail.getSopNo()));
-            Optional.ofNullable(tfCustomFlowEntity)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbCrmDetail.getSopNo());
 
             Task task = taskService.createTaskQuery().processInstanceId(tfCustomFlowEntity.getFlowId().toString())
                     .singleResult();
@@ -483,11 +477,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Override
     @Transactional
     public Boolean sopAllocation(SopAllocationParam sopAllocationParam) throws InterruptedException {
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getFlowId, sopAllocationParam.getFlowId()));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(sopAllocationParam.getFlowId());
         TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
         FlowStatusEnum flowStatus = tbCrmDetailService.findById(
                 Objects.nonNull(tbCrmDetail) ? tbCrmDetail.getId() : null);
@@ -533,11 +523,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             throw ExceptionResultEnum.ERROR.exception("正在保存数据,请稍候再试!");
         }
         try {
-            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                    new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
-            Optional.ofNullable(tfCustomFlowEntity)
-                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
+            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(flowId);
             FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
             LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
             FlowTaskResult flowTaskResult = tbSopInfoService.getFormProperties(tfCustomFlowEntity, 1);
@@ -619,13 +605,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             throw ExceptionResultEnum.FLOW_SOP_DATA_NOT_ME.exception();
         }
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                        .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(
+                Long.parseLong(task.getProcessInstanceId()));
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
                 && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
@@ -1126,14 +1108,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         TBSopInfo tbSopInfo = this.getById(id);
         Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbSopInfo.getSopNo());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
         FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
         FlowResult flowResultNew = new FlowResult();
         BeanUtils.copyProperties(flowResult, flowResultNew);
@@ -1185,17 +1161,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         TBSopInfo tbSopInfo = this.getById(sopSaveParam.getId());
         Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
 
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbSopInfo.getSopNo()));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbSopInfo.getSopNo());
 
         String oldFlowProcessVar = tfCustomFlowEntity.getFlowProcessVar();
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
-                .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         FlowResult flowResultParam = JSONObject.parseObject(sopSaveParam.getFormProperties(), FlowResult.class);
@@ -1484,12 +1454,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
      */
     @Override
     public SopPlanTimeResult querySopPlanTime(String sopNo) {
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, sopNo));
-        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-        TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(sopNo);
+        TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
 
         Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId()))
                 .singleResult();

+ 52 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TFCustomFlowEntityServiceImpl.java

@@ -1,12 +1,18 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.bean.result.FlowTaskMsgResult;
 import com.qmth.sop.business.bean.result.FlowTaskSmsResult;
 import com.qmth.sop.business.entity.TFCustomFlowEntity;
 import com.qmth.sop.business.mapper.TFCustomFlowEntityMapper;
 import com.qmth.sop.business.service.TFCustomFlowEntityService;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.Optional;
 
 /**
  * <p>
@@ -17,7 +23,8 @@ import org.springframework.stereotype.Service;
  * @since 2023-07-17
  */
 @Service
-public class TFCustomFlowEntityServiceImpl extends ServiceImpl<TFCustomFlowEntityMapper, TFCustomFlowEntity> implements TFCustomFlowEntityService {
+public class TFCustomFlowEntityServiceImpl extends ServiceImpl<TFCustomFlowEntityMapper, TFCustomFlowEntity>
+        implements TFCustomFlowEntityService {
 
     /**
      * 根据id和用户id获取流程消息信息
@@ -54,4 +61,48 @@ public class TFCustomFlowEntityServiceImpl extends ServiceImpl<TFCustomFlowEntit
     public FlowTaskSmsResult getFlowTaskRemindSmsInfo(String crmNo, Long userId) {
         return this.baseMapper.getFlowTaskRemindSmsInfoByCrmNo(crmNo, userId);
     }
+
+    /**
+     * 根据code查询数据
+     *
+     * @param code
+     * @return
+     */
+    @Override
+    public TFCustomFlowEntity findByCode(String code) {
+        TFCustomFlowEntity tfCustomFlowEntity = this.getOne(
+                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, code));
+        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        return tfCustomFlowEntity;
+    }
+
+    /**
+     * 根据派单号查询数据
+     *
+     * @param crmNo
+     * @return
+     */
+    @Override
+    public List<TFCustomFlowEntity> findByCrmNo(String crmNo) {
+        List<TFCustomFlowEntity> tfCustomFlowEntityList = this.list(
+                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCrmNo, crmNo));
+        if (CollectionUtils.isEmpty(tfCustomFlowEntityList)) {
+            throw ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception();
+        }
+        return tfCustomFlowEntityList;
+    }
+
+    /**
+     * 根据流程id查询数据
+     *
+     * @param flowId
+     * @return
+     */
+    @Override
+    public TFCustomFlowEntity findByFlowId(Long flowId) {
+        TFCustomFlowEntity tfCustomFlowEntity = this.getOne(
+                new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
+        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        return tfCustomFlowEntity;
+    }
 }

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

@@ -8,6 +8,7 @@ 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.ExceptionResultEnum;
 import com.qmth.sop.common.enums.TFCustomTypeEnum;
 import com.qmth.sop.common.util.GsonUtil;
 import org.springframework.stereotype.Service;
@@ -78,4 +79,31 @@ public class TFCustomFlowServiceImpl extends ServiceImpl<TFCustomFlowMapper, TFC
         return this.list(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getType, type)
                 .orderByDesc(TFCustomFlow::getVersion));
     }
+
+    /**
+     * 根据部署id查询数据
+     *
+     * @param flowDeploymentId
+     * @return
+     */
+    @Override
+    public TFCustomFlow findByFlowDeploymentId(String flowDeploymentId) {
+        TFCustomFlow tfCustomFlow = this.getOne(
+                new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
+        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        return tfCustomFlow;
+    }
+
+    /**
+     * 根据id查询数据
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public TFCustomFlow findById(Long id) {
+        TFCustomFlow tfCustomFlow = this.getById(id);
+        Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
+        return tfCustomFlow;
+    }
 }

+ 19 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TFFlowApproveServiceImpl.java

@@ -1,12 +1,15 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.entity.TFFlowApprove;
 import com.qmth.sop.business.mapper.TFFlowApproveMapper;
 import com.qmth.sop.business.service.TFFlowApproveService;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 /**
  * <p>
@@ -17,7 +20,8 @@ import java.util.List;
  * @since 2023-07-17
  */
 @Service
-public class TFFlowApproveServiceImpl extends ServiceImpl<TFFlowApproveMapper, TFFlowApprove> implements TFFlowApproveService {
+public class TFFlowApproveServiceImpl extends ServiceImpl<TFFlowApproveMapper, TFFlowApprove>
+        implements TFFlowApproveService {
 
     /**
      * 根据crmNo查询flowId
@@ -40,4 +44,18 @@ public class TFFlowApproveServiceImpl extends ServiceImpl<TFFlowApproveMapper, T
     public int findFlowPassageSopByCrmNo(String crmNo) {
         return this.baseMapper.findFlowPassageSopByCrmNo(crmNo);
     }
+
+    /**
+     * 根据流程id查询数据
+     *
+     * @param flowId
+     * @return
+     */
+    @Override
+    public TFFlowApprove findByFlowId(Long flowId) {
+        TFFlowApprove tfFlowApprove = this.getOne(
+                new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, flowId));
+        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+        return tfFlowApprove;
+    }
 }

+ 3 - 11
sop-task/src/main/java/com/qmth/sop/task/job/RemindTaskJob.java

@@ -58,18 +58,10 @@ public class RemindTaskJob extends QuartzJobBean {
                 TSJobRemind tsJobRemind = tsJobRemindService.getById(tsJobRemindTask.getId());
                 if (Objects.nonNull(tsJobRemind)) {//数据还在则说明要发送提醒短信
                     if (tsJobRemind.getType() == JobQuartzTypeEnum.FLOW) {//流程发送短信
-                        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                                new QueryWrapper<TFCustomFlowEntity>().lambda()
-                                        .eq(TFCustomFlowEntity::getCode, tsJobRemind.getCode()));
-                        Optional.ofNullable(tfCustomFlowEntity)
-                                .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-
-                        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(
-                                new QueryWrapper<TFFlowApprove>().lambda()
-                                        .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
-                        Optional.ofNullable(tfFlowApprove)
-                                .orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+                        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(
+                                tsJobRemind.getCode());
 
+                        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
                         if (tfFlowApprove.getSetup().intValue() > 0) {
                             FlowTaskSmsResult flowTaskSmsResult = tsJobRemindService.getFlowTaskRemindSmsInfo(
                                     tsJobRemind.getId());

+ 2 - 6
sop-task/src/main/java/com/qmth/sop/task/listener/MyJobListener.java

@@ -1,6 +1,5 @@
 package com.qmth.sop.task.listener;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.service.*;
@@ -69,11 +68,8 @@ public class MyJobListener implements JobListener {
                                 && tsJobRemind.getRemindType() == JobTypeEnum.AFTER) {
                             TFCustomFlowEntityService tfCustomFlowEntityService = SpringContextHolder.getBean(
                                     TFCustomFlowEntityService.class);
-                            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
-                                    new QueryWrapper<TFCustomFlowEntity>().lambda()
-                                            .eq(TFCustomFlowEntity::getCode, tsJobRemind.getCode()));
-                            Optional.ofNullable(tfCustomFlowEntity)
-                                    .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+                            TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(
+                                    tsJobRemind.getCode());
 
                             if (tsJobRemind.getCode().contains(SystemConstant.SOP)) {
                                 TBDelayWarnService tbDelayWarnService = SpringContextHolder.getBean(