wangliang 3 лет назад
Родитель
Сommit
ef358643c5

+ 7 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/StartApproveSubListener.java

@@ -1,10 +1,8 @@
 package com.qmth.distributed.print.business.activiti;
 
 import com.qmth.distributed.print.business.entity.ExamTask;
-import com.qmth.distributed.print.business.entity.TFFlowApprove;
-import com.qmth.distributed.print.business.entity.TFFlowApproveLog;
-import com.qmth.distributed.print.business.entity.TFFlowLog;
-import com.qmth.distributed.print.business.service.*;
+import com.qmth.distributed.print.business.service.ExamTaskService;
+import com.qmth.distributed.print.business.service.TExamTaskFlowService;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import org.activiti.engine.delegate.DelegateExecution;
@@ -14,9 +12,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import java.util.StringJoiner;
 
 /**
  * @Description: 子流程启动监听
@@ -34,9 +30,10 @@ public class StartApproveSubListener implements ExecutionListener {
         ExamTaskService examTaskService = SpringContextHolder.getBean(ExamTaskService.class);
         TExamTaskFlowService tExamTaskFlowService = SpringContextHolder.getBean(TExamTaskFlowService.class);
         ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(delegateExecution.getRootProcessInstanceId()));
-        Map<String, Object> map = new HashMap<>();
-        map.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-        map.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(delegateExecution.getProcessInstanceId()));
-        tExamTaskFlowService.saveOrUpdate(map);
+        Map<String, Object> texamTaskFlowMap = new HashMap<>();
+        texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+        texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+        texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(delegateExecution.getProcessInstanceId()));
+        tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
     }
 }

+ 5 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -377,10 +377,11 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda().set(ExamTask::getFlowId, flowId).eq(ExamTask::getId, examTaskDetail.getExamTaskId());
             examTaskService.update(updateWrapper);
-            Map<String, Object> map2 = new HashMap<>();
-            map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-            map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> flowId);
-            tExamTaskFlowService.saveOrUpdate(map2);
+            Map<String, Object> texamTaskFlowMap = new HashMap<>();
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> flowId);
+            tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
             if (Objects.nonNull(flowId)) {
                 // 审核一级
                 Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(flowId)).singleResult();

+ 30 - 24
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -278,10 +278,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
                 ProcessInstance processInstance = activitiService.flowStart(map);
                 flowId = SystemConstant.convertIdToLong(processInstance.getId());
-                Map<String, Object> map2 = new HashMap<>();
-                map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-                map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(processInstance.getId()));
-                tExamTaskFlowService.saveOrUpdate(map2);
+                Map<String, Object> texamTaskFlowMap = new HashMap<>();
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(processInstance.getId()));
+                tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
             }
         }
         // 更改命题老师
@@ -301,10 +302,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
                     ProcessInstance processInstance = activitiService.startActivity(SystemConstant.GDYKDX_FLOW_KEY, map);
                     flowId = SystemConstant.convertIdToLong(processInstance.getId());
-                    Map<String, Object> map2 = new HashMap<>();
-                    map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-                    map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(processInstance.getId()));
-                    tExamTaskFlowService.saveOrUpdate(map2);
+                    Map<String, Object> texamTaskFlowMap = new HashMap<>();
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> SystemConstant.convertIdToLong(processInstance.getId()));
+                    tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
                 } else {
                     flowId = task.getFlowId();
                 }
@@ -436,10 +438,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 examTask.setStatus(ExamStatusEnum.STAGE);
             }
             this.save(examTask);
-            Map<String, Object> map2 = new HashMap<>();
-            map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-            map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
-            tExamTaskFlowService.saveOrUpdate(map2);
+            Map<String, Object> texamTaskFlowMap = new HashMap<>();
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+            texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
+            tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ActivitiObjectNotFoundException) {
@@ -728,10 +731,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
                 ProcessInstance processInstance = activitiService.flowStart(map);
                 examTask.setFlowId(SystemConstant.convertIdToLong(processInstance.getId()));
-                Map<String, Object> map2 = new HashMap<>();
-                map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-                map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
-                tExamTaskFlowService.saveOrUpdate(map2);
+                Map<String, Object> texamTaskFlowMap = new HashMap<>();
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+                texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
+                tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
                 examTask.updateInfo(sysUser.getId());
                 this.updateById(examTask);
             }
@@ -1518,10 +1522,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
                     ProcessInstance processInstance = activitiService.flowStart(map);
                     examTask.setFlowId(SystemConstant.convertIdToLong(processInstance.getId()));
-                    Map<String, Object> map2 = new HashMap<>();
-                    map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-                    map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
-                    tExamTaskFlowService.saveOrUpdate(map2);
+                    Map<String, Object> texamTaskFlowMap = new HashMap<>();
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
+                    tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
                 }
             }
             this.saveOrUpdate(examTask);
@@ -1658,10 +1663,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
                     ProcessInstance processInstance = activitiService.flowStart(map);
                     examTask.setFlowId(SystemConstant.convertIdToLong(processInstance.getId()));
-                    Map<String, Object> map2 = new HashMap<>();
-                    map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-                    map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
-                    tExamTaskFlowService.saveOrUpdate(map2);
+                    Map<String, Object> texamTaskFlowMap = new HashMap<>();
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.SCHOOL_ID, v -> examTask.getSchoolId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+                    texamTaskFlowMap.computeIfAbsent(SystemConstant.FLOW_ID, v -> examTask.getFlowId());
+                    tExamTaskFlowService.saveOrUpdate(texamTaskFlowMap);
                 }
             }
             this.save(examTask);

+ 14 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TExamTaskFlowServiceImpl.java

@@ -7,7 +7,9 @@ import com.qmth.distributed.print.business.entity.TExamTaskFlow;
 import com.qmth.distributed.print.business.mapper.TExamTaskFlowMapper;
 import com.qmth.distributed.print.business.service.TExamTaskFlowService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import org.springframework.stereotype.Service;
@@ -35,6 +37,9 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
     @Resource
     TExamTaskFlowMapper taskFlowMapper;
 
+    @Resource
+    CommonCacheService commonCacheService;
+
     /**
      * 保存TExamTaskFlow
      *
@@ -42,6 +47,7 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
      */
     @Override
     public boolean saveOrUpdate(Map<String, Object> map) {
+        Long schoolId = (Long) map.get(SystemConstant.SCHOOL_ID);
         Long taskId = (Long) map.get(SystemConstant.EXAM_TASK_ID);
         Long flowId = (Long) map.get(SystemConstant.FLOW_ID);
         boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_TASK_FLOW_PREFIX + flowId, SystemConstant.REDIS_LOCK_EXAM_TASK_FLOW_TIME_OUT);
@@ -56,10 +62,14 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
                 TExamTaskFlow tExamTaskFlow = new TExamTaskFlow(taskId, flowId, 1);
                 this.save(tExamTaskFlow);
             } else if (Objects.nonNull(tExamTaskFlowList) && tExamTaskFlowList.size() == 1) {
-                TExamTaskFlow tExamTaskFlow = tExamTaskFlowList.get(0);
-                Integer level = tExamTaskFlow.getLevel();
-                TExamTaskFlow tExamTaskFlowSub = new TExamTaskFlow(taskId, flowId, ++level);
-                this.save(tExamTaskFlowSub);
+                Map<String, List<String>> flowSchoolCodeMap = SystemConstant.getFlowSchoolCodeMap();
+                BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+                if (flowSchoolCodeMap.get(SystemConstant.GDYKDX_FLOW_KEY).contains(basicSchool.getCode())) {
+                    TExamTaskFlow tExamTaskFlow = tExamTaskFlowList.get(0);
+                    Integer level = tExamTaskFlow.getLevel();
+                    TExamTaskFlow tExamTaskFlowSub = new TExamTaskFlow(taskId, flowId, ++level);
+                    this.save(tExamTaskFlowSub);
+                }
             }
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);