wangliang il y a 1 an
Parent
commit
8ea3927960

+ 7 - 1
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -267,7 +267,11 @@ public class ActivitiServiceImpl implements ActivitiService {
                         if (Objects.nonNull(flowApproveParam.getSetup())) {
                             currSetup = flowApproveParam.getSetup();
                         } else {
-                            currSetup = currSetup == setupMap.size() - 1 ? 0 : currSetup + 1;
+                            if (tfCustomFlow.getType() == TFCustomTypeEnum.DING_EXCEPTION_FLOW && currSetup == 2 && Objects.nonNull(flowApproveParam.getApproveRemark()) && Objects.equals(DingExceptionApproveEnum.NO_PASS.getTitle(), flowApproveParam.getApproveRemark())) {
+                                currSetup = 0;
+                            } else {
+                                currSetup = currSetup == setupMap.size() - 1 ? 0 : currSetup + 1;
+                            }
                         }
                         nextFlowTaskResult = this.getNextFlowTaskResult(nrOfCompletedInstances,
                                 nrOfInstances,
@@ -909,6 +913,8 @@ public class ActivitiServiceImpl implements ActivitiService {
         } else {
             if (approvePass == FlowApprovePassEnum.DRAFT || approvePass == FlowApprovePassEnum.START) {
                 tfFlowApprove.setStatus(FlowStatusEnum.valueOf(approvePass.name()));
+            } else if (nextFlowTaskResult.getSetup().intValue() == 0) {
+                tfFlowApprove.setStatus(FlowStatusEnum.FINISH);
             } else {
                 tfFlowApprove.setStatus(FlowStatusEnum.AUDITING);
             }

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/service/TBDingApplyService.java

@@ -75,11 +75,11 @@ public interface TBDingApplyService extends IService<TBDingApply> {
     /**
      * 更新考勤异常打卡时间
      *
-     * @param dingExceptionNo
+     * @param tbDingApply
      * @param dingExceptionApprove
      * @return
      */
-    Boolean updateDingExceptionTime(String dingExceptionNo, DingExceptionApproveEnum dingExceptionApprove);
+    Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove);
 
     /**
      * 考勤异常审核接口

+ 19 - 11
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -18,10 +18,7 @@ import com.qmth.sop.business.service.TBDingService;
 import com.qmth.sop.business.service.TFCustomFlowEntityService;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.DingExceptionApproveEnum;
-import com.qmth.sop.common.enums.ExceptionResultEnum;
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
-import com.qmth.sop.common.enums.InOutTypeEnum;
+import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.Task;
@@ -75,7 +72,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
         Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("考勤记录为空"));
 
-        Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, !CollectionUtils.isEmpty(tbDingApply.getApproveUserIds()) ? tbDingApply.getApproveUserIds() : Arrays.asList(String.valueOf(sysUser.getId())), tbDing.getCrmNo()));
+        //TODO 这里根据sopNo获取服务单元甲方大区经理角色
+        List<String> approveUserIds = new ArrayList<>();
+        approveUserIds.add("431777963202052096");
+        FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, tbDing.getCrmNo());
+        flowApproveParam.setApproveRemark(FlowApproveOperationEnum.START.getTitle());
+        Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
         tbDingApply.setCode(tfCustomFlowEntity.getCode(), tbDingApply.getAttachmentIdList(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbDingApply.getId());
@@ -179,15 +181,13 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     /**
      * 更新考勤异常打卡时间
      *
-     * @param dingExceptionNo
+     * @param tbDingApply
      * @param dingExceptionApprove
      * @return
      */
     @Override
     @Transactional
-    public Boolean updateDingExceptionTime(String dingExceptionNo, DingExceptionApproveEnum dingExceptionApprove) {
-        TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, dingExceptionNo));
-        Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
+    public Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove) {
         if (dingExceptionApprove == DingExceptionApproveEnum.PASS) {
             TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
             Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.DING_NO_DATA.exception());
@@ -239,9 +239,17 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
 
         TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
-        activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, Arrays.asList(String.valueOf(userId)), tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
+        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+
+        TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, tfCustomFlowEntity.getCode()));
+        Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
+
+        //TODO 这里根据sopNo获取服务单元乙方区域协调人角色
+        List<String> approveUserIds = new ArrayList<>();
+        approveUserIds.add("431778210271723520");
+        activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
 
         TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
-        return tbDingApplyService.updateDingExceptionTime(tfCustomFlowEntity.getCode(), dingExceptionApprove);
+        return tbDingApplyService.updateDingExceptionTime(tbDingApply, dingExceptionApprove);
     }
 }

+ 16 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -185,9 +185,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         FlowTaskResult flowTaskResult = JSONObject.parseObject(sopApplyParam.getFormProperties(), FlowTaskResult.class);
-        Long regionUserId = null, engineerUserId = null;
-        String assistantEngineerUserIds = null;
-        this.getApproveUserIds(flowTaskResult, regionUserId, engineerUserId, assistantEngineerUserIds);
+        Map<String,Object> mapVar = this.getApproveUserIds(flowTaskResult);
+        Long regionUserId = (Long) mapVar.get(SystemConstant.REGION_USER_ID);
+        Long engineerUserId = (Long) mapVar.get(SystemConstant.ENGINEER_USER_ID);
+        String assistantEngineerUserIds = (String) mapVar.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
 
         List<String> approveUserIds = Objects.nonNull(engineerUserId) ? Arrays.asList(String.valueOf(engineerUserId)) : Arrays.asList(String.valueOf(sysUser.getId()));
         Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(sopApplyParam.getFlowDeploymentId(), sopApplyParam.getApprove(), approveUserIds, sopApplyParam.getCrmNo(), sopApplyParam.getFormProperties()));
@@ -238,7 +239,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         if (flowTaskResult.getSetup().intValue() == 1) {
             Long regionUserId = null;
             String assistantEngineerUserIds = null;
-            this.getApproveUserIds(flowTaskResult, regionUserId, engineerUserId, assistantEngineerUserIds);
+            Map<String, Object> map = this.getApproveUserIds(flowTaskResult);
+            regionUserId = (Long) map.get(SystemConstant.REGION_USER_ID);
+            engineerUserId = (Long) map.get(SystemConstant.ENGINEER_USER_ID);
+            assistantEngineerUserIds = (String) map.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
 
             UpdateWrapper<TBSopInfoDetail> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda().eq(TBSopInfoDetail::getSopInfoId, tbSopInfo.getId())
@@ -271,11 +275,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
      * 获取审批人
      *
      * @param flowTaskResult
-     * @param regionUserId
-     * @param engineerUserId
-     * @param assistantEngineerUserIds
      */
-    public void getApproveUserIds(FlowTaskResult flowTaskResult, Long regionUserId, Long engineerUserId, String assistantEngineerUserIds) {
+    public Map<String, Object> getApproveUserIds(FlowTaskResult flowTaskResult) {
+        Map<String, Object> map = new HashMap<>();
+        Long regionUserId = null, engineerUserId = null;
+        String assistantEngineerUserIds = null;
         List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
         for (FlowFormWidgetResult f : formProperty) {
             if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue())) {
@@ -298,5 +302,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         if (Objects.isNull(engineerUserId)) {
             throw ExceptionResultEnum.ERROR.exception("实施工程师不能为空");
         }
+        map.put(SystemConstant.REGION_USER_ID, regionUserId);
+        map.put(SystemConstant.ENGINEER_USER_ID, engineerUserId);
+        map.put(SystemConstant.ASSISTANT_ENGINEER_USER_ID, assistantEngineerUserIds);
+        return map;
     }
 }