Преглед на файлове

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

xiaofei преди 2 години
родител
ревизия
86e65314d8

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

@@ -125,13 +125,13 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     @Override
     public double calculateTotalSubjects(Long printPlanId) {
         List<ExamDetail> examDetailList = this.list(new QueryWrapper<ExamDetail>().lambda().eq(ExamDetail::getPrintPlanId, printPlanId));
-        List<Long> examDetailIds = examDetailList.stream().map(m->m.getId()).collect(Collectors.toList());
+        List<Long> examDetailIds = examDetailList.stream().map(m -> m.getId()).collect(Collectors.toList());
 
-        if(examDetailIds.isEmpty()){
+        if (examDetailIds.isEmpty()) {
             return 0;
         }
         List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(new QueryWrapper<ExamDetailCourse>().lambda().in(ExamDetailCourse::getExamDetailId, examDetailIds));
-        return examDetailCourseList.isEmpty() ? 0 : examDetailCourseList.stream().map(m->m.getCourseCode()).distinct().count();
+        return examDetailCourseList.isEmpty() ? 0 : examDetailCourseList.stream().map(m -> m.getCourseCode()).distinct().count();
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -194,7 +194,20 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                 JSONObject object = jsonArray.getJSONObject(i);
                 JSONObject jsonObject = new JSONObject();
                 jsonObject.put(SystemConstant.TYPE, Objects.nonNull(object.get("printType")) ? PdfTypeEnum.valueOf((String) object.get("printType")) : null);
-                jsonObject.put("url", Objects.nonNull(object.get(SystemConstant.PDF_PATH)) ? teachcloudCommonService.filePreviewByPathAndType((String) object.get(SystemConstant.PDF_PATH), (String) object.get(SystemConstant.UPLOAD_TYPE), (String) object.get("type"), false) : null);
+                String uploadType = null;
+                if (object.get(SystemConstant.UPLOAD_TYPE) instanceof JSONArray) {
+                    JSONArray uploadTypeJsonArray = object.getJSONArray(SystemConstant.UPLOAD_TYPE);
+                    uploadTypeFor:
+                    for (int y = 0; y < uploadTypeJsonArray.size(); y++) {
+                        uploadType = uploadTypeJsonArray.getString(y);
+                        if (uploadType.equalsIgnoreCase("PDF")) {
+                            break uploadTypeFor;
+                        }
+                    }
+                } else {
+                    uploadType = (String) object.get(SystemConstant.UPLOAD_TYPE);
+                }
+                jsonObject.put("url", Objects.nonNull(object.get(SystemConstant.PDF_PATH)) ? teachcloudCommonService.filePreviewByPathAndType((String) object.get(SystemConstant.PDF_PATH), uploadType, (String) object.get("type"), false) : null);
                 list.add(jsonObject);
             }
         }

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

@@ -453,7 +453,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         }
 
         // 不需要审核,直接更新,否则加入待审核列表(状态为不需要审核的或者为管理员身份的都不重新走审核流程)
-        if (examTask.getReview() || !sysUserService.isAdminDataAuth(requestUser.getId())) {
+        if ((Objects.nonNull(examTask.getReview()) && examTask.getReview()) || !sysUserService.isAdminDataAuth(requestUser.getId())) {
             // 发起新流程
             Map<String, Object> map = SystemConstant.buildFlowVar(examTask.getId(),
                     examTask,

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

@@ -436,7 +436,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             examTask.setTeachingRoomId(teachingRoomId);
             if (examTask.getUserId() == null) {
                 examTask.setStatus(ExamStatusEnum.DRAFT);
-            } else if (examTask.getReview()) {
+            } else if (Objects.nonNull(examTask.getReview()) && examTask.getReview()) {
                 examTask.setStatus(ExamStatusEnum.STAGE);
                 Map<String, Object> map = SystemConstant.buildFlowVar(examTask.getId(),
                         examTask,
@@ -447,7 +447,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 examTask.setFlowId(SystemConstant.convertIdToLong((String) map.get(SystemConstant.FLOW_ID)));
                 map.computeIfAbsent(SystemConstant.FLOW_JOIN_TYPE, v -> FlowJoinTypeEnum.NEW);
                 tfFlowJoinService.saveOrUpdate(map);
-            } else if (!examTask.getReview()) {
+            } else if (Objects.nonNull(examTask.getReview()) && !examTask.getReview()) {
                 examTask.setStatus(ExamStatusEnum.STAGE);
             }
             this.save(examTask);
@@ -760,7 +760,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
         this.saveBatch(list);
         for (ExamTask examTask : list) {
-            if (examTask.getReview() && Objects.nonNull(examTask.getUserId()) && Objects.isNull(examTask.getFlowId())) {
+            if (Objects.nonNull(examTask.getReview()) && examTask.getReview() && Objects.nonNull(examTask.getUserId()) && Objects.isNull(examTask.getFlowId())) {
                 Map<String, Object> map = SystemConstant.buildFlowVar(examTask.getId(),
                         examTask,
                         TFCustomTypeEnum.ELECTRON_FLOW,
@@ -785,7 +785,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskApply(new Page<>(pageNumber, pageSize), schoolId, semesterId, examId, auditStatus, cardRuleId, courseCode, paperNumber, startTime, endTime, sysUser.getId(), userName);
         for (ExamTaskDto record : examTaskDtoIPage.getRecords()) {
-            if ((record.getReview() && FlowStatusEnum.FINISH.name().equals(record.getAuditStatus()) && !ExamModelEnum.MODEL3.equals(record.getExamModel()))) {
+            if ((Objects.nonNull(record.getReview()) && record.getReview() && FlowStatusEnum.FINISH.name().equals(record.getAuditStatus()) && !ExamModelEnum.MODEL3.equals(record.getExamModel()))) {
                 record.setApproveFormStatus(true);
             } else {
                 record.setApproveFormStatus(false);
@@ -937,12 +937,12 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
         examTaskDetail.setUpdateId(sysUser.getId());
         examTaskDetail.setUpdateTime(System.currentTimeMillis());
-         examTaskDetailService.saveOrUpdate(examTaskDetail);
+        examTaskDetailService.saveOrUpdate(examTaskDetail);
 
         // 将题卡更新为已绑定
         String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
         List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
-        List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m->CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m->m.getLong("cardId")).collect(Collectors.toList());
+        List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
         for (Long cardId : cardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
@@ -956,7 +956,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     public boolean status(ExamTask examTask) {
         Optional.ofNullable(examTask.getId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("参数有误"));
         ExamTask task = this.getById(examTask.getId());
-        if (!task.getReview()) {
+        if (Objects.nonNull(task.getReview()) && !task.getReview()) {
             throw ExceptionResultEnum.ERROR.exception("命题任务不需要审核,不能撤回");
         }
         Optional.ofNullable(task.getFlowId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("审核流程有误,不能撤回"));
@@ -1468,7 +1468,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
             examTask.setStatus(ExamStatusEnum.valueOf(examTaskDetail.getOperateType()));
             if (Objects.isNull(examTask.getFlowId())) {
-                if (basicPrintConfig.getReview()) {
+                if (Objects.nonNull(basicPrintConfig.getReview()) && basicPrintConfig.getReview()) {
                     Map<String, Object> map = SystemConstant.buildFlowVar(examTask.getId(),
                             examTask,
                             TFCustomTypeEnum.ELECTRON_FLOW,
@@ -1610,7 +1610,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             examTask.setCardRuleId(basicPrintConfig.getCardRuleId());
 
             if (Objects.isNull(examTask.getFlowId())) {
-                if (basicPrintConfig.getReview()) {
+                if (Objects.nonNull(basicPrintConfig.getReview()) && basicPrintConfig.getReview()) {
                     Map<String, Object> map = SystemConstant.buildFlowVar(examTask.getId(),
                             examTask,
                             TFCustomTypeEnum.ELECTRON_FLOW,
@@ -1639,7 +1639,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             // 将题卡更新为已绑定
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
-            List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m->CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m->m.getLong("cardId")).collect(Collectors.toList());
+            List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
             for (Long cardId : cardIds) {
                 UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
                 updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);

+ 1 - 1
distributed-print-business/src/main/resources/db/install/teachcloud_db.sql

@@ -2011,7 +2011,7 @@ INSERT INTO `sys_privilege` VALUES (42, '卷库查询', 'TaskPaperManage', 'MENU
 INSERT INTO `sys_privilege` VALUES (43, '印刷计划管理', 'PrintPlanManage', 'MENU', 38, 1, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (44, '考务数据导入', 'BusinessDataExport', 'MENU', 38, 2, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (45, '考务明细查询', 'BusinessDataDetail', 'MENU', 38, 3, NULL, NULL, 1, 0, 1);
-INSERT INTO `sys_privilege` VALUES (46, '关联试卷管理', 'PlanLinkPaper', 'MENU', 38, 4, NULL, NULL, 1, 0, 1);
+INSERT INTO `sys_privilege` VALUES (46, '关联试卷管理', 'PlanLinkPaper', 'MENU', 38, 4, NULL, NULL, 0, 0, 0);
 INSERT INTO `sys_privilege` VALUES (47, '印刷任务管理', 'PrintTaskManage', 'MENU', 38, 5, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (48, '查询', '/api/admin/exam/print/list', 'URL', 43, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (49, '按类型查询模板', '/api/admin/exam/print/get_template', 'URL', 43, 2, 'AUTH', NULL, 1, 1, 1);

+ 4 - 4
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

@@ -363,7 +363,7 @@ public class ExamTaskController {
     public Result taskApplySave(@RequestBody ExamTaskDetail examTaskDetail) throws IOException {
         boolean isSuccess = examTaskService.saveExamTaskDetail(examTaskDetail);
         ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
-        if (examTaskDetail.getOperateType().equals(ExamStatusEnum.SUBMIT.name()) && !examTask.getReview()) {
+        if (examTaskDetail.getOperateType().equals(ExamStatusEnum.SUBMIT.name()) && (Objects.nonNull(examTask.getReview()) && !examTask.getReview())) {
             // 校验是否可以提交打印状态
             printCommonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());
         }
@@ -636,7 +636,7 @@ public class ExamTaskController {
         boolean isSuccess = examTaskDetailService.paperUpdate(examTaskDetail);
         if (isSuccess) {
             ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
-            if (examTask.getReview()) {
+            if (Objects.nonNull(examTask.getReview()) && examTask.getReview()) {
                 // 发送短信
                 basicMessageService.sendNoticeTaskAuditCreateOrReview(examTask, MessageEnum.NOTICE_OF_AUDIT_REVIEW);
             } else {
@@ -706,7 +706,7 @@ public class ExamTaskController {
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.ADD)
     public Result submitTaskApply(@RequestBody ExamTaskApplyTemp examTaskApplyTemp) throws IOException {
         ExamTask examTask = examTaskService.submitTaskApply(examTaskApplyTemp);
-        if (!examTask.getReview()) {
+        if (Objects.nonNull(examTask.getReview()) && !examTask.getReview()) {
             // 校验是否可以提交打印状态
             printCommonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());
         }
@@ -724,7 +724,7 @@ public class ExamTaskController {
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.ADD)
     public Result saveTaskApply(@RequestBody ExamTaskApplyParam examTaskApplyParam) throws IOException {
         ExamTask examTask = examTaskService.saveExamTaskAndExamTaskDetail(examTaskApplyParam);
-        if (examTaskApplyParam.getExamTaskDetail().getOperateType().equals(ExamStatusEnum.SUBMIT.name()) && !examTask.getReview()) {
+        if (examTaskApplyParam.getExamTaskDetail().getOperateType().equals(ExamStatusEnum.SUBMIT.name()) && (Objects.nonNull(examTask.getReview()) && !examTask.getReview())) {
             // 校验是否可以提交打印状态
             printCommonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());
         }