Browse Source

3.4.0 update

xiaofei 11 months ago
parent
commit
f8e3746d45
22 changed files with 173 additions and 112 deletions
  1. 8 6
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/RelatePaperDto.java
  2. 13 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/BasicCardRule.java
  3. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java
  4. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskDetailMapper.java
  5. 0 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java
  6. 3 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicExamStudentService.java
  7. 4 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java
  8. 31 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  9. 24 19
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  10. 10 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java
  11. 1 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  12. 15 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  13. 10 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java
  14. 19 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java
  15. 16 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java
  16. 2 1
      distributed-print-business/src/main/resources/mapper/BasicCardRuleMapper.xml
  17. 4 5
      distributed-print-business/src/main/resources/mapper/ExamTaskDetailMapper.xml
  18. 0 25
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  19. 1 0
      distributed-print/install/mysql/upgrade/3.4.0.sql
  20. 1 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java
  21. 6 1
      teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml
  22. 1 0
      teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

+ 8 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/RelatePaperDto.java

@@ -10,8 +10,10 @@ import java.util.List;
  */
 public class RelatePaperDto {
 
-    private String id;
-    private String schoolId;
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long schoolId;
     @JsonSerialize(using = ToStringSerializer.class)
     private Long courseId;
     private String courseCode;
@@ -19,19 +21,19 @@ public class RelatePaperDto {
     private String paperNumber;
     private List<String> paperTypes;
 
-    public String getId() {
+    public Long getId() {
         return id;
     }
 
-    public void setId(String id) {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public String getSchoolId() {
+    public Long getSchoolId() {
         return schoolId;
     }
 
-    public void setSchoolId(String schoolId) {
+    public void setSchoolId(Long schoolId) {
         this.schoolId = schoolId;
     }
 

+ 13 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/BasicCardRule.java

@@ -82,6 +82,11 @@ public class BasicCardRule extends BaseEntity implements Serializable {
      */
     @TableField(value = "undertaking_body", updateStrategy = FieldStrategy.IGNORED)
     private String undertakingBody;
+    /**
+     * 选择题默认选项个数
+     */
+    @TableField(value = "default_option_number", updateStrategy = FieldStrategy.IGNORED)
+    private Integer defaultOptionNumber;
     /**
      * 必选字段
      */
@@ -342,4 +347,12 @@ public class BasicCardRule extends BaseEntity implements Serializable {
     public void setOrgIds(Long[] orgIds) {
         this.orgIds = orgIds;
     }
+
+    public Integer getDefaultOptionNumber() {
+        return defaultOptionNumber;
+    }
+
+    public void setDefaultOptionNumber(Integer defaultOptionNumber) {
+        this.defaultOptionNumber = defaultOptionNumber;
+    }
 }

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java

@@ -11,11 +11,11 @@ import java.util.List;
  */
 public enum RequiredFieldsEnum {
 
-    STUDENT_NAME("studentName","姓名", true, true),
     STUDENT_CODE("studentCode", "学号", true, true),
-    SITE_NUMBER("siteNumber", "座位号", true, false),
-    COURSE_NAME("courseName","课程名称", true, true),
+    STUDENT_NAME("studentName","姓名", true, true),
     COURSE_CODE("courseCode","课程代码", true, true),
+    COURSE_NAME("courseName","课程名称", true, true),
+    SITE_NUMBER("siteNumber", "座位号", true, false),
     PAPER_NUMBER("paperNumber","试卷编号", true, false),
     EXAM_DATE("examDate","考试日期", true, true),
     EXAM_TIME("examTime","考试时间", true, true),

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

@@ -24,7 +24,7 @@ public interface ExamTaskDetailMapper extends BaseMapper<ExamTaskDetail> {
 
     List<ExamTaskDetailDto> listPage(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("relateType") String relateType, @Param("printPlanIdList") List<Long> printPlanIdList, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("userName") String userName, @Param("dpr") DataPermissionRule dpr);
 
-    List<String> listExamDetailCourse(@Param("schoolId") Long schoolId, @Param("paperType") String paperType, @Param("printPlanId") Long printPlanId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);
+    List<String> listExamDetailCourse(@Param("schoolId") Long schoolId, @Param("paperType") String paperType, @Param("printPlanId") Long printPlanId, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber);
     /**
      * 根据examTaskId下载pdf
      *

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

@@ -40,8 +40,6 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     IPage<ExamTaskDetailDto> listTaskPaper(Page<ExamTaskDetailDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("dpr") DataPermissionRule dpr, @Param("containsQuestionTeacher") boolean containsQuestionTeacher, @Param("userId") Long userId);
 
-    List<RelatePaperDto> listPaperNumbers(@Param("schoolId") Long schoolId, @Param("courseId") Long courseId, @Param("status") String status, @Param("dpr") DataPermissionRule dpr);
-
     ExamTaskDetailCardDto applyGetOne(@Param("examTaskId") Long examTaskId, @Param("source") String source);
 
     List<ExamTask> listExamTaskExpire(@Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("status") String[] status);

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

@@ -89,5 +89,7 @@ public interface BasicExamStudentService extends IService<BasicExamStudent> {
 
     List<BasicExamStudent> listByExamIdAndCourseIdAndTeachClassName(Long examId, Long courseId, String teachClassName);
 
-    void clearPaperNumberAndPaperType(List<Long> ids);
+    void clearPaperNumberAndPaperTypeById(List<Long> ids);
+
+    void clearPaperNumberAndPaperTypeByExamIdAndPaperNumber(Long examId, String paperNumber);
 }

+ 4 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java

@@ -29,11 +29,11 @@ public interface ExamStudentService extends IService<ExamStudent> {
 
     List<ExamStudent> listByExamDetailCourseIdNotIntMarkStudent(Long examDetailCourseId, String paperType);
 
-    List<ExamStudent> listByExamDetailCourseId1(Long examDetailCourseId);
+    List<ExamStudent> listByExamDetailCourseId(Long examDetailCourseId);
 
     List<ExamStudent> saveStudentForExamApply(ExamTask examTask, String extendFields, List<Long> examTaskStudentObjectParamList, Long examDetailCourseId, SysUser sysUser);
 
-    List<ExamStudentInfo> listByExamDetailCourseId(Long examDetailCourseId);
+    List<ExamStudentInfo> listStudentByExamDetailCourseId(Long examDetailCourseId);
 
     void updateAttachmentIdById(ExamStudentInfo t);
 
@@ -44,4 +44,6 @@ public interface ExamStudentService extends IService<ExamStudent> {
     List<ExamStudent> listByBasicStudentId(Long basicStudentId);
 
     int countByExamDetailCourseId(Long examDetailCourseId);
+
+    int countByExamIdAndPaperNumber(Long examId, String paperNumber);
 }

+ 31 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -166,11 +167,11 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             }
 
             Set<String> paperNumberSet = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).map(BasicExamStudent::getPaperNumber).collect(Collectors.toSet());
-            if(CollectionUtils.isNotEmpty(paperNumberSet)){
+            if (CollectionUtils.isNotEmpty(paperNumberSet)) {
                 Long examId = basicExamStudentList.get(0).getExamId();
                 for (String paperNumber : paperNumberSet) {
                     MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-                    if(markPaper == null){
+                    if (markPaper == null) {
                         continue;
                     }
                     // 更新扫描数据
@@ -279,6 +280,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && dbBasicExamStudent.getPaperNumber().equals(paperType)) {
                 throw ExceptionResultEnum.ERROR.exception("不允许修改卷型");
             }
+
             basicExamStudent.updateInfo(requestUserId);
         } else {
             // 新增 (学号在考试课程下唯一)
@@ -287,18 +289,29 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                     .eq(BasicExamStudent::getStudentCode, basicExamStudent.getStudentCode())) > 0) {
                 throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]考生已存在", basicExamStudent.getStudentCode()));
             }
-            // 试卷编号绑定其它课程
+            basicExamStudent.insertInfo(requestUserId);
+        }
+
+        // 试卷编号绑定其它课程
+        if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber())) {
+            if(StringUtils.isBlank(basicExamStudent.getExamPlace())){
+                throw ExceptionResultEnum.ERROR.exception("校区(考点)必填");
+            }
             if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
                     .eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
                     .ne(BasicExamStudent::getCourseId, basicExamStudent.getCourseId())) > 0) {
                 throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]已绑定其它课程", basicExamStudent.getPaperNumber()));
             }
-            if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
-                    .eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
-                    .ne(BasicExamStudent::getExamStartTime, basicExamStudent.getExamStartTime()).ne(BasicExamStudent::getExamEndTime, basicExamStudent.getExamEndTime())) > 0) {
-                throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]有不同考试时间", basicExamStudent.getPaperNumber()));
+            QueryWrapper<BasicExamStudent> queryWrapper = new QueryWrapper<>();
+            LambdaQueryWrapper<BasicExamStudent> lambda = queryWrapper.lambda();
+            lambda.eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
+                    .and(m -> m.ne(BasicExamStudent::getExamStartTime, basicExamStudent.getExamStartTime()).or().ne(BasicExamStudent::getExamEndTime, basicExamStudent.getExamEndTime()));
+            if (basicExamStudent.getId() != null) {
+                lambda.ne(BasicExamStudent::getId, basicExamStudent.getId());
+            }
+            if (this.count(queryWrapper) > 0) {
+                throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]存在不同考试时间", basicExamStudent.getPaperNumber()));
             }
-            basicExamStudent.insertInfo(requestUserId);
         }
 
         parserRequiredField(basicExamStudent);
@@ -495,10 +508,19 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
     }
 
     @Override
-    public void clearPaperNumberAndPaperType(List<Long> ids) {
+    public void clearPaperNumberAndPaperTypeById(List<Long> ids) {
         UpdateWrapper<BasicExamStudent> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(BasicExamStudent::getPaperType, null)
                 .in(BasicExamStudent::getId, ids);
         this.update(updateWrapper);
     }
+
+    @Override
+    public void clearPaperNumberAndPaperTypeByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        UpdateWrapper<BasicExamStudent> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().set(BasicExamStudent::getPaperType, null)
+                .eq(BasicExamStudent::getExamId, examId)
+                .eq(BasicExamStudent::getPaperNumber, paperNumber);
+        this.update(updateWrapper);
+    }
 }

+ 24 - 19
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -753,36 +753,41 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                 examDetailCourseService.removeById(examDetailCourse.getId());
 
                 // 删除 exam_student
-                QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
-                examStudentQueryWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
-                List<ExamStudent> examStudents = examStudentService.list(examStudentQueryWrapper);
+                List<ExamStudent> examStudents = examStudentService.listByExamDetailCourseId(examDetailCourse.getId());
                 if (!examStudents.isEmpty()) {
                     List<Long> examStudentIds = examStudents.stream().map(ExamStudent::getId).collect(Collectors.toList());
-
                     // 已扫描
                     QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
                     queryWrapper.lambda().in(MarkStudent::getId, examStudentIds).eq(MarkStudent::getUpload, true);
                     if (markStudentService.count(queryWrapper) > 0) {
                         throw ExceptionResultEnum.ERROR.exception("有考生已扫描,不允许删除");
+                    }
+                    examStudentService.removeByIds(examStudentIds);
+                    // 删除扫描数据
+                    markStudentService.removeByIds(examStudentIds);
+                    // 当考务数据考生表中学生数量为0时,扫描表中学生数量大于0,说明从考生管理新增的考生未删除,则通过试卷编号全部删掉
+                    if (examStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) == 0 && markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) > 0) {
+                        markStudentService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
+                    }
+                    if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) == 0) {
+                        markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
+                        markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
+                        markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
+                        scanAnswerCardService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
+                        markUserGroupService.deleteByExamIdAndPaperNumberAndGroupNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null);
+                        markUserClassService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                     } else {
-                        // 删除扫描数据
-                        markStudentService.removeByIds(examStudentIds);
-                        if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) == 0) {
-                            markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
-                            markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
-                            markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
-                            scanAnswerCardService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
-                            markUserGroupService.deleteByExamIdAndPaperNumberAndGroupNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null);
-                            markUserClassService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
-                        } else {
-                            for (String paperType : examDetailCourse.getPaperNumber().split(",")) {
-                                markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examDetail.getExamId(), examDetailCourse.getPaperNumber(), paperType);
-                            }
+                        for (String paperType : examDetailCourse.getPaperType().split(",")) {
+                            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examDetail.getExamId(), examDetailCourse.getPaperNumber(), paperType);
                         }
+                    }
+                    if(markPaperService.getByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) != null) {
                         // 清空考生管理中卷型
-                        basicExamStudentService.clearPaperNumberAndPaperType(examStudents.stream().filter(m -> m.getBasicStudentId() != null).map(ExamStudent::getBasicStudentId).collect(Collectors.toList()));
+                        basicExamStudentService.clearPaperNumberAndPaperTypeById(examStudents.stream().filter(m -> m.getBasicStudentId() != null).map(ExamStudent::getBasicStudentId).collect(Collectors.toList()));
+                    } else {
+                        basicExamStudentService.clearPaperNumberAndPaperTypeByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                     }
-                    examStudentService.removeByIds(examStudentIds);
+
                 }
             }
         }

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

@@ -91,7 +91,7 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
     }
 
     @Override
-    public List<ExamStudent> listByExamDetailCourseId1(Long examDetailCourseId) {
+    public List<ExamStudent> listByExamDetailCourseId(Long examDetailCourseId) {
         QueryWrapper<ExamStudent> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, examDetailCourseId)
                 .orderByAsc(ExamStudent::getId);
@@ -122,7 +122,7 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
     }
 
     @Override
-    public List<ExamStudentInfo> listByExamDetailCourseId(Long examDetailCourseId) {
+    public List<ExamStudentInfo> listStudentByExamDetailCourseId(Long examDetailCourseId) {
         return this.baseMapper.listByExamDetailCourseId(examDetailCourseId);
     }
 
@@ -178,4 +178,12 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
         queryWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, examDetailCourseId);
         return this.count(queryWrapper);
     }
+
+    @Override
+    public int countByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        QueryWrapper<ExamStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamStudent::getExamId, examId)
+                .eq(ExamStudent::getPaperNumber, paperNumber);
+        return this.count(queryWrapper);
+    }
 }

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

@@ -214,11 +214,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
         List<ExamTaskDetailDto> examDetailDtoIPage = this.baseMapper.listPage(schoolId, semesterId, examId, relateType, printPlanIdList, courseId, paperNumber, userName, dpr);
         examDetailDtoIPage.stream().map(m -> {
-            String paperType = StringUtils.isBlank(m.getRelatePaperType()) ? null : m.getRelatePaperType();
-            Long printPlanIdT = Long.valueOf(m.getPrintPlanId());
-            String courseCodeT = m.getCourseCode();
-            String paperNumberT = m.getPaperNumber();
-            List<String> examDetailCourseIds = this.baseMapper.listExamDetailCourse(schoolId, paperType, printPlanIdT, courseCodeT, paperNumberT);
+            List<String> examDetailCourseIds = this.baseMapper.listExamDetailCourse(schoolId, m.getRelatePaperType(), Long.valueOf(m.getPrintPlanId()), m.getCourseId(), m.getPaperNumber());
             m.setExamDetailCourseIds(String.join(",", examDetailCourseIds));
             return m;
         }).collect(Collectors.toList());

+ 15 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -671,20 +671,21 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
     @Override
     public List<RelatePaperDto> listPaperTypes(Long examTaskId, Long printPlanId, Long courseId) {
-        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-        List<RelatePaperDto> list = this.baseMapper.listPaperNumbers(schoolId, courseId, ExamStatusEnum.SUBMIT.name(), dpr);
-        for (RelatePaperDto relatePaperDto : list) {
-            QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, relatePaperDto.getId()).eq(ExamTaskDetail::getEnable, true);
-            ExamTaskDetail examTaskDetail = this.examTaskDetailService.getOne(queryWrapper);
-            if (examTaskDetail != null) {
-                // 所有卷型
-                String paperType = examTaskDetail.getPaperType();
-                relatePaperDto.setPaperTypes(Arrays.asList(paperType.split(",")));
-            }
+        List<RelatePaperDto> list = new ArrayList<>();
+        ExamTask examTask = this.getById(examTaskId);
+        RelatePaperDto relatePaperDto = new RelatePaperDto();
+        relatePaperDto.setId(examTask.getId());
+        relatePaperDto.setSchoolId(examTask.getSchoolId());
+        relatePaperDto.setCourseId(examTask.getCourseId());
+        relatePaperDto.setPaperNumber(examTask.getPaperNumber());
+
+        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskIdNotValid(examTaskId);
+        if (examTaskDetail != null) {
+            // 所有卷型
+            String paperType = examTaskDetail.getPaperType();
+            relatePaperDto.setPaperTypes(Arrays.asList(paperType.split(",")));
         }
+        list.add(relatePaperDto);
         return list;
     }
 
@@ -1160,7 +1161,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
                         if (!CollectionUtils.isEmpty(examDetailCourseList)) {
                             examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).forEach(m -> {
-                                examStudentService.listByExamDetailCourseId(m.getId()).stream().filter(t -> t.getBasicStudentId() != null).forEach(s -> basicStudentIdUserMap.put(s.getBasicStudentId(), String.format("%s(%s)", m.getRealName(), m.getLoginName())));
+                                examStudentService.listStudentByExamDetailCourseId(m.getId()).stream().filter(t -> t.getBasicStudentId() != null).forEach(s -> basicStudentIdUserMap.put(s.getBasicStudentId(), String.format("%s(%s)", m.getRealName(), m.getLoginName())));
                             });
                         }
 

+ 10 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -125,7 +125,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         }
 
         List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
-                .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber, BasicExamStudent::getPaperType)
+                .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber, BasicExamStudent::getPaperType, BasicExamStudent::getExamStartTime, BasicExamStudent::getExamEndTime)
                 .eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
         Map<String, BasicExamStudent> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), Function.identity()));
 
@@ -135,7 +135,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         // 试卷编号->课程
         Map<String, Long> paperNumberCourseIdMap = new HashMap<>();
         // 试卷编号->考试时间
-        Map<String, String> paperNumberExamTimeMap = new HashMap<>();
+        Map<String, String> paperNumberExamTimeMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.toMap(BasicExamStudent::getPaperNumber, m -> m.getExamStartTime() + "-" + m.getExamEndTime(), (v1, v2) -> v1));
         Map<String, Long> basicCourseIdMap = new HashMap<>();
         // 课程学号唯一
         List<String> courseCodeStudentCodeList = new ArrayList<>();
@@ -274,6 +274,11 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                             paperNumberExamTimeMap.put(basicExamStudent.getPaperNumber(), examTimeValue);
                         }
                     }
+
+                    // 试卷编号不为空时,校区(考点必填)
+                    if (StringUtils.isBlank(basicExamStudent.getExamPlace())) {
+                        stringJoiner.add("校区(考点)必填");
+                    }
                 }
 
                 // 校验课程学号唯一
@@ -516,14 +521,14 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         }
 
         List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
-                .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber)
+                .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber, BasicExamStudent::getExamStartTime, BasicExamStudent::getExamEndTime)
                 .eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
         Map<String, BasicExamStudent> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), Function.identity()));
 
         // 文件中试卷编号对应多个课程代码
         Map<String, Long> paperNumberCourseIdInMap = new HashMap<>();
         // 试卷编号->考试时间
-        Map<String, String> paperNumberExamTimeMap = new HashMap<>();
+        Map<String, String> paperNumberExamTimeMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.toMap(BasicExamStudent::getPaperNumber, m -> m.getExamStartTime() + "-" + m.getExamEndTime(), (v1, v2) -> v1));
         Map<String, Long> basicCourseIdMap = new HashMap<>();
 
         // 课程管理中课程代码-课程名
@@ -698,7 +703,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                     String examTimeValue = basicExamStudent.getExamStartTime() + "-" + basicExamStudent.getExamEndTime();
                     if (paperNumberExamTimeMap.containsKey(basicExamStudent.getPaperNumber())) {
                         if (!paperNumberExamTimeMap.get(basicExamStudent.getPaperNumber()).equals(examTimeValue)) {
-                            stringJoiner.add("试卷编号[" + basicExamStudent.getPaperNumber() + "]只能相同考试时间");
+                            stringJoiner.add("试卷编号[" + basicExamStudent.getPaperNumber() + "]只能存在相同考试时间");
                         }
                     } else {
                         paperNumberExamTimeMap.put(basicExamStudent.getPaperNumber(), examTimeValue);

+ 19 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java

@@ -14,10 +14,12 @@ import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.ExamStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
+import com.qmth.distributed.print.business.enums.RequiredFieldsEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.service.PdfTaskLogicService;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.PdfUtil;
+import com.qmth.teachcloud.common.bean.examRule.CodeNameEnableValue;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -184,7 +186,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
         try {
             for (ExamDetailCourse examDetailCourse : createPdfDto.getExamDetailCourseList()) {
                 ExamTaskAssignPaperType examTaskAssignPaperType = examTaskAssignPaperTypeService.extractPaperType(tbTaskPdf, examDetailCourse);
-                List<ExamStudent> examStudentList = examStudentService.listByExamDetailCourseId1(examDetailCourse.getId());
+                List<ExamStudent> examStudentList = examStudentService.listByExamDetailCourseId(examDetailCourse.getId());
                 // 考生实际关联试卷类型
                 List<String> relatePaperTypes = new ArrayList<>();
                 List<String> paperTypes = Arrays.stream(examTaskAssignPaperType.getPaperType().split(",")).sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
@@ -249,7 +251,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             // 计算备份数量,默认最小为1份。
             int backupCount = SystemConstant.calcBackupCount(examDetail.getBackupCount(), examDetail.getTotalSubjects(), 1);
 
-            List<ExamStudentInfo> examStudentInfoList = examStudentService.listByExamDetailCourseId(examDetailCourse.getId());
+            List<ExamStudentInfo> examStudentInfoList = examStudentService.listStudentByExamDetailCourseId(examDetailCourse.getId());
             // 试卷数据组装
             if ((CreatePdfTypeEnum.ALL.equals(createPdfType) || CreatePdfTypeEnum.PAPER.equals(createPdfType)) && printContent.contains("PAPER")) {
                 List<PaperPdfDto> paperPdfDtoList = createPdfUtil.getPaperPdfFile(examDetailCourse.getPaperType(), examTaskDetail.getPaperInfoVoList(null), createPdfDto);
@@ -393,7 +395,21 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             if (StringUtils.isNotBlank(variableContent)) {
                 List<ExamStudentInfo> examStudentInfoList = new ArrayList<>();
                 for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
-                    CollectionUtils.addAll(examStudentInfoList, examStudentService.listByExamDetailCourseId(examDetailCourse.getId()));
+                    CollectionUtils.addAll(examStudentInfoList, examStudentService.listStudentByExamDetailCourseId(examDetailCourse.getId()));
+                }
+
+                if(ExamModelEnum.MODEL2.equals(basicExam.getExamModel()) && CollectionUtils.isEmpty(examStudentInfoList) && examDetail.getTotalSubjects() > 0){
+                    for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
+                        for (Integer i = 0; i < examDetailCourse.getTotalSubjects(); i++) {
+                            ExamStudentInfo examStudentInfo = new ExamStudentInfo();
+                            List<CodeNameEnableValue> fieldList = new ArrayList<>();
+                            // 只有试卷编号和教学班
+                            fieldList.add(new CodeNameEnableValue(RequiredFieldsEnum.PAPER_NUMBER.getCode(), RequiredFieldsEnum.PAPER_NUMBER.getName(),RequiredFieldsEnum.PAPER_NUMBER.getEnable(), examDetailCourse.getPaperNumber()));
+                            fieldList.add(new CodeNameEnableValue(RequiredFieldsEnum.TEACH_CLASS_NAME.getCode(), RequiredFieldsEnum.TEACH_CLASS_NAME.getName(),RequiredFieldsEnum.TEACH_CLASS_NAME.getEnable(), examDetailCourse.getClazzName()));
+                            examStudentInfo.setFieldList(fieldList);
+                            examStudentInfoList.add(examStudentInfo);
+                        }
+                    }
                 }
 
                 //获取变量印品

+ 16 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -192,10 +192,14 @@ public class CreatePdfUtil {
                     if (isDateFill) {
                         continue;
                     }
-                    String startDate = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DATE_PATTERN);
-                    String startTime = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.TIME_PATTERN);
-                    String endTime = DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.TIME_PATTERN);
-                    basicValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, startDate + " " + startTime + SystemConstant.HYPHEN + endTime);
+                    if (examDetail.getExamStartTime() != null && examDetail.getExamEndTime() != null) {
+                        String startDate = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DATE_PATTERN);
+                        String startTime = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.TIME_PATTERN);
+                        String endTime = DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.TIME_PATTERN);
+                        basicValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, startDate + " " + startTime + SystemConstant.HYPHEN + endTime);
+                    } else {
+                        basicValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, "");
+                    }
                     isDateFill = true;
                 } else {
                     basicValue = defaultCodeNameEnableValue(code, name, examStudentFieldSet);
@@ -263,10 +267,14 @@ public class CreatePdfUtil {
                     if (isDateFill) {
                         continue;
                     }
-                    String startDate = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DATE_PATTERN);
-                    String startTime = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.TIME_PATTERN);
-                    String endTime = DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.TIME_PATTERN);
-                    codeNameEnableValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, startDate + " " + startTime + SystemConstant.HYPHEN + endTime);
+                    if (examDetail.getExamStartTime() != null && examDetail.getExamEndTime() != null) {
+                        String startDate = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DATE_PATTERN);
+                        String startTime = DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.TIME_PATTERN);
+                        String endTime = DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.TIME_PATTERN);
+                        codeNameEnableValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, startDate + " " + startTime + SystemConstant.HYPHEN + endTime);
+                    } else {
+                        codeNameEnableValue = new CodeNameEnableValue(RequiredFieldsEnum.EXAM_TIME.getCode(), RequiredFieldsEnum.EXAM_TIME.getName(), true, "");
+                    }
                     isDateFill = true;
                 } else {
                     codeNameEnableValue = defaultCodeNameEnableValue(code, name, examStudentFieldSet);

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

@@ -15,6 +15,7 @@
         <result column="discipline" property="discipline" />
         <result column="undertaking_enable" property="undertakingEnable" />
         <result column="undertaking_body" property="undertakingBody" />
+        <result column="default_option_number" property="defaultOptionNumber" />
         <result column="required_fields" property="requiredFields" />
         <result column="extend_fields" property="extendFields" />
         <result column="fill_fields" property="fillFields" />
@@ -33,7 +34,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        select id, school_id, name, exam_number_style,exam_number_digit, paper_type, exam_absent, write_sign, discipline,undertaking_enable, undertaking_body,required_fields, extend_fields,fill_fields, title_rule,first_level_subheading,second_level_subheading, attention, objective_attention, subjective_attention, enable, remark, create_id, create_time, update_id, update_time, fill_number from basic_card_rule
+        select id, school_id, name, exam_number_style,exam_number_digit, paper_type, exam_absent, write_sign, discipline,undertaking_enable, undertaking_body,default_option_number,required_fields, extend_fields,fill_fields, title_rule,first_level_subheading,second_level_subheading, attention, objective_attention, subjective_attention, enable, remark, create_id, create_time, update_id, update_time, fill_number from basic_card_rule
     </sql>
     <select id="listPage" resultType="com.qmth.distributed.print.business.entity.BasicCardRule">
         <include refid="Base_Column_List"></include>

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

@@ -136,9 +136,8 @@
             exam_detail a
             LEFT JOIN exam_detail_course b ON a.id = b.exam_detail_id
             LEFT JOIN
-            exam_task c ON a.school_id = c.school_id
-                AND a.exam_id = c.exam_id
-                AND b.course_code = c.course_code
+            exam_task c ON a.exam_id = c.exam_id
+                AND b.course_id = c.course_id
                 AND b.paper_number = c.paper_number
             LEFT JOIN
             sys_user g ON c.create_id = g.id
@@ -155,8 +154,8 @@
             <if test="printPlanId != null and printPlanId != ''">
                 and a.print_plan_id = #{printPlanId}
             </if>
-            <if test="courseCode != null and courseCode != ''">
-                and c.course_code = #{courseCode}
+            <if test="courseId != null">
+                and c.course_id = #{courseId}
             </if>
             <if test="paperNumber != null and paperNumber != ''">
                 and c.paper_number = #{paperNumber}

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

@@ -546,31 +546,6 @@
         </where>
         order by IFNULL(g.update_time, a.update_time) desc, a.paper_number desc
     </select>
-    <select id="listPaperNumbers" resultType="com.qmth.distributed.print.business.bean.dto.RelatePaperDto">
-        SELECT
-        et.id,
-        et.school_id schoolId,
-        et.course_id courseId,
-        bc.code courseCode,
-        bc.name courseName,
-        et.paper_number paperNumber
-        FROM
-        exam_task et left join basic_course bc on et.course_id = bc.id
-        <where>
-            et.school_id = #{schoolId} and et.course_id = #{courseId} and et.status = #{status} and et.enable = true
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND et.create_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND bc.teaching_room_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-        </where>
-    </select>
     <select id="applyGetOne" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailCardDto">
         SELECT
             e.id examTaskId,

+ 1 - 0
distributed-print/install/mysql/upgrade/3.4.0.sql

@@ -416,3 +416,4 @@ ALTER TABLE t_c_final_score ADD CONSTRAINT t_c_final_score_unique UNIQUE KEY (cu
 ALTER TABLE t_c_usual_score DROP KEY t_c_usual_score_unique;
 ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (culture_program_id,course_id,student_code);
 
+ALTER TABLE `basic_card_rule` ADD COLUMN `default_option_number` INT NULL DEFAULT 4 COMMENT '选择题默认选项个数' AFTER `undertaking_body`;

+ 1 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -1808,6 +1808,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                     scanPaperService.removeById(scanStudentPaper.getPaperId());
                 }
             }
+            this.removeById(markStudent.getId());
         }
     }
 

+ 6 - 1
teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml

@@ -59,7 +59,12 @@
                 and mp.paper_number = #{paperNumber}
             </if>
             <if test="groupStatus != null">
-                and (mp.question_status = #{groupStatus} or mp.group_status = #{groupStatus})
+                <if test="groupStatus == true">
+                    and (mp.question_status = #{groupStatus} and mp.group_status = #{groupStatus})
+                </if>
+                <if test="groupStatus == false">
+                    and (mp.question_status = #{groupStatus} or mp.group_status = #{groupStatus})
+                </if>
             </if>
             <if test="dpr != null">
                 <if test="dpr.requestUserId != null">

+ 1 - 0
teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

@@ -339,6 +339,7 @@
             resultType="com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo">
         select t.id,
                bes.student_code,
+               bes.site_number,
                bes.student_name,
                bc.code courseCode,
                bc.name courseName,