Bladeren bron

3.4.2 update

xiaofei 7 maanden geleden
bovenliggende
commit
aa0c31bddc
29 gewijzigde bestanden met toevoegingen van 280 en 79 verwijderingen
  1. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDetailDto.java
  2. 7 13
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskTemp.java
  3. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/BasicCardRuleMapper.java
  4. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicCardRuleService.java
  5. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicExamStudentService.java
  6. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java
  7. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicCardRuleServiceImpl.java
  8. 5 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  9. 12 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java
  10. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  11. 130 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  12. 11 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java
  13. 5 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java
  14. 5 1
      distributed-print-business/src/main/resources/mapper/BasicCardRuleMapper.xml
  15. 3 14
      distributed-print-business/src/main/resources/mapper/ExamCardMapper.xml
  16. 1 0
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  17. 3 3
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicCardRuleController.java
  18. 3 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskQueryController.java
  19. 1 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  20. 2 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/SysUserMapper.java
  21. 2 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicCourseService.java
  22. 2 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java
  23. 7 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCourseServiceImpl.java
  24. 5 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java
  25. 18 0
      teachcloud-common/src/main/resources/mapper/SysUserMapper.xml
  26. 3 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/manage/MarkerSpecialTagDTO.java
  27. 1 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java
  28. 25 9
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java
  29. 10 11
      teachcloud-mark/src/main/resources/mapper/MarkRejectHistoryMapper.xml

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

@@ -31,6 +31,7 @@ public class ExamTaskDetailDto {
     private String userName;
     private String status;
     private Boolean enable;
+    private Boolean examTaskDetailEnable;
     private String createId;
     private Long createTime;
     private String paperType;
@@ -193,6 +194,14 @@ public class ExamTaskDetailDto {
         this.enable = enable;
     }
 
+    public Boolean getExamTaskDetailEnable() {
+        return examTaskDetailEnable;
+    }
+
+    public void setExamTaskDetailEnable(Boolean examTaskDetailEnable) {
+        this.examTaskDetailEnable = examTaskDetailEnable;
+    }
+
     public String getCreateId() {
         return createId;
     }

+ 7 - 13
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskTemp.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.boot.tools.excel.annotation.ExcelColumn;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -28,11 +29,6 @@ public class ExamTaskTemp extends BaseEntity implements Serializable {
     @TableField("school_id")
     private Long schoolId;
 
-    @ApiModelProperty(value = "机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(value = "org_id", updateStrategy = FieldStrategy.IGNORED)
-    private Long orgId;
-
     /**
      * 本次导入数据临时ID
      */
@@ -46,27 +42,33 @@ public class ExamTaskTemp extends BaseEntity implements Serializable {
     /**
      * 课程代码
      */
+    @ExcelColumn(name = "课程代码", index = 1)
     @TableField("course_code")
     private String courseCode;
     /**
      * 课程名称
      */
+    @ExcelColumn(name = "课程名称", index = 2)
     @TableField("course_name")
     private String courseName;
     /**
      * 开课学院
      */
+    @ExcelColumn(name = "开课学院", index = 3)
     @TableField("teaching_room_name")
     private String teachingRoomName;
     /**
      * 试卷编号
      */
+    @ExcelColumn(name = "试卷编号", index = 4)
     @TableField("paper_number")
     private String paperNumber;
 
+    @ExcelColumn(name = "命题老师工号", index = 5, nullable = true)
     @TableField("user_account")
     private String userAccount;
 
+    @ExcelColumn(name = "命题老师姓名", index = 6, nullable = true)
     @TableField("user_name")
     private String userName;
 
@@ -74,14 +76,6 @@ public class ExamTaskTemp extends BaseEntity implements Serializable {
         return serialVersionUID;
     }
 
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-
     public Long getSchoolId() {
         return schoolId;
     }

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

@@ -21,5 +21,5 @@ public interface BasicCardRuleMapper extends BaseMapper<BasicCardRule> {
 
     IPage<BasicCardRule> listPage(Page<BasicCardRule> page, @Param("schoolId") Long schoolId, @Param("enable") Boolean enable, @Param("name") String name, @Param("createStartTime") Long createStartTime, @Param("createEndTime") Long createEndTime, @Param("dpr") DataPermissionRule dpr);
 
-    List<BasicCardRule> list(@Param("schoolId") Long schoolId, @Param("param") String param);
+    List<BasicCardRule> list(@Param("schoolId") Long schoolId, @Param("examId") Long examId);
 }

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

@@ -18,7 +18,7 @@ public interface BasicCardRuleService extends IService<BasicCardRule> {
 
     IPage<BasicCardRule> list(Boolean enable, String name, Long createStartTime, Long createEndTime, Integer pageNumber, Integer pageSize);
 
-    List<BasicCardRule> list(String param);
+    List<BasicCardRule> list(Long examId);
 
     boolean delete(BasicCardRule cardRule);
 

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

@@ -8,6 +8,7 @@ import com.qmth.distributed.print.business.bean.dto.DeleteBasicExamStudentStatus
 import com.qmth.distributed.print.business.bean.dto.ExamStudentDto;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
+import com.qmth.distributed.print.business.entity.BasicCardRule;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.teachcloud.common.entity.BasicExam;
 import com.qmth.teachcloud.common.entity.BasicExamStudent;
@@ -71,7 +72,7 @@ public interface BasicExamStudentService extends IService<BasicExamStudent> {
 
     void updateTeacherIdById(List<BasicExamStudent> basicExamStudentList);
 
-    void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList);
+    void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList, BasicCardRule basicCardRule);
 
     void updateMarkData(Long examId, List<BasicExamStudent> basicExamStudentList, Long createId);
 

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

@@ -58,6 +58,7 @@ public interface ExamTaskService extends IService<ExamTask> {
     ExamTask saveExamTaskNew(ExamTask examTask);
 
     ExamTaskImportResultDto importFile(MultipartFile file) throws IOException, NoSuchFieldException;
+    ExamTaskImportResultDto importFile1(MultipartFile file) throws IOException, NoSuchFieldException;
 
     List<ExamTask> saveBatch(ExamTask task);
 

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

@@ -111,9 +111,9 @@ public class BasicCardRuleServiceImpl extends ServiceImpl<BasicCardRuleMapper, B
     }
 
     @Override
-    public List<BasicCardRule> list(String param) {
+    public List<BasicCardRule> list(Long examId) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
-        return this.baseMapper.list(schoolId, param);
+        return this.baseMapper.list(schoolId, examId);
     }
 
     @Override

+ 5 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -13,9 +13,11 @@ import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.query.BasicExamStudentPageQuery;
 import com.qmth.distributed.print.business.bean.query.BasicExamStudentQuery;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
+import com.qmth.distributed.print.business.entity.BasicCardRule;
 import com.qmth.distributed.print.business.entity.BasicExamRule;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
+import com.qmth.distributed.print.business.enums.ExamNumberStyleEnum;
 import com.qmth.distributed.print.business.enums.RequiredFieldsEnum;
 import com.qmth.distributed.print.business.mapper.BasicExamStudentMapper;
 import com.qmth.distributed.print.business.service.*;
@@ -285,7 +287,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperNumber()) && !dbBasicExamStudent.getPaperNumber().equals(paperNumber)) {
                 throw ExceptionResultEnum.ERROR.exception("不允许修改试卷编号");
             }
-            if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && dbBasicExamStudent.getPaperNumber().equals(paperType)) {
+            if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && dbBasicExamStudent.getPaperType().equals(paperType)) {
                 throw ExceptionResultEnum.ERROR.exception("不允许修改卷型");
             }
 
@@ -424,7 +426,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
     }
 
     @Override
-    public void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList) {
+    public void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList, BasicCardRule basicCardRule) {
         for (ExamStudent examStudent : examStudentList) {
             BasicExamStudent basicExamStudent = this.getById(examStudent.getBasicStudentId());
             if (StringUtils.isNoneBlank(basicExamStudent.getPaperNumber(), basicExamStudent.getPaperType()) && !examStudent.getPaperNumber().equals(basicExamStudent.getPaperNumber())) {
@@ -438,7 +440,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             }
             this.update(new UpdateWrapper<BasicExamStudent>().lambda()
                     .set(BasicExamStudent::getPaperNumber, examStudent.getPaperNumber())
-                    .set(BasicExamStudent::getPaperType, examStudent.getPaperType())
+                    .set(ExamNumberStyleEnum.PRINT.equals(basicCardRule.getExamNumberStyle()), BasicExamStudent::getPaperType, examStudent.getPaperType())
                     .set(BasicExamStudent::getRequiredFields, JSON.toJSONString(requiredFieldList))
                     .eq(BasicExamStudent::getId, examStudent.getBasicStudentId()));
         }

+ 12 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java

@@ -12,6 +12,7 @@ import com.qmth.distributed.print.business.entity.ExamDetail;
 import com.qmth.distributed.print.business.entity.ExamDetailCourse;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamTask;
+import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.mapper.ExamDetailCourseMapper;
 import com.qmth.distributed.print.business.mapper.ExamStudentMapper;
 import com.qmth.distributed.print.business.service.BasicExamStudentService;
@@ -150,13 +151,20 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
             List<Long> examStudentIds = examStudentList.stream().map(ExamStudent::getId).collect(Collectors.toList());
             this.removeByIds(examStudentIds);
             List<Long> examDetailCourseIds = examStudentList.stream().map(ExamStudent::getExamDetailCourseId).distinct().collect(Collectors.toList());
-            // 更新考场科目表科次
-            for (Long examDetailCourseId : examDetailCourseIds) {
-                examDetailCourseService.updateTotalSubjects(examDetailCourseId, this.countByExamDetailCourseId(examDetailCourseId));
-            }
+            List<ExamDetailStatusEnum> examDetailStatusEnumList = Arrays.asList(ExamDetailStatusEnum.READY, ExamDetailStatusEnum.WAITING, ExamDetailStatusEnum.PRINTING, ExamDetailStatusEnum.FINISH);
             // 更新考场科次
             List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listByIds(examDetailCourseIds);
             for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
+                ExamDetail examDetail = examDetailService.getById(examDetailCourse.getExamDetailId());
+                // 已生成了pdf,不更新科次
+                if (examDetailStatusEnumList.contains(examDetail.getStatus())) {
+                    continue;
+                }
+
+                // 更新考场科目科次
+                examDetailCourseService.updateTotalSubjects(examDetailCourse.getId(), this.countByExamDetailCourseId(examDetailCourse.getId()));
+
+                // 更新考场科次
                 List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailCourse.getExamDetailId());
                 if (CollectionUtils.isNotEmpty(examDetailCourses)) {
                     examDetailService.updateTotalSubjects(examDetailCourse.getExamDetailId(), examDetailCourses.stream().filter(m -> m.getTotalSubjects() != null).mapToInt(m -> m.getTotalSubjects()).sum());

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

@@ -109,7 +109,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             }
         }
         // 禁用,解决试卷关联关系,并且解除生成pdf绑定
-        if (!examTask.getEnable()) {
+        if (examTaskById.getExamTaskDetailEnable()) {
             // 正在生成pdf不能禁用
             if (examDetails != null && examDetails.size() > 0) {
                 Map<Long, List<Long>> map = examDetails.stream().collect(Collectors.groupingBy(ExamDetail::getPrintPlanId, Collectors.mapping(ExamDetail::getId, Collectors.toList())));
@@ -128,7 +128,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
                             .in(ExamDetail::getId, examDetailIds);
                     examDetailService.update(examDetailUpdateWrapper);
                     // 更新绑定关系
-                    List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByPrintPlanIdAndCourseIdAndPaperNumber(examTask.getSchoolId(), listEntry.getKey(), examTask.getCourseId(), examTask.getPaperNumber());
+                    List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByPrintPlanIdAndCourseIdAndPaperNumber(examTaskById.getSchoolId(), listEntry.getKey(), examTaskById.getCourseId(), examTaskById.getPaperNumber());
                     List<Long> examDetailCourseIds = examDetailCourses.stream().map(m -> m.getId()).collect(Collectors.toList());
                     UpdateWrapper<ExamDetailCourse> examDetailCourseUpdateWrapper = new UpdateWrapper<>();
                     examDetailCourseUpdateWrapper.lambda()
@@ -145,7 +145,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             }
         }
         UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().set(ExamTask::getEnable, examTask.getEnable()).eq(ExamTask::getId, examTask.getId());
+        updateWrapper.lambda().set(ExamTask::getExamTaskDetailEnable, !examTaskById.getExamTaskDetailEnable()).eq(ExamTask::getId, examTaskById.getId());
         examTaskService.update(updateWrapper);
 
         return true;

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

@@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import com.google.gson.Gson;
+import com.qmth.boot.tools.excel.ExcelReader;
+import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.approvalForm.*;
 import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
@@ -71,6 +73,7 @@ import java.io.InputStream;
 import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -550,6 +553,132 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         return examTaskImportResultDto;
     }
 
+    @Override
+    public ExamTaskImportResultDto importFile1(MultipartFile file) throws IOException {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+
+        ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, file.getInputStream(), 1);
+        List<ExamTaskTemp> examTaskImportDtoList;
+        try {
+            examTaskImportDtoList = excelReader.getObjectList(ExamTaskTemp.class);
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception("读取excel内容失败");
+        }
+
+        AtomicInteger i = new AtomicInteger(3);
+        List<SysOrg> sysOrgList = sysOrgService.getSecondOrg(schoolId, null);
+        if (CollectionUtils.isEmpty(sysOrgList)) {
+            throw ExceptionResultEnum.ERROR.exception("请先导入机构数据");
+        }
+        List<BasicCourse> basicCourseList = basicCourseService.listBySchoolId(schoolId);
+        if (CollectionUtils.isEmpty(basicCourseList)) {
+            throw ExceptionResultEnum.ERROR.exception("请先导入课程数据");
+        }
+        List<SysUserResult> sysUserList = sysUserService.listBySchoolId(schoolId);
+        if (CollectionUtils.isEmpty(sysUserList)) {
+            throw ExceptionResultEnum.ERROR.exception("请先导入用户数据");
+        }
+
+        // 课程与名称map
+        Map<String, String> courseCodeAndNameMap = new HashMap<>();
+        // 试卷编号与课程代码map
+        Map<String, String> paperNumberAndCourseCodeMap = new HashMap<>();
+
+        ExamTaskImportResultDto examTaskImportResultDto = new ExamTaskImportResultDto();
+        examTaskImportResultDto.setBatchNo(String.valueOf(System.nanoTime()));
+        List<ExamTaskTemp> examTaskTempList = new ArrayList<>();
+        List<ExamTaskDto> examTaskDtos = new ArrayList<>();
+
+        for (ExamTaskTemp examTaskTemp : examTaskImportDtoList) {
+            StringJoiner errorMsg = new StringJoiner("");
+            errorMsg.add("第" + i.getAndIncrement() + "行");
+            String courseCode = examTaskTemp.getCourseCode();
+            String courseName = examTaskTemp.getCourseName();
+            String teachingRoomName = examTaskTemp.getTeachingRoomName();
+            String paperNumber = examTaskTemp.getPaperNumber();
+            String userAccount = examTaskTemp.getUserAccount();
+            String userName = examTaskTemp.getUserName();
+            if (StringUtils.isBlank(courseCode)) {
+                errorMsg.add("课程代码" + courseCode + "不能为空");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            if (StringUtils.isBlank(courseName)) {
+                errorMsg.add("课程名称[" + courseName + "]不能为空");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            if (StringUtils.isBlank(teachingRoomName)) {
+                errorMsg.add("开课学院[" + teachingRoomName + "]不能为空");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            SysOrg sysOrg = sysOrgList.stream().filter(m -> m.getName().equals(teachingRoomName)).findFirst().orElse(null);
+            if (sysOrg == null) {
+                errorMsg.add("开课学院[" + teachingRoomName + "]不存在");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            BasicCourse basicCourse = basicCourseList.stream().filter(m -> m.getTeachingRoomId().equals(sysOrg.getId()) && m.getCode().equals(courseCode)).findFirst().orElse(null);
+            if (basicCourse == null) {
+                errorMsg.add("开课学院[" + teachingRoomName + "]未找到课程代码[" + courseCode + "]");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            // 课程是否重复
+            if (courseCodeAndNameMap.containsKey(courseCode + teachingRoomName)) {
+                if (courseCodeAndNameMap.get(courseCode + teachingRoomName).equals(paperNumber)) {
+                    errorMsg.add("课程代码[" + courseCode + "]、开课学院[" + teachingRoomName + "]有重复数据");
+                    throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+                }
+            } else {
+                courseCodeAndNameMap.put(courseCode + teachingRoomName, paperNumber);
+            }
+            // 试卷编号是否重复
+            if (StringUtils.isNotBlank(paperNumber)) {
+                if (paperNumberAndCourseCodeMap.containsKey(paperNumber)) {
+                    errorMsg.add("试卷编号[" + paperNumber + "]有重复数据");
+                    throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+                } else {
+                    courseCodeAndNameMap.put(paperNumber, "1");
+                }
+            }
+            if ((StringUtils.isNotBlank(userAccount) && StringUtils.isBlank(userName)) ||
+                    (StringUtils.isBlank(userAccount) && StringUtils.isNotBlank(userName))) {
+                errorMsg.add("命题老师工号、命题老师姓名必须都为空或都不为空");
+                throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+            }
+            SysUserResult sysUser = null;
+            if (!StringUtils.isAllBlank(userAccount, userName)) {
+                // 校验命题老师
+                sysUser = sysUserList.stream().filter(m -> m.getLoginName().equals(userAccount)).findFirst().orElse(null);
+                if (sysUser != null && !userName.equals(sysUser.getRealName())) {
+                    errorMsg.add("命题老师姓名[" + userName + "]与用户管理中不一致");
+                    throw ExceptionResultEnum.ERROR.exception(errorMsg.toString());
+                }
+            }
+
+            examTaskTemp.setId(SystemConstant.getDbUuid());
+            examTaskTemp.setSchoolId(schoolId);
+            examTaskTemp.setBatchNo(examTaskImportResultDto.getBatchNo());
+            examTaskTemp.setCourseId(basicCourse.getId());
+            examTaskTempList.add(examTaskTemp);
+
+            ExamTaskDto examTaskDto = new ExamTaskDto();
+            examTaskDto.setCourseId(basicCourse.getId());
+            examTaskDto.setCourseCode(examTaskTemp.getCourseCode());
+            examTaskDto.setCourseName(examTaskTemp.getCourseName());
+            examTaskDto.setPaperNumber(examTaskTemp.getPaperNumber());
+            if (sysUser != null) {
+                examTaskDto.setUserId(String.valueOf(sysUser.getId()));
+                examTaskDto.setUserName(sysUser.getRealName());
+            }
+            examTaskDto.setUsers(sysUserList);
+            examTaskDtos.add(examTaskDto);
+
+        }
+        examTaskImportResultDto.setTasks(examTaskDtos);
+        if (CollectionUtils.isNotEmpty(examTaskTempList)) {
+            examTaskTempService.saveBatch(examTaskTempList);
+        }
+        return examTaskImportResultDto;
+    }
+
     @Override
     public List<ExamTask> saveBatch(ExamTask task) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -734,7 +863,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
 //                map.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
             map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> FlowApprovePassEnum.PASS);
-//                map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
+            map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskApplyPram.getApproveUserIds());
             map = activitiService.taskApprove(map);
             map.put(SystemConstant.SEND_FLOW_MQ, true);
         }

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

@@ -11,10 +11,7 @@ import com.qmth.distributed.print.business.bean.dto.PaperPdfDto;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.distributed.print.business.bean.dto.pdf.ExamStudentInfo;
 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.enums.*;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.service.PdfTaskLogicService;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
@@ -220,7 +217,11 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                 examStudentService.updateBatchById(examStudentList);
 
                 // 更新考生管理表中试卷编号和卷型
-                basicExamStudentService.updatePaperNumberAndPaperTypeById(examStudentList);
+                ExamTask examTask = examTaskService.getByExamIdAndPaperNumber(tbTaskPdf.getExamId(), examDetailCourse.getPaperNumber());
+                //查询题卡规则
+                BasicCardRule basicCardRule = basicCardRuleService.getById(examTask.getCardRuleId());
+                basicExamStudentService.updatePaperNumberAndPaperTypeById(examStudentList, basicCardRule);
+
             }
         } catch (Exception e) {
             throw ExceptionResultEnum.ERROR.exception(e.getMessage());
@@ -248,13 +249,17 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             int backupCount = SystemConstant.calcBackupCount(examDetail.getBackupCount(), examDetail.getTotalSubjects(), 1);
 
             List<ExamStudentInfo> examStudentInfoList = examStudentService.listStudentByExamDetailCourseId(examDetailCourse.getId());
+            //查询题卡规则
+            BasicCardRule basicCardRule = basicCardRuleService.getById(examTask.getCardRuleId());
+
             // 试卷数据组装
             if ((CreatePdfTypeEnum.ALL.equals(createPdfType) || CreatePdfTypeEnum.PAPER.equals(createPdfType)) && printContent.contains("PAPER")) {
                 List<PaperPdfDto> paperPdfDtoList = createPdfUtil.getPaperPdfFile(examDetailCourse.getPaperType(), examTaskDetail.getPaperInfoVoList(), createPdfDto);
                 // 生成考生试卷
                 if (CollectionUtils.isNotEmpty(examStudentInfoList)) {
                     for (ExamStudentInfo t : examStudentInfoList) {
-                        String[] waterMarkNames = {t.getStudentName(), t.getStudentCode()};
+                        // 印刷模式需要在试卷打水印(学号、姓名)
+                        String[] waterMarkNames = ExamNumberStyleEnum.PRINT.equals(basicCardRule.getExamNumberStyle()) ? new String[]{t.getStudentName(), t.getStudentCode()} : null;
                         createPdfUtil.getExamStudentPaperPdf(t.getPaperType(), paperPdfDtoList, createPdfDto, waterMarkNames);
                     }
                 } else if (examDetail.getTotalSubjects() != null) {
@@ -279,8 +284,6 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
 
             // 题卡数据组装
             if ((CreatePdfTypeEnum.ALL.equals(createPdfType) || CreatePdfTypeEnum.CARD_A3.equals(createPdfType)) && printContent.contains("CARD")) {
-                //查询题卡规则
-                BasicCardRule basicCardRule = basicCardRuleService.getById(examTask.getCardRuleId());
                 Map<String, ExamCard> examCardMap = new HashMap<>();
                 ExamCard examCard;
                 for (PaperInfoVo paperInfoVo : examTaskDetail.getPaperInfoVoList()) {

+ 5 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -579,6 +579,10 @@ public class CreatePdfUtil {
                         } else if (RequiredFieldsEnum.EXAM_ROOM.getCode().equals(extendDto.getCode())) {
                             value = examDetail.getExamRoom();
                         }
+                        // 江西中医药大学题卡回填字段clazzName单独处理
+                        if(RequiredFieldsEnum.CLASS_NAME.getCode().equals(extendDto.getCode())) {
+                            studentHtml = studentHtml.replaceAll("\\$\\{clazzName\\}", value);
+                        }
                         studentHtml = studentHtml.replaceAll("\\$\\{" + extendDto.getCode() + "\\}", value);
                     }
                 }
@@ -700,6 +704,7 @@ public class CreatePdfUtil {
         } else {
             htmlContent = htmlContent.replaceAll("\\$\\{packageCodeDom\\}", "");
         }
+        htmlContent = htmlContent.replaceAll("\\$\\{[A-Za-z0-9]+\\}", "");
         return htmlContent;
     }
 

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

@@ -76,7 +76,11 @@
             basic_card_rule a
         <where>
             AND a.school_id = #{schoolId}
---             AND a.enable = true
+            AND (a.enable = true
+                <if test="examId != null">
+                    or exists (select 1 from basic_print_config bpc where bpc.exam_id = #{examId} and a.id = bpc.card_rule_id)
+                </if>
+            )
         </where>
         order by create_time desc
     </select>

+ 3 - 14
distributed-print-business/src/main/resources/mapper/ExamCardMapper.xml

@@ -44,20 +44,9 @@
         order by a.create_time desc
     </select>
     <select id="listPage" resultType="com.qmth.distributed.print.business.entity.ExamCard">
-        select ec.id,
-               ec.title,
-               ec.make_method,
-               ec.status,
-               ec.type,
-               ec.create_method,
-               ec.enable,
-               ec.used,
-               ec.remark,
-               ec.card_rule_id,
-               ec.create_time,
-               ec.jpg_attachment,
-               bc.code courseCode,
-               bc.name courseName
+        select bc.code courseCode,
+                bc.name courseName,
+                ec.*
                from exam_card ec
             left join basic_course bc on ec.course_id = bc.id
         <where>

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

@@ -503,6 +503,7 @@
         a.start_time startTime,
         a.end_time endTime,
         a.create_id createId,
+        a.exam_task_detail_enable,
         IFNULL(g.update_time, a.update_time) createTime,
         CASE a.card_rule_id
         WHEN - 1 THEN '全部通卡'

+ 3 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicCardRuleController.java

@@ -64,13 +64,13 @@ public class BasicCardRuleController {
     /**
      * 模糊查询
      *
-     * @param param
+     * @param examId 考试ID
      * @return
      */
     @ApiOperation(value = "模糊查询")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
-    public Result list(@RequestParam(value = "param", required = false) String param) {
-        List<BasicCardRule> cardRules = basicCardRuleService.list(param);
+    public Result list(@RequestParam(value = "examId", required = false) Long examId) {
+        List<BasicCardRule> cardRules = basicCardRuleService.list(examId);
         return ResultUtil.ok(cardRules);
     }
 

+ 3 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskQueryController.java

@@ -98,10 +98,11 @@ public class ExamTaskQueryController {
     @OperationLogDetail(operationType = OperationTypeEnum.ENABLE, detail = "启用/禁用操作,命题任务ID:{{examTaskDetail.examTaskId}}")
     public Result taskPaperEnable(@RequestBody ExamTask examTask) throws IOException {
         boolean isSuccess = examTaskDetailService.enable(examTask);
+        ExamTask examTaskById = examTaskService.getById(examTask.getId());
         // 启用,触发考场生成pdf
-        if (examTask.getExamTaskDetailEnable()) {
+        if (examTaskById.getExamTaskDetailEnable()) {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-            ExamTask examTaskById = examTaskService.getById(examTask.getId());
+
             // 校验课程关联考场,是否已经提交打印
             Boolean isCreate = printCommonService.checkExamDetailStatus(examTaskById.getSchoolId(), null, examTaskById.getExamId(), examTaskById.getCourseId(), examTaskById.getPaperNumber());
             // 校验是否可以提交打印状态

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

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.aventrix.jnanoid.jnanoid.NanoIdUtils;
 import com.qmth.boot.core.uid.service.UidService;
+import com.qmth.boot.tools.excel.model.CellValue;
 import com.qmth.teachcloud.common.annotation.DBVerify;
 import com.qmth.teachcloud.common.bean.result.DBVerifyResult;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
@@ -29,7 +30,6 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.text.DecimalFormat;
 import java.text.MessageFormat;
 import java.time.LocalDateTime;
@@ -1362,7 +1362,6 @@ public class SystemConstant {
         return path;
     }
 
-
     public static void addSummary(StringJoiner stringJoinerSummary, String message) {
         // 时间:事件
         stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), "->", message));

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/SysUserMapper.java

@@ -125,4 +125,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     List<SysUserResult> findCourseSysUserResultByTeachIdSet(@Param("teachIdSet") Set<Long> teachIdSet);
 
     SysUser getByUserId(@Param("userId") Long userId);
+
+    List<SysUserResult> listBySchoolId(@Param("schoolId") Long schoolId);
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicCourseService.java

@@ -94,4 +94,6 @@ public interface BasicCourseService extends IService<BasicCourse> {
     void importBasicCourse(MultipartFile file);
 
     BasicCourse getByTeachRoomIdAndCode(Long teachRoomId, String courseCode);
+
+    List<BasicCourse> listBySchoolId(Long schoolId);
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java

@@ -248,4 +248,6 @@ public interface SysUserService extends IService<SysUser> {
 	void updateUiSetting(Long userId, String unescapeHtml);
 
     SysUser getByLoginName(Long schoolId, String loginName);
+
+    List<SysUserResult> listBySchoolId(Long schoolId);
 }

+ 7 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCourseServiceImpl.java

@@ -351,4 +351,11 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
                 .eq(BasicCourse::getCode, courseCode);
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public List<BasicCourse> listBySchoolId(Long schoolId) {
+        QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId);
+        return this.list(queryWrapper);
+    }
 }

+ 5 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -1156,4 +1156,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 .eq(SysUser::getLoginName, loginName);
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public List<SysUserResult> listBySchoolId(Long schoolId) {
+        return this.baseMapper.listBySchoolId(schoolId);
+    }
 }

+ 18 - 0
teachcloud-common/src/main/resources/mapper/SysUserMapper.xml

@@ -491,4 +491,22 @@
         WHERE
             su.id = #{userId}
     </select>
+    <select id="listBySchoolId" resultType="com.qmth.teachcloud.common.bean.result.SysUserResult">
+        SELECT
+            su.id as id,
+            su.login_name as loginName,
+            su.real_name as realName,
+            su.real_name as name,
+            su.mobile_number as mobileNumber,
+            so.id as orgId,
+            so.name as orgName,
+            so.code as orgCode
+        FROM
+            sys_user su
+                LEFT JOIN
+            sys_org so ON su.org_id = so.id
+        WHERE
+            su.school_id = #{schoolId} AND su.enable = 1
+          AND so.enable = 1
+    </select>
 </mapper>

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/manage/MarkerSpecialTagDTO.java

@@ -1,5 +1,7 @@
 package com.qmth.teachcloud.mark.dto.mark.manage;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.mark.dto.mark.SpecialTagDTO;
 import com.qmth.teachcloud.mark.entity.MarkHeaderTag;
 import com.qmth.teachcloud.mark.entity.MarkSpecialTag;
@@ -8,6 +10,7 @@ public class MarkerSpecialTagDTO extends SpecialTagDTO {
 
     private static final long serialVersionUID = 4928109012686348307L;
 
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long markerId;
 
     private int groupNumber;

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

@@ -1439,6 +1439,7 @@ public class MarkServiceImpl implements MarkService {
             markRejectHistoryService.save(history);
             markTrackService.deleteByTaskId(markTask.getId());
             markSpecialTagService.deleteByTaskId(markTask.getId());
+            markHeaderTrackService.deleteByExamIdAndPaperNumberAndGroupNumberAndStudentId(markTask.getExamId(), markTask.getPaperNumber(), markTask.getGroupNumber(), markTask.getStudentId());
             markSubjectiveScoreService.updateRejected(markTask.getStudentId(), markTask.getGroupNumber(), true);
             resetStudentGroup(markTask.getStudentId(), markTask.getExamId(), markTask.getPaperNumber(), markTask.getGroupNumber());
             updateMarkedCount(markTask.getExamId(), markTask.getPaperNumber(), markTask.getGroupNumber());

+ 25 - 9
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -70,9 +70,11 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.FillPatternType;
 import org.apache.poi.ss.usermodel.IndexedColors;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.FileCopyUtils;
+import org.springframework.util.ReflectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -85,6 +87,7 @@ import java.awt.color.ColorSpace;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorConvertOp;
 import java.io.*;
+import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.util.List;
@@ -1284,8 +1287,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                 for (Map.Entry<CellValue, List<CellValue[]>> entry : entrySet) {
                     writer = ExcelWriter.create(ExcelType.XLSX);
                     writer.writeDataArrays("成绩单", null, columnNames, entry.getValue().listIterator());
-                    // todo 班级名称未解决
-                    FileOutputStream classFileOut = new FileOutputStream(downloadFilePath + File.separator + basicCourse.getName() + "-" + entry.getKey() + "成绩单" + SystemConstant.EXCEL_PREFIX);
+                    Object value = getCellValueFieldValue("value", entry.getKey());
+                    FileOutputStream classFileOut = new FileOutputStream(downloadFilePath + File.separator + basicCourse.getName() + "-" + value + "成绩单" + SystemConstant.EXCEL_PREFIX);
                     writer.output(classFileOut);
                     classFileOut.flush();
                     classFileOut.close();
@@ -1304,6 +1307,16 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         }
     }
 
+    private static Object getCellValueFieldValue(String fieldName, CellValue cellValue) {
+        try {
+            Field declaredField = CellValue.class.getDeclaredField(fieldName);
+            declaredField.setAccessible(true);
+            return declaredField.get(cellValue);
+        } catch (Exception e) {
+            throw new RuntimeException("获取属性值失败: " + e.getMessage(), e);
+        }
+    }
+
     @Override
     public ScoreReportVo scoreReport(ArchiveStudentQuery query) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -1548,7 +1561,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 
     private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
         List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
-        Map<String, List<ArchiveStudentVo>> collect = studentList.stream().collect(Collectors.groupingBy(ArchiveStudentVo::getPaperType));
+        Map<String, List<ArchiveStudentVo>> collect = studentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperType())).collect(Collectors.groupingBy(ArchiveStudentVo::getPaperType));
 
         List<QuestionObjectiveVo> questionObjectiveVoList = new ArrayList<>();
         for (Map.Entry<String, List<ArchiveStudentVo>> entry : collect.entrySet()) {
@@ -2019,15 +2032,17 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             if (MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
                 throw ExceptionResultEnum.ERROR.exception("试卷编号[" + markPaper.getPaperNumber() + "]已结束阅卷,不允许新增考生");
             }
-            markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), markPaper.getSerialNumber(), markPaper.getPaperType(), basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
-            if (markStudent.getSecretNumber() == null) {
-                markStudent.randomSecretNumber();
-                while (secretNumberSet.contains(markStudent.getSecretNumber())
-                        || this.countByExamIdAndSecretNumber(markStudent.getExamId(), markStudent.getSecretNumber()) > 0) {
+            if (StringUtils.isNotBlank(basicExamStudent.getPaperType())) {
+                markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), markPaper.getSerialNumber(), basicExamStudent.getPaperType(), basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
+                if (markStudent.getSecretNumber() == null) {
                     markStudent.randomSecretNumber();
+                    while (secretNumberSet.contains(markStudent.getSecretNumber())
+                            || this.countByExamIdAndSecretNumber(markStudent.getExamId(), markStudent.getSecretNumber()) > 0) {
+                        markStudent.randomSecretNumber();
+                    }
                 }
+                secretNumberSet.add(markStudent.getSecretNumber());
             }
-            secretNumberSet.add(markStudent.getSecretNumber());
         } else {
             markStudent.setPaperNumber(basicExamStudent.getPaperNumber());
             markStudent.setPaperType(basicExamStudent.getPaperType());
@@ -2280,4 +2295,5 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         this.update(markStudentUpdateWrapper);
         return UpdateTimeVo.create();
     }
+
 }

+ 10 - 11
teachcloud-mark/src/main/resources/mapper/MarkRejectHistoryMapper.xml

@@ -37,18 +37,17 @@
                  *
              FROM
                  mark_reject_history
-             WHERE
+            <where>
                  exam_id = #{examId} AND paper_number = #{paperNumber}
-                <where>
-                    <if test="groupNumber != null">
-                        and group_number = #{groupNumber}
-                    </if>
-                    <if test="studentCode != null and studentCode != ''">
-                        and student_code like concat('%', #{studentCode}, '%')
-                    </if>
-                    <if test="secretNumber != null and secretNumber != ''">
-                        and secret_number = #{secretNumber}
-                    </if>
+                <if test="groupNumber != null">
+                    and group_number = #{groupNumber}
+                </if>
+                <if test="studentCode != null and studentCode != ''">
+                    and student_code like concat('%', #{studentCode}, '%')
+                </if>
+                <if test="secretNumber != null and secretNumber != ''">
+                    and secret_number = #{secretNumber}
+                </if>
                 </where>
              ) mrh
                 LEFT JOIN