Przeglądaj źródła

广药子流程update 优化

wangliang 3 lat temu
rodzic
commit
4fbfecc715
32 zmienionych plików z 218 dodań i 166 usunięć
  1. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/DirectorApproveByJxzyyListener.java
  2. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/DirectorApproveListener.java
  3. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/PresidentApproveListener.java
  4. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/PrintApproveSubListener.java
  5. 5 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/TFFlowLogResult.java
  6. 7 7
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TExamTaskFlow.java
  7. 5 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TExamTaskFlowMapper.java
  8. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowApproveLogMapper.java
  9. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowApproveMapper.java
  10. 4 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowLogMapper.java
  11. 2 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowMapper.java
  12. 11 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TExamTaskFlowService.java
  13. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowApproveLogService.java
  14. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowApproveService.java
  15. 4 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowLogService.java
  16. 2 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowService.java
  17. 14 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java
  18. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  19. 74 27
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  20. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceServiceImpl.java
  21. 21 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TExamTaskFlowServiceImpl.java
  22. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowApproveLogServiceImpl.java
  23. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowApproveServiceImpl.java
  24. 6 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowLogServiceImpl.java
  25. 4 7
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowServiceImpl.java
  26. 16 16
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  27. 4 4
      distributed-print-business/src/main/resources/mapper/ExamTaskReviewLogMapper.xml
  28. 4 4
      distributed-print-business/src/main/resources/mapper/TExamTaskFlowMapper.xml
  29. 2 2
      distributed-print-business/src/main/resources/mapper/TFFlowApproveLogMapper.xml
  30. 3 3
      distributed-print-business/src/main/resources/mapper/TFFlowApproveMapper.xml
  31. 3 3
      distributed-print-business/src/main/resources/mapper/TFFlowLogMapper.xml
  32. 12 18
      distributed-print-business/src/main/resources/mapper/TFFlowMapper.xml

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/DirectorApproveByJxzyyListener.java

@@ -65,7 +65,7 @@ public class DirectorApproveByJxzyyListener implements TaskListener {
             }
         }
         // 发送审核短信
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId, examTask.getSchoolId());
         if (tfFlowApprove.getStatus().equals(FlowStatusEnum.AUDITING)
                 && tfFlowApprove.getSetup().equals(FlowApproveSetupEnum.PRIMARY_APPROVE.getSetup())) {
             basicMessageService.sendNoticeTaskAuditFlow(examTask, sysUserList, MessageEnum.NOTICE_OF_AUDIT_CREATED);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/DirectorApproveListener.java

@@ -74,7 +74,7 @@ public class DirectorApproveListener implements TaskListener {
         tfFlowLogService.updateById(tfFlowLog);
 
         // 发送审核短信
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId, examTask.getSchoolId());
         if (tfFlowApprove.getStatus().equals(FlowStatusEnum.AUDITING)
                 && tfFlowApprove.getSetup().equals(FlowApproveSetupEnum.PRIMARY_APPROVE.getSetup())) {
             basicMessageService.sendNoticeTaskAuditFlow(examTask, sysUserList, MessageEnum.NOTICE_OF_AUDIT_CREATED);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/PresidentApproveListener.java

@@ -81,7 +81,7 @@ public class PresidentApproveListener implements TaskListener {
         tfFlowLogService.updateById(tfFlowLog);
 
         // 发送审核短信
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId, examTask.getSchoolId());
         if (tfFlowApprove.getStatus().equals(FlowStatusEnum.AUDITING)
                 && tfFlowApprove.getSetup().equals(FlowApproveSetupEnum.SECOND_APPROVE.getSetup())) {
             basicMessageService.sendNoticeTaskAuditFlow(examTask, sysUserList, MessageEnum.NOTICE_OF_AUDIT_CREATED);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/activiti/PrintApproveSubListener.java

@@ -79,7 +79,7 @@ public class PrintApproveSubListener implements TaskListener {
         tfFlowLogService.updateById(tfFlowLog);
 
         // 发送审核短信
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId);
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId, examTask.getSchoolId());
         if (tfFlowApprove.getStatus().equals(FlowStatusEnum.AUDITING)
                 && tfFlowApprove.getSetup().equals(FlowApproveSetupEnum.FOUR_APPROVE.getSetup())) {
             basicMessageService.sendNoticeTaskAuditFlow(examTask, sysUserList, MessageEnum.NOTICE_OF_AUDIT_CREATED);

+ 5 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/TFFlowLogResult.java

@@ -25,7 +25,7 @@ public class TFFlowLogResult extends ApproveUserResult implements Serializable {
 
     @ApiModelProperty(value = "任务id")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long examTaskId;
+    private Long taskId;
 
     @ApiModelProperty(value = "审核人id")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -73,12 +73,12 @@ public class TFFlowLogResult extends ApproveUserResult implements Serializable {
         this.flowId = flowId;
     }
 
-    public Long getExamTaskId() {
-        return examTaskId;
+    public Long getTaskId() {
+        return taskId;
     }
 
-    public void setExamTaskId(Long examTaskId) {
-        this.examTaskId = examTaskId;
+    public void setTaskId(Long taskId) {
+        this.taskId = taskId;
     }
 
     public Long getApproveId() {

+ 7 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TExamTaskFlow.java

@@ -27,7 +27,7 @@ public class TExamTaskFlow implements Serializable {
 
     @ApiModelProperty(value = "考试任务id")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long examTaskId;
+    private Long taskId;
 
     @ApiModelProperty(value = "流程id")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -40,9 +40,9 @@ public class TExamTaskFlow implements Serializable {
 
     }
 
-    public TExamTaskFlow(Long examTaskId, Long flowId, Integer level) {
+    public TExamTaskFlow(Long taskId, Long flowId, Integer level) {
         setId(SystemConstant.getDbUuid());
-        this.examTaskId = examTaskId;
+        this.taskId = taskId;
         this.flowId = flowId;
         this.level = level;
     }
@@ -59,12 +59,12 @@ public class TExamTaskFlow implements Serializable {
         this.id = id;
     }
 
-    public Long getExamTaskId() {
-        return examTaskId;
+    public Long getTaskId() {
+        return taskId;
     }
 
-    public void setExamTaskId(Long examTaskId) {
-        this.examTaskId = examTaskId;
+    public void setTaskId(Long taskId) {
+        this.taskId = taskId;
     }
 
     public Long getFlowId() {

+ 5 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TExamTaskFlowMapper.java

@@ -17,10 +17,10 @@ public interface TExamTaskFlowMapper extends BaseMapper<TExamTaskFlow> {
     /**
      * 根据考试任务id查找
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
-    Integer findByFlowLevel(@Param("examTaskId") Long examTaskId);
+    Integer findByFlowLevel(@Param("taskId") Long taskId);
 
     /**
      * 根据流程id查找
@@ -33,10 +33,10 @@ public interface TExamTaskFlowMapper extends BaseMapper<TExamTaskFlow> {
     /**
      * 根据考试任务id查找
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
-    Integer findByRootLevelByExamTaskId(@Param("examTaskId") Long examTaskId);
+    Integer findByRootLevelByExamTaskId(@Param("taskId") Long taskId);
 
-    Long selectMaxFlowIdByExamTaskId(Long taskId);
+    Long selectMaxFlowIdByExamTaskId(@Param("taskId") Long taskId);
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowApproveLogMapper.java

@@ -20,5 +20,5 @@ public interface TFFlowApproveLogMapper extends BaseMapper<TFFlowApproveLog> {
      * @param flowId
      * @return
      */
-    TFFlowApproveLog findByFlowId(@Param("flowId") String flowId);
+    TFFlowApproveLog findByFlowId(@Param("flowId") Long flowId);
 }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowApproveMapper.java

@@ -18,7 +18,8 @@ public interface TFFlowApproveMapper extends BaseMapper<TFFlowApprove> {
      * 根据流程id查询流程状态
      *
      * @param flowId
+     * @param schoolId
      * @return
      */
-    TFFlowApprove findByFlowId(@Param("flowId") Long flowId);
+    TFFlowApprove findByFlowId(@Param("flowId") Long flowId, @Param("schoolId") Long schoolId);
 }

+ 4 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowLogMapper.java

@@ -21,15 +21,16 @@ public interface TFFlowLogMapper extends BaseMapper<TFFlowLog> {
      * 根据流程id查询流程状态
      *
      * @param flowId
+     * @param schoolId
      * @return
      */
-    List<TFFlowLog> findByFlowId(@Param("flowId") Long flowId);
+    List<TFFlowLog> findByFlowId(@Param("flowId") Long flowId, @Param("schoolId") Long schoolId);
 
     /**
      * 根据考试任务id查询
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
-    List<TFFlowLogResult> findByExamTaskId(@Param("examTaskId") Long examTaskId);
+    List<TFFlowLogResult> findByExamTaskId(@Param("taskId") Long taskId);
 }

+ 2 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowMapper.java

@@ -42,16 +42,13 @@ public interface TFFlowMapper extends BaseMapper<TFFlow> {
     IPage<FlowApproveResult> flowApproveList(IPage<Map> iPage, @Param("status") String status, @Param("startName") String startName, @Param("createStartTime") Long createStartTime, @Param("createEndTime") Long createEndTime, @Param("schoolId") Long schoolId, @Param("orgId") Long orgId, @Param("flowId") Long flowId);
 
     /**
-     * 流程审批记录找人列表
+     * 流程审批记录找人
      *
-     * @param iPage
-     * @param startName
      * @param schoolId
-     * @param orgId
      * @param flowId
      * @return
      */
-    IPage<FlowApproveResult> flowApproveUserList(IPage<Map> iPage, @Param("startName") String startName, @Param("schoolId") Long schoolId, @Param("orgId") Long orgId, @Param("flowId") Long flowId);
+    FlowApproveResult flowApproveUserList(@Param("schoolId") Long schoolId, @Param("flowId") Long flowId);
 
     /**
      * 根据key查找id

+ 11 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TExamTaskFlowService.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.entity.TExamTaskFlow;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -25,10 +26,18 @@ public interface TExamTaskFlowService extends IService<TExamTaskFlow> {
     /**
      * 根据考试任务id查找
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
-    public TExamTaskFlow findByFlowLevel(Long examTaskId);
+    public TExamTaskFlow findByFlowLevel(Long taskId);
+
+    /**
+     * 根据考试任务id查找
+     *
+     * @param taskId
+     * @return
+     */
+    public List<TExamTaskFlow> findByExamTaskId(Long taskId);
 
     /**
      * 根据流程id查找

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowApproveLogService.java

@@ -20,5 +20,5 @@ public interface TFFlowApproveLogService extends IService<TFFlowApproveLog> {
      * @param flowId
      * @return
      */
-    TFFlowApproveLog findByFlowId(String flowId);
+    TFFlowApproveLog findByFlowId(Long flowId);
 }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowApproveService.java

@@ -17,7 +17,8 @@ public interface TFFlowApproveService extends IService<TFFlowApprove> {
      * 根据流程id查询流程状态
      *
      * @param flowId
+     * @param schoolId
      * @return
      */
-    TFFlowApprove findByFlowId(Long flowId);
+    TFFlowApprove findByFlowId(Long flowId, Long schoolId);
 }

+ 4 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowLogService.java

@@ -20,15 +20,16 @@ public interface TFFlowLogService extends IService<TFFlowLog> {
      * 根据流程id查询流程状态
      *
      * @param flowId
+     * @param schoolId
      * @return
      */
-    List<TFFlowLog> findByFlowId(Long flowId);
+    List<TFFlowLog> findByFlowId(Long flowId, Long schoolId);
 
     /**
      * 根据考试任务id查询
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
-    List<TFFlowLogResult> findByExamTaskId(Long examTaskId);
+    List<TFFlowLogResult> findByExamTaskId(Long taskId);
 }

+ 2 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowService.java

@@ -41,16 +41,13 @@ public interface TFFlowService extends IService<TFFlow> {
     public IPage<FlowApproveResult> flowApproveList(IPage<Map> iPage, String status, String startName, Long createStartTime, Long createEndTime, Long schoolId, Long orgId, Long flowId);
 
     /**
-     * 流程审批记录找人列表
+     * 流程审批记录找人
      *
-     * @param iPage
-     * @param startName
      * @param schoolId
-     * @param orgId
      * @param flowId
      * @return
      */
-    public IPage<FlowApproveResult> flowApproveUserList(IPage<Map> iPage, String startName, Long schoolId, Long orgId, Long flowId);
+    public FlowApproveResult flowApproveUserList(Long schoolId, Long flowId);
 
     /**
      * 根据key查找流程

+ 14 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -2,8 +2,6 @@ package com.qmth.distributed.print.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.result.*;
 import com.qmth.distributed.print.business.entity.*;
@@ -184,11 +182,11 @@ public class ActivitiServiceImpl implements ActivitiService {
         try {
             Task task = taskService.createTaskQuery().processInstanceId(flowId).singleResult();
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-            runtimeService.deleteProcessInstance(flowId, FlowApproveSetupEnum.END.getTitle());
+//            runtimeService.deleteProcessInstance(flowId, FlowApproveSetupEnum.END.getTitle());
+            ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(flowId));
             //流程审批
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(flowId));
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(flowId), examTask.getSchoolId());
             if (Objects.isNull(tfFlowApprove)) {
-                ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(flowId));
                 int count = sysUserService.countByTeachingRoomId(examTask.getTeachingRoomId());
                 tfFlowApprove = new TFFlowApprove(sysUser.getSchoolId(), sysUser.getOrgId(), SystemConstant.convertIdToLong(flowId), sysUser.getId(), FlowStatusEnum.END, sysUser.getId(), count == 0 ? FlowModelEnum.CHOOSE : FlowModelEnum.SYSTEM);
             } else {
@@ -199,7 +197,6 @@ public class ActivitiServiceImpl implements ActivitiService {
             tfFlowApproveService.saveOrUpdate(tfFlowApprove);
 
             //流程流水日志
-            ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(flowId));
             TFFlowLog tfFlowLog = new TFFlowLog(sysUser.getSchoolId(), sysUser.getOrgId(), examTask.getFlowId(), examTask.getId(), sysUser.getId(), sysUser.getId(), FlowApproveSetupEnum.END.getTitle());
             tfFlowLog.setApproveOperation(FlowApproveOperationEnum.END);
             tfFlowLog.setApproveSetup(FlowApproveSetupEnum.END.getSetup());
@@ -215,7 +212,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                 if (currFlow instanceof UserTask) {
                     UserTask userTask = (UserTask) currFlow;
                     //流程审批记录
-                    TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.findByFlowId(flowId);
+                    TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.findByFlowId(SystemConstant.convertIdToLong(flowId));
                     if (Objects.isNull(tfFlowApproveLog)) {
                         tfFlowApproveLog = new TFFlowApproveLog(sysUser.getSchoolId(), sysUser.getOrgId(), SystemConstant.convertIdToLong(flowId), examTask.getId(), sysUser.getId(), sysUser.getId());
                     }
@@ -250,10 +247,11 @@ public class ActivitiServiceImpl implements ActivitiService {
             }
 
             //命题任务修改
-            examTask.setFlowId(null);
-            examTask.setStatus(ExamStatusEnum.DRAFT);
+//            examTask.setFlowId(null);
+            examTask.setStatus(ExamStatusEnum.STAGE);
             examTask.updateInfo(sysUser.getId());
             examTaskService.updateById(examTask);
+            runtimeService.deleteProcessInstance(flowId, FlowApproveSetupEnum.END.getTitle());
         } catch (Exception e) {
             e.printStackTrace();
             if (e instanceof ApiException) {
@@ -315,10 +313,10 @@ public class ActivitiServiceImpl implements ActivitiService {
             FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(currActivityId);
 
             //流程审批
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(processInstanceId));
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(processInstanceId), examTask.getSchoolId());
 
             //流程审批记录
-            TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.findByFlowId(processInstanceId);
+            TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.findByFlowId(SystemConstant.convertIdToLong(processInstanceId));
 
             Map<String, Object> objectMap = new HashMap<>();
             TFFlowLog tfFlowLog = null;
@@ -477,7 +475,7 @@ public class ActivitiServiceImpl implements ActivitiService {
             flowTaskApprovePeopleAllResult = new FlowTaskApprovePeopleAllResult(SystemConstant.convertIdToLong(task.getProcessInstanceId()));
             flowTaskApprovePeopleResultList = new LinkedList();
             //获取当前流程节点
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId());
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId(), Long.parseLong((String) ServletUtil.getRequestHeaderSchoolId()));
             Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到流程状态记录"));
             if (tfFlowApprove.getSetup() <= 0) {
                 throw ExceptionResultEnum.ERROR.exception("流程已结束或已终止");
@@ -487,11 +485,7 @@ public class ActivitiServiceImpl implements ActivitiService {
 
             ExamTask examTask = examTaskService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId());
 
-            IPage<FlowApproveResult> flowApproveResultIPage = tfFlowService.flowApproveUserList(new Page<>(SystemConstant.PAGE_NUMBER, SystemConstant.PAGE_SIZE), null, SystemConstant.getHeadOrUserSchoolId(), null, flowTaskApprovePeopleAllResult.getFlowId());
-            FlowApproveResult flowApproveResult = null;
-            if (Objects.nonNull(flowApproveResultIPage) && flowApproveResultIPage.getRecords().size() > 0) {
-                flowApproveResult = flowApproveResultIPage.getRecords().get(0);
-            }
+            FlowApproveResult flowApproveResult = tfFlowService.flowApproveUserList(SystemConstant.getHeadOrUserSchoolId(), flowTaskApprovePeopleAllResult.getFlowId());
             Optional.ofNullable(flowApproveResult).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到流程审批记录"));
             List<FlowTaskResult> taskTaskAll = getTaskAll(task.getProcessInstanceId());
             switch (tfFlowApprove.getSetup()) {
@@ -700,7 +694,7 @@ public class ActivitiServiceImpl implements ActivitiService {
         Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
         Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程任务为空或该流程已被他人审核,请刷新再试!"));
         String flowId = task.getProcessInstanceId();
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(flowId));
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(flowId), Long.parseLong((String) ServletUtil.getRequestHeaderSchoolId()));
         Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到流程状态记录"));
         if (tfFlowApprove.getSetup() <= 0) {
             throw ExceptionResultEnum.ERROR.exception("流程已结束或已终止");
@@ -777,7 +771,7 @@ public class ActivitiServiceImpl implements ActivitiService {
         Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程任务为空或该流程已被他人审核,请刷新再试!"));
         FlowTaskApprovePeopleAllResult flowTaskApprovePeopleAllResult = new FlowTaskApprovePeopleAllResult(SystemConstant.convertIdToLong(task.getProcessInstanceId()));
         //获取当前流程节点
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId(), sysUser.getSchoolId());
         Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到流程状态记录"));
         if (tfFlowApprove.getSetup() <= 0) {
             throw ExceptionResultEnum.ERROR.exception("流程已结束或已终止");
@@ -877,7 +871,7 @@ public class ActivitiServiceImpl implements ActivitiService {
 
             flowTaskApprovePeopleAllResult = new FlowTaskApprovePeopleAllResult(SystemConstant.convertIdToLong(task.getProcessInstanceId()));
             //获取当前流程节点
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId());
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowTaskApprovePeopleAllResult.getFlowId(), Long.parseLong((String) ServletUtil.getRequestHeaderSchoolId()));
             Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到流程状态记录"));
             if (tfFlowApprove.getSetup() <= 0) {
                 throw ExceptionResultEnum.ERROR.exception("流程已结束或已终止");

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

@@ -427,7 +427,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
 
         ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
         // 是否审核中
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(examTask.getFlowId());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(examTask.getFlowId(), examTask.getSchoolId());
         if (!tfFlowApprove.getStatus().equals(FlowStatusEnum.FINISH)) {
             throw ExceptionResultEnum.ERROR.exception("命题任务没有审核完成,不能修改卷库");
         }

+ 74 - 27
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -113,9 +113,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Resource
     TBTaskService tbTaskService;
 
-    @Resource
-    AsyncCreatePdfTempleteService asyncCreatePdfTempleteService;
-
     @Autowired
     private ExamTaskPaperLogService examTaskPaperLogService;
 
@@ -149,6 +146,12 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Resource
     RedisUtil redisUtil;
 
+    @Resource
+    TFFlowApproveLogService tfFlowApproveLogService;
+
+    @Resource
+    TFFlowLogService tfFlowLogService;
+
     @Resource
     SysOrgService sysOrgService;
 
@@ -319,7 +322,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
         ExamTask task = this.getById(examTask.getId());
         if (Objects.nonNull(task.getFlowId())) {
-            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(task.getFlowId());
+            TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(task.getFlowId(), task.getSchoolId());
             if (tfFlowApprove.getStatus().equals(FlowStatusEnum.FINISH) ||
                     tfFlowApprove.getStatus().equals(FlowStatusEnum.END)) {
                 throw ExceptionResultEnum.ERROR.exception("流程状态为已结束或已终止,不能启用/禁用操作");
@@ -962,15 +965,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
         // 更新examTask状态status
         ExamTask examTask = this.getById(examTaskDetail.getExamTaskId());
-        UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda()
-                .set(ExamTask::getStatus, examTaskDetail.getOperateType())
-                .set(ExamTask::getUpdateId, sysUser.getId())
-                .set(ExamTask::getUpdateTime, System.currentTimeMillis())
-                .set(ExamTask::getReviewStatus, null)
-                .set(ExamTask::getFlowId, examTask.getFlowId())
-                .eq(ExamTask::getId, examTask.getId());
-        this.update(updateWrapper);
 
         if (Objects.nonNull(examTask.getFlowId()) && ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
             //TODO 加入从前端获取userId
@@ -983,8 +977,42 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 map1.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
                 activitiService.taskApprove(map1);
             }
+        } else {
+            Map<String, Object> map = new HashMap<>();
+            map.computeIfAbsent(SystemConstant.APPROVE_ID, v -> String.valueOf(examTask.getUserId()));
+            map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> examTask.getTeachingRoomId());
+            ProcessInstance processInstance = activitiService.flowStart(map);
+            examTask.setFlowId(SystemConstant.convertIdToLong(processInstance.getId()));
+
+            List<TExamTaskFlow> tExamTaskFlowList = tExamTaskFlowService.findByExamTaskId(examTask.getId());
+            tExamTaskFlowService.removeByIds(tExamTaskFlowList.stream().map(s -> s.getId()).collect(Collectors.toList()));
+
+            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);
+
+            //TODO 撤销问题
+//            Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
+//            if (Objects.nonNull(task)) {
+//                Map<String, Object> map1 = new HashMap<>();
+//                map1.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
+//                map1.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
+//                map1.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
+//                activitiService.taskApprove(map1);
+//            }
         }
 
+        UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda()
+                .set(ExamTask::getStatus, examTaskDetail.getOperateType())
+                .set(ExamTask::getUpdateId, sysUser.getId())
+                .set(ExamTask::getUpdateTime, System.currentTimeMillis())
+                .set(ExamTask::getReviewStatus, null)
+                .set(ExamTask::getFlowId, examTask.getFlowId())
+                .eq(ExamTask::getId, examTask.getId());
+        this.update(updateWrapper);
+
         QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
         ExamTaskDetail detail = examTaskDetailService.getOne(queryWrapper);
@@ -1015,6 +1043,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     }
 
     @Override
+    @Transactional
     public boolean status(ExamTask examTask) {
         if (examTask.getId() == null) {
             throw ExceptionResultEnum.ERROR.exception("参数有误");
@@ -1027,7 +1056,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             throw ExceptionResultEnum.ERROR.exception("审核流程有误,不能撤回");
         }
 
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(task.getFlowId());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(task.getFlowId(), task.getSchoolId());
         if (Objects.isNull(tfFlowApprove)) {
             throw ExceptionResultEnum.ERROR.exception("审核流程进度丢失,不能撤回");
         }
@@ -1036,21 +1065,39 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             throw ExceptionResultEnum.ERROR.exception("当前审核节点不能撤回");
         }
 
-        Map<String, Object> map = new HashMap<>();
-        map.computeIfAbsent(SystemConstant.APPROVE_ID, v -> String.valueOf(task.getUserId()));
-        map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> task.getTeachingRoomId());
-        ProcessInstance processInstance = activitiService.flowStart(map);
+//        Map<String, Object> map = new HashMap<>();
+//        map.computeIfAbsent(SystemConstant.APPROVE_ID, v -> String.valueOf(task.getUserId()));
+//        map.computeIfAbsent(SystemConstant.TEACHING_ROOM_ID, v -> task.getTeachingRoomId());
+//        ProcessInstance processInstance = activitiService.flowStart(map);
 
-        Map<String, Object> map2 = new HashMap<>();
-        map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
-        map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> Long.parseLong(processInstance.getId()));
-        tExamTaskFlowService.saveOrUpdate(map2);
+//        tfFlowApproveService.removeById(tfFlowApprove);
+//
+//        TFFlowApproveLog tfFlowApproveLog = tfFlowApproveLogService.findByFlowId(task.getFlowId());
+//        if (Objects.nonNull(tfFlowApproveLog)) {
+//            tfFlowApproveLogService.removeById(tfFlowApproveLog);
+//        }
+//
+//        List<TFFlowLog> tfFlowLogList = tfFlowLogService.findByFlowId(task.getFlowId());
+//        if (Objects.nonNull(tfFlowLogList) && tfFlowLogList.size() > 0) {
+//            tfFlowLogService.removeByIds(tfFlowLogList.stream().map(s -> s.getId()).collect(Collectors.toList()));
+//        }
+//
+//        TExamTaskFlow tExamTaskFlow = tExamTaskFlowService.findByFlowLevel(task.getId());
+//        tExamTaskFlowService.removeById(tExamTaskFlow);
 
-        UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().set(ExamTask::getStatus, ExamStatusEnum.STAGE)
-                .set(ExamTask::getFlowId, Long.parseLong(processInstance.getId()))
-                .eq(ExamTask::getId, examTask.getId());
-        return this.update(updateWrapper);
+//        UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
+//        updateWrapper.lambda().set(ExamTask::getStatus, ExamStatusEnum.STAGE)
+//                .set(ExamTask::getFlowId, null)
+//                .eq(ExamTask::getId, examTask.getId());
+//        this.update(updateWrapper);
+
+        activitiService.flowEnd(String.valueOf(task.getFlowId()));
+
+//        Map<String, Object> map2 = new HashMap<>();
+//        map2.computeIfAbsent(SystemConstant.EXAM_TASK_ID, v -> examTask.getId());
+//        map2.computeIfAbsent(SystemConstant.FLOW_ID, v -> Long.parseLong(processInstance.getId()));
+//        tExamTaskFlowService.saveOrUpdate(map2);
+        return true;
     }
 
     @Override

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceServiceImpl.java

@@ -989,7 +989,7 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
             log.info("卷库已禁用");
             return;
         }
-        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(examTask.getFlowId());
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(examTask.getFlowId(), examTask.getSchoolId());
         // 1.命题任务已完成
         if (tfFlowApprove != null && tfFlowApprove.getStatus() == FlowStatusEnum.FINISH) {
             // 2.校验考务数据是否导入

+ 21 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TExamTaskFlowServiceImpl.java

@@ -13,6 +13,7 @@ import com.qmth.teachcloud.common.util.ResultUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
@@ -41,7 +42,7 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
      */
     @Override
     public boolean saveOrUpdate(Map<String, Object> map) {
-        Long examTaskId = (Long) map.get(SystemConstant.EXAM_TASK_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);
         if (!lock) {
@@ -49,14 +50,14 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
         }
         try {
             QueryWrapper<TExamTaskFlow> taskFlowQueryWrapper = new QueryWrapper<>();
-            taskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getExamTaskId, examTaskId);
+            taskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getTaskId, taskId);
             TExamTaskFlow tExamTaskFlow = this.getOne(taskFlowQueryWrapper);
             if (Objects.isNull(tExamTaskFlow)) {
-                tExamTaskFlow = new TExamTaskFlow(examTaskId, flowId, 1);
+                tExamTaskFlow = new TExamTaskFlow(taskId, flowId, 1);
                 this.save(tExamTaskFlow);
             } else {
                 Integer level = tExamTaskFlow.getLevel();
-                TExamTaskFlow tExamTaskFlowSub = new TExamTaskFlow(examTaskId, flowId, ++level);
+                TExamTaskFlow tExamTaskFlowSub = new TExamTaskFlow(taskId, flowId, ++level);
                 this.save(tExamTaskFlowSub);
             }
         } catch (Exception e) {
@@ -76,19 +77,30 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
     /**
      * 根据考试任务id查找
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
     @Override
-    public TExamTaskFlow findByFlowLevel(Long examTaskId) {
-        Integer level = taskFlowMapper.findByFlowLevel(examTaskId);
+    public TExamTaskFlow findByFlowLevel(Long taskId) {
+        Integer level = taskFlowMapper.findByFlowLevel(taskId);
         Optional.ofNullable(level).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到子流程信息"));
         QueryWrapper<TExamTaskFlow> tExamTaskFlowQueryWrapper = new QueryWrapper<>();
-        tExamTaskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getExamTaskId, examTaskId)
+        tExamTaskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getTaskId, taskId)
                 .eq(TExamTaskFlow::getLevel, level);
         return this.getOne(tExamTaskFlowQueryWrapper);
     }
 
+    /**
+     * 根据考试任务id查找
+     *
+     * @param taskId
+     * @return
+     */
+    @Override
+    public List<TExamTaskFlow> findByExamTaskId(Long taskId) {
+        return this.list(new QueryWrapper<TExamTaskFlow>().lambda().eq(TExamTaskFlow::getTaskId, taskId));
+    }
+
     /**
      * 根据流程id查找
      *
@@ -102,7 +114,7 @@ public class TExamTaskFlowServiceImpl extends ServiceImpl<TExamTaskFlowMapper, T
         Integer level = taskFlowMapper.findByRootLevelByExamTaskId(examTaskId);
         Optional.ofNullable(level).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到主流程信息"));
         QueryWrapper<TExamTaskFlow> tExamTaskFlowQueryWrapper = new QueryWrapper<>();
-        tExamTaskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getExamTaskId, examTaskId)
+        tExamTaskFlowQueryWrapper.lambda().eq(TExamTaskFlow::getTaskId, examTaskId)
                 .eq(TExamTaskFlow::getLevel, level);
         return this.getOne(tExamTaskFlowQueryWrapper);
     }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowApproveLogServiceImpl.java

@@ -29,7 +29,7 @@ public class TFFlowApproveLogServiceImpl extends ServiceImpl<TFFlowApproveLogMap
      * @return
      */
     @Override
-    public TFFlowApproveLog findByFlowId(String flowId) {
+    public TFFlowApproveLog findByFlowId(Long flowId) {
         return tfFlowApproveLogMapper.findByFlowId(flowId);
     }
 }

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowApproveServiceImpl.java

@@ -30,7 +30,7 @@ public class TFFlowApproveServiceImpl extends ServiceImpl<TFFlowApproveMapper, T
      * @return
      */
     @Override
-    public TFFlowApprove findByFlowId(Long flowId) {
-        return tfFlowApproveMapper.findByFlowId(flowId);
+    public TFFlowApprove findByFlowId(Long flowId, Long schoolId) {
+        return tfFlowApproveMapper.findByFlowId(flowId, schoolId);
     }
 }

+ 6 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowLogServiceImpl.java

@@ -28,21 +28,22 @@ public class TFFlowLogServiceImpl extends ServiceImpl<TFFlowLogMapper, TFFlowLog
      * 根据流程id查询流程状态
      *
      * @param flowId
+     * @param schoolId
      * @return
      */
     @Override
-    public List<TFFlowLog> findByFlowId(Long flowId) {
-        return tfFlowLogMapper.findByFlowId(flowId);
+    public List<TFFlowLog> findByFlowId(Long flowId, Long schoolId) {
+        return tfFlowLogMapper.findByFlowId(flowId, schoolId);
     }
 
     /**
      * 根据考试任务id查询
      *
-     * @param examTaskId
+     * @param taskId
      * @return
      */
     @Override
-    public List<TFFlowLogResult> findByExamTaskId(Long examTaskId) {
-        return tfFlowLogMapper.findByExamTaskId(examTaskId);
+    public List<TFFlowLogResult> findByExamTaskId(Long taskId) {
+        return tfFlowLogMapper.findByExamTaskId(taskId);
     }
 }

+ 4 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowServiceImpl.java

@@ -83,7 +83,7 @@ public class TFFlowServiceImpl extends ServiceImpl<TFFlowMapper, TFFlow> impleme
 
             Long maxFlowId = tExamTaskFlowMapper.selectMaxFlowIdByExamTaskId(record.getTaskId());
             if (Objects.nonNull(maxFlowId)) {
-                List<TFFlowLog> flowLogs = tfFlowLogMapper.findByFlowId(maxFlowId);
+                List<TFFlowLog> flowLogs = tfFlowLogMapper.findByFlowId(maxFlowId, Long.parseLong((String) ServletUtil.getRequestHeaderSchoolId()));
                 TFFlowLog tfFlowLog = flowLogs.stream().sorted(Comparator.comparingLong(TFFlowLog::getCreateTime).reversed()).findFirst().orElse(null);
                 if (Objects.nonNull(tfFlowLog)) {
                     String pendApproveId = tfFlowLog.getPendApproveId();
@@ -101,18 +101,15 @@ public class TFFlowServiceImpl extends ServiceImpl<TFFlowMapper, TFFlow> impleme
     }
 
     /**
-     * 流程审批记录找人列表
+     * 流程审批记录找人
      *
-     * @param iPage
-     * @param startName
      * @param schoolId
-     * @param orgId
      * @param flowId
      * @return
      */
     @Override
-    public IPage<FlowApproveResult> flowApproveUserList(IPage<Map> iPage, String startName, Long schoolId, Long orgId, Long flowId) {
-        return tfFlowMapper.flowApproveUserList(iPage, startName, schoolId, orgId, flowId);
+    public FlowApproveResult flowApproveUserList(Long schoolId, Long flowId) {
+        return tfFlowMapper.flowApproveUserList(schoolId, flowId);
     }
 
     /**

+ 16 - 16
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -258,7 +258,7 @@
         left join t_exam_task_flow tetf on
             tetf.flow_id = art.PROC_INST_ID_
         left join exam_task a on
-            a.id = tetf.exam_task_id
+            a.id = tetf.task_id
         left join act_ru_identitylink ari on
             ari.TASK_ID_ = art.ID_
         LEFT JOIN
@@ -270,7 +270,7 @@
         LEFT JOIN
         exam_task_paper_log e ON a.id = e.exam_task_id AND e.review = false
         LEFT JOIN
-        t_f_flow_approve f ON a.flow_id = f.flow_id
+        t_f_flow_approve f ON a.school_id = f.school_id and a.flow_id = f.flow_id
         LEFT JOIN
         sys_org so ON a.teaching_room_id = so.id
         <where>
@@ -350,7 +350,7 @@
         FROM
         exam_task a
         left join t_exam_task_flow tetf on
-            a.id = tetf.exam_task_id
+            a.id = tetf.task_id
         LEFT JOIN
         basic_card_rule b ON a.card_rule_id = b.id
         LEFT JOIN
@@ -358,16 +358,16 @@
         LEFT JOIN
         sys_user d ON a.create_id = d.id
         LEFT JOIN t_f_flow_approve f ON
-        a.flow_id = f.flow_id
+            a.school_id = f.school_id and a.flow_id = f.flow_id
         LEFT JOIN t_f_flow_approve_log tffal ON
-        a.flow_id = tffal.flow_id
+            a.school_id = tffal.school_id and a.flow_id = tffal.flow_id
         LEFT JOIN
-        sys_org e ON a.teaching_room_id = e.id
+            sys_org e ON a.teaching_room_id = e.id
         <where>
             a.enable = true and a.review = true
             and (f.status = 'AUDITING' or f.status = 'REJECT' or f.status = 'FINISH')
-            and tetf.flow_id in (
-            select
+            and EXISTS (
+            select * from(select
             aht.PROC_INST_ID_
             from
             ACT_HI_TASKINST aht
@@ -402,10 +402,10 @@
             join t_exam_task_flow tetf on
                 tetf.flow_id = t.PROC_INST_ID_
             JOIN t_f_flow_approve_log tffal ON
-                tffal.task_id = tetf.exam_task_id
+                tffal.task_id = tetf.task_id
             where (tffal.primary_approve_id = #{currentUserId} or tffal.second_approve_id = #{currentUserId}
             OR tffal.three_approve_id = #{currentUserId}
-            OR tffal.four_approve_id = #{currentUserId}))
+            OR tffal.four_approve_id = #{currentUserId})) temp where temp.PROC_INST_ID_ = tetf.flow_id)
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>
@@ -865,11 +865,11 @@
             left join t_exam_task_flow tetf on
                 tetf.flow_id = art.PROC_INST_ID_
             left join exam_task et on
-                et.id = tetf.exam_task_id
+                et.id = tetf.task_id
             left join basic_card_rule b ON
                 et.card_rule_id = b.id
             left join t_f_flow_approve tffa on
-                tffa.flow_id = et.flow_id
+                tffa.school_id = et.school_id and tffa.flow_id = et.flow_id
             left join sys_user c ON
                 art.ASSIGNEE_ = c.id
             LEFT JOIN sys_user d ON
@@ -919,13 +919,13 @@
             left join t_exam_task_flow tetf on
                 tetf.flow_id = art.PROC_INST_ID_
             left join exam_task et on
-                et.id = tetf.exam_task_id
+                et.id = tetf.task_id
             left join act_ru_identitylink ari on
                 ari.TASK_ID_ = art.ID_
             left join basic_card_rule b ON
                 et.card_rule_id = b.id
             left join t_f_flow_approve tffa on
-                tffa.flow_id = et.flow_id
+                tffa.school_id = et.school_id and tffa.flow_id = et.flow_id
             left join sys_user c ON
                 ari.USER_ID_ = c.id
             LEFT JOIN sys_user d ON
@@ -1160,8 +1160,8 @@
     <select id="findByFlowId" resultType="com.qmth.distributed.print.business.entity.ExamTask">
         select * from exam_task et where
             EXISTS(
-            select tetf.exam_task_id from t_exam_task_flow tetf
-            where tetf.flow_id = #{flowId} and tetf.exam_task_id = et.id
+            select tetf.task_id from t_exam_task_flow tetf
+            where tetf.flow_id = #{flowId} and tetf.task_id = et.id
             )
     </select>
 

+ 4 - 4
distributed-print-business/src/main/resources/mapper/ExamTaskReviewLogMapper.xml

@@ -32,8 +32,8 @@
         left join sys_user su on tffl.approve_id = su.id
         where EXISTS(
             select t.flow_id from t_exam_task_flow t
-        where EXISTS (select tetf.exam_task_id from t_exam_task_flow tetf
-                where tetf.flow_id = #{flowId} and tetf.exam_task_id = t.exam_task_id)
+        where EXISTS (select tetf.task_id from t_exam_task_flow tetf
+                where tetf.flow_id = #{flowId} and tetf.task_id = t.task_id)
         and tffl.flow_id = t.flow_id)
         order by tffl.create_time desc
     </select>
@@ -55,8 +55,8 @@
             <if test="flowId > 0 and flowId != ''">
                 AND EXISTS(
                 select t.flow_id from t_exam_task_flow t
-                where EXISTS (select tetf.exam_task_id from t_exam_task_flow tetf
-                where tetf.flow_id = #{flowId} and tetf.exam_task_id = t.exam_task_id)
+                where EXISTS (select tetf.task_id from t_exam_task_flow tetf
+                where tetf.flow_id = #{flowId} and tetf.task_id = t.task_id)
                 and tffl.flow_id = t.flow_id)
             </if>
             <if test="setup != null and setup != ''">

+ 4 - 4
distributed-print-business/src/main/resources/mapper/TExamTaskFlowMapper.xml

@@ -3,17 +3,17 @@
 <mapper namespace="com.qmth.distributed.print.business.mapper.TExamTaskFlowMapper">
 
     <select id="findByFlowLevel" resultType="java.lang.Integer">
-        SELECT max(t.level) FROM t_exam_task_flow t WHERE t.exam_task_id = #{examTaskId}
+        SELECT max(t.level) FROM t_exam_task_flow t WHERE t.task_id = #{taskId}
     </select>
 
     <select id="findByRootLevel" resultType="java.lang.Long">
-        SELECT t.exam_task_id FROM t_exam_task_flow t WHERE t.flow_id = #{flowId}
+        SELECT t.task_id FROM t_exam_task_flow t WHERE t.flow_id = #{flowId}
     </select>
 
     <select id="findByRootLevelByExamTaskId" resultType="java.lang.Integer">
-        SELECT min(t.level) FROM t_exam_task_flow t WHERE t.exam_task_id = #{examTaskId}
+        SELECT min(t.level) FROM t_exam_task_flow t WHERE t.task_id = #{taskId}
     </select>
     <select id="selectMaxFlowIdByExamTaskId" resultType="java.lang.Long">
-        select max(flow_id) from t_exam_task_flow t where t.exam_task_id = #{taskId}
+        select max(flow_id) from t_exam_task_flow t where t.task_id = #{taskId}
     </select>
 </mapper>

+ 2 - 2
distributed-print-business/src/main/resources/mapper/TFFlowApproveLogMapper.xml

@@ -5,8 +5,8 @@
     <select id="findByFlowId" resultType="com.qmth.distributed.print.business.entity.TFFlowApproveLog">
         select * from t_f_flow_approve_log tffal
          where EXISTS(
-            select tetf.exam_task_id from t_exam_task_flow tetf
-            where tetf.flow_id = #{flowId} and tetf.exam_task_id = tffal.task_id
+            select tetf.task_id from t_exam_task_flow tetf
+            where tetf.flow_id = #{flowId} and tetf.task_id = tffal.task_id
             )
     </select>
 </mapper>

+ 3 - 3
distributed-print-business/src/main/resources/mapper/TFFlowApproveMapper.xml

@@ -6,9 +6,9 @@
         select * from t_f_flow_approve tffa
         where EXISTS(
             select t.flow_id from t_exam_task_flow t
-            where EXISTS (select tetf.exam_task_id from t_exam_task_flow tetf
-            where tetf.flow_id = #{flowId} and t.exam_task_id = tetf.exam_task_id)
-            and t.`level` = 1 and tffa.flow_id = t.flow_id
+            where EXISTS (select tetf.task_id from t_exam_task_flow tetf
+            where tetf.flow_id = #{flowId} and t.task_id = tetf.task_id)
+            and t.`level` = 1 and tffa.school_id = #{schoolId} and tffa.flow_id = t.flow_id
             )
     </select>
 </mapper>

+ 3 - 3
distributed-print-business/src/main/resources/mapper/TFFlowLogMapper.xml

@@ -6,7 +6,7 @@
         select * from t_f_flow_log tffl
          join t_exam_task_flow tetf on
          tetf.flow_id = tffl.flow_id
-         where tffl.flow_id = #{flowId}
+         where tffl.school_id = #{schoolId} and tffl.flow_id = #{flowId}
     </select>
 
     <select id="findByExamTaskId" resultType="com.qmth.distributed.print.business.bean.result.TFFlowLogResult">
@@ -18,7 +18,7 @@
             tffl.pend_approve_id as pendApproveId,
             tffl.create_time as createTime,
             tffl.flow_id as flowId,
-            tffl.task_id as examTaskId,
+            tffl.task_id as askId,
             tffl.id,
             tffl.paper_attachment_id as paperAttachmentId,
             su.school_id as schoolId,
@@ -36,7 +36,7 @@
         join sys_org so on
             so.id = su.org_id
         where
-            tffl.task_id = #{examTaskId}
+            tffl.task_id = #{taskId}
         order by
             tffl.create_time desc
     </select>

+ 12 - 18
distributed-print-business/src/main/resources/mapper/TFFlowMapper.xml

@@ -5,13 +5,13 @@
     <select id="list" resultType="com.qmth.distributed.print.business.entity.TFFlow">
         select tff.id,tff.school_id as schoolId,tff.org_id as orgId,tff.name,tff.enable,tff.publish from t_f_flow tff
         <where>
-            and tff.enable = 1
-            <if test="name != null and name != ''">
-                and tff.name like concat('%',#{name},'%')
-            </if>
             <if test="schoolId != null and schoolId != ''">
                 and tff.school_id = #{schoolId}
             </if>
+            <if test="name != null and name != ''">
+                and tff.name like concat('%',#{name},'%')
+            </if>
+            and tff.enable = 1
 <!--            <if test="orgId != null and orgId != ''">-->
 <!--                and tff.org_id = #{orgId}-->
 <!--            </if>-->
@@ -32,6 +32,9 @@
         left join t_f_flow_approve tffa on tffa.flow_id = tffal.flow_id
         left join sys_user su on su.id = tffal.start_id
         <where>
+            <if test="schoolId != null and schoolId != ''">
+                and tffal.school_id = #{schoolId}
+            </if>
             <if test="status != null and status != ''">
                 and tffa.status = #{status}
             </if>
@@ -44,16 +47,13 @@
             <if test="createEndTime != null and createEndTime != ''">
                 and tffal.create_time &lt;= #{createEndTime}
             </if>
-            <if test="schoolId != null and schoolId != ''">
-                and tffal.school_id = #{schoolId}
-            </if>
 <!--            <if test="orgId != null and orgId != ''">-->
 <!--                and tffal.org_id = #{orgId}-->
 <!--            </if>-->
             <if test="flowId != null and flowId != ''">
                 and EXISTS(
-                select tetf.exam_task_id from t_exam_task_flow tetf
-                where tetf.flow_id = #{flowId} and tetf.exam_task_id = tffal.task_id
+                select tetf.task_id from t_exam_task_flow tetf
+                where tetf.flow_id = #{flowId} and tetf.task_id = tffal.task_id
                 )
             </if>
             and tffal.enable = 1
@@ -108,22 +108,16 @@
         tffa.status
         from
         t_f_flow_approve_log tffal
-        left join t_f_flow_approve tffa on tffa.flow_id = tffal.flow_id
+        left join t_f_flow_approve tffa on tffa.school_id = tffal.school_id and tffa.flow_id = tffal.flow_id
         left join sys_user su on su.id = tffal.start_id
         <where>
-            <if test="startName != null and startName != ''">
-                and su.real_name like concat('%',#{startName},'%')
-            </if>
             <if test="schoolId != null and schoolId != ''">
                 and tffal.school_id = #{schoolId}
             </if>
-            <!--            <if test="orgId != null and orgId != ''">-->
-            <!--                and tffal.org_id = #{orgId}-->
-            <!--            </if>-->
             <if test="flowId != null and flowId != ''">
                 and EXISTS(
-                select tetf.exam_task_id from t_exam_task_flow tetf
-                where tetf.flow_id = #{flowId} and tetf.exam_task_id = tffal.task_id
+                select tetf.task_id from t_exam_task_flow tetf
+                where tetf.flow_id = #{flowId} and tetf.task_id = tffal.task_id
                 )
             </if>
             and tffal.enable = 1