xiaofei hace 10 meses
padre
commit
cce164187a

+ 9 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/bean/result/DocManageDetailResult.java

@@ -11,6 +11,7 @@ public class DocManageDetailResult {
     private Long studentId;
     private String studentName;
     private String studentCode;
+    private String batchNo;
     private String courseCode;
     private String courseName;
     private String teacher;
@@ -55,6 +56,14 @@ public class DocManageDetailResult {
         this.studentCode = studentCode;
     }
 
+    public String getBatchNo() {
+        return batchNo;
+    }
+
+    public void setBatchNo(String batchNo) {
+        this.batchNo = batchNo;
+    }
+
     public String getCourseCode() {
         return courseCode;
     }

+ 12 - 13
paper-library-business/src/main/java/com/qmth/paper/library/business/bean/result/DocManageStatResult.java

@@ -4,25 +4,24 @@ import io.swagger.annotations.ApiModelProperty;
 
 public class DocManageStatResult {
 
-    @ApiModelProperty(value = "学生数量")
-    private int studentCount;
-    @ApiModelProperty(value = "已扫学生数量")
-    private int scanStudentCount;
+    @ApiModelProperty(value = "课程数量")
+    private int courseCount;
+    @ApiModelProperty(value = "图片数量")
+    private int pictureCount;
 
-
-    public int getStudentCount() {
-        return studentCount;
+    public int getCourseCount() {
+        return courseCount;
     }
 
-    public void setStudentCount(int studentCount) {
-        this.studentCount = studentCount;
+    public void setCourseCount(int courseCount) {
+        this.courseCount = courseCount;
     }
 
-    public int getScanStudentCount() {
-        return scanStudentCount;
+    public int getPictureCount() {
+        return pictureCount;
     }
 
-    public void setScanStudentCount(int scanStudentCount) {
-        this.scanStudentCount = scanStudentCount;
+    public void setPictureCount(int pictureCount) {
+        this.pictureCount = pictureCount;
     }
 }

+ 10 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/bean/result/PaperLibraryImageResult.java

@@ -17,6 +17,8 @@ public class PaperLibraryImageResult implements Serializable {
     private Long paperLibraryId;
     @ApiModelProperty(value = "图片访问地址(解析后地址)")
     private List<String> fileUrls;
+    @ApiModelProperty(value = "批次号")
+    private String batchNo;
 
     public Long getPaperLibraryId() {
         return paperLibraryId;
@@ -33,4 +35,12 @@ public class PaperLibraryImageResult implements Serializable {
     public void setFileUrls(List<String> fileUrls) {
         this.fileUrls = fileUrls;
     }
+
+    public String getBatchNo() {
+        return batchNo;
+    }
+
+    public void setBatchNo(String batchNo) {
+        this.batchNo = batchNo;
+    }
 }

+ 11 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/bean/result/PictureManageDetailResult.java

@@ -13,6 +13,9 @@ public class PictureManageDetailResult implements Serializable {
     @ApiModelProperty(value = "考试ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long examId;
+    @ApiModelProperty(value = "任务ID")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long paperScanTaskId;
 
     @ApiModelProperty(value = "考生ID")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -71,6 +74,14 @@ public class PictureManageDetailResult implements Serializable {
         this.examId = examId;
     }
 
+    public Long getPaperScanTaskId() {
+        return paperScanTaskId;
+    }
+
+    public void setPaperScanTaskId(Long paperScanTaskId) {
+        this.paperScanTaskId = paperScanTaskId;
+    }
+
     public Long getStudentId() {
         return studentId;
     }

+ 6 - 6
paper-library-business/src/main/java/com/qmth/paper/library/business/mapper/PictureManageMapper.java

@@ -9,12 +9,12 @@ import java.util.List;
 
 public interface PictureManageMapper {
 
-    IPage<PictureManageDetailResult> pageData(Page<PictureManageDetailResult> page, @Param(value = "semesterIds") List<Long> semesterIds,
-            @Param(value = "examIds") List<Long> examIds, @Param(value = "courseCodes") List<String> courseCodes,
-            @Param(value = "collegeNames") List<String> collegeNames, @Param(value = "majorNames") List<String> majorNames,
-            @Param(value = "classNames") List<String> classNames, @Param(value = "teacher") String teacher, @Param(value = "teachClass") String teachClass,
-            @Param(value = "param") String param, @Param(value = "minScore") Double minScore,
-            @Param(value = "maxScore") Double maxScore, @Param(value = "pictureSymbol") String pictureSymbol,
+    IPage<PictureManageDetailResult> pageData(Page<PictureManageDetailResult> page, @Param(value = "semesterId") Long semesterId,
+            @Param(value = "examId") Long examId, @Param(value = "courseCode") String courseCode,
+            @Param(value = "collegeName") String collegeName, @Param(value = "majorName") String majorName,
+            @Param(value = "className") String className, @Param(value = "teacher") String teacher, @Param(value = "teachClass") String teachClass,
+            @Param(value = "param") String param, @Param(value = "startStudentCode") String startStudentCode,
+            @Param(value = "endStudentCode") String endStudentCode, @Param(value = "pictureSymbol") String pictureSymbol,
             @Param(value = "pictureCount") Integer pictureCount);
 
     List<PictureManageDetailResult> pageData(@Param(value = "semesterIds") List<Long> semesterIds,

+ 2 - 2
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PictureManageService.java

@@ -12,8 +12,8 @@ import java.util.List;
  */
 public interface PictureManageService {
 
-    IPage<PictureManageDetailResult> pageData(List<Long> semesterIds, List<Long> examIds, List<String> courseCodes, List<String> collegeNames,
-            List<String> majorNames, List<String> classNames, String teacher, String teachClass, String param, Double minScore, Double maxScore,
+    IPage<PictureManageDetailResult> pageData(Long semesterId, Long examId, String courseCode, String collegeName,
+            String majorName, String className, String teacher, String teachClass, String param, String startStudentCode, String endStudentCode,
             String pictureSymbol, Integer pictureCount, Integer pageNumber, Integer pageSize);
 
     boolean savePicture(MultipartFile file, String fileMd5, String fileUrl, Long paperLibraryId);

+ 6 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/DocManageServiceImpl.java

@@ -64,6 +64,12 @@ public class DocManageServiceImpl implements DocManageService {
     @Override
     public IPage<DocManageDetailResult> pageDetail(Long paperScanTaskId, String collegeName, String majorName, String className, String examRoom, String teacher, String teachClass, Boolean isBind, String param, Double minScore, Double maxScore, Integer minBindCount, Integer maxBindCount, String pictureSymbol, Integer pictureCount, Integer pageNumber, Integer pageSize) {
         IPage<DocManageDetailResult> detailResultIPage = docManageMapper.pageDetail(new Page<>(pageNumber, pageSize), paperScanTaskId, collegeName, majorName, className, examRoom, teacher, teachClass, isBind, param, minScore, maxScore, minBindCount, maxBindCount, pictureSymbol, pictureCount);
+        for (DocManageDetailResult record : detailResultIPage.getRecords()) {
+            List<String> batchNoList = paperLibraryService.listBatchNo(record.getStudentId());
+            if(!batchNoList.isEmpty()) {
+                record.setBatchNo(String.join(",", batchNoList));
+            }
+        }
         return detailResultIPage;
     }
 

+ 4 - 2
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryServiceImpl.java

@@ -125,6 +125,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
                 fileUrls.add(fileUploadService.filePreview(filePathVo));
             }
             paperLibraryImageResult.setFileUrls(fileUrls);
+            paperLibraryImageResult.setBatchNo(paperLibrary.getBatchNo());
             fileUrlList.add(paperLibraryImageResult);
         }
         paperLibraryResult.setFileUrls(fileUrlList);
@@ -387,12 +388,13 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         if (paperLibrary == null) {
             throw ExceptionResultEnum.ERROR.exception("图片数据不存在");
         }
-        if (paperLibrary.getStudentId() != null) {
+        // 删除后,重新统计绑定数量
+        if (this.removeById(paperLibraryId) && paperLibrary.getStudentId() != null) {
             examStudentService.updateBindCount(paperLibrary.getStudentId());
             // 清除pdf文件记录
             examStudentService.clearPdfFilePath(paperLibrary.getStudentId());
         }
-        return this.removeById(paperLibraryId);
+        return true;
     }
 
     @Override

+ 15 - 9
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PictureManageServiceImpl.java

@@ -3,8 +3,10 @@ package com.qmth.paper.library.business.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.paper.library.business.bean.result.PictureManageDetailResult;
+import com.qmth.paper.library.business.entity.PaperScanTask;
 import com.qmth.paper.library.business.mapper.PictureManageMapper;
 import com.qmth.paper.library.business.service.PaperLibraryService;
+import com.qmth.paper.library.business.service.PaperScanTaskService;
 import com.qmth.paper.library.business.service.PictureManageService;
 import com.qmth.paper.library.common.bean.params.DownloadPictureParams;
 import com.qmth.paper.library.common.enums.ExceptionResultEnum;
@@ -25,6 +27,8 @@ public class PictureManageServiceImpl implements PictureManageService {
 
     @Resource
     private PictureManageMapper pictureManageMapper;
+    @Resource
+    private PaperScanTaskService paperScanTaskService;
 
     @Resource
     private PaperLibraryService paperLibraryService;
@@ -33,19 +37,21 @@ public class PictureManageServiceImpl implements PictureManageService {
     private FileStoreUtil fileStoreUtil;
 
     @Override
-    public IPage<PictureManageDetailResult> pageData(List<Long> semesterIds, List<Long> examIds, List<String> courseCodes, List<String> collegeNames,
-            List<String> majorNames, List<String> classNames, String teacher, String teachClass, String param, Double minScore, Double maxScore,
-            String pictureSymbol, Integer pictureCount, Integer pageNumber, Integer pageSize) {
-        IPage<PictureManageDetailResult> picturePage = pictureManageMapper.pageData(new Page<>(pageNumber, pageSize), semesterIds, examIds,
-                courseCodes, collegeNames, majorNames, classNames, teacher,
-                teachClass, param, minScore, maxScore, pictureSymbol, pictureCount);
+    public IPage<PictureManageDetailResult> pageData(Long semesterId, Long examId, String courseCode, String collegeName,
+                                                     String majorName, String className, String teacher, String teachClass, String param, String startStudentCode, String endStudentCode,
+                                                     String pictureSymbol, Integer pictureCount, Integer pageNumber, Integer pageSize) {
+        IPage<PictureManageDetailResult> picturePage = pictureManageMapper.pageData(new Page<>(pageNumber, pageSize), semesterId, examId,
+                courseCode, collegeName, majorName, className, teacher,
+                teachClass, param, startStudentCode, endStudentCode, pictureSymbol, pictureCount);
         List<PictureManageDetailResult> records = picturePage.getRecords();
         for (PictureManageDetailResult record : records) {
             //一个考生 可能会存在多个批次号
             List<String> batchNoList = paperLibraryService.listBatchNo(record.getStudentId());
-            if(!batchNoList.isEmpty()) {
+            if (!batchNoList.isEmpty()) {
                 record.setBatchNo(String.join(",", batchNoList));
             }
+            PaperScanTask paperScanTask = paperScanTaskService.getByExamIdAndCourseCode(record.getExamId(), record.getCourseCode());
+            record.setPaperScanTaskId(paperScanTask != null ? paperScanTask.getId() : null);
         }
         return picturePage;
     }
@@ -86,10 +92,10 @@ public class PictureManageServiceImpl implements PictureManageService {
         Integer pictureCount = params.getPictureCount();
         List<PictureManageDetailResult> pictureList = pictureManageMapper.pageData(semesterIds, examIds, courseCodes, collegeNames, majorNames,
                 classNames, teacher, teachClass, param, minScore, maxScore, pictureSymbol, pictureCount);
-        for(PictureManageDetailResult result : pictureList) {
+        for (PictureManageDetailResult result : pictureList) {
             //一个考生 可能会存在多个批次号
             List<String> batchNoList = paperLibraryService.listBatchNo(result.getStudentId());
-            if(!batchNoList.isEmpty()) {
+            if (!batchNoList.isEmpty()) {
                 result.setBatchNo(String.join(",", batchNoList));
             }
         }

+ 4 - 2
paper-library-business/src/main/resources/mapper/DocManageMapper.xml

@@ -28,11 +28,13 @@
     </select>
     <select id="statData" resultType="com.qmth.paper.library.business.bean.result.DocManageStatResult">
         SELECT
-            sum(pst.student_count) studentCount,
-            sum(pst.scan_student_count) scanStudentCount
+            count(distinct pst.course_code) courseCount,
+            count(1) pictureCount
         FROM
             paper_scan_task pst
                 LEFT JOIN
+            paper_library pl ON pst.id = pl.paper_scan_task_id
+                LEFT JOIN
             basic_exam be ON pst.exam_id = be.id
         <where>
             be.semester_id = #{semesterId}

+ 16 - 34
paper-library-business/src/main/resources/mapper/PictureManageMapper.xml

@@ -25,41 +25,23 @@
         left join basic_exam ea on es.exam_id = ea.id
         left join basic_semester bs on es.semester_id = bs.id
         WHERE es.bind_count>0
-        <if test="semesterIds != null and semesterIds.size>0">
-            AND bs.id IN
-            <foreach collection="semesterIds" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="semesterId != null">
+            AND bs.id = #{semesterId}
         </if>
-        <if test="examIds != null and examIds.size>0">
-            AND ea.id IN
-            <foreach collection="examIds" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="examId != null">
+            AND ea.id = #{examId}
         </if>
-        <if test="courseCodes != null and courseCodes != '' and courseCodes.size>0">
-            AND es.course_code IN
-            <foreach collection="courseCodes" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="courseCode != null and courseCode != ''">
+            AND es.course_code = #{courseCode}
         </if>
-        <if test="collegeNames != null and collegeNames != '' and collegeNames.size>0">
-            AND es.college_name IN
-            <foreach collection="collegeNames" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="collegeName != null and collegeName != ''">
+            AND es.college_name = #{collegeName}
         </if>
-        <if test="majorNames != null and majorNames != '' and majorNames.size>0">
-            AND es.major_name IN
-            <foreach collection="majorNames" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="majorName != null and majorName != ''">
+            AND es.major_name = #{majorName}
         </if>
-        <if test="classNames != null and classNames != '' and classNames.size>0">
-            AND es.class_name IN
-            <foreach collection="classNames" item="item" index="index" open="(" separator="," close=")">
-                #{item}
-            </foreach>
+        <if test="className != null and className != ''">
+            AND es.class_name = #{className}
         </if>
         <if test="teacher != null and teacher != ''">
             and es.teacher like concat(#{teacher},'%')
@@ -70,11 +52,11 @@
         <if test="param != null and param != ''">
             and (es.student_name like concat(#{param},'%') or es.student_code like concat(#{param},'%'))
         </if>
-        <if test="minScore != null">
-            and es.score &gt;= #{minScore}
+        <if test="startStudentCode != null and startStudentCode != ''">
+            and es.student_code &gt;= #{startStudentCode}
         </if>
-        <if test="maxScore != null">
-            and es.score &lt;= #{maxScore}
+        <if test="endStudentCode != null and endStudentCode != ''">
+            and es.student_code &lt;= #{endStudentCode}
         </if>
         <if test="pictureSymbol != null and pictureSymbol !='' and pictureCount != null and pictureCount !='' ">
             <if test="pictureSymbol == 'GREAT_THEN'">

+ 11 - 11
paper-library/src/main/java/com/qmth/paper/library/api/PictureManageController.java

@@ -55,24 +55,24 @@ public class PictureManageController {
     @ApiOperation(value = "分页查询")
     @PostMapping("/page")
     @ApiResponses({ @ApiResponse(code = 200, message = "查询成功", response = Result.class) })
-    public Result page(@ApiParam(value = "学期IDS") @RequestParam(value = "semesterIds", required = false) List<Long> semesterIds,
-            @ApiParam(value = "考试IDS") @RequestParam(value = "examIds", required = false) List<Long> examIds,
-            @ApiParam(value = "课程代码") @RequestParam(value = "courseCodes", required = false) List<String> courseCodes,
-            @ApiParam(value = "学院") @RequestParam(value = "collegeNames", required = false) List<String> collegeNames,
-            @ApiParam(value = "专业") @RequestParam(value = "majorNames", required = false) List<String> majorNames,
-            @ApiParam(value = "班级") @RequestParam(value = "classNames", required = false) List<String> classNames,
+    public Result page(@ApiParam(value = "姓名或学号") @RequestParam(value = "param", required = false) String param,
+            @ApiParam(value = "学号(开始)") @RequestParam(value = "startStudentCode", required = false) String startStudentCode,
+            @ApiParam(value = "学号(结束)") @RequestParam(value = "endStudentCode", required = false) String endStudentCode,
+            @ApiParam(value = "学期ID") @RequestParam(value = "semesterId", required = false) Long semesterId,
+            @ApiParam(value = "考试ID") @RequestParam(value = "examId", required = false) Long examId,
+            @ApiParam(value = "课程代码") @RequestParam(value = "courseCode", required = false) String courseCode,
             @ApiParam(value = "任课老师") @RequestParam(value = "teacher", required = false) String teacher,
+            @ApiParam(value = "学院") @RequestParam(value = "collegeName", required = false) String collegeName,
+            @ApiParam(value = "专业") @RequestParam(value = "majorName", required = false) String majorName,
+            @ApiParam(value = "班级") @RequestParam(value = "className", required = false) String className,
             @ApiParam(value = "教学班") @RequestParam(value = "teachClass", required = false) String teachClass,
-            @ApiParam(value = "姓名或学号") @RequestParam(value = "param", required = false) String param,
-            @ApiParam(value = "成绩(小)") @RequestParam(value = "minScore", required = false) Double minScore,
-            @ApiParam(value = "成绩(大)") @RequestParam(value = "maxScore", required = false) Double maxScore,
             @ApiParam(value = "大于、等于、小于、不等于") @RequestParam(value = "pictureSymbol", required = false) String pictureSymbol,
             @ApiParam(value = "图片张数") @RequestParam(value = "pictureCount", required = false) Integer pictureCount,
             @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
             @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         return ResultUtil.ok(
-                pictureManageService.pageData(semesterIds, examIds, courseCodes, collegeNames, majorNames, classNames, teacher, teachClass, param, minScore,
-                        maxScore, pictureSymbol, pictureCount, pageNumber, pageSize));
+                pictureManageService.pageData(semesterId, examId, courseCode, collegeName, majorName, className, teacher, teachClass, param, startStudentCode,
+                        endStudentCode, pictureSymbol, pictureCount, pageNumber, pageSize));
     }
 
     @ApiOperation(value = "查询考生图片集合")