Pārlūkot izejas kodu

流程数据修改

wangliang 3 gadi atpakaļ
vecāks
revīzija
39e2f17d89

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDto.java

@@ -39,6 +39,15 @@ public class ExamTaskDto {
     private String flowStatusStr;
     private String statusStr;
     private List<BlurryUserDto> users;
+    private boolean myself;
+
+    public boolean isMyself() {
+        return myself;
+    }
+
+    public void setMyself(boolean myself) {
+        this.myself = myself;
+    }
 
     public FlowStatusEnum getFlowStatus() {
         return flowStatus;

+ 18 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java

@@ -31,7 +31,7 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     IPage<ExamTaskDto> listTaskApply(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("auditStatus") String auditStatus, @Param("reviewStatus") String reviewStatus, @Param("cardRuleId") Long cardRuleId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") Long userId, @Param("orgIds") Set<Long> orgIds, @Param("userName") String userName);
 
-    IPage<ExamTaskDto> listTaskReviewUnaudited(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("cardRuleId") Long cardRuleId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("startCreateTime") Long startCreateTime, @Param("endCreateTime") Long endCreateTime, @Param("createName") String createName);
+    IPage<ExamTaskDto> listTaskReviewUnaudited(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("cardRuleId") Long cardRuleId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("startCreateTime") Long startCreateTime, @Param("endCreateTime") Long endCreateTime, @Param("createName") String createName, @Param("myselfFlowIds") List<Long> myselfFlowIds, @Param("notMyselfFlowIds") List<Long> notMyselfFlowIds);
 
     IPage<ExamTaskDto> listTaskReviewAudited(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("reviewStatus") String reviewStatus, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("cardRuleId") Long cardRuleId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("startCreateTime") Long startCreateTime, @Param("endCreateTime") Long endCreateTime, @Param("createName") String createName);
 
@@ -111,5 +111,21 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
      * @param flowStatus
      * @return
      */
-    List<ExamTask> findByFlowStatus(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode,@Param("courseName") String courseName,@Param("paperNumber") String paperNumber,@Param("flowStatus") String flowStatus);
+    List<ExamTask> findByFlowStatus(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("courseName") String courseName, @Param("paperNumber") String paperNumber, @Param("flowStatus") String flowStatus);
+
+    /**
+     * 获取自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    List<Long> findFlowIdToMySelf(@Param("userId") Long userId);
+
+    /**
+     * 获取不是自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    List<Long> findFlowIdToNotMySelf(@Param("userId") Long userId);
 }

+ 17 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java

@@ -183,8 +183,25 @@ public interface ExamTaskService extends IService<ExamTask> {
 
     /**
      * 查找题卡规则标题
+     *
      * @param cardRuleId 题卡规则主键
      * @return 标题名称
      */
     String findCardTitle(Long cardRuleId);
+
+    /**
+     * 获取自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    List<Long> findFlowIdToMySelf(Long userId);
+
+    /**
+     * 获取不是自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    List<Long> findFlowIdToNotMySelf(Long userId);
 }

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

@@ -611,11 +611,13 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Override
     public IPage<ExamTaskDto> listTaskReviewUnaudited(String courseCode, String paperNumber, Long userId, Long
             cardRuleId, Long startTime, Long endTime, Long startCreateTime, Long endCreateTime, String createName, Integer pageNumber, Integer pageSize) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         createName = SystemConstant.translateSpecificSign(createName);
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        Page<ExamTaskDto> page = new Page<>(pageNumber, pageSize);
-        IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskReviewUnaudited(page, schoolId, courseCode, paperNumber, userId, cardRuleId, startTime, endTime, orgIds, startCreateTime, endCreateTime, createName);
+        List<Long> myselfFlowIds = this.findFlowIdToMySelf(sysUser.getId());
+        List<Long> notMyselfFlowIds = this.findFlowIdToNotMySelf(sysUser.getId());
+        IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskReviewUnaudited(new Page<>(pageNumber, pageSize), schoolId, courseCode, paperNumber, userId, cardRuleId, startTime, endTime, orgIds, startCreateTime, endCreateTime, createName, myselfFlowIds, notMyselfFlowIds);
         return examTaskDtoIPage;
     }
 
@@ -1477,4 +1479,26 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
         return title;
     }
+
+    /**
+     * 获取自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<Long> findFlowIdToMySelf(Long userId) {
+        return examTaskMapper.findFlowIdToMySelf(userId);
+    }
+
+    /**
+     * 获取不是自己可以审核的流程id集合
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<Long> findFlowIdToNotMySelf(Long userId) {
+        return examTaskMapper.findFlowIdToNotMySelf(userId);
+    }
 }

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

@@ -31,53 +31,53 @@
     </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,
-            CASE
-                WHEN
-                    a.status = 'SUBMIT'
-                        AND (e.status = 'START'
-                        OR e.status = 'AUDITING')
-                THEN
-                    'AUDITING'
-                WHEN
-                    a.status = 'SUBMIT'
-                        AND e.status = 'REJECT'
-                THEN
-                    'REJECT'
-                WHEN
-                    a.status = 'SUBMIT'
-                        AND (e.status = 'FINISH'
-                            OR e.status is null)
-                THEN
-                    'FINISH'
-                ELSE
-                    a.status
-            END 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,
+        CASE
+        WHEN
+        a.status = 'SUBMIT'
+        AND (e.status = 'START'
+        OR e.status = 'AUDITING')
+        THEN
+        'AUDITING'
+        WHEN
+        a.status = 'SUBMIT'
+        AND e.status = 'REJECT'
+        THEN
+        'REJECT'
+        WHEN
+        a.status = 'SUBMIT'
+        AND (e.status = 'FINISH'
+        OR e.status is null)
+        THEN
+        'FINISH'
+        ELSE
+        a.status
+        END status,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime
         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
-            t_f_flow_approve e ON a.flow_id = e.flow_id
+        t_f_flow_approve e ON a.flow_id = e.flow_id
         <where>
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
@@ -151,54 +151,54 @@
     </select>
     <select id="listTaskApply" 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,
-            a.start_time startTime,
-            a.end_time endTime,
-            a.status,
-            a.teacher_name teacherName,
-            a.lecturer_name lecturerName,
-            d.name teachingRoomName,
-            CASE
-                WHEN e.status = 'FINISH' THEN 'AUDITED'
-                WHEN e.status = 'AUDITING' THEN 'AUDITING'
-                WHEN
-                    e.status IS NOT NULL
-                        AND e.status != 'FINISH'
-                        AND e.status != 'AUDITING'
-                THEN
-                    'NOT_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,
-            e.setup
+        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,
+        a.teacher_name teacherName,
+        a.lecturer_name lecturerName,
+        d.name teachingRoomName,
+        CASE
+        WHEN e.status = 'FINISH' THEN 'AUDITED'
+        WHEN e.status = 'AUDITING' THEN 'AUDITING'
+        WHEN
+        e.status IS NOT NULL
+        AND e.status != 'FINISH'
+        AND e.status != 'AUDITING'
+        THEN
+        'NOT_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,
+        e.setup
         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_org d ON a.teaching_room_id = d.id
-                LEFT JOIN
-            t_f_flow_approve e ON a.flow_id = e.flow_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_org d ON a.teaching_room_id = d.id
+        LEFT JOIN
+        t_f_flow_approve e ON a.flow_id = e.flow_id
         <where>
             a.enable = true
             and (a.status = 'STAGE' or (a.status = 'SUBMIT' and e.status = 'REJECT'))
@@ -236,43 +236,133 @@
         order by a.create_time desc
     </select>
     <select id="listTaskReviewUnaudited" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
+        select
+        t.*
+        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,
+        d.real_name createName,
+        a.start_time startTime,
+        a.end_time endTime,
+        a.enable,
+        a.create_id createId,
+        a.create_time createTime,
+        a.status,
+        a.flow_id flowId,
+        f.setup,
+        f.status as flowStatus,
+        true as myself
+        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
+        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
+        <where>
+            a.enable = true
+            AND a.review = true
+            <if test="myselfFlowIds != null and myselfFlowIds.size > 0">
+                AND a.flow_id IN
+                <foreach collection="myselfFlowIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="schoolId != null and schoolId != ''">
+                and a.school_id = #{schoolId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and a.course_code = #{courseCode}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                and a.paper_number = #{paperNumber}
+            </if>
+            <if test="userId != null and userId != ''">
+                and a.user_id = #{userId}
+            </if>
+            <if test="cardRuleId != null and cardRuleId != ''">
+                and a.card_rule_id = #{cardRuleId}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.start_time &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.start_time &lt;= #{endTime}
+            </if>
+            <if test="startCreateTime != null and startCreateTime > 0">
+                and a.create_time >= #{startCreateTime}
+            </if>
+            <if test="endCreateTime != null and endCreateTime > 0">
+                and #{endCreateTime} >= a.create_time
+            </if>
+            <if test="createName != null and createName != ''">
+                and d.real_name like concat('%',#{createName},'%')
+            </if>
+            <if test="orgIds != null">
+                AND d.org_id IN
+                <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        union all
         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,
-            a.flow_id flowId,
-            f.setup,
-            f.status as flowStatus
+        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,
+        a.flow_id flowId,
+        f.setup,
+        f.status as flowStatus,
+        false as myself
         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
         LEFT JOIN
-            t_f_flow_approve f ON a.flow_id = f.flow_id
+        t_f_flow_approve f ON a.flow_id = f.flow_id
         <where>
             a.enable = true
             AND a.review = true
-            AND a.status = 'SUBMIT' and (f.status = 'AUDITING' or f.status = 'REJECT')
+            <if test="notMyselfFlowIds != null and notMyselfFlowIds.size > 0">
+                AND a.flow_id IN
+                <foreach collection="notMyselfFlowIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>
@@ -310,7 +400,8 @@
                 </foreach>
             </if>
         </where>
-        order by a.create_time desc
+        ) t
+        order by t.createTime desc
     </select>
     <select id="listTaskReviewAudited" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">
         SELECT
@@ -393,43 +484,43 @@
     </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(g.update_time, a.update_time) createTime,
-            b.enable,
-            b.paper_type paperType,
-            b.exposed_paper_type exposedPaperType,
-            b.unexposed_paper_type unexposedPaperType,
-            CASE a.card_rule_id
-            WHEN - 1 THEN '全部通卡'
-            ELSE e.name
-            END cardRuleName,
-            f.make_method makeMethod,
-            g.setup
+        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(g.update_time, a.update_time) createTime,
+        b.enable,
+        b.paper_type paperType,
+        b.exposed_paper_type exposedPaperType,
+        b.unexposed_paper_type unexposedPaperType,
+        CASE a.card_rule_id
+        WHEN - 1 THEN '全部通卡'
+        ELSE e.name
+        END cardRuleName,
+        f.make_method makeMethod,
+        g.setup
         FROM
         exam_task a
-            LEFT JOIN
+        LEFT JOIN
         exam_task_detail b ON a.id = b.exam_task_id
-            LEFT JOIN
+        LEFT JOIN
         t_f_flow_approve g ON g.flow_id = a.flow_id
-            LEFT JOIN
+        LEFT JOIN
         sys_user c ON a.user_id = c.id
-            LEFT JOIN
+        LEFT JOIN
         sys_user d ON a.create_id = d.id
-            LEFT JOIN
+        LEFT JOIN
         basic_card_rule e ON a.card_rule_id = e.id
-            LEFT JOIN
+        LEFT JOIN
         exam_card f ON b.card_id = f.id
         <where>
             (a.status = 'SUBMIT' and a.flow_id is null or (a.flow_id is not null and g.status = 'FINISH'))
@@ -766,7 +857,7 @@
                     et.card_rule_id when -1 then '全部通卡'
                     else b.name
                 end cardRuleName,
-                art.ASSIGNEE_ as userId,
+                cast(art.ASSIGNEE_ as Decimal(24)) as userId,
                 c.real_name userName,
                 et.start_time startTime,
                 et.end_time endTime,
@@ -790,7 +881,7 @@
             left join sys_user c ON
                 art.ASSIGNEE_ = c.id
             where
-                 art.ASSIGNEE_ = #{userId}
+                 art.ASSIGNEE_ = cast(#{userId} as char)
                 and et.school_id = #{schoolId}
             UNION all
                     select
@@ -806,7 +897,7 @@
                     et.card_rule_id when -1 then '全部通卡'
                     else b.name
                 end cardRuleName,
-                ari.USER_ID_ as userId,
+                cast(ari.USER_ID_ as Decimal(24)) as userId,
                 c.real_name userName,
                 et.start_time startTime,
                 et.end_time endTime,
@@ -833,7 +924,7 @@
                 ari.USER_ID_ = c.id
             where
                 art.ASSIGNEE_ is null
-                and ari.USER_ID_ = #{userId}
+                and ari.USER_ID_ = cast(#{userId} as char)
                 and ari.TYPE_ = 'candidate'
                 and et.school_id = #{schoolId}
             union all
@@ -895,31 +986,96 @@
                 et.userId = c.id
     </select>
 
+    <select id="findFlowIdToMySelf" resultType="java.lang.Long">
+     select cast(art.PROC_INST_ID_ as Decimal(24)) as flowId
+        from
+            ACT_RU_TASK art
+        where
+             art.ASSIGNEE_ = cast(#{userId} as char)
+        UNION all
+          select
+            art.PROC_INST_ID_ as flowId
+        from
+            ACT_RU_TASK art
+        left join act_ru_identitylink ari on
+            ari.TASK_ID_ = art.ID_
+        where
+            art.ASSIGNEE_ is null
+            and ari.USER_ID_ = cast(#{userId} as char)
+            and ari.TYPE_ = 'candidate'
+    </select>
+
+    <select id="findFlowIdToNotMySelf" resultType="java.lang.Long">
+        select
+            cast(t.flowId as Decimal(24)) as flowId
+        from
+            (
+            select
+                art.PROC_INST_ID_ as flowId
+            from
+                ACT_RU_TASK art
+        UNION
+            select
+                art.PROC_INST_ID_ as flowId
+            from
+                ACT_RU_TASK art
+            left join act_ru_identitylink ari on
+                ari.TASK_ID_ = art.ID_
+            where
+                art.ASSIGNEE_ is null
+                and ari.TYPE_ = 'candidate') t
+        where
+             NOT EXISTS(
+            select
+                *
+            from
+                (
+                select
+                    art.PROC_INST_ID_ as flowId
+                from
+                    ACT_RU_TASK art
+                where
+                    art.ASSIGNEE_ = cast(#{userId} as char)
+            UNION all
+                select
+                    art.PROC_INST_ID_ as flowId
+                from
+                    ACT_RU_TASK art
+                left join act_ru_identitylink ari on
+                    ari.TASK_ID_ = art.ID_
+                where
+                    art.ASSIGNEE_ is null
+                    and ari.USER_ID_ = cast(#{userId} as char)
+                    and ari.TYPE_ = 'candidate') temp
+            where
+                t.flowId = temp.flowId)
+    </select>
+
     <select id="findByFlowStatus" resultType="com.qmth.distributed.print.business.entity.ExamTask">
         select
-            et.*
+        et.*
         from
-            exam_task et
+        exam_task et
         left join t_f_flow_approve tffa on
-            tffa.flow_id = et.flow_id
-            <where>
-                and et.enable = true
-                <if test="schoolId != null and schoolId != ''">
-                    and et.school_id = #{schoolId}
-                </if>
-                <if test="courseCode != null and courseCode != ''">
-                    and et.course_code = #{courseCode}
-                </if>
-                <if test="courseName != null and courseName != ''">
-                    and et.course_name = #{courseName}
-                </if>
-                <if test="paperNumber != null and paperNumber != ''">
-                    and et.paper_number = #{paperNumber}
-                </if>
-                <if test="flowStatus != null and flowStatus != ''">
-                    and tffa.status = #{flowStatus}
-                </if>
-            </where>
-            order by et.paper_number asc
+        tffa.flow_id = et.flow_id
+        <where>
+            and et.enable = true
+            <if test="schoolId != null and schoolId != ''">
+                and et.school_id = #{schoolId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and et.course_code = #{courseCode}
+            </if>
+            <if test="courseName != null and courseName != ''">
+                and et.course_name = #{courseName}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                and et.paper_number = #{paperNumber}
+            </if>
+            <if test="flowStatus != null and flowStatus != ''">
+                and tffa.status = #{flowStatus}
+            </if>
+        </where>
+        order by et.paper_number asc
     </select>
 </mapper>

+ 3 - 3
distributed-print/src/main/resources/application-dev.properties

@@ -12,10 +12,10 @@ spring.application.name=distributed-print
 #\u6570\u636E\u6E90\u914D\u7F6E
 db.host=localhost
 db.port=3306
-db.name=distributed-v2.2.0
-#db.name=distributed-v2.2.0-test
+#db.name=distributed-v2.2.0
+db.name=distributed-v2.2.0-test
 db.username=root
-db.password=88888888
+db.password=123456789
 
 #redis\u6570\u636E\u6E90\u914D\u7F6E
 com.qmth.redis.host=${db.host}