Bladeren bron

3.3.0 update

xiaofei 1 jaar geleden
bovenliggende
commit
b1722dc14f

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

@@ -65,4 +65,6 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
     ExamTaskDetail findByExamIdAndCourseCodeAndPaperNumber(Long schoolId, Long examId, String code, String number);
 
     boolean cancel(Long id, String cancelRemark);
+
+    ExamTaskDetail getByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
 }

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

@@ -211,4 +211,6 @@ public interface ExamTaskService extends IService<ExamTask> {
     List<ExamTask> getExamTaskByCourseCodeAndCardId(Long schoolId, String courseCode, String cardId);
 
     List<String> listPaperNumber(String param, List<Long> printPlanIdList);
+
+    ExamTask getByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
 }

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

@@ -138,7 +138,7 @@ public class DownloadServiceImpl implements DownloadService {
                     if (attachment == null) {
                         throw ExceptionResultEnum.ERROR.exception("附件数据异常");
                     }
-                    String paperPath = rootPath + File.separator + examTask.getCourseName() + SystemConstant.HYPHEN + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
+                    String paperPath = rootPath + File.separator + examTask.getCourseName().replaceAll(" ", "") + SystemConstant.HYPHEN + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
                     String fileName = "试卷" + "_" + attachment.getName() + "_" + paperType + attachment.getType();
                     fileList.add(attachmentCommonService.downloadFile(paperPath, fileName, attachment));
                 }
@@ -149,7 +149,7 @@ public class DownloadServiceImpl implements DownloadService {
                 if (cardId != null) {
                     ExamCard examCard = examCardMapper.selectById(cardId);
 
-                    String cardPath = rootPath + File.separator + examTask.getCourseName() + SystemConstant.HYPHEN + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
+                    String cardPath = rootPath + File.separator + examTask.getCourseName().replaceAll(" ", "") + SystemConstant.HYPHEN + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
                     String cardHtmlPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + "_" + paperType + SystemConstant.HTML_PREFIX;
                     String cardPdfPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + "_" + paperType + SystemConstant.PDF_PREFIX;
 

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

@@ -704,6 +704,15 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         return true;
     }
 
+    @Override
+    public ExamTaskDetail getByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
+        ExamTask examTask = examTaskService.getByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        if (examTask == null) {
+            throw ExceptionResultEnum.ERROR.exception("未查询到试卷信息");
+        }
+        return this.getByExamTaskId(examTask.getId());
+    }
+
     /**
      * 卷库校验
      *

+ 17 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+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;
@@ -21,7 +22,6 @@ import com.qmth.distributed.print.business.bean.result.WorkResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskExamStudentImportResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.StudentInfo;
-import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.mapper.ExamTaskMapper;
@@ -38,6 +38,7 @@ import com.qmth.teachcloud.common.bean.params.BasicStudentExtrasParam;
 import com.qmth.teachcloud.common.bean.result.BasicStudentResult;
 import com.qmth.teachcloud.common.bean.result.SysUserResult;
 import com.qmth.teachcloud.common.bean.result.TbTaskDetailResult;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.enums.*;
@@ -949,9 +950,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             dirPath = dirPath.add(rootPath).add(File.separator)
                     .add(examTaskDetailPdfDownloadDto.getSemesterName()).add(File.separator)
                     .add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
-                    .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(File.separator)
+                    .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
                     .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator)
-                    .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(SystemConstant.HYPHEN)
+                    .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(SystemConstant.HYPHEN)
                     .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(SystemConstant.HYPHEN);
             List<File> fileList = new ArrayList<>();
             List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailPdfDownloadDto.getPaperAttachmentIds());
@@ -966,7 +967,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     paperPath = paperPath.add(rootPath).add(File.separator)
                             .add(examTaskDetailPdfDownloadDto.getSemesterName()).add(File.separator)
                             .add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
-                            .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(File.separator)
+                            .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
                             .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator);
                     String fileName = examTaskDetailPdfDownloadDto.getCourseNameCode() + SystemConstant.HYPHEN + examTaskDetailPdfDownloadDto.getPaperNumber() + SystemConstant.HYPHEN + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
                     File file = teachcloudCommonService.copyFile(paperPath.toString(), fileName, attachment);
@@ -2131,6 +2132,18 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
     }
 
+    @Override
+    public ExamTask getByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
+        QueryWrapper<ExamTask> queryWrapper = new QueryWrapper<>();
+        LambdaQueryWrapper<ExamTask> lambdaQueryWrapper = queryWrapper.lambda();
+        lambdaQueryWrapper.eq(ExamTask::getExamId, examId);
+        if (StringUtils.isNotBlank(courseCode)) {
+            lambdaQueryWrapper.eq(ExamTask::getCourseCode, courseCode);
+        }
+        lambdaQueryWrapper.eq(ExamTask::getPaperNumber, paperNumber);
+        return this.getOne(queryWrapper);
+    }
+
     /**
      * 简单校验提交参数
      *

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

@@ -1306,9 +1306,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 dirPath = dirPath.add(zipLocalRootPath).add(File.separator)
                         .add(examTaskDetailPdfDownloadDto.getSemesterName()).add(File.separator)
                         .add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
-                        .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(File.separator)
+                        .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
                         .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator)
-                        .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(SystemConstant.HYPHEN)
+                        .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(SystemConstant.HYPHEN)
                         .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(SystemConstant.HYPHEN);
                 // 试卷
                 String paperAttachmentIds = examTaskDetailPdfDownloadDto.getPaperAttachmentIds();
@@ -1885,7 +1885,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 throw ExceptionResultEnum.ERROR.exception("没有找到任何试卷信息");
             }
             // 二级路径 课程
-            Set<String> courseSet = examTaskPaperFileDtoList.stream().map(e -> e.getCourseName() + SystemConstant.HYPHEN + e.getCourseCode()).collect(Collectors.toSet());
+            Set<String> courseSet = examTaskPaperFileDtoList.stream().map(e -> e.getCourseName().replaceAll(" ", "") + SystemConstant.HYPHEN + e.getCourseCode()).collect(Collectors.toSet());
             // 文件数以一级目录文件为准(初始1是excel)
             int count = 1;
             for (String course : courseSet) {
@@ -1893,7 +1893,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 int courseCount = 0;
                 Set<String> paperNumberSet = examTaskPaperFileDtoList
                         .stream()
-                        .filter(e -> course.equals(e.getCourseName() + SystemConstant.HYPHEN + e.getCourseCode()))
+                        .filter(e -> course.equals(e.getCourseName().replaceAll(" ", "") + SystemConstant.HYPHEN + e.getCourseCode()))
                         .map(ExamTaskPaperFileDto::getPaperNumber)
                         .collect(Collectors.toSet());
                 for (String paperNumber : paperNumberSet) {

+ 33 - 8
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkQuestionController.java

@@ -2,15 +2,23 @@ package com.qmth.distributed.print.api.mark;
 
 
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.entity.ExamCard;
+import com.qmth.distributed.print.business.entity.ExamTaskDetail;
+import com.qmth.distributed.print.business.service.ExamCardService;
+import com.qmth.distributed.print.business.service.ExamTaskDetailService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
-import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
-import com.qmth.teachcloud.mark.params.MarkQuestionParams;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.mark.entity.MarkQuestion;
+import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
 import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
-import com.qmth.teachcloud.mark.service.MarkQuestionService;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.mark.dto.mark.setting.MarkQuestionDto;
+import com.qmth.teachcloud.mark.entity.MarkQuestion;
+import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
+import com.qmth.teachcloud.mark.params.MarkQuestionParams;
+import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -34,7 +42,11 @@ import java.util.List;
 public class MarkQuestionController {
 
     @Resource
-    MarkQuestionService markQuestionService;
+    private MarkQuestionService markQuestionService;
+    @Resource
+    private ExamTaskDetailService examTaskDetailService;
+    @Resource
+    private ExamCardService examCardService;
 
     /**
      * 评卷结构查询
@@ -42,9 +54,22 @@ public class MarkQuestionController {
     @ApiOperation(value = "查询")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                       @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
-        List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
-        return ResultUtil.ok(markQuestionList);
+                       @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;
+                }
+            }
+        }
+        MarkQuestionDto markQuestionDto = markQuestionService.pageQuestionsByExamIdAndPaperNumber(examId, paperNumber, paperType, canCreate);
+        return ResultUtil.ok(markQuestionDto);
     }
 
     /**

+ 45 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/setting/MarkQuestionDto.java

@@ -0,0 +1,45 @@
+package com.qmth.teachcloud.mark.dto.mark.setting;
+
+import com.qmth.teachcloud.mark.entity.MarkQuestion;
+
+import java.util.List;
+
+public class MarkQuestionDto {
+
+    private Boolean canCreate;
+    private Boolean questionSubmit;
+    private Boolean objectiveSubmit;
+    private List<MarkQuestion> questions;
+
+    public Boolean getCanCreate() {
+        return canCreate;
+    }
+
+    public void setCanCreate(Boolean canCreate) {
+        this.canCreate = canCreate;
+    }
+
+    public Boolean getQuestionSubmit() {
+        return questionSubmit;
+    }
+
+    public void setQuestionSubmit(Boolean questionSubmit) {
+        this.questionSubmit = questionSubmit;
+    }
+
+    public Boolean getObjectiveSubmit() {
+        return objectiveSubmit;
+    }
+
+    public void setObjectiveSubmit(Boolean objectiveSubmit) {
+        this.objectiveSubmit = objectiveSubmit;
+    }
+
+    public List<MarkQuestion> getQuestions() {
+        return questions;
+    }
+
+    public void setQuestions(List<MarkQuestion> questions) {
+        this.questions = questions;
+    }
+}

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkQuestionService.java

@@ -1,6 +1,7 @@
 package com.qmth.teachcloud.mark.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.mark.dto.mark.setting.MarkQuestionDto;
 import com.qmth.teachcloud.mark.entity.MarkQuestion;
 import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
 import com.qmth.teachcloud.mark.params.MarkQuestionParams;
@@ -47,4 +48,6 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
 
 	List<MarkQuestion> listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(Long examId, String paperNumber,
 			Integer paperIndex, Integer pageIndex);
+
+    MarkQuestionDto pageQuestionsByExamIdAndPaperNumber(Long examId, String paperNumber, String paperType, boolean canCreate);
 }

+ 19 - 5
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -3,6 +3,7 @@ package com.qmth.teachcloud.mark.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.mark.dto.mark.setting.MarkQuestionDto;
 import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
 import com.qmth.teachcloud.mark.params.MarkQuestionParams;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
@@ -206,14 +207,27 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         return this.getOne(queryWrapper);
     }
 
-	@Override
-	public List<MarkQuestion> listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(Long examId, String paperNumber,
-			Integer paperIndex, Integer pageIndex) {
-		QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
+    @Override
+    public List<MarkQuestion> listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(Long examId, String paperNumber,
+                                                                                  Integer paperIndex, Integer pageIndex) {
+        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(MarkQuestion::getExamId, examId)
                 .eq(MarkQuestion::getPaperNumber, paperNumber)
                 .eq(MarkQuestion::getPaperIndex, paperIndex)
                 .eq(MarkQuestion::getPageIndex, pageIndex);
         return this.list(queryWrapper);
-	}
+    }
+
+    @Override
+    public MarkQuestionDto pageQuestionsByExamIdAndPaperNumber(Long examId, String paperNumber, String paperType, boolean canCreate) {
+        MarkQuestionDto markQuestionDto = new MarkQuestionDto();
+        markQuestionDto.setCanCreate(canCreate);
+        List<MarkQuestion> markQuestionList = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
+        long subjectiveCount = markQuestionList.stream().filter(m -> !m.getObjective() && m.getTotalScore() != null).count();
+        markQuestionDto.setQuestionSubmit(subjectiveCount > 0);
+        long objectiveCount = markQuestionList.stream().filter(m -> m.getObjective() && StringUtils.isNotBlank(m.getAnswer())).count();
+        markQuestionDto.setObjectiveSubmit(objectiveCount > 0);
+        markQuestionDto.setQuestions(markQuestionList);
+        return markQuestionDto;
+    }
 }