Bläddra i källkod

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

wangliang 7 månader sedan
förälder
incheckning
bcccc04ee1
14 ändrade filer med 100 tillägg och 25 borttagningar
  1. 4 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java
  2. 9 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  3. 18 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePrintPdfUtil.java
  4. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPrintTaskController.java
  5. 1 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  6. 2 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/TeachcloudCommonService.java
  7. 28 3
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java
  8. 22 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/FileStoreUtil.java
  9. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java
  10. 2 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkProblemHistoryServiceImpl.java
  11. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java
  12. 9 10
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java
  13. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanRefixBatchServiceImpl.java
  14. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/TaskServiceImpl.java

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

@@ -17,11 +17,11 @@ public enum RequiredFieldsEnum {
     COURSE_NAME("courseName","课程名称", true, true),
     SITE_NUMBER("siteNumber", "座位号", true, false),
     PAPER_NUMBER("paperNumber","试卷编号", true, false),
-    EXAM_DATE("examDate","考试日期", true, true),
-    EXAM_TIME("examTime","考试时间", true, true),
+    EXAM_DATE("examDate","考试日期", true, false),
+    EXAM_TIME("examTime","考试时间", true, false),
     EXAM_PLACE("examPlace","校区(考点)", true, false),
-    EXAM_ROOM("examRoom","考试教室(考场)", true, true),
-    COLLEGE_NAME("collegeName","学院", true, true),
+    EXAM_ROOM("examRoom","考试教室(考场)", true, false),
+    COLLEGE_NAME("collegeName","学院", true, false),
     MAJOR_NAME("majorName","专业", true, false),
     TEACH_CLASS_NAME("teachClassName","教学班", true, true),
     CLASS_NAME("className","行政班", true, false),

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

@@ -234,6 +234,14 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                     errorMsgList.add("任课老师[" + teacherName + "]与用户管理中姓名[" + sysUser.getRealName() + "]不一致");
                 } else {
                     teacherId = sysUser.getId();
+                    // 校验同课程、同教学班下任课老师必须相同
+                    List<BasicExamStudent> basicExamStudentList = this.listByExamIdAndCourseIdAndTeachClassName(basicExamStudentParam.getExamId(), basicExamStudentParam.getCourseId(), basicExamStudentParam.getTeachClassName());
+                    if(CollectionUtils.isNotEmpty(basicExamStudentList)){
+                        long count = basicExamStudentList.stream().filter(m -> m.getTeacherId() != null && !sysUser.getId().equals(m.getTeacherId())).count();
+                        if(count > 0){
+                            throw ExceptionResultEnum.ERROR.exception("教学班["+basicExamStudentParam.getTeachClassName()+"]存在其它任课老师,教学班的任课老师必须相同");
+                        }
+                    }
                 }
             }
         }
@@ -285,7 +293,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.getPaperType().equals(paperType)) {
+            if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && !dbBasicExamStudent.getPaperType().equals(paperType)) {
                 throw ExceptionResultEnum.ERROR.exception("不允许修改卷型");
             }
 

+ 18 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePrintPdfUtil.java

@@ -187,6 +187,15 @@ public class CreatePrintPdfUtil {
                     studentTable.addCell(PdfFillUtils.createCell1(lineHeightTimes, value, chooseFont(basicTemplate), null, Element.ALIGN_CENTER, 0, 1, 1));
                 }
             }
+
+            // 少于40行,默认补齐
+            if (forCount < 30) {
+                for (int i = 0; i < 30 - forCount; i++) {
+                    for (String headKey : headKeys) {
+                        studentTable.addCell(PdfFillUtils.createCell1(lineHeightTimes, "", chooseFont(basicTemplate), null, Element.ALIGN_CENTER, 0, 1, 1));
+                    }
+                }
+            }
         }
         // 单列
         else {
@@ -213,6 +222,15 @@ public class CreatePrintPdfUtil {
                     studentTable.addCell(PdfFillUtils.createCell1(lineHeightTimes, value, chooseFont(basicTemplate), null, Element.ALIGN_CENTER, 0, 1, 1));
                 }
             }
+
+            // 少于40行,默认补齐
+            if (studentPlateCount < 30) {
+                for (int i = 0; i < 30 - studentPlateCount; i++) {
+                    for (String headKey : headKeys) {
+                        studentTable.addCell(PdfFillUtils.createCell1(lineHeightTimes, "", chooseFont(basicTemplate), null, Element.ALIGN_CENTER, 0, 1, 1));
+                    }
+                }
+            }
         }
         //将表格的第一行设置为表头 让它在每一页都显示出来
         studentTable.setHeaderRows(1);

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

@@ -186,7 +186,7 @@ public class ExamPrintTaskController {
                 throw ExceptionResultEnum.ERROR.exception("状态为新建不能下载");
             }
         }
-        Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.PRINT_PDF_DOWNLOAD, arraysParams.getSemesterId(), arraysParams.getExamId(), (SysUser) ServletUtil.getRequestUser());
+        Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.PRINT_PDF_DOWNLOAD, arraysParams, (SysUser) ServletUtil.getRequestUser());
         asyncDownloadPdfTempleteService.exportTask(map);
         TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
         return Objects.nonNull(tbTask) ? ResultUtil.ok(new EditResult(tbTask.getId())) : ResultUtil.error("创建任务失败");

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

@@ -44,6 +44,7 @@ import java.util.stream.Collectors;
  * @Date: 2019/10/11
  */
 public class SystemConstant {
+    public static final long MARK_JPG_EXPIRE_MINUTE = 12 * 60;
     private final static Logger log = LoggerFactory.getLogger(SystemConstant.class);
 
     public static final String DEFAULT_PAPER_TYPE_A = "A";

+ 2 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/TeachcloudCommonService.java

@@ -123,13 +123,14 @@ public interface TeachcloudCommonService {
      * @param path 文件path
      */
     String filePreview(String path);
+    String filePreview(String path, long expiredMinute);
 
     /**
      * 批量文件预览
      *
      * @param path 文件path集合
      */
-    List<String> filePreview(List<String> path);
+    List<String> filePreview(List<String> path, long expiredMinute);
 
     /**
      * 阅卷图片

+ 28 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -372,7 +372,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                             }
 
                             List<Long> intersectionPrivilegeIds = (List<Long>) CollectionUtils.intersection(relateIds, privilegeIds);
-                            if (CollectionUtils.isNotEmpty(intersectionPrivilegeIds)){
+                            if (CollectionUtils.isNotEmpty(intersectionPrivilegeIds)) {
                                 QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper1 = new QueryWrapper<>();
                                 sysPrivilegeQueryWrapper1.lambda().in(SysPrivilege::getId, intersectionPrivilegeIds)
                                         .eq(SysPrivilege::getType, PrivilegeEnum.URL)
@@ -605,6 +605,31 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         return FileUtil.replaceSplit(url);
     }
 
+    @Override
+    public String filePreview(String path, long expiredMinute) {
+        if (StringUtils.isBlank(path)) {
+            return null;
+        }
+        String url = null;
+        JSONObject jsonObject = JSONObject.parseObject(path);
+        String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
+        String filePath = (String) jsonObject.get(SystemConstant.PATH);
+        if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
+            if (filePath.contains(dictionaryConfig.fssPrivateDomain().getServer())) {
+                url = filePath.substring(filePath.indexOf(dictionaryConfig.fssPrivateDomain().getServer()), filePath.length());
+            } else if (filePath.contains(dictionaryConfig.fssPublicDomain().getServer())) {
+                url = filePath.substring(filePath.indexOf(dictionaryConfig.fssPublicDomain().getServer()), filePath.length());
+            } else {
+                UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+                url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType(), expiredMinute);
+            }
+        } else {
+            UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+            url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType(), expiredMinute);
+        }
+        return FileUtil.replaceSplit(url);
+    }
+
     /**
      * 文件预览
      *
@@ -969,10 +994,10 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
     }
 
     @Override
-    public List<String> filePreview(List<String> paths) {
+    public List<String> filePreview(List<String> paths, long expiredMinute) {
         List<String> result = new ArrayList<String>();
         for (String path : paths) {
-            result.add(this.filePreview(path));
+            result.add(this.filePreview(path, expiredMinute));
         }
         return result;
     }

+ 22 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/FileStoreUtil.java

@@ -235,6 +235,28 @@ public class FileStoreUtil {
         }
     }
 
+    public String getPrivateUrl(String objectPath, String type, long expiredMinute) {
+        String server = null;
+        if ("public".equals(type)) {
+            server = dictionaryConfig.fssPublicDomain().getServer();
+            return server + SystemConstant.ORG_SPLIT + objectPath;
+        } else if ("private".equals(type)) {
+            Boolean oss = dictionaryConfig.sysDomain().isOss();
+            if (Objects.nonNull(oss) && oss) {
+                FileStore fileStore = fileStoreService.getFileStore(type);
+                return fileStore.getServerUrl(objectPath, Duration.ofMinutes(expiredMinute));
+            } else {
+                if (objectPath.startsWith(SystemConstant.ORG_SPLIT)) {
+                    return dictionaryConfig.fssPrivateDomain().getServer() + objectPath;
+                } else {
+                    return dictionaryConfig.fssPrivateDomain().getServer() + SystemConstant.ORG_SPLIT + objectPath;
+                }
+            }
+        } else {
+            throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");
+        }
+    }
+
     /**
      * 获取文件访问url
      *

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

@@ -113,7 +113,7 @@ public interface MarkStudentService extends IService<MarkStudent> {
      * @param updateOmrTask updateOmrTask
      * @param omrEdit       是否是'修改答题卡识别结果'调用
      */
-    void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask, @NotNull boolean omrEdit);
+    void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask, @NotNull boolean omrEdit, @NotNull boolean omrAssigned);
 
     MarkStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId, String studentCode);
 

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

@@ -4,6 +4,7 @@ import java.util.List;
 
 import javax.annotation.Resource;
 
+import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.mark.dto.mark.MarkStudentVo;
 import org.springframework.stereotype.Service;
@@ -68,7 +69,7 @@ public class MarkProblemHistoryServiceImpl extends ServiceImpl<MarkProblemHistor
             MarkStudentVo markStudent = markStudentService.getMarkStudentVoByStudentId(problemDto.getStudentId());
             problemDto.setStudentName(markStudent.getStudentName());
             problemDto.setStudentCode(markStudent.getStudentCode());
-            problemDto.setSheetUrls(teachcloudCommonService.filePreview(markStudent.getSheetPathList()));
+            problemDto.setSheetUrls(teachcloudCommonService.filePreview(markStudent.getSheetPathList(), SystemConstant.MARK_JPG_EXPIRE_MINUTE));
             problemDto.setProblemTypeName(problemDto.getType().getDesc());
             problemDto.setStatusName(problemDto.getStatus().getName());
             problemDto.setGroupQuestions(markQuestionService

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

@@ -793,7 +793,7 @@ public class MarkServiceImpl implements MarkService {
         dto.getSubject().setAnswerUrl(StringUtils.isBlank(markPaper.getAnswerFilePath()) ? null
                 : teachcloudCommonService.filePreview(markPaper.getAnswerFilePath()));
         dto.getSubject().setPaperUrl(StringUtils.isBlank(markPaper.getPaperFilePath()) ? null
-                : JSON.toJSONString(teachcloudCommonService.filePreview(JSON.parseArray(markPaper.getPaperFilePath(), String.class))));
+                : JSON.toJSONString(teachcloudCommonService.filePreview(JSON.parseArray(markPaper.getPaperFilePath(), String.class),  SystemConstant.MARK_JPG_EXPIRE_MINUTE)));
         BasicCourse basicCourse = basicCourseService.getById(markPaper.getCourseId());
         dto.getSubject().setCode(markPaper.getPaperNumber());
         dto.getSubject().setName(basicCourse != null ? basicCourse.getName() : null);

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

@@ -541,7 +541,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
      */
     @Override
     @Transactional
-    public void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask, @NotNull boolean omrEdit) {
+    public void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask, @NotNull boolean omrEdit, @NotNull boolean omrAssigned) {
         MarkStudent student = this.getById(studentId);
         if (student == null) {
             throw new ParameterException("找不到对应的考生");
@@ -552,10 +552,6 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 
         // 重置状态
         student.setIncomplete(false);
-        if (!omrEdit) {
-            student.setAssigned(false);
-            student.setAssignConfirmed(false);
-        }
         student.setInvalid(false);
         student.setQuestionFilled(false);
         int paperCount = 0;
@@ -566,7 +562,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             // 获取paper详情更新考生状态
             ScanPaper paper = scanPaperService.getById(studentPaper.getPaperId());
             // 二次识别不进人工绑定检查
-            student.setAssigned(omrEdit && (student.getAssigned() || paper.getAssigned()));
+            if(omrAssigned) {
+                student.setAssigned(paper.getAssigned());
+                student.setAssignConfirmed(false);
+            }
             student.setInvalid(student.getInvalid() || paper.getInvalid());
             student.setQuestionFilled(student.getQuestionFilled() || paper.getQuestionFilled());
             student.setCardNumber(paper.getCardNumber());
@@ -886,7 +885,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             studentPaperService.saveOrUpdateBatch(studentPaperList);
         }
         // 更新考生状态
-        updateStudentByPaper(user.getId(), id, true, false);
+        updateStudentByPaper(user.getId(), id, true, false, true);
     }
 
     @Override
@@ -1050,7 +1049,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                 }
                 scanPaperService.savePaperAndPages(paperEntity, pages);
             }
-            updateStudentByPaper(userId, student.getId(), true, true);
+            updateStudentByPaper(userId, student.getId(), true, true, false);
             return UpdateTimeVo.create();
         } finally {
             concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();
@@ -1115,7 +1114,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         lw.eq(MarkStudent::getId, student.getId());
         update(lw);
 
-        // 确认缺考清除客观题查检任务,取消缺考统计客观题分数
+        // 确认缺考清除客观题查检任务,取消缺考统计客观题分数、重新生成客观题检查任务
         if (!omrAbsent) {
             calculateObjectiveScore(student);
             scanOmrTaskService.saveTask(student.getId());
@@ -1224,7 +1223,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             for (FilePathVo filePathVo : vos) {
                 list.add(JSON.toJSONString(filePathVo));
             }
-            record.setSheetUrls(teachcloudCommonService.filePreview(list));
+            record.setSheetUrls(teachcloudCommonService.filePreview(list, SystemConstant.MARK_JPG_EXPIRE_MINUTE));
         }
         return ret;
     }

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

@@ -106,7 +106,7 @@ public class ScanRefixBatchServiceImpl extends ServiceImpl<ScanRefixBatchMapper,
 //            if (!student.getCardNumber().equals(answerCard.getNumber())) {
 //                markService.deleteMarkTaskByStudent(student);
 //            }
-            studentService.updateStudentByPaper(userId, student.getId(), true, false);
+            studentService.updateStudentByPaper(userId, student.getId(), true, false, false);
             return AnswerRefixVo.create();
         } finally {
             concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();

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

@@ -67,7 +67,7 @@ public class TaskServiceImpl implements TaskService {
             task.setObjectiveScore(markStudent.getObjectiveScore());
         }
         if (StringUtils.isNotBlank(markStudent.getSheetPath())) {
-            task.setSheetUrls(teachcloudCommonService.filePreview(markStudent.getSheetPathList()));
+            task.setSheetUrls(teachcloudCommonService.filePreview(markStudent.getSheetPathList(), SystemConstant.MARK_JPG_EXPIRE_MINUTE));
         }
         task.setMarkerTime(markArbitrateHistory.getUpdateTime());
         if (markArbitrateHistory.getTotalScore() != null) {