wangliang %!s(int64=4) %!d(string=hai) anos
pai
achega
d4b26930a8

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

@@ -15,5 +15,7 @@ public interface BasicExamRuleService extends IService<BasicExamRule> {
 
     BasicExamRule getBySchoolId();
 
+    BasicExamRule getBySchoolId(Long schoolId);
+
     boolean saveExamRule(BasicExamRule examRule);
 }

+ 12 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamRuleServiceImpl.java

@@ -42,6 +42,13 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
         return this.getOne(queryWrapper);
     }
 
+    @Override
+    public BasicExamRule getBySchoolId(Long schoolId) {
+        QueryWrapper<BasicExamRule> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(BasicExamRule::getSchoolId, schoolId);
+        return this.getOne(queryWrapper);
+    }
+
     @Override
     public boolean saveExamRule(BasicExamRule examRule) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -50,7 +57,7 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
 
         // 已开始新建印刷计划,不能新增、删除扩展字段
         // 新增
-        if (examRule.getId() == null){
+        if (examRule.getId() == null) {
             examRule.setId(SystemConstant.getDbUuid());
             examRule.setCreateId(sysUser.getId());
             examRule.setCreateTime(System.currentTimeMillis());
@@ -62,14 +69,14 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
             QueryWrapper<ExamPrintPlan> queryWrapper = new QueryWrapper<>();
             queryWrapper.lambda().ne(ExamPrintPlan::getStatus, PrintPlanStatusEnum.END);
             List<ExamPrintPlan> examPrintPlanList = examPrintPlanService.list(queryWrapper);
-            if(examPrintPlanList != null && examPrintPlanList.size() > 0) {
+            if (examPrintPlanList != null && examPrintPlanList.size() > 0) {
                 BasicExamRule basicExamRule = this.getById(examRule.getId());
                 // 匹配扩展字段是否有变动
                 String oldExtends = basicExamRule.getExtendFields();
                 String newExtends = examRule.getExtendFields();
                 List<Map> oldMapList = JSONObject.parseArray(oldExtends, Map.class);
                 List<Map> newMapList = JSONObject.parseArray(newExtends, Map.class);
-                if (oldMapList.size() != newMapList.size()){
+                if (oldMapList.size() != newMapList.size()) {
                     throw ExceptionResultEnum.ERROR.exception("有未结束的印刷计划,不能修改扩展字段");
                 }
                 for (Map map : oldMapList) {
@@ -82,10 +89,10 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
                         String code1 = String.valueOf(map1.get("code"));
                         String name1 = String.valueOf(map1.get("name"));
                         String enable1 = String.valueOf(map1.get("enable"));
-                        if (code.equals(code1) && name.equals(name1) && enable.equals(enable1)){
+                        if (code.equals(code1) && name.equals(name1) && enable.equals(enable1)) {
                             flag = false;
                         }
-                        if(flag) {
+                        if (flag) {
                             throw ExceptionResultEnum.ERROR.exception("有未结束的印刷计划,不能修改扩展字段");
                         }
                     }

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

@@ -518,6 +518,7 @@ public class CommonServiceImpl implements CommonService {
                         if (Objects.nonNull(examDetail.getId())) {
                             map.computeIfAbsent("examDetailId", v -> examDetail.getId());
                         }
+                        map.computeIfAbsent("schoolId", v -> schoolId);
                         asyncCreatePdfTempleteService.createPdf(map);
                     }
                 }

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

@@ -109,6 +109,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
             SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
             Long examDetailId = Objects.nonNull(map.get("examDetailId")) ? (Long) map.get("examDetailId") : null;
+            Long schoolId = (Long) map.get("schoolId");
 
             //这里为保存附件html的逻辑
             //查询题卡详情是否有附件id,有的话则把以前的附件删除
@@ -261,7 +262,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 }
                 detailCourseService.saveOrUpdateBatch(examDetailCourseList);
                 //合并pdf
-                basicAttachmentList.add(createPdfUtil.mergePdf(tbTask, examDetail, sysUser.getId(), variablePdfList, ordinaryPdfList, paperPdfList, examStudentPdfList, backupPaperPdfList, cardPdfList));
+                basicAttachmentList.add(createPdfUtil.mergePdf(tbTask, examDetail, sysUser.getId(), schoolId, variablePdfList, ordinaryPdfList, paperPdfList, examStudentPdfList, backupPaperPdfList, cardPdfList));
             }
             map.computeIfAbsent("size", v -> examDetailList.size());
             //最后一步删除附件

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

@@ -304,11 +304,12 @@ public class CreatePdfUtil {
      * @param tbTask
      * @param examDetail
      * @param userId
+     * @param schoolId
      * @param list
      * @return
      * @throws IOException
      */
-    public BasicAttachment mergePdf(TBTask tbTask, ExamDetail examDetail, Long userId, List<PdfDto>... list) throws IOException {
+    public BasicAttachment mergePdf(TBTask tbTask, ExamDetail examDetail, Long userId, Long schoolId, List<PdfDto>... list) throws IOException {
         StringJoiner stringJoiner = new StringJoiner("").add(SystemConstant.PDF_TEMP_FILES_DIR).add(File.separator);
         List<PdfDto> mergePdfList = new ArrayList<>();
         int pageA3Count = 0;
@@ -330,7 +331,7 @@ public class CreatePdfUtil {
         examDetail.setAttachmentId(basicAttachment.getId());
         examDetail.setPagesA3(pageA3Count);
         examDetail.setPagesA4(pageA4Count);
-        BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId();
+        BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(schoolId);
         examDetail.setStatus(PrintMethodEnum.AUTO == basicExamRule.getPrintMethod() ? ExamDetailStatusEnum.WAITING : ExamDetailStatusEnum.READY);
         detailService.saveOrUpdate(examDetail);
         ossUtil.ossUpload(dirName, localPdfFile, DigestUtils.md5Hex(new FileInputStream(localPdfFile)));

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

@@ -158,6 +158,7 @@ public class SysUserController {
 //        if (Objects.nonNull(examDetailId)) {
 //            map.computeIfAbsent("examDetailId", v -> SystemConstant.convertIdToLong(examDetailId));
 //        }
+//        map.computeIfAbsent("schoolId", v -> schoolId);
 //        asyncCreatePdfTempleteService.createPdf(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("创建任务失败");