xiaofei 1 жил өмнө
parent
commit
4a43f14fe1

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

@@ -576,6 +576,9 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
     @Override
     public ExamTaskDetail findByExamIdAndCourseCodeAndPaperNumber(Long examId, String code, String number) {
         ExamTask examTask = examTaskService.getByExamIdAndCourseCodeAndPaperNumber(examId, code, number);
+        if (examTask == null) {
+            return null;
+        }
         return this.getByExamTaskId(examTask.getId());
     }
 

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

@@ -1269,7 +1269,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, paperInfoVo.getCardId());
                     examCardService.update(updateWrapper);
                 }
-                // 删除临时题卡
+            }
+            // 删除临时题卡
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
                 if (paperInfoVo.getPaperId() != null) {
                     QueryWrapper<ExamCard> deleteWrapper = new QueryWrapper<>();
                     deleteWrapper.lambda().eq(ExamCard::getCreateId, sysUser.getId())

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -644,7 +644,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
         String printPlanName = examPrintPlan.getName();
         if (!tbTaskPdfService.countByPrintPlanIdAndEntityId(schoolId, printPlanId)) {
-            throw ExceptionResultEnum.ERROR.exception("印刷计划[" + printPlanName + "]正在生成PDF文件,无法导入考务数据");
+            throw ExceptionResultEnum.ERROR.exception("印刷计划[" + printPlanName + "]有考场正在生成PDF文件,无法导入考务数据");
         }
         PrintPlanStatusEnum printPlanStatus = examPrintPlan.getStatus();
         if (PrintPlanStatusEnum.NEW != printPlanStatus && PrintPlanStatusEnum.READY != printPlanStatus) {

+ 9 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -472,19 +472,26 @@ public class CreatePdfUtil {
                 }
                 basicPlate.add(basicMap);
             } else if ("collegeName".equals(code)) {
-                Set<String> collegeNames = examStudentList.stream().map(ExamStudentCourseDto::getCollegeName).collect(Collectors.toSet());
+                Set<String> collegeNames = examStudentList.stream().filter(m->StringUtils.isNotBlank(m.getCollegeName())).map(ExamStudentCourseDto::getCollegeName).collect(Collectors.toSet());
                 Map<String, String> basicMap = new HashMap<>();
                 basicMap.put("code", code);
                 basicMap.put("name", name);
                 basicMap.put("value", String.join(SystemConstant.COMMA_OF_CHINESE, collegeNames));
                 basicPlate.add(basicMap);
             } else if ("majorName".equals(code)) {
-                Set<String> majorNames = examStudentList.stream().map(ExamStudentCourseDto::getMajorName).collect(Collectors.toSet());
+                Set<String> majorNames = examStudentList.stream().filter(m->StringUtils.isNotBlank(m.getMajorName())).map(ExamStudentCourseDto::getMajorName).collect(Collectors.toSet());
                 Map<String, String> basicMap = new HashMap<>();
                 basicMap.put("code", code);
                 basicMap.put("name", name);
                 basicMap.put("value", String.join(SystemConstant.COMMA_OF_CHINESE, majorNames));
                 basicPlate.add(basicMap);
+            } else if ("teachClazzName".equals(code)) {
+                Set<String> teachClassNames = examStudentList.stream().filter(m->StringUtils.isNotBlank(m.getClazzName())).map(ExamStudentCourseDto::getClazzName).collect(Collectors.toSet());
+                Map<String, String> basicMap = new HashMap<>();
+                basicMap.put("code", code);
+                basicMap.put("name", name);
+                basicMap.put("value", String.join(SystemConstant.COMMA_OF_CHINESE, teachClassNames));
+                basicPlate.add(basicMap);
             } else if ("examCount".equals(code)) {
                 Map<String, String> basicMap = new HashMap<>();
                 basicMap.put("code", code);

+ 6 - 0
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -673,3 +673,9 @@ CREATE TABLE `client_upgrade` (
           `upgrade_path` VARCHAR(200) NULL COMMENT '升级包保存地址',
           `mainfest_path` VARCHAR(200) NULL COMMENT 'mainfest.json文件保存路径',
           PRIMARY KEY (`platform`));
+
+ALTER TABLE `mark_question`
+    ADD COLUMN `create_id` BIGINT(20) NULL AFTER `objective_policy_score`,
+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`;

+ 14 - 10
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkQuestionController.java

@@ -39,7 +39,7 @@ import java.util.List;
 @Api(tags = "评卷-试卷结构")
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_MARK + "/question")
-public class MarkQuestionController extends BaseController{
+public class MarkQuestionController extends BaseController {
 
     @Resource
     private MarkQuestionService markQuestionService;
@@ -56,15 +56,19 @@ public class MarkQuestionController extends BaseController{
     public Result list(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
                        @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
                        @ApiParam(value = "试卷编号", required = true) @RequestParam String paperType) {
-        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndCourseCodeAndPaperNumber(examId, null, paperNumber);
-        List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), paperType);
-        PaperInfoVo paperInfoVo = paperInfoVoList.get(0);
         boolean canCreate = false;
-        if (paperInfoVo.getCardId() != null) {
-            ExamCard examCard = examCardService.getById(paperInfoVo.getCardId());
-            if (examCard != null) {
-                if (CardCreateMethodEnum.UPLOAD.equals(examCard.getCreateMethod())) {
-                    canCreate = true;
+        ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndCourseCodeAndPaperNumber(examId, null, paperNumber);
+        if (examTaskDetail == null) {
+            canCreate = true;
+        } else {
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), paperType);
+            PaperInfoVo paperInfoVo = paperInfoVoList.get(0);
+            if (paperInfoVo.getCardId() != null) {
+                ExamCard examCard = examCardService.getById(paperInfoVo.getCardId());
+                if (examCard != null) {
+                    if (CardCreateMethodEnum.UPLOAD.equals(examCard.getCreateMethod())) {
+                        canCreate = true;
+                    }
                 }
             }
         }
@@ -127,6 +131,6 @@ public class MarkQuestionController extends BaseController{
                                    @ApiParam(value = "文件", required = true) @RequestParam MultipartFile file,
                                    @ApiParam(value = "文件md5", required = true) @RequestParam String md5) {
 
-        return ResultUtil.ok(markQuestionService.uploadSubjectiveFile(examId, paperNumber, file, md5),"");
+        return ResultUtil.ok(markQuestionService.uploadSubjectiveFile(examId, paperNumber, file, md5), "");
     }
 }

+ 14 - 12
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkSettingController.java

@@ -68,16 +68,18 @@ public class MarkSettingController {
     @ApiOperation(value = "评卷设置数据列表")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId, @ApiParam(value = "课程代码") @RequestParam(required = false) String courseCode,
-            @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @ApiParam(value = "提交状态") @RequestParam(required = false) Boolean groupStatus,
-            @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+                       @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @ApiParam(value = "提交状态") @RequestParam(required = false) Boolean groupStatus,
+                       @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         Long schoolId = Long.parseLong(ServletUtil.getRequestHeaderSchoolId().toString());
         IPage<MarkSettingDto> markSettingDtoIPage = markPaperService.listPaperSetting(examId, courseCode, paperNumber,
                 groupStatus, 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);
@@ -109,8 +111,8 @@ public class MarkSettingController {
     @ApiOperation(value = "评卷管理数据列表")
     @RequestMapping(value = "/summary", method = RequestMethod.POST)
     public Result summary(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId, @ApiParam(value = "课程代码") @RequestParam(required = false) String courseCode,
-            @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @ApiParam(value = "完成进度") @RequestParam(required = false) Boolean progressStatus,
-            @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+                          @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @ApiParam(value = "完成进度") @RequestParam(required = false) Boolean progressStatus,
+                          @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         IPage<MarkManageDto> markManageDtoIPage = markTaskService.listPaperManage(examId, courseCode, paperNumber,
                 progressStatus, pageNumber, pageSize);
         return ResultUtil.ok(markManageDtoIPage);
@@ -122,7 +124,7 @@ public class MarkSettingController {
     @ApiOperation(value = "导出评卷员工作量")
     @RequestMapping(value = "/export_marker", method = RequestMethod.POST)
     public void exportMarker(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId, @ApiParam(value = "课程代码") @RequestParam(required = false) String courseCode,
-            @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, HttpServletResponse response) {
+                             @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, HttpServletResponse response) {
         markTaskService.exportMarker(examId, courseCode, paperNumber, response);
     }
 
@@ -132,8 +134,8 @@ public class MarkSettingController {
     @ApiOperation(value = "成绩检查数据列表")
     @RequestMapping(value = "/scoreList", method = RequestMethod.POST)
     public Result scoreList(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId, @ApiParam(value = "课程代码") @RequestParam(required = false) String courseCode,
-            @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
-            @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+                            @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber, @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                            @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         IPage<CheckScoreListDto> scoreListDtoIPage = markPaperService.listStudentScoreList(examId, courseCode,
                 paperNumber, pageNumber, pageSize);
         return ResultUtil.ok(scoreListDtoIPage);
@@ -141,10 +143,10 @@ public class MarkSettingController {
 
     @ApiOperation(value = "阅卷数据批量导入(同步)")
     @RequestMapping(value = "/mark_student_import", method = RequestMethod.POST)
-    @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = Result.class) })
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Result.class)})
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
     public Result markStudentImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
-            @ApiParam(value = "考试id", required = true) @RequestParam String examId) throws Exception {
+                                    @ApiParam(value = "考试id", required = true) @RequestParam String examId) throws Exception {
         Map<String, Object> map = printCommonService.saveTask(file, SystemConstant.convertIdToLong(examId), TaskTypeEnum.MARK_STUDENT_IMPORT);
         map.put("examId", SystemConstant.convertIdToLong(examId));
         return syncMarkStudentImportService.importTask(map);

+ 2 - 14
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/MarkQuestion.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.enums.ObjectivePolicy;
 
 import io.swagger.annotations.ApiModel;
@@ -23,15 +24,10 @@ import io.swagger.annotations.ApiModelProperty;
  */
 @TableName("mark_question")
 @ApiModel(value="MarkQuestion对象", description="小题信息表")
-public class MarkQuestion implements Serializable {
+public class MarkQuestion extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(value = "主键")
-    @TableId(value = "id")
-    private Long id;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "考试ID")
     private Long examId;
@@ -84,13 +80,6 @@ public class MarkQuestion implements Serializable {
 
     private String name;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
     public Long getExamId() {
         return examId;
     }
@@ -224,7 +213,6 @@ public class MarkQuestion implements Serializable {
 	@Override
     public String toString() {
         return "MarkQuestion{" +
-            "id=" + id +
             ", examId=" + examId +
             ", paperNumber=" + paperNumber +
             ", objective=" + objective +

+ 20 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -5,6 +5,8 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -75,6 +77,7 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
     @Transactional
     @Override
     public void saveQuestions(MarkQuestionParams markQuestionParams) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Long examId = markQuestionParams.getExamId();
         String paperNumber = markQuestionParams.getPaperNumber();
         MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
@@ -103,6 +106,11 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                 }
                 question.setExamId(examId);
                 question.setPaperNumber(paperNumber);
+                question.setCreateId(sysUser.getId());
+                question.setCreateTime(System.currentTimeMillis());
+                // 用来判断是否保存过
+                question.setUpdateId(sysUser.getId());
+                question.setUpdateTime(System.currentTimeMillis());
             }
             this.saveBatch(questions);
         } else {
@@ -129,6 +137,9 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                         }
                         markQuestion.setTotalScore(question.getTotalScore());
                         markQuestion.setIntervalScore(question.getIntervalScore());
+                        // 用来判断是否保存过
+                        question.setUpdateId(sysUser.getId());
+                        question.setUpdateTime(System.currentTimeMillis());
                         saveOrUpdateList.add(markQuestion);
                         markQuestionList.remove(markQuestion);
                     } else {
@@ -136,6 +147,11 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                         question.setExamId(examId);
                         question.setPaperNumber(paperNumber);
                         question.setPaperType(markPaper.getPaperType());
+                        question.setCreateId(sysUser.getId());
+                        question.setCreateTime(System.currentTimeMillis());
+                        // 用来判断是否保存过
+                        question.setUpdateId(sysUser.getId());
+                        question.setUpdateTime(System.currentTimeMillis());
                         saveOrUpdateList.add(question);
 //                        throw ExceptionResultEnum.ERROR.exception("数据异常,请刷新页面后重新操作");
                     }
@@ -194,10 +210,10 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                 throw ExceptionResultEnum.ERROR.exception("答案不能为空");
             }
             if (question.getObjectivePolicy() != null && question.getObjectivePolicy().equals(ObjectivePolicy.LEAK)) {
-                if(question.getObjectivePolicyScore()==null){
+                if (question.getObjectivePolicyScore() == null) {
                     throw ExceptionResultEnum.ERROR.exception("漏选给分不能没有计分规则");
                 }
-                if(question.getObjectivePolicyScore()>(question.getTotalScore()/question.getAnswer().length())){
+                if (question.getObjectivePolicyScore() > (question.getTotalScore() / question.getAnswer().length())) {
                     throw ExceptionResultEnum.ERROR.exception("漏选给分计分规则有误");
                 }
             }
@@ -267,9 +283,9 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         MarkQuestionDto markQuestionDto = new MarkQuestionDto();
         markQuestionDto.setCanCreate(canCreate);
         List<MarkQuestion> markQuestionList = this.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
-        long subjectiveCount = markQuestionList.stream().filter(m -> !m.getObjective() && m.getTotalScore() != null).count();
+        long subjectiveCount = markQuestionList.stream().filter(m -> !m.getObjective() && m.getTotalScore() != null && m.getUpdateTime() != null).count();
         markQuestionDto.setQuestionSubmit(subjectiveCount > 0);
-        long objectiveCount = markQuestionList.stream().filter(m -> m.getObjective() && StringUtils.isNotBlank(m.getAnswer())).count();
+        long objectiveCount = markQuestionList.stream().filter(m -> m.getObjective() && StringUtils.isNotBlank(m.getAnswer()) && m.getUpdateTime() != null).count();
         markQuestionDto.setObjectiveSubmit(objectiveCount > 0);
         markQuestionDto.setQuestions(markQuestionList);
         return markQuestionDto;