Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev_v3.3.1' into dev_v3.3.1

wangliang 1 anno fa
parent
commit
5896cd35a4

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailService.java

@@ -242,4 +242,6 @@ public interface ExamDetailService extends IService<ExamDetail> {
     ExamDetail getByExamDetailCourseId(Long examDetailId);
 
     int countMakeupUsedByExamIdAndPaperNumber(Long examId, String paperNumber);
+
+    void updateStatusById(ExamDetailStatusEnum examDetailStatusEnum, Long id);
 }

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

@@ -7,24 +7,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.tools.excel.ExcelReader;
 import com.qmth.boot.tools.excel.enums.ExcelType;
-import com.qmth.boot.tools.excel.model.DataMap;
-import com.qmth.boot.tools.models.ByteArray;
 import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
 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.BasicExamStudent;
 import com.qmth.distributed.print.business.entity.BasicTeachClazz;
-import com.qmth.distributed.print.business.listener.ObjectCollector;
 import com.qmth.distributed.print.business.mapper.BasicExamStudentMapper;
 import com.qmth.distributed.print.business.service.BasicExamStudentService;
 import com.qmth.distributed.print.business.service.BasicTeachClazzService;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
+import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
@@ -67,6 +66,9 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
     @Resource
     private SysUserService sysUserService;
 
+    @Resource
+    private CommonCacheService commonCacheService;
+
     @Override
     public IPage<BasicExamStudentResult> page(SysUser requestUser, Long semesterId, Long examId, String courseCode,
             String teacher, String college, String major, String teachClazz, String examStudentInfo, int pageNumber,
@@ -250,6 +252,8 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         }
 
         // 校验2 试卷编号存在时,任课教师,考试时间,考点考场均必填;
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        boolean needPaperNumber = basicSchool.getHasPaperNumber();
         if (SystemConstant.strNotNull(paperNumber)) {
             String hasPaperNumberError = "存在试卷编号时: ";
             if (!SystemConstant.strNotNull(teacherCode) || !SystemConstant.strNotNull(teacherName)) {
@@ -264,6 +268,8 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             if (!SystemConstant.strNotNull(examRoom)) {
                 errorMsgList.add(hasPaperNumberError + "缺少考场信息");
             }
+        } else if (needPaperNumber) {
+            errorMsgList.add("缺少试卷编号");
         }
 
         if (CollectionUtils.isNotEmpty(errorMsgList)) {

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

@@ -540,7 +540,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                 .set(ExamDetail::getPrintStartTime, System.currentTimeMillis())
                 .set(ExamDetail::getPrintEndTime, System.currentTimeMillis())
                 .eq(ExamDetail::getId, examDetail.getId());
-         this.update(updateWrapper);
+        this.update(updateWrapper);
 
         // 所有考场打印完成,更新印刷计划状态
         examPrintPlanService.updateFinishStatus(examDetail.getPrintPlanId());
@@ -606,7 +606,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                 taskSubmit(examDetail);
             } else if ("cancel".equals(type)) {
                 taskCancel(Long.valueOf(id));
-            } else if("finish".equals(type)){
+            } else if ("finish".equals(type)) {
                 taskFinish(examDetail);
             }
         }
@@ -1246,4 +1246,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     public int countMakeupUsedByExamIdAndPaperNumber(Long examId, String paperNumber) {
         return this.baseMapper.countMakeupUsedByExamIdAndPaperNumber(examId, paperNumber);
     }
+
+    @Override
+    public void updateStatusById(ExamDetailStatusEnum examDetailStatusEnum, Long id) {
+        UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(ExamDetail::getStatus, examDetailStatusEnum)
+                .eq(ExamDetail::getId, id);
+        this.update(updateWrapper);
+    }
 }

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.qmth.distributed.print.business.bean.dto.CreatePdfDto;
 import com.qmth.distributed.print.business.bean.dto.ExamStudentCourseDto;
@@ -101,21 +102,41 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             updatePdfDataStatus(tbTaskPdf);
 
             ExamDetail examDetail = examDetailService.getById(tbTaskPdf.getId());
-            if(examDetail == null){
+            if (examDetail == null) {
                 throw ExceptionResultEnum.EXAM_DETAIL_IS_NULL.exception();
             }
             createPdfDto.setExamDetail(examDetail);
             ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetail.getPrintPlanId());
-            if(examPrintPlan == null){
+            if (examPrintPlan == null) {
                 throw ExceptionResultEnum.EXAM_PRINT_IS_NULL.exception();
             }
             createPdfDto.setExamPrintPlan(examPrintPlan);
             List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listByExamDetailId(tbTaskPdf.getId());
-            if(CollectionUtils.isEmpty(examDetailCourseList)){
+            if (CollectionUtils.isEmpty(examDetailCourseList)) {
                 throw ExceptionResultEnum.EXAM_DETAIL_COURSE_IS_NULL.exception();
             }
             createPdfDto.setExamDetailCourseList(examDetailCourseList);
 
+            createPdfCore(tbTaskPdf, createPdfDto, stringJoinerSummary);
+            long endTime = System.currentTimeMillis();
+            addSummary(stringJoinerSummary, "pdf文件生成成功,共处理" + examDetail.getTotalSubjects() + "科次。耗时:" + (endTime - startTime) / 1000 + "秒");
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        } finally {
+            if (CollectionUtils.isNotEmpty(createPdfDto.getFileTempList())) {
+                for (File file : createPdfDto.getFileTempList()) {
+                    FileUtil.deleteFile(file);
+                }
+            }
+            //
+
+        }
+    }
+
+    @Transactional
+    public void createPdfCore(TBTaskPdf tbTaskPdf, CreatePdfDto createPdfDto, StringJoiner stringJoinerSummary) {
+        ExamDetailStatusEnum examDetailStatusEnum = null;
+        try {
             // 抽取卷型,更新考场、考生对应卷型值
             updateAssignPaperType(tbTaskPdf, createPdfDto);
             // 查询生成pdf需要文件
@@ -126,21 +147,19 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             String dirNamePaper = createPdfNewUtil.mergeA3Pdf(createPdfDto.getPaperPdfList());
             //合并A3(题卡+备用题卡)
             String dirNameCardA3 = createPdfNewUtil.mergeA3Pdf(createPdfDto.getCardPdfList());
+            // 生成A4文件
+            createA4File(tbTaskPdf, createPdfDto.getExamDetailCourseList(), createPdfDto.getFileTempList());
             // 更新文件路径、更新考场状态、印刷计划状态
             createPdfNewUtil.mergePdfSaveDb(dirNamePaper, dirNameCardA3, tbTaskPdf);
-            // 生成A4文件
-            createA4File(tbTaskPdf, examDetailCourseList, createPdfDto.getFileTempList());
-            long endTime = System.currentTimeMillis();
-            addSummary(stringJoinerSummary, "pdf文件生成成功,共处理" + examDetail.getTotalSubjects() + "科次。耗时:" + (endTime - startTime) / 1000 + "秒");
         } catch (Exception e) {
+            examDetailStatusEnum = ExamDetailStatusEnum.NEW;
             throw ExceptionResultEnum.ERROR.exception(e.getMessage());
         } finally {
-            if (CollectionUtils.isNotEmpty(createPdfDto.getFileTempList())) {
-                for (File file : createPdfDto.getFileTempList()) {
-                    FileUtil.deleteFile(file);
-                }
+            if (ExamDetailStatusEnum.NEW.equals(examDetailStatusEnum)) {
+                examDetailService.updateStatusById(examDetailStatusEnum, tbTaskPdf.getId());
             }
         }
+
     }
 
     private void updatePdfDataStatus(TBTaskPdf tbTaskPdf) {
@@ -150,8 +169,19 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             throw ExceptionResultEnum.EXAM_PRINT_IS_NULL.exception();
         }
         UpdateWrapper<ExamDetail> examDetailQueryWrapper = new UpdateWrapper<>();
-        examDetailQueryWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.CREATING)
-                .eq(ExamDetail::getId, tbTaskPdf.getId());
+        LambdaUpdateWrapper<ExamDetail> lambda = examDetailQueryWrapper.lambda();
+        lambda.set(ExamDetail::getStatus, ExamDetailStatusEnum.CREATING);
+        if (CreatePdfTypeEnum.ALL.equals(tbTaskPdf.getCreateType()) || CreatePdfTypeEnum.PAPER.equals(tbTaskPdf.getCreateType())) {
+            lambda.set(ExamDetail::getAttachmentId, null);
+        }
+        if (CreatePdfTypeEnum.ALL.equals(tbTaskPdf.getCreateType()) || CreatePdfTypeEnum.CARD_A3.equals(tbTaskPdf.getCreateType())) {
+            lambda.set(ExamDetail::getCardAttachmentId, null);
+        }
+        if (CreatePdfTypeEnum.ALL.equals(tbTaskPdf.getCreateType()) || CreatePdfTypeEnum.SIGN.equals(tbTaskPdf.getCreateType())
+                || CreatePdfTypeEnum.PACKAGE.equals(tbTaskPdf.getCreateType()) || CreatePdfTypeEnum.CHECK_IN.equals(tbTaskPdf.getCreateType())) {
+            lambda.set(ExamDetail::getAttachmentPath, null);
+        }
+        lambda.eq(ExamDetail::getId, tbTaskPdf.getId());
         examDetailService.update(examDetailQueryWrapper);
 
         //所有考场都撤回,印刷任务状态改为就绪

+ 11 - 12
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -271,7 +271,6 @@ CREATE TABLE `course_target` (
 
 ALTER TABLE `course_target`
     ADD UNIQUE INDEX `course_target_unique` (`school_id` ASC,`exam_id` ASC, `course_code` ASC, `target_name` ASC);
-;
 
 CREATE TABLE `course_evaluation` (
                                      `id` BIGINT(20) NOT NULL COMMENT 'id',
@@ -289,7 +288,6 @@ CREATE TABLE `course_evaluation` (
 
 ALTER TABLE `course_evaluation`
     ADD UNIQUE INDEX `course_evaluation_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `evaluation` ASC);
-;
 
 CREATE TABLE `course_weight` (
                                  `id` BIGINT(20) NOT NULL COMMENT 'id',
@@ -312,7 +310,6 @@ COMMENT = '课程权重设置表';
 
 ALTER TABLE `course_weight`
     ADD UNIQUE INDEX `course_weight_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `target_id` ASC, `evaluation_id` ASC);
-;
 
 CREATE TABLE `basic_teach_clazz` (
                                      `id` BIGINT(20)NOT NULL COMMENT 'id',
@@ -331,7 +328,6 @@ COMMENT = '基础教学班表';
 
 ALTER TABLE `basic_teach_clazz`
     ADD UNIQUE INDEX `basic_teach_clazz_unique` (`school_id` ASC, `exam_id` ASC, `clazz_name` ASC);
-;
 
 CREATE TABLE `basic_exam_student` (
                                       `id` BIGINT(20) NOT NULL COMMENT 'id',
@@ -359,7 +355,6 @@ CREATE TABLE `basic_exam_student` (
 
 ALTER TABLE `basic_exam_student`
     ADD UNIQUE INDEX `basic_exam_student_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `student_code` ASC);
-;
 
 -- 2024/2/27
 UPDATE sys_privilege
@@ -440,7 +435,6 @@ WHERE
 ALTER TABLE `teach_course`
     DROP INDEX `teach_course_unique` ,
     ADD UNIQUE INDEX `teach_course_unique` USING BTREE (`school_id`, `exam_id`, `course_code`, `user_id`);
-;
 
 ALTER TABLE `course_dimension`
     ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
@@ -448,7 +442,6 @@ ALTER TABLE `course_dimension`
     ADD COLUMN `source` VARCHAR(20) NOT NULL COMMENT '来源' AFTER `user_id`;
 ALTER TABLE `course_dimension`
     ADD UNIQUE INDEX `course_dimension_unique` (`teach_course_id` ASC, `source` ASC, `code` ASC);
-;
 
 ALTER TABLE `course_evaluation`
     ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
@@ -456,23 +449,18 @@ ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
 ADD COLUMN `type` VARCHAR(20) NOT NULL COMMENT '类型(默认DEFAULT、自定义CUSTOM)' AFTER `user_id`,
 DROP INDEX `course_evaluation_unique` ,
 ADD UNIQUE INDEX `course_evaluation_unique` (`teach_course_id` ASC, `evaluation` ASC);
-;
 
 ALTER TABLE `course_target`
     ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
 ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
 DROP INDEX `course_target_unique` ,
 ADD UNIQUE INDEX `course_target_unique` (`teach_course_id` ASC, `target_name` ASC);
-;
 
 ALTER TABLE `course_weight`
     ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
 ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
 DROP INDEX `course_weight_unique` ,
 ADD UNIQUE INDEX `course_weight_unique` (`teach_course_id` ASC, `target_id` ASC, `evaluation_id` ASC);
-;
-
-
 
 -- 2024/03/02
 DROP TABLE IF EXISTS `exam_task_paper_data`;
@@ -679,3 +667,14 @@ ALTER TABLE `mark_question`
 ADD COLUMN `create_time` BIGINT(20) NULL AFTER `create_id`,
 ADD COLUMN `update_id` BIGINT(20) NULL AFTER `create_time`,
 ADD COLUMN `update_time` BIGINT(20) NULL AFTER `update_id`;
+
+-- 2024/03/22
+update sys_privilege set related = 768 where id = 770;
+
+UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '762');
+UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '761');
+UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '875');
+UPDATE `sys_privilege` SET `name` = '考生库选择' WHERE (`id` = '876');
+UPDATE `sys_privilege` SET `name` = '考生库选择(是否可选学生)' WHERE (`id` = '877');
+
+ALTER TABLE `basic_school` ADD COLUMN `has_paper_number` TINYINT(1) NULL DEFAULT '0' COMMENT '该学校是否有固定试卷编号' AFTER `default_school`;

+ 5 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java

@@ -87,12 +87,12 @@ public class BasicExamStudentController {
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
     public Result basicExamStudentImportSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
             @ApiParam(value = "考试id", required = true) @RequestParam String examId) throws Exception {
-//        Map<String, Object> map = printCommonService.saveTask(file,SystemConstant.convertIdToLong(examId), TaskTypeEnum.BASIC_EXAM_STUDENT_IMPORT);
-//        map.put("examId", SystemConstant.convertIdToLong(examId));
-//        return syncBasicExamStudentImportService.importTask(map);
+        Map<String, Object> map = printCommonService.saveTask(file,SystemConstant.convertIdToLong(examId), TaskTypeEnum.BASIC_EXAM_STUDENT_IMPORT);
+        map.put("examId", SystemConstant.convertIdToLong(examId));
+        return syncBasicExamStudentImportService.importTask(map);
 
-        basicExamStudentService.testImport(file);
-        return ResultUtil.ok();
+//        basicExamStudentService.testImport(file);
+//        return ResultUtil.ok();
     }
 
     @ApiOperation(value = "考生字典管理-导出")

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

@@ -94,9 +94,11 @@ public class WorkController {
         IPage<MarkSettingDto> markSettingDtoIPage = markPaperService.listPaperSetting(null, null, null, false, pageNumber, pageSize);
         for (MarkSettingDto record : markSettingDtoIPage.getRecords()) {
             ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndCourseCodeAndPaperNumber(record.getExamId(), record.getCourseCode(), record.getPaperNumber());
-            List<PaperInfoVo> paperInfoVos = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), record.getPaperType());
-            if (CollectionUtils.isNotEmpty(paperInfoVos)) {
-                record.setCardId(Long.valueOf(paperInfoVos.get(0).getCardId()));
+            if (examTaskDetail != null) {
+                List<PaperInfoVo> paperInfoVos = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), record.getPaperType());
+                if (CollectionUtils.isNotEmpty(paperInfoVos)) {
+                    record.setCardId(Long.valueOf(paperInfoVos.get(0).getCardId()));
+                }
             }
         }
         return ResultUtil.ok(markSettingDtoIPage);

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkDocumentController.java

@@ -77,7 +77,7 @@ public class MarkDocumentController {
                        @ApiParam(value = "文档ID", required = true) String documentName,
                        @ApiParam(value = "文件md5", required = true) String md5,
                        @ApiParam(value = "文件", required = true) @RequestParam MultipartFile file) {
-        return ResultUtil.ok(markDocumentService.save(examId, paperNumber,documentName, file,md5));
+        return ResultUtil.ok(markDocumentService.save(examId, paperNumber,documentName, file,md5), null);
     }
 
     @ApiOperation(value = "文档删除")

+ 12 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicSchool.java

@@ -54,6 +54,10 @@ public class BasicSchool extends BaseEntity implements Serializable {
     @TableField(value = "default_school")
     private Boolean defaultSchool;
 
+    @ApiModelProperty(value = "该学校是否有固定试卷编号")
+    @TableField(value = "has_paper_number")
+    private Boolean hasPaperNumber;
+
     public BasicSchool() {
 
     }
@@ -180,4 +184,12 @@ public class BasicSchool extends BaseEntity implements Serializable {
     public void setDefaultSchool(Boolean defaultSchool) {
         this.defaultSchool = defaultSchool;
     }
+
+    public Boolean getHasPaperNumber() {
+        return hasPaperNumber;
+    }
+
+    public void setHasPaperNumber(Boolean hasPaperNumber) {
+        this.hasPaperNumber = hasPaperNumber;
+    }
 }

+ 2 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/ExamModelEnum.java

@@ -9,7 +9,8 @@ public enum ExamModelEnum {
 
     MODEL1("电子交卷环节需要提交考务数据"),
     MODEL2("电子交卷环节不需要提交考务数据,只输入印刷份数即可"),
-    MODEL3("电子交卷环节不需要提交考务数据");
+    MODEL3("电子交卷环节不需要提交考务数据"),
+    MODEL4("跳过电子交卷环节,直接使用阅卷");
 
     private String desc;
 

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

@@ -283,7 +283,7 @@ public class MarkServiceImpl implements MarkService {
             if (markTask.getStatus() == MarkTaskStatus.MARKED) {
                 validCount++;
                 // 有效分数里,管理员打分数量(主观题检查)
-                if (markTask.getHeaderId() != null) {
+                if (markTask.getHeaderScore() != null) {
                     headerFinishCount++;
                 }
             }