wangliang 3 rokov pred
rodič
commit
25df7804ea

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

@@ -20,6 +20,6 @@ public class DirectorApproveListener implements TaskListener {
     @Override
     public void notify(DelegateTask delegateTask) {
         //添加或签的人员,一人通过即可进入下一环节
-        delegateTask.addCandidateUsers(Arrays.asList("王总", "赵总"));
+        delegateTask.addCandidateUsers(Arrays.asList("4", "8"));
     }
 }

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

@@ -20,6 +20,6 @@ public class PresidentApproveListener implements TaskListener {
     @Override
     public void notify(DelegateTask delegateTask) {
         //添加或签的人员,一人通过即可进入下一环节
-        delegateTask.addCandidateUsers(Arrays.asList("王总", "赵总"));
+        delegateTask.addCandidateUsers(Arrays.asList("2", "6"));
     }
 }

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApprove.java

@@ -37,6 +37,9 @@ public class TFFlowApprove extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "状态,DRAFT:草稿,TO_BE_SUBMIT:待提交,SUBMIT:已提交,AUDITING:审核中,REJECT:已驳回,END:已终止,FINISH:已结束")
     private FlowStatusEnum status;
 
+    @ApiModelProperty(value = "计划步骤")
+    private Integer setup;
+
     public TFFlowApprove() {
 
     }
@@ -48,6 +51,14 @@ public class TFFlowApprove extends BaseEntity implements Serializable {
         insertInfo(userId);
     }
 
+    public Integer getSetup() {
+        return setup;
+    }
+
+    public void setSetup(Integer setup) {
+        this.setup = setup;
+    }
+
     public FlowStatusEnum getStatus() {
         return status;
     }

+ 6 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowLog.java

@@ -3,8 +3,6 @@ package com.qmth.distributed.print.business.entity;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.enums.FlowApproveLevelEnum;
 import com.qmth.teachcloud.common.enums.FlowApproveOperationEnum;
 import com.qmth.teachcloud.common.enums.FlowApprovePassEnum;
 import io.swagger.annotations.ApiModel;
@@ -37,8 +35,8 @@ public class TFFlowLog extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long approveId;
 
-    @ApiModelProperty(value = "审核等级")
-    private Integer approveLevel;
+    @ApiModelProperty(value = "审核步骤")
+    private Integer approveSetup;
 
     @ApiModelProperty(value = "审核意见")
     private String approveRemark;
@@ -107,12 +105,12 @@ public class TFFlowLog extends BaseEntity implements Serializable {
         this.approveId = approveId;
     }
 
-    public Integer getApproveLevel() {
-        return approveLevel;
+    public Integer getApproveSetup() {
+        return approveSetup;
     }
 
-    public void setApproveLevel(Integer approveLevel) {
-        this.approveLevel = approveLevel;
+    public void setApproveSetup(Integer approveSetup) {
+        this.approveSetup = approveSetup;
     }
 
     public String getApproveRemark() {

+ 3 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ActivitiService.java

@@ -64,16 +64,9 @@ public interface ActivitiService {
     public void flowLog(Map<String, Object> map);
 
     /**
-     * 根据taskId获取任务
+     * 审批任务
      *
-     * @param taskId
-     */
-    public void approveByTaskId(Long taskId);
-
-    /**
-     * 根据id获取任务列表
-     *
-     * @param userId
+     * @param map
      */
-    public void getTaskList(Long userId);
+    public void taskApprove(Map<String, Object> map);
 }

+ 30 - 28
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -11,6 +11,8 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.FlowStatusEnum;
 import com.qmth.teachcloud.common.util.ServletUtil;
+import org.activiti.bpmn.model.*;
+import org.activiti.bpmn.model.Process;
 import org.activiti.engine.HistoryService;
 import org.activiti.engine.RepositoryService;
 import org.activiti.engine.RuntimeService;
@@ -31,10 +33,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * @Description: activiti service impl
@@ -171,18 +170,22 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Transactional
     public void flowLog(Map<String, Object> map) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+
         if (Objects.isNull(map.get(SystemConstant.FLOW_ID))) {
             throw ExceptionResultEnum.ERROR.exception("流程id不能为空");
         }
         Long flowId = (Long) map.get(SystemConstant.FLOW_ID);
+
         if (Objects.isNull(map.get(SystemConstant.TASK_ID))) {
             throw ExceptionResultEnum.ERROR.exception("命题任务id不能为空");
         }
         Long taskId = (Long) map.get(SystemConstant.TASK_ID);
+
         if (Objects.isNull(map.get(SystemConstant.FLOW_STATUS))) {
             throw ExceptionResultEnum.ERROR.exception("流程状态不能为空");
         }
         FlowStatusEnum flowStatusEnum = (FlowStatusEnum) map.get(SystemConstant.FLOW_STATUS);
+
         Long teachId = Objects.nonNull(map.get(SystemConstant.TEACH_ID)) ? Long.parseLong(String.valueOf(map.get(SystemConstant.TEACH_ID))) : null;
         QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
         tfFlowApproveQueryWrapper.lambda().eq(TFFlowApprove::getFlowId, flowId);
@@ -198,38 +201,37 @@ public class ActivitiServiceImpl implements ActivitiService {
 
         //增加流水
         if (flowStatusEnum != FlowStatusEnum.DRAFT && flowStatusEnum != FlowStatusEnum.TO_BE_SUBMIT) {
-            Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
-            String processInstanceId = task.getProcessInstanceId();
-
-            // 流程标示
-            String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().getProcessDefinitionId();
-            ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
-            ExecutionEntity execution = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
-            // 当前实例的执行到哪个节点
-            String activitiId = execution.getActivityId();
-            String currentActivityId = execution.getCurrentActivityId();
-            List<TaskEntity> taskEntityList = execution.getTasks();
-            // 获得当前任务的所有节点
-//        List<ActivityImpl> activitiList = def.getIdentityLinks();
             TFFlowLog tfFlowLog = new TFFlowLog(flowId, taskId, teachId, sysUser.getId());
         }
     }
 
     /**
-     * 根据任务id获取task
+     * 审批任务
      *
-     * @param taskId
+     * @param map
      */
     @Override
     @Transactional
-    public void approveByTaskId(Long taskId) {
-        Task task1 = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
-        taskService.complete(String.valueOf(taskId));
-        Task task2 = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
-    }
-
-    @Override
-    public void getTaskList(Long userId) {
-
+    public void taskApprove(Map<String, Object> map) {
+        if (Objects.isNull(map.get(SystemConstant.FLOW_TASK_ID))) {
+            throw ExceptionResultEnum.ERROR.exception("流程任务id不能为空");
+        }
+        String flowTaskId = (String) map.get(SystemConstant.FLOW_TASK_ID);
+        Task task = taskService.createTaskQuery().taskId(flowTaskId).singleResult();
+        String processInstanceId = task.getProcessInstanceId();
+        String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().getProcessDefinitionId();
+        ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
+        String currActivityId = task.getTaskDefinitionKey();
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
+        FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(currActivityId);
+        if (currFlow instanceof UserTask) {
+            UserTask userTask = (UserTask) currFlow;
+            //广东医科大学流程
+            if (Objects.nonNull(processDefinitionEntity) && processDefinitionEntity.getKey().contains(SystemConstant.GDYKDX_FLOW_KEY)) {
+
+            }
+        }
+        //当前实例的执行到哪个节点
+        taskService.complete(String.valueOf(flowTaskId), map);
     }
 }

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

@@ -4,24 +4,24 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.qmth.distributed.print.business.entity.ExamTask">
-    <result column="id" property="id" />
-        <result column="school_id" property="schoolId" />
-        <result column="course_code" property="courseCode" />
-        <result column="course_name" property="courseName" />
-        <result column="specialty" property="specialty" />
-        <result column="paper_number" property="paperNumber" />
-        <result column="start_time" property="startTime" />
-        <result column="end_time" property="endTime" />
-        <result column="card_rule_id" property="cardRuleId" />
-        <result column="user_id" property="userId" />
-        <result column="status" property="status" />
-        <result column="review_status" property="reviewStatus" />
-        <result column="enable" property="enable" />
-        <result column="batch_no" property="batchNo" />
-        <result column="create_id" property="createId" />
-        <result column="create_time" property="createTime" />
-        <result column="update_id" property="updateId" />
-        <result column="update_time" property="updateTime" />
+        <result column="id" property="id"/>
+        <result column="school_id" property="schoolId"/>
+        <result column="course_code" property="courseCode"/>
+        <result column="course_name" property="courseName"/>
+        <result column="specialty" property="specialty"/>
+        <result column="paper_number" property="paperNumber"/>
+        <result column="start_time" property="startTime"/>
+        <result column="end_time" property="endTime"/>
+        <result column="card_rule_id" property="cardRuleId"/>
+        <result column="user_id" property="userId"/>
+        <result column="status" property="status"/>
+        <result column="review_status" property="reviewStatus"/>
+        <result column="enable" property="enable"/>
+        <result column="batch_no" property="batchNo"/>
+        <result column="create_id" property="createId"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_id" property="updateId"/>
+        <result column="update_time" property="updateTime"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -31,31 +31,31 @@
     </sql>
     <select id="listPage" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
         SELECT
-            a.id,
-            a.school_id schoolId,
-            a.course_code courseCode,
-            a.course_name courseName,
-            a.specialty,
-            a.paper_number paperNumber,
-            a.card_rule_id cardRuleId,
-            case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
-            a.user_id userId,
-            c.real_name userName,
-            d.real_name createName,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.status,
-            a.enable,
-            a.create_id createId,
-            a.create_time createTime
+        a.id,
+        a.school_id schoolId,
+        a.course_code courseCode,
+        a.course_name courseName,
+        a.specialty,
+        a.paper_number paperNumber,
+        a.card_rule_id cardRuleId,
+        case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
+        a.user_id userId,
+        c.real_name userName,
+        d.real_name createName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.status,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime
         FROM
-            exam_task a
-                LEFT JOIN
-            basic_card_rule b ON a.card_rule_id = b.id
-                LEFT JOIN
-            sys_user c ON a.user_id = c.id
-                LEFT JOIN
-            sys_user d ON a.create_id = d.id
+        exam_task a
+        LEFT JOIN
+        basic_card_rule b ON a.card_rule_id = b.id
+        LEFT JOIN
+        sys_user c ON a.user_id = c.id
+        LEFT JOIN
+        sys_user d ON a.create_id = d.id
         <where>
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
@@ -92,11 +92,11 @@
     </select>
     <select id="listUser" resultType="com.qmth.teachcloud.common.bean.dto.BlurryUserDto">
         SELECT
-           distinct a.user_id id, b.real_name name
+        distinct a.user_id id, b.real_name name
         FROM
-            exam_task a
-                LEFT JOIN
-            sys_user b ON a.user_id = b.id
+        exam_task a
+        LEFT JOIN
+        sys_user b ON a.user_id = b.id
         <where>
             b.enable = true
             <if test="schoolId != null and schoolId != ''">
@@ -109,47 +109,47 @@
     </select>
     <select id="listTaskApply" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
         select * from (SELECT
-            a.id,
-            a.school_id schoolId,
-            a.course_code courseCode,
-            a.course_name courseName,
-            a.specialty,
-            a.paper_number paperNumber,
-            a.card_rule_id cardRuleId,
-            case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
-            a.user_id userId,
-            c.real_name userName,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.status,
-            CASE
-                WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
-                WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND  a.review_status IS NOT NULL THEN 'AUDITED'
-                ELSE ''
-            END auditStatus,
-            CASE
-                WHEN a.review_status IS NULL THEN ''
-                ELSE a.review_status
-            END reviewStatus,
-            a.enable,
-            a.create_id createId,
-            a.create_time createTime
+        a.id,
+        a.school_id schoolId,
+        a.course_code courseCode,
+        a.course_name courseName,
+        a.specialty,
+        a.paper_number paperNumber,
+        a.card_rule_id cardRuleId,
+        case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
+        a.user_id userId,
+        c.real_name userName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.status,
+        CASE
+        WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
+        WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND a.review_status IS NOT NULL THEN 'AUDITED'
+        ELSE ''
+        END auditStatus,
+        CASE
+        WHEN a.review_status IS NULL THEN ''
+        ELSE a.review_status
+        END reviewStatus,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime
         FROM
-            exam_task a
-                LEFT JOIN
-            basic_card_rule b ON a.card_rule_id = b.id
-                LEFT JOIN
-            sys_user c ON a.user_id = c.id
-            <where>
-                <if test="orgIds != null and userId != null and userId != ''">
-                    and a.user_id = #{userId}
-                </if>
-            </where>
-            order by a.create_time desc) a
+        exam_task a
+        LEFT JOIN
+        basic_card_rule b ON a.card_rule_id = b.id
+        LEFT JOIN
+        sys_user c ON a.user_id = c.id
+        <where>
+            <if test="orgIds != null and userId != null and userId != ''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+        order by a.create_time desc) a
         <where>
             a.enable = true and a.status not in
             <foreach item="item" collection="status" separator="," open="(" close=")" index="">
-               #{item}
+                #{item}
             </foreach>
             <if test="schoolId != null and schoolId != ''">
                 and a.schoolId = #{schoolId}
@@ -179,42 +179,42 @@
     </select>
     <select id="listTaskReviewUnaudited" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
         SELECT
-            a.id,
-            a.school_id schoolId,
-            a.course_code courseCode,
-            a.course_name courseName,
-            a.specialty,
-            a.paper_number paperNumber,
-            a.card_rule_id cardRuleId,
-            case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
-            a.user_id userId,
-            c.real_name userName,
-            d.real_name createName,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.enable,
-            a.create_id createId,
-            a.create_time createTime,
-            a.status,
-            CASE
-                WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
-                WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND  a.review_status IS NOT NULL THEN 'AUDITED'
-                ELSE ''
-            END auditStatus,
-            CASE
-                WHEN a.review_status IS NULL THEN ''
-                ELSE a.review_status
-            END reviewStatus
+        a.id,
+        a.school_id schoolId,
+        a.course_code courseCode,
+        a.course_name courseName,
+        a.specialty,
+        a.paper_number paperNumber,
+        a.card_rule_id cardRuleId,
+        case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
+        a.user_id userId,
+        c.real_name userName,
+        d.real_name createName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime,
+        a.status,
+        CASE
+        WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
+        WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND a.review_status IS NOT NULL THEN 'AUDITED'
+        ELSE ''
+        END auditStatus,
+        CASE
+        WHEN a.review_status IS NULL THEN ''
+        ELSE a.review_status
+        END reviewStatus
         FROM
-            exam_task a
+        exam_task a
         LEFT JOIN
-            basic_card_rule b ON a.card_rule_id = b.id
+        basic_card_rule b ON a.card_rule_id = b.id
         LEFT JOIN
-            sys_user c ON a.user_id = c.id
+        sys_user c ON a.user_id = c.id
         LEFT JOIN
-            sys_user d ON a.create_id = d.id
+        sys_user d ON a.create_id = d.id
         LEFT JOIN
-            exam_task_paper_log e ON a.id = e.exam_task_id AND e.review = false
+        exam_task_paper_log e ON a.id = e.exam_task_id AND e.review = false
         <where>
             a.enable = true
             and a.review = true
@@ -251,41 +251,41 @@
     </select>
     <select id="listTaskReviewAudited" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
         SELECT
-            a.id,
-            a.school_id schoolId,
-            a.course_code courseCode,
-            a.course_name courseName,
-            a.specialty,
-            a.paper_number paperNumber,
-            a.card_rule_id cardRuleId,
-            case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
-            a.user_id userId,
-            c.real_name userName,
-            d.real_name createName,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.review_status reviewStatus,
-            a.enable,
-            a.create_id createId,
-            a.create_time createTime,
-            a.status,
-            CASE
-                WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
-                WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND  a.review_status IS NOT NULL THEN 'AUDITED'
-                ELSE ''
-            END auditStatus,
-            CASE
-                WHEN a.review_status IS NULL THEN ''
-                ELSE a.review_status
-            END reviewStatus
+        a.id,
+        a.school_id schoolId,
+        a.course_code courseCode,
+        a.course_name courseName,
+        a.specialty,
+        a.paper_number paperNumber,
+        a.card_rule_id cardRuleId,
+        case a.card_rule_id when -1 then '全部通卡' else b.name end cardRuleName,
+        a.user_id userId,
+        c.real_name userName,
+        d.real_name createName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.review_status reviewStatus,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime,
+        a.status,
+        CASE
+        WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
+        WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND a.review_status IS NOT NULL THEN 'AUDITED'
+        ELSE ''
+        END auditStatus,
+        CASE
+        WHEN a.review_status IS NULL THEN ''
+        ELSE a.review_status
+        END reviewStatus
         FROM
-            exam_task a
+        exam_task a
         LEFT JOIN
-            basic_card_rule b ON a.card_rule_id = b.id
+        basic_card_rule b ON a.card_rule_id = b.id
         LEFT JOIN
-            sys_user c ON a.user_id = c.id
+        sys_user c ON a.user_id = c.id
         LEFT JOIN
-            sys_user d ON a.create_id = d.id
+        sys_user d ON a.create_id = d.id
         <where>
             a.enable = true and a.review = true and a.status in ('STAGE','FINISH') and a.review_status is not null
             <if test="schoolId != null and schoolId != ''">
@@ -323,38 +323,38 @@
     </select>
     <select id="listTaskPaper" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto">
         SELECT
-            a.id,
-            a.school_id schoolId,
-            a.course_code courseCode,
-            a.course_name courseName,
-            a.specialty,
-            a.paper_number paperNumber,
-            a.user_id userId,
-            a.card_rule_id cardRuleId,
-            c.real_name userName,
-            d.real_name createName,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.create_id createId,
-            ifnull(e.operate_time, a.update_time)  createTime,
-            b.enable,
-            b.paper_type paperType,
-            b.exposed_paper_type exposedPaperType,
-            b.unexposed_paper_type unexposedPaperType
+        a.id,
+        a.school_id schoolId,
+        a.course_code courseCode,
+        a.course_name courseName,
+        a.specialty,
+        a.paper_number paperNumber,
+        a.user_id userId,
+        a.card_rule_id cardRuleId,
+        c.real_name userName,
+        d.real_name createName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.create_id createId,
+        ifnull(e.operate_time, a.update_time) createTime,
+        b.enable,
+        b.paper_type paperType,
+        b.exposed_paper_type exposedPaperType,
+        b.unexposed_paper_type unexposedPaperType
         FROM
-            exam_task a
-                LEFT JOIN
-            exam_task_detail b ON a.id = b.exam_task_id
-                LEFT JOIN
-            (SELECT
-                a.exam_task_id, MAX(operate_time) operate_time
-            FROM
-                exam_task_review_log a
-            GROUP BY a.exam_task_id) e ON e.exam_task_id = a.id
-                LEFT JOIN
-            sys_user c ON a.user_id = c.id
-                LEFT JOIN
-            sys_user d ON a.create_id = d.id
+        exam_task a
+        LEFT JOIN
+        exam_task_detail b ON a.id = b.exam_task_id
+        LEFT JOIN
+        (SELECT
+        a.exam_task_id, MAX(operate_time) operate_time
+        FROM
+        exam_task_review_log a
+        GROUP BY a.exam_task_id) e ON e.exam_task_id = a.id
+        LEFT JOIN
+        sys_user c ON a.user_id = c.id
+        LEFT JOIN
+        sys_user d ON a.create_id = d.id
         <where>
             a.status = 'FINISH'
             <if test="schoolId != null and schoolId != ''">
@@ -386,13 +386,13 @@
     </select>
     <select id="listPaperNumbers" resultType="com.qmth.distributed.print.business.bean.dto.RelatePaperDto">
         SELECT
-            id,
-            school_id schoolId,
-            course_code courseCode,
-            course_name courseName,
-            paper_number paperNumber
+        id,
+        school_id schoolId,
+        course_code courseCode,
+        course_name courseName,
+        paper_number paperNumber
         FROM
-            exam_task
+        exam_task
         <where>
             school_id = #{schoolId} and course_code = #{courseCode} and status = #{status} and enable = true
         </where>
@@ -419,65 +419,65 @@
     </select>
 
     <select id="queryByMyWork" resultType="com.qmth.distributed.print.business.bean.result.WorkResult">
-        <include refid="myworkCommonHead" />
-        <include refid="myworkCommonMiddle" />
+        <include refid="myworkCommonHead"/>
+        <include refid="myworkCommonMiddle"/>
         <where>
-            <include refid="myworkSubmitCommonFoot" />
+            <include refid="myworkSubmitCommonFoot"/>
         </where>
     </select>
 
     <select id="queryUserByMyWork" resultType="com.qmth.distributed.print.business.bean.result.WorkResult">
-        <include refid="myworkCommonHead" />
-        <include refid="myworkCommonMiddle" />
+        <include refid="myworkCommonHead"/>
+        <include refid="myworkCommonMiddle"/>
         <where>
-            <include refid="myworkCommonFoot" />
+            <include refid="myworkCommonFoot"/>
         </where>
     </select>
 
     <select id="queryByMyWorkSubmit" resultType="com.qmth.distributed.print.business.bean.result.WorkResult">
-        <include refid="myworkCommonHead" />
-        <include refid="myworkCommonMiddle" />
+        <include refid="myworkCommonHead"/>
+        <include refid="myworkCommonMiddle"/>
         <where>
-            <include refid="myworkSubmitCommonFootNew" />
+            <include refid="myworkSubmitCommonFootNew"/>
         </where>
     </select>
     <select id="listClientExamTaskPage"
             resultType="com.qmth.distributed.print.business.bean.dto.ClientExamTaskDto">
         SELECT
         distinct a.school_id schoolId,
-            a.id printPlanId,
-            a.name printPlanName,
-            c.course_code courseCode,
-            c.course_name courseName,
-            c.paper_number paperNumber,
-            d.id examTaskId,
-            d.specialty,
-            d.user_id userId,
-            f.real_name userName,
-            ifnull(e.is_try, false) isTry,
-            ifnull(e.is_pass, false) isPass,
-            e.try_time tryTime
+        a.id printPlanId,
+        a.name printPlanName,
+        c.course_code courseCode,
+        c.course_name courseName,
+        c.paper_number paperNumber,
+        d.id examTaskId,
+        d.specialty,
+        d.user_id userId,
+        f.real_name userName,
+        ifnull(e.is_try, false) isTry,
+        ifnull(e.is_pass, false) isPass,
+        e.try_time tryTime
         FROM
-            exam_print_plan a
-                JOIN
-            exam_detail b ON a.id = b.print_plan_id
-                JOIN
-            exam_detail_course c ON b.id = c.exam_detail_id
-                JOIN
-            exam_task d ON d.school_id = c.school_id
-                AND d.course_code = c.course_code
-                AND d.paper_number = c.paper_number
-                LEFT JOIN
-            client_status e ON e.school_id = d.school_id
-                AND b.id = e.exam_detail_id
-                AND a.id = e.print_plan_id
-                AND e.course_code = d.course_code
-                AND e.paper_number = d.paper_number
-                and e.machine_code = #{machineCode}
-                LEFT JOIN
-            sys_user f ON d.user_id = f.id
-                LEFT JOIN
-            sys_user g ON a.create_id = g.id
+        exam_print_plan a
+        JOIN
+        exam_detail b ON a.id = b.print_plan_id
+        JOIN
+        exam_detail_course c ON b.id = c.exam_detail_id
+        JOIN
+        exam_task d ON d.school_id = c.school_id
+        AND d.course_code = c.course_code
+        AND d.paper_number = c.paper_number
+        LEFT JOIN
+        client_status e ON e.school_id = d.school_id
+        AND b.id = e.exam_detail_id
+        AND a.id = e.print_plan_id
+        AND e.course_code = d.course_code
+        AND e.paper_number = d.paper_number
+        and e.machine_code = #{machineCode}
+        LEFT JOIN
+        sys_user f ON d.user_id = f.id
+        LEFT JOIN
+        sys_user g ON a.create_id = g.id
         <where>
             and a.status = #{printPlanStatus}
             and d.status = 'FINISH'
@@ -555,12 +555,12 @@
     </select>
     <select id="listExamTaskAuditExpire" resultMap="BaseResultMap">
         SELECT
-            *
+        *
         FROM
-            exam_task a
-                LEFT JOIN
-            exam_task_paper_log b ON a.id = b.exam_task_id
-                AND b.review = FALSE
+        exam_task a
+        LEFT JOIN
+        exam_task_paper_log b ON a.id = b.exam_task_id
+        AND b.review = FALSE
         <where>
             and a.enable = true
             and a.review = true
@@ -664,58 +664,82 @@
     </sql>
 
     <select id="getFlowTaskReadyList" resultType="com.qmth.distributed.print.business.bean.result.WorkResult">
-            SELECT
-                et.id,
-                et.school_id schoolId,
-                et.course_code courseCode,
-                et.course_name courseName,
-                et.specialty,
-                et.paper_number paperNumber,
-                et.card_rule_id cardRuleId,
-                case
-                    et.card_rule_id when -1 then '全部通卡'
-                    else b.name
-                end cardRuleName,
-                art.ASSIGNEE_ userId,
-                c.real_name userName,
-                et.start_time startTime,
-                et.end_time endTime,
-                tffa.status,
-                et.enable,
-                et.create_id createId,
-                et.create_time createTime,
-                art.EXECUTION_ID_ as executionId,
-                et.flow_id as flowId,
-                art.NAME_ as taskName,
-                art.TASK_DEF_KEY_ as taskDefKey,
-                art.ID_ as taskId
-            FROM
-                exam_task et
-            LEFT JOIN
-                        basic_card_rule b ON
-                et.card_rule_id = b.id
-            LEFT JOIN
-                        exam_task_paper_log d ON
-                et.id = d.exam_task_id
-                and d.review = false
-            LEFT JOIN
-                        sys_user c ON
-                et.user_id = c.id
-            left join ACT_RU_TASK art on
-                art.PROC_INST_ID_ = et.flow_id
-            left join t_f_flow_approve tffa
-                on tffa.flow_id = et.flow_id
+        select
+        et.id,
+        et.school_id schoolId,
+        et.org_id as orgId,
+        et.course_code courseCode,
+        et.course_name courseName,
+        et.specialty,
+        et.paper_number paperNumber,
+        et.card_rule_id cardRuleId,
+        case
+        et.card_rule_id when -1 then '全部通卡'
+        else b.name
+        end cardRuleName,
+        flow.userId,
+        c.real_name userName,
+        et.start_time startTime,
+        et.end_time endTime,
+        tffa.status,
+        et.enable,
+        et.create_time createTime,
+        art.EXECUTION_ID_ as executionId,
+        et.flow_id as flowId,
+        art.NAME_ as taskName,
+        art.TASK_DEF_KEY_ as taskDefKey,
+        art.ID_ as taskId
+        from
+        (
+        select
+        ari.USER_ID_ as userId,
+        ari.TASK_ID_ as taskId,
+        (
+        select
+        t.PROC_INST_ID_
+        from
+        ACT_RU_TASK t
+        where
+        t.ID_ = ari.TASK_ID_) as procInstId,
+        ari.PROC_DEF_ID_ as procDefId,
+        ari.REV_ as rev,
+        ari.GROUP_ID_ as groupId
+        from
+        act_ru_identitylink ari
+        where
+        EXISTS(
+        select
+        t.ID_
+        from
+        ACT_RU_TASK t
+        left join exam_task et
+        on
+        et.flow_id = t.PROC_INST_ID_
+        where
+        ari.TASK_ID_ = t.ID_)
+        and ari.USER_ID_ = #{userId}) flow
+        left join exam_task et
+        on
+        et.flow_id = flow.procInstId
+        LEFT JOIN
+        basic_card_rule b ON
+        et.card_rule_id = b.id
+        LEFT JOIN
+        sys_user c ON
+        flow.userId = c.id
+        left join t_f_flow_approve tffa
+        on
+        tffa.flow_id = et.flow_id
+        left join ACT_RU_TASK art on
+        art.PROC_INST_ID_ = et.flow_id
         <where>
-                <if test="userId != null and userId != ''">
-                    and art.ASSIGNEE_ = #{userId}
-                </if>
-                <if test="schoolId != null and schoolId != ''">
-                    and et.school_id = #{schoolId}
-                </if>
-                <if test="orgId != null and orgId != ''">
-                    and et.org_id = #{orgId}
-                </if>
-            </where>
+            <if test="schoolId != null and schoolId != ''">
+                and et.school_id = #{schoolId}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                and et.org_id = #{orgId}
+            </if>
+        </where>
     </select>
 
 </mapper>

+ 6 - 0
distributed-print/.bpmn/src/main/resources/processes/GdykdxPaperApprove.bpmn2d

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="BPMNdiagram" name="GdykdxPaperApprove" snapToGrid="true" version="0.11.0">
+  <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
+  <colors red="227" green="238" blue="249"/>
+  <colors red="255" green="255" blue="255"/>
+</pi:Diagram>

+ 7 - 8
distributed-print/src/main/java/com/qmth/distributed/print/api/TFFlowController.java

@@ -153,14 +153,13 @@ public class TFFlowController {
         return ResultUtil.ok();
     }
 
-    @ApiOperation(value = "命题老师获取待办流程")
+    @ApiOperation(value = "审批流程")
     @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = ResultUtil.class)})
-    @RequestMapping(value = "teach/task/list", method = RequestMethod.POST)
-    public Result teachTaskList(@ApiParam(value = "页码", required = true) @RequestParam Integer pageNumber,
-                                @ApiParam(value = "数量", required = true) @RequestParam Integer pageSize) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        List<Task> taskList = taskService.createTaskQuery().taskAssignee(String.valueOf(sysUser.getId())).orderByTaskCreateTime().desc().list();
-//        BaseListPage<Task> taskIPage = new BaseListPage<>(tasks.subList(pageNumber, pageSize), pageNumber, pageSize, tasks.size());
-        return ResultUtil.ok(true);
+    @RequestMapping(value = "/task/approve", method = RequestMethod.POST)
+    public Result teachTaskList(@ApiParam(value = "流程任务id", required = true) @RequestParam String taskId) {
+        Map<String, Object> map = new HashMap<>();
+        map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> taskId);
+        activitiService.taskApprove(map);
+        return ResultUtil.ok();
     }
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -186,6 +186,8 @@ public class SystemConstant {
     public static final String TEACH_ID = "teachId";//命题老师id
     public static final String FLOW_ID = "flowId";//流程id
     public static final String TASK_ID = "taskId";//命题任务id
+    public static final String FLOW_TASK_ID = "flowTaskId";//流程任务id
+    public static final String APPROVE = "approve";//流程审核变量
     public static final String FLOW_STATUS = "flowStatus";//流程状态
 
     /**

+ 0 - 44
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/FlowApproveLevelEnum.java

@@ -1,44 +0,0 @@
-package com.qmth.teachcloud.common.enums;
-
-import java.util.Objects;
-
-/**
- * @Description: 流程审批等级 enum
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2021/8/2
- */
-public enum FlowApproveLevelEnum {
-
-    START("发起人"),
-
-    PRIMARY("一级审核人"),
-
-    SECOND("二级审核人");
-
-    private String title;
-
-    private FlowApproveLevelEnum(String title) {
-        this.title = title;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    /**
-     * 状态转换 toName
-     *
-     * @param title
-     * @return
-     */
-    public static String convertToName(String title) {
-        for (FlowApproveLevelEnum e : FlowApproveLevelEnum.values()) {
-            if (Objects.equals(title, e.getTitle())) {
-                return e.name();
-            }
-        }
-        return null;
-    }
-}

+ 60 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/FlowGdykdxApproveSetupEnum.java

@@ -0,0 +1,60 @@
+package com.qmth.teachcloud.common.enums;
+
+import java.util.Objects;
+
+/**
+ * @Description: 广东医科大学流程审批步骤 enum
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/8/2
+ */
+public enum FlowGdykdxApproveSetupEnum {
+
+    SUBMIT("提交试卷", "usertask1", 1),
+
+    PRIMARY_APPROVE("一级审核", "usertask2", 2),
+
+    SECOND_APPROVE("二级审核", "usertask3", 3),
+
+    END("已结束或已终止", null, -1);
+
+    private String title;
+
+    private String id;
+
+    private int setup;
+
+    private FlowGdykdxApproveSetupEnum(String title, String id, int setup) {
+        this.title = title;
+        this.id = id;
+        this.setup = setup;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public int getSetup() {
+        return setup;
+    }
+
+    /**
+     * 状态转换 toName
+     *
+     * @param title
+     * @return
+     */
+    public static String convertToName(String title) {
+        for (FlowGdykdxApproveSetupEnum e : FlowGdykdxApproveSetupEnum.values()) {
+            if (Objects.equals(title, e.getTitle())) {
+                return e.name();
+            }
+        }
+        return null;
+    }
+}