浏览代码

3.2.7 bug修改

xiaofei 1 年之前
父节点
当前提交
f4befd9d68

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

@@ -58,6 +58,9 @@ public class ExamDetailCourse extends BaseEntity implements Serializable {
     @TableField("clazz_id")
     private String clazzId;
 
+    @TableField("clazz_name")
+    private String clazzName;
+
     @ApiModelProperty(value = "备用题卡json")
     @TableField("attachment_id")
     private String attachmentId;
@@ -158,6 +161,14 @@ public class ExamDetailCourse extends BaseEntity implements Serializable {
         this.clazzId = clazzId;
     }
 
+    public String getClazzName() {
+        return clazzName;
+    }
+
+    public void setClazzName(String clazzName) {
+        this.clazzName = clazzName;
+    }
+
     public String getCommonAttachmentId() {
         return commonAttachmentId;
     }

+ 4 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -710,6 +710,10 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             examDetailCourse.setPaperNumber(paperNumber);
             examDetailCourse.setTotalSubjects(examDetailCourseStudentList.size());
             examDetailCourse.setCreateId(sysUser.getId());
+            String clazzName = examDetailCourseStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).map(ExaminationImportDto::getClazzName).collect(Collectors.joining(","));
+            if (StringUtils.isNotBlank(clazzName)) {
+                examDetailCourse.setClazzName(clazzName);
+            }
             examDetailCourseService.save(examDetailCourse);
 
             //组装exam_student数据

+ 3 - 12
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPrintPlanServiceImpl.java

@@ -28,6 +28,7 @@ import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.redisson.api.mapreduce.RCollator;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -347,19 +348,9 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
                 }
             }
 
-            // 班级
-            String className = examDetailService.findClazzNamesByClazzIds(record.getClassId(), ",");
-            if (StringUtils.isBlank(className)) {
-                // 查询考场下考生对应的班级
-                List<ExamStudent> examStudentList = examDetailService.listStudentByExamDetailId(record.getExamDetailId());
-                if (!CollectionUtils.isEmpty(examStudentList)) {
-                    List<String> classNameList = examStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).map(ExamStudent::getClazzName).distinct().collect(Collectors.toList());
-                    if (!CollectionUtils.isEmpty(classNameList)) {
-                        className = String.join(",", classNameList);
-                    }
-                }
+            if(StringUtils.isNotBlank(record.getClassName())){
+                record.setClassName(String.join(",", new HashSet<>(Arrays.asList(record.getClassName().split(",")))));
             }
-            record.setClassName(className);
         }
         return clientPrintTaskDtoIPage;
     }

+ 0 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskPrintServiceImpl.java

@@ -139,18 +139,4 @@ public class ExamTaskPrintServiceImpl extends ServiceImpl<ExamTaskPrintMapper, E
         return taskPrintClassDtos;
     }
 
-    private void validateClass(List<ExamTaskPrint> examTaskPrints, List<String> classIds) {
-        if (!CollectionUtils.isEmpty(examTaskPrints)) {
-            for (ExamTaskPrint taskPrint : examTaskPrints) {
-                List<String> hisClassIds = Arrays.asList(taskPrint.getClassId().split(","));
-                for (String classId : classIds) {
-                    if (hisClassIds.contains(classId)) {
-                        String clazzNamesByClazzIds = examDetailService.findClazzNamesByClazzIds(classId, ",");
-                        throw ExceptionResultEnum.ERROR.exception(clazzNamesByClazzIds + "已分配考场");
-                    }
-                }
-            }
-        }
-    }
-
 }

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

@@ -1447,6 +1447,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                         examDetailCourse.setCourseName(examTask.getCourseName());
                         examDetailCourse.setPaperNumber(paperNumber);
                         examDetailCourse.setClazzId(examDetailList.getClassId());
+                        examDetailCourse.setClazzName(examDetailList.getClassName());
                         examDetailCourse.setTotalSubjects(examDetailList.getStudentCount());
                         examDetailCourse.setCreateId(sysUser.getId());
                         examDetailCourseService.save(examDetailCourse);

+ 14 - 0
distributed-print-business/src/main/resources/db/log/脚本-xiaof.sql

@@ -319,3 +319,17 @@ UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '375');
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '376');
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '391');
+
+
+ALTER TABLE `exam_detail_course` ADD COLUMN `clazz_name` MEDIUMTEXT NULL COMMENT '班级(取学生表中的班级集合)' AFTER `clazz_id`;
+
+UPDATE exam_detail_course edc
+SET
+    edc.clazz_name = (SELECT
+                          GROUP_CONCAT(DISTINCT es.clazz_name)
+                      FROM
+                          exam_student es
+                      WHERE
+                          clazz_name IS NOT NULL
+                        AND edc.id = es.exam_detail_course_id
+                      GROUP BY es.exam_detail_course_id);

+ 14 - 1
distributed-print-business/src/main/resources/db/upgrade/3.2.7.sql

@@ -225,4 +225,17 @@ UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '374');
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '375');
 UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '376');
-UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '391');
+UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '391');
+
+ALTER TABLE `exam_detail_course` ADD COLUMN `clazz_name` MEDIUMTEXT NULL COMMENT '班级(取学生表中的班级集合)' AFTER `clazz_id`;
+
+UPDATE exam_detail_course edc
+SET
+    edc.clazz_name = (SELECT
+                          GROUP_CONCAT(DISTINCT es.clazz_name)
+                      FROM
+                          exam_student es
+                      WHERE
+                          clazz_name IS NOT NULL
+                        AND edc.id = es.exam_detail_course_id
+                      GROUP BY es.exam_detail_course_id);

+ 1 - 1
distributed-print-business/src/main/resources/mapper/ExamDetailCourseMapper.xml

@@ -417,7 +417,7 @@
                 and a.paper_number like concat('%', #{param},'%')
             </if>
             <if test="orgIds != null and orgIds != '' and orgIds.size > 0">
-                AND a.org_id IN
+                AND b.org_id IN
                 <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
                     #{item}
                 </foreach>

+ 156 - 124
distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml

@@ -147,13 +147,12 @@
             </if>
         </where>
     </select>
-    <select id="listClientPrintTask"
-            resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto">
+    <select id="listClientPrintTask" resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto">
         SELECT
             b.id examDetailId,
             b.package_code packageCode,
             a.id printPlanId,
-            a.name printPlanName,
+            a.NAME printPlanName,
             a.print_content printContent,
             a.variable_content variableContent,
             a.ordinary_content ordinaryContent,
@@ -162,112 +161,138 @@
             c.courseNameCode,
             c.paperNumber,
             c.classId,
+            c.className,
             b.exam_place examPlace,
             b.exam_room examRoom,
             b.total_subjects totalSubjects,
             IFNULL(b.paper_pages, 0) paperPages,
             IFNULL(b.card_pages, 0) cardPages,
             IFNULL(b.pages_a4, 0) pagesA4,
-            case b.status when 'FINISH' then IFNULL(b.paper_pages, 0)+IFNULL(b.card_pages, 0)+IFNULL(b.pages_a4, 0) else 0 end totalPrint,
+            CASE b.STATUS
+                WHEN 'FINISH' THEN IFNULL(b.paper_pages, 0) + IFNULL(b.card_pages, 0) + IFNULL(b.pages_a4, 0)
+                ELSE 0
+                END totalPrint,
             c.singlePagesA3,
-            b.status,
-            ifnull(b.validate, false) validate,
-            case c.isDownload when 0 then true else false end download,
+            b.STATUS,
+            IFNULL(b.validate, FALSE) validate,
+            CASE c.isDownload
+                WHEN 0 THEN TRUE
+                ELSE FALSE
+                END download,
             b.print_user printUser,
-            e.real_name printUserName,
             b.print_start_time printStartTime,
             b.print_end_time printEndTime,
-            case c.isTry when 0 then true else false end isTry,
-            case c.isPass when 0 then true else false end isPass
+            CASE c.isTry
+                WHEN 0 THEN TRUE
+                ELSE FALSE
+                END isTry,
+            CASE c.isPass
+                WHEN 0 THEN TRUE
+                ELSE FALSE
+                END isPass
         FROM
-            (select epp.school_id, epp.id,epp.name,epp.print_content,epp.variable_content,epp.ordinary_content,epp.status from exam_print_plan epp
-                LEFT JOIN
-                basic_exam be ON epp.exam_id = be.id
-            <where>
-                and epp.school_id = #{schoolId}
-                and be.enable = true
-                and be.semester_id = #{semesterId}
-                <if test="examId != null">
-                    and be.id = #{examId}
-                </if>
-                <if test="printPlanId != null">
-                    and epp.id = #{printPlanId}
-                </if>
-            </where>
-            ) a
+            (SELECT
+                 epp.school_id,
+                 epp.id,
+                 epp.exam_id,
+                 epp.NAME,
+                 epp.print_content,
+                 epp.variable_content,
+                 epp.ordinary_content,
+                 epp.STATUS
+             FROM
+                 exam_print_plan epp
+                     JOIN basic_exam be ON epp.exam_id = be.id AND be.ENABLE = TRUE
+                <where>
+                    and epp.school_id = #{schoolId}
+                    and be.semester_id = #{semesterId}
+                    <if test="examId != null">
+                        and epp.exam_id = #{examId}
+                    </if>
+                    <if test="printPlanId != null">
+                        and epp.id = #{printPlanId}
+                    </if>
+                </where>) a
                 JOIN
-            exam_detail b ON a.id = b.print_plan_id
+                (SELECT *
+                    from exam_detail t
+                    <where>
+                        <choose>
+                            <when test="status != null and status != ''">
+                                and t.status = #{status}
+                            </when>
+                            <otherwise>
+                                AND t.status not IN
+                                <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
+                                    #{item}
+                                </foreach>
+                            </otherwise>
+                        </choose>
+                        <if test="examPlace != null and examPlace != ''">
+                            and t.exam_place = #{examPlace}
+                        </if>
+                        <if test="examRoom != null and examRoom != ''">
+                            and t.exam_room = #{examRoom}
+                        </if>
+                        <if test="examStartTime != null and examStartTime != ''">
+                            and t.exam_start_time &gt; #{examStartTime}
+                        </if>
+                        <if test="examEndTime != null and examEndTime != ''">
+                            and t.exam_end_time &lt; #{examEndTime}
+                        </if>
+                        <if test="validate != null">
+                            and ifnull(t.validate, false) = #{validate}
+                        </if>
+                        <if test="orgId != null">
+                            AND (t.print_house_id = #{orgId} or t.print_house_id is null)
+                        </if>
+                    </where>
+                    ) b ON a.id = b.print_plan_id
                 JOIN
             (SELECT
-                    a.exam_detail_id,
-                    GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
-                    GROUP_CONCAT(a.paper_number) paperNumber,
-                    GROUP_CONCAT(a.clazz_id) classId,
-                    GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
-                    SUM(CASE b.is_download
-                        WHEN true THEN 0
-                        ELSE 1
-                    END) isDownload,
-                    SUM(CASE b.is_try
-                        WHEN true THEN 0
-                        ELSE 1
-                    END) isTry,
-                    SUM(CASE b.is_pass
-                        WHEN true THEN 0
-                        ELSE 1
-                    END) isPass
-            FROM
-                exam_detail_course a
-            LEFT JOIN client_status b ON a.school_id = b.school_id
-                AND a.exam_detail_id = b.exam_detail_id
-                AND a.course_code = b.course_code
-                AND a.paper_number = b.paper_number
-                AND b.machine_code = #{machineCode}
-            GROUP BY a.exam_detail_id) c ON b.id = c.exam_detail_id
-                LEFT JOIN
-            sys_user e ON a.school_id = e.school_id and b.print_user = e.login_name
-        <where>
-            AND b.status not IN
-            <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
-            <if test="status != null and status != ''">
-                and b.status = #{status}
-            </if>
-            <if test="courseCode != null and courseCode != ''">
-                and c.courseNameCode like concat('%',#{courseCode},'%')
-            </if>
-            <if test="paperNumber != null and paperNumber != ''">
-                and c.paperNumber like concat('%',#{paperNumber},'%')
-            </if>
-            <if test="examPlace != null and examPlace != ''">
-                and b.exam_place = #{examPlace}
-            </if>
-            <if test="examRoom != null and examRoom != ''">
-                and b.exam_room = #{examRoom}
-            </if>
-            <if test="examStartTime != null and examStartTime != ''">
-                and b.exam_start_time &gt; #{examStartTime}
-            </if>
-            <if test="examEndTime != null and examEndTime != ''">
-                and b.exam_end_time &lt; #{examEndTime}
-            </if>
-            <if test="validate != null">
-                and ifnull(b.validate, false) = #{validate}
-            </if>
-            <if test="isDownload != null">
-                <if test="isDownload == true">
-                    and c.isDownload = 0
+                 a.exam_detail_id,
+                 GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
+                 GROUP_CONCAT(a.paper_number) paperNumber,
+                 GROUP_CONCAT(a.clazz_id) classId,
+                 GROUP_CONCAT(a.clazz_name) className,
+                 GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
+                 SUM(CASE b.is_download
+                         WHEN TRUE THEN 0
+                         ELSE 1
+                     END) isDownload,
+                 SUM(CASE b.is_try
+                         WHEN TRUE THEN 0
+                         ELSE 1
+                     END) isTry,
+                 SUM(CASE b.is_pass
+                         WHEN TRUE THEN 0
+                         ELSE 1
+                     END) isPass
+             FROM
+                 exam_detail_course a
+                     LEFT JOIN client_status b ON a.school_id = b.school_id
+                     AND a.exam_detail_id = b.exam_detail_id
+                     AND a.course_code = b.course_code
+                     AND a.paper_number = b.paper_number
+                     AND b.machine_code = #{machineCode}
+             GROUP BY a.exam_detail_id) c ON b.id = c.exam_detail_id
+            <where>
+                <if test="courseCode != null and courseCode != ''">
+                    and c.courseNameCode like concat('%',#{courseCode},'%')
                 </if>
-                <if test="isDownload == false">
-                    and c.isDownload > 0
+                <if test="paperNumber != null and paperNumber != ''">
+                    and c.paperNumber like concat('%',#{paperNumber},'%')
                 </if>
-            </if>
-            <if test="orgId != null">
-                AND (b.print_house_id = #{orgId} or b.print_house_id is null)
-            </if>
-        </where>
-        order by a.id desc, b.id desc
+                <if test="isDownload != null">
+                    <if test="isDownload == true">
+                        and c.isDownload = 0
+                    </if>
+                    <if test="isDownload == false">
+                        and c.isDownload > 0
+                    </if>
+                </if>
+            </where>
+        ORDER BY a.id DESC , b.id DESC
     </select>
     <select id="clientTaskTotalData" resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto">
         SELECT
@@ -282,22 +307,54 @@
             GROUP_CONCAT(c.paperType) paperNumberAndType
         FROM
             (select epp.id from exam_print_plan epp
-                LEFT JOIN
-                basic_exam be ON epp.exam_id = be.id
+                 JOIN
+                basic_exam be ON epp.exam_id = be.id AND be.ENABLE = TRUE
             <where>
                 and epp.school_id = #{schoolId}
-                and be.enable = true
                 and be.semester_id = #{semesterId}
                 <if test="examId != null">
-                    and be.id = #{examId}
+                    and epp.exam_id = #{examId}
                 </if>
                 <if test="printPlanId != null">
                     and epp.id = #{printPlanId}
                 </if>
             </where>) a
         JOIN
-            exam_detail b ON a.id = b.print_plan_id
-        JOIN
+            (SELECT *
+                from exam_detail t
+                <where>
+                    <choose>
+                        <when test="status != null and status != ''">
+                            and t.status = #{status}
+                        </when>
+                        <otherwise>
+                            AND t.status not IN
+                            <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
+                                #{item}
+                            </foreach>
+                        </otherwise>
+                    </choose>
+                    <if test="examPlace != null and examPlace != ''">
+                        and t.exam_place = #{examPlace}
+                    </if>
+                    <if test="examRoom != null and examRoom != ''">
+                        and t.exam_room = #{examRoom}
+                    </if>
+                    <if test="examStartTime != null and examStartTime != ''">
+                        and t.exam_start_time &gt; #{examStartTime}
+                    </if>
+                    <if test="examEndTime != null and examEndTime != ''">
+                        and t.exam_end_time &lt; #{examEndTime}
+                    </if>
+                    <if test="validate != null">
+                        and ifnull(t.validate, false) = #{validate}
+                    </if>
+                    <if test="orgId != null">
+                        AND (t.print_house_id = #{orgId} or t.print_house_id is null)
+                    </if>
+                </where>
+                ) b ON a.id = b.print_plan_id
+            JOIN
             (SELECT
                 a.exam_detail_id,
                 GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
@@ -325,34 +382,12 @@
                 AND b.machine_code = #{machineCode}
         GROUP BY a.exam_detail_id) c ON b.id = c.exam_detail_id
         <where>
-            AND b.status not IN
-            <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
-            <if test="status != null and status != ''">
-                and b.status = #{status}
-            </if>
             <if test="courseCode != null and courseCode != ''">
                 and c.courseNameCode like concat('%',#{courseCode},'%')
             </if>
             <if test="paperNumber != null and paperNumber != ''">
                 and c.paperNumber like concat('%',#{paperNumber},'%')
             </if>
-            <if test="examPlace != null and examPlace != ''">
-                and b.exam_place = #{examPlace}
-            </if>
-            <if test="examRoom != null and examRoom != ''">
-                and b.exam_room = #{examRoom}
-            </if>
-            <if test="examStartTime != null and examStartTime != ''">
-                and b.exam_start_time &gt; #{examStartTime}
-            </if>
-            <if test="examEndTime != null and examEndTime != ''">
-                and b.exam_end_time &lt; #{examEndTime}
-            </if>
-            <if test="validate != null">
-                and ifnull(b.validate, false) = #{validate}
-            </if>
             <if test="isDownload != null">
                 <if test="isDownload == true">
                     and c.isDownload = 0
@@ -361,9 +396,6 @@
                     and c.isDownload > 0
                 </if>
             </if>
-            <if test="orgId != null">
-                AND (b.print_house_id = #{orgId} or b.print_house_id is null)
-            </if>
         </where>
     </select>
     <select id="listClientPrintStatistics"