浏览代码

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof 4 年之前
父节点
当前提交
9156a60505

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamStudentDto.java

@@ -15,6 +15,8 @@ public class ExamStudentDto extends ExamStudent {
     @ApiModelProperty(value = "序号")
     private Integer index; //序号
 
+    private String name;
+
     public Integer getIndex() {
         return index;
     }
@@ -22,4 +24,12 @@ public class ExamStudentDto extends ExamStudent {
     public void setIndex(Integer index) {
         this.index = index;
     }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
 }

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

@@ -62,11 +62,11 @@ public class BasicCardRuleServiceImpl extends ServiceImpl<BasicCardRuleMapper, B
     @Override
     public List<BasicCardRule> list(String param) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
-        QueryWrapper<BasicCardRule> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(BasicCardRule::getSchoolId, schoolId).eq(BasicCardRule::getEnable, true);
-        if (StringUtils.isNotBlank(param)) {
-            queryWrapper.lambda().like(BasicCardRule::getName, ConvertUtil.translateSpecificSign(param));
-        }
+//        QueryWrapper<BasicCardRule> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.lambda().eq(BasicCardRule::getSchoolId, schoolId).eq(BasicCardRule::getEnable, true);
+//        if (StringUtils.isNotBlank(param)) {
+//            queryWrapper.lambda().like(BasicCardRule::getName, ConvertUtil.translateSpecificSign(param));
+//        }
         Set<Long> orgIds = commonService.listSubOrgIds(null);
         return this.baseMapper.list(schoolId, param, orgIds);
     }

+ 80 - 56
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
@@ -96,8 +97,8 @@ public class ClientServiceImpl implements ClientService {
         Map<String, Object> finalMap = new HashMap<>();
         ExamDetail examDetail = examDetailService.getById(examDetailId);
         // 撤回提示
-        if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
-                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
+        if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
+                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
             throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
         }
         // 取试卷
@@ -149,8 +150,8 @@ public class ClientServiceImpl implements ClientService {
     public Map<String, Object> getPrintData(Long examDetailId, String machineCode, Boolean isPrint, String printUser) {
         ExamDetail examDetail = examDetailService.getById(examDetailId);
         // 撤回提示
-        if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
-                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
+        if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
+                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
             throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
         }
         if (isPrint && StringUtils.isBlank(printUser)) {
@@ -167,7 +168,7 @@ public class ClientServiceImpl implements ClientService {
         // 2.取生成的完整的pdf
         String printContent = examPrintPlan.getPrintContent();
         // 是否包含试卷、题卡
-        if(StringUtils.isNotBlank(printContent)) {
+        if (StringUtils.isNotBlank(printContent)) {
             // 试卷、题卡map
             Map<String, Object> detailMap = new HashMap<>();
             // 备用试卷、备用题卡map
@@ -176,7 +177,7 @@ public class ClientServiceImpl implements ClientService {
             int backupCount = examPrintPlan.getBackupCount().intValue();
             // 取考生列表
             List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, "1", "1");
-            if(printContent.contains("PAPER")){
+            if (printContent.contains("PAPER")) {
                 if (examDetail.getAttachmentId() == null) {
                     throw ExceptionResultEnum.ERROR.exception("考场pdf未生成");
                 }
@@ -224,7 +225,7 @@ public class ClientServiceImpl implements ClientService {
 
             }
 
-            if(printContent.contains("CARD")){
+            if (printContent.contains("CARD")) {
                 // 生成题卡List
                 detailMap.put("card", spliceCardContent(studentList));
 
@@ -232,6 +233,9 @@ public class ClientServiceImpl implements ClientService {
                 List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
                 for (Map<String, Object> examDetailCours : examDetailCourses) {
                     String attachmentIds = examDetailCours.get("cardAttachmentIds").toString();
+                    if (StringUtils.isBlank(attachmentIds)) {
+                        throw ExceptionResultEnum.ERROR.exception("备用题卡未生成");
+                    }
                     JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
                     List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
                     for (Map backupCard : backupCards) {
@@ -331,8 +335,8 @@ public class ClientServiceImpl implements ClientService {
                 return m.getExamDetailId();
             }
             return null;
-        }).filter(m->StringUtils.isNotBlank(m)).count();
-        if(count > 0){
+        }).filter(m -> StringUtils.isNotBlank(m)).count();
+        if (count > 0) {
             throw ExceptionResultEnum.ERROR.exception("有任务被撤回,请刷新列表后再试");
         }
         List<Map<String, Object>> finalList = new ArrayList<>();
@@ -394,8 +398,8 @@ public class ClientServiceImpl implements ClientService {
         }
 
         // 撤回提示
-        if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
-                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
+        if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
+                || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
             throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
         }
 
@@ -405,57 +409,77 @@ public class ClientServiceImpl implements ClientService {
         if (!packageCode.equals(examDetail.getPackageCode())) {
             throw ExceptionResultEnum.ERROR.exception("卷袋编号与系统数据不一致");
         }
-        // 取最后一张备卡
-        QueryWrapper<ExamDetailCourse> courseQueryWrapper = new QueryWrapper<>();
-        courseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetailId).orderByDesc(ExamDetailCourse::getPaperNumber);
-        List<ExamDetailCourse> examDetailCourses = examDetailCourseService.list(courseQueryWrapper);
-        if (examDetailCourses.isEmpty()) {
-            throw ExceptionResultEnum.ERROR.exception("考场下课程数据异常");
-        }
-        ExamDetailCourse examDetailCourse = examDetailCourses.get(0);
 
-        QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
-        taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getCourseCode, examDetailCourse.getCourseCode()).eq(ExamTask::getPaperNumber, examDetailCourse.getPaperNumber());
-        ExamTask examTask = examTaskService.getOne(taskQueryWrapper);
-        if (examTask == null) {
-            throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
+        ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetail.getPrintPlanId());
+        String printContent = examPrintPlan.getPrintContent();
+        if (StringUtils.isBlank(printContent)) {
+            throw ExceptionResultEnum.ERROR.exception("打印内容没有包含试卷、题卡,无需校验");
         }
+        Integer backupCount = examPrintPlan.getBackupCount();
+        // 有备用题卡
+        if (printContent.contains("CARD")) {
+            QueryWrapper<ExamDetailCourse> courseQueryWrapper = new QueryWrapper<>();
+            courseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetailId).orderByDesc(ExamDetailCourse::getPaperNumber);
+            List<ExamDetailCourse> examDetailCourses = examDetailCourseService.list(courseQueryWrapper);
+            if (examDetailCourses.isEmpty()) {
+                throw ExceptionResultEnum.ERROR.exception("考场下课程数据异常");
+            }
 
-        QueryWrapper<ExamTaskDetail> taskDetailQueryWrapper = new QueryWrapper<>();
-        taskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTask.getId());
-        ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(taskDetailQueryWrapper);
-        if (examTaskDetail == null) {
-            throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
-        }
-        ExamCardDetail examCardDetail = examCardDetailService.getByCardId(examTaskDetail.getCardId());
-        if (examCardDetail == null) {
-            throw ExceptionResultEnum.ERROR.exception("题卡数据异常");
-        }
-        String attachmentIds = examCardDetail.getAttachmentId();
-        if (StringUtils.isBlank(attachmentIds)) {
-            throw ExceptionResultEnum.ERROR.exception("备卡数据异常");
-        }
-        JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
-        String backupAttachmentIds = JSONObject.toJSONString(jsonObject.get("card"));
-        List<Map> list = JSONObject.parseArray(backupAttachmentIds, Map.class);
-        Map map = list.get(list.size() - 1);
-        String backupPackageCode = map.get("packageCode").toString();
-        if (StringUtils.isBlank(lastCode)) {
-            throw ExceptionResultEnum.ERROR.exception("最后一张备卡数据异常");
-        }
-        if (!lastCode.equals(backupPackageCode)) {
-            throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与系统数据不一致");
-        }
+            if (backupCount > 0) {
+                if (StringUtils.isBlank(lastCode)) {
+                    throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码数据异常");
+                }
 
-        String lastCodeSub = lastCode.substring(0, lastCode.length() - 2);
-        if (!packageCode.equals(lastCodeSub)) {
-            throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与试卷编号不一致");
-        }
+                // 取最后一个课程数据(包含最后一张备卡条码信息)
+                ExamDetailCourse examDetailCourselast = examDetailCourses.get(examDetailCourses.size() - 1);
+                if (examDetailCourselast == null) {
+                    throw ExceptionResultEnum.ERROR.exception("题卡数据异常");
+                }
+                String attachmentIds = examDetailCourselast.getAttachmentId();
+                if (StringUtils.isBlank(attachmentIds)) {
+                    throw ExceptionResultEnum.ERROR.exception("备卡数据异常");
+                }
+                JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
+                String backupAttachmentIds = JSONObject.toJSONString(jsonObject.get("card"));
+                List<Map> list = JSONObject.parseArray(backupAttachmentIds, Map.class);
+                Map map = list.get(list.size() - 1);
+                String backupPackageCode = map.get("packageCode").toString();
+
+                if (!lastCode.equals(backupPackageCode)) {
+                    throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与系统数据不匹配");
+                }
 
-        UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().set(ExamDetail::getValidate, true).eq(ExamDetail::getId, examDetailId);
+                String lastCodeSub = lastCode.substring(0, lastCode.length() - 2);
+                if (!packageCode.equals(lastCodeSub)) {
+                    throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与试卷编号不属于同一考场");
+                }
+            } else {
+                // 无备卡,取最后一个考生考号
+                if (StringUtils.isBlank(lastCode)) {
+                    throw ExceptionResultEnum.ERROR.exception("最后一张题卡条码数据异常");
+                }
+                List<Long> examDetailCourseIds = examDetailCourses.stream().map(m -> m.getId()).collect(Collectors.toList());
+                QueryWrapper<ExamStudent> studentQueryWrapper = new QueryWrapper<>();
+                studentQueryWrapper.lambda().in(ExamStudent::getExamDetailCourseId, examDetailCourseIds);
+                List<ExamStudent> examStudents = examStudentService.list(studentQueryWrapper);
+                if (CollectionUtils.isEmpty(examStudents)) {
+                    throw ExceptionResultEnum.ERROR.exception("考生数据异常");
+                }
+                examStudents.sort(Comparator.comparing(ExamStudent::getSiteNumber));
+                ExamStudent examStudent = examStudents.get(examStudents.size() - 1);
+                if (StringUtils.isBlank(examStudent.getTicketNumber())) {
+                    throw ExceptionResultEnum.ERROR.exception("考生考号异常");
+                }
+                if (lastCode.equals(examStudent.getTicketNumber())) {
+                    throw ExceptionResultEnum.ERROR.exception("最后一张题卡条码与系统数据不匹配");
+                }
+            }
 
-        return examDetailService.update(updateWrapper);
+            UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.lambda().set(ExamDetail::getValidate, true).eq(ExamDetail::getId, examDetailId);
+            examDetailService.update(updateWrapper);
+        }
+        return true;
     }
 
     @Override

+ 3 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncCreatePdfTempleteService.java

@@ -20,10 +20,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.text.MessageFormat;
-import java.util.Date;
-import java.util.Map;
-import java.util.Objects;
-import java.util.StringJoiner;
+import java.util.*;
 
 /**
  * @Description: 创建pdf模版
@@ -49,10 +46,11 @@ public class AsyncCreatePdfTempleteService extends AsyncCreateTaskTemplete {
     @Override
     public Result createPdf(Map<String, Object> map, CallbackCreatePdf callbackCreatePdf) throws IOException {
         TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
+        Boolean manual = (Boolean) map.get(SystemConstant.MANUAL);
         StringJoiner stringJoinerSummary = new StringJoiner("\n").add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
         TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
         TBTask dbTask = tbTaskService.getById(tbTask.getId());
-        if (dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult())) {//无需重新生成pdf
+        if (Objects.isNull(manual) && (dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult()))) {//无需重新生成pdf
             return ResultUtil.ok();
         }
         tbTask.setStatus(TaskStatusEnum.RUNNING);

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

@@ -28,6 +28,7 @@ import com.qmth.distributed.print.common.util.FileUtil;
 import com.qmth.distributed.print.common.util.HexUtils;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -191,6 +192,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                                     List<PdfDto>... list
     ) throws IOException, DocumentException {
         if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
+            String printContent = examPrintPlan.getPrintContent();
+            if (StringUtils.isBlank(printContent)) {
+                return null;
+            }
+
             Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
             for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
                 List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
@@ -260,7 +266,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     examTaskDetail.setRelatePaperType(paperType);
                     examDetailCourse.setPaperType(paperType);
 
-                    PaperPdfDto paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
+                    PaperPdfDto paperPdfDto = null;
+                    if (printContent.contains("PAPER")) {
+                        paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
+                    }
 
                     //获取试卷pdf
                     PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
@@ -268,39 +277,41 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     list[0].addAll(backupPaperTempPdfList);
 
                     basicAttachmentList = Objects.isNull(basicAttachmentList) ? basicAttachmentList = new ArrayList<>() : basicAttachmentList;
-                    for (ExamCardDetail examCardDetail : examCardDetailList) {
-                        createPdfUtil.getCardAttachmentId(examCardDetail, attachmentIds);
-
-                        //把模板页面上的 ${} 替换成实际内容
-                        String cardContent = createPdfUtil.replaceHtmlTemplete(examCardDetail);
-                        String studentContent = cardContent;
-
-                        for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
-                            BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList, basicCardRule);
-                            examDetailCourse.setCardPagesA3(basicAttachment.getPages());
-                            basicAttachmentList.add(basicAttachment);
-                        }
-                        list[1].addAll(cardPdfTempList);
-
-                        //查询考生
-                        QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
-                        examStudentQueryWrapper.lambda().eq(ExamStudent::getSchoolId, sysUser.getSchoolId())
-                                .eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
-                        List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
-
-                        for (ExamStudent t : examStudentList) {
-                            if (Objects.nonNull(pdfDto)) {
-                                createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
+                    if (printContent.contains("CARD")) {
+                        for (ExamCardDetail examCardDetail : examCardDetailList) {
+                            createPdfUtil.getCardAttachmentId(examCardDetail, attachmentIds);
+
+                            //把模板页面上的 ${} 替换成实际内容
+                            String cardContent = createPdfUtil.replaceHtmlTemplete(examCardDetail);
+                            String studentContent = examCardDetail.getHtmlContent();
+
+                            for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
+                                BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList, basicCardRule);
+                                examDetailCourse.setCardPagesA3(basicAttachment.getPages());
+                                basicAttachmentList.add(basicAttachment);
                             }
-                            basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
+                            list[1].addAll(cardPdfTempList);
+
+                            //查询考生
+                            QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
+                            examStudentQueryWrapper.lambda().eq(ExamStudent::getSchoolId, sysUser.getSchoolId())
+                                    .eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
+                            List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
+
+                            for (ExamStudent t : examStudentList) {
+                                if (Objects.nonNull(pdfDto)) {
+                                    createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
+                                }
+                                basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
+                            }
+                            list[2].addAll(paperPdfTempList);
+                            list[3].addAll(examStudentTempPdfList);
+                            examStudentService.saveOrUpdateBatch(examStudentList);
+                            jsonObject.put("card", jsonArray);
+                            examDetailCourse.setAttachmentId(jsonObject.toJSONString());
                         }
-                        list[2].addAll(paperPdfTempList);
-                        list[3].addAll(examStudentTempPdfList);
-                        examStudentService.saveOrUpdateBatch(examStudentList);
-                        jsonObject.put("card", jsonArray);
-                        examDetailCourse.setAttachmentId(jsonObject.toJSONString());
+//                        examCardDetailService.saveOrUpdateBatch(examCardDetailList);
                     }
-                    examCardDetailService.saveOrUpdateBatch(examCardDetailList);
                 }
                 examDetailCourse.setAttachmentId(jsonObject.toJSONString());
                 examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
@@ -339,7 +350,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
         if (Objects.nonNull(examPrintPlan.getVariableContent())) {
             List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
-            int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() > 2).count();
+            int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() != null && s.getPaperPageA3() > 2).count();
             boolean tag = count > 0 ? true : false;
 
             //获取变量印品
@@ -455,7 +466,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 List<PdfDto> mergePdfDeleteList = new ArrayList<>();
                 mergePdfDeleteList.addAll(examStudentPdfList);
                 mergePdfDeleteList.addAll(cardPdfList);
-                basicAttachmentList.add(createPdfUtil.mergePdfSaveDb(dirNameA4, dirNameA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList));
+                BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNameA4, dirNameA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList);
+                if (basicAttachmentList != null) {
+                    basicAttachmentList.add(attachment);
+                }
             }
             updateExamPrintPlan(basicExamRule, examPrintPlan);
             map.computeIfAbsent("size", v -> examDetailList.size());

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

@@ -255,12 +255,14 @@ public class CreatePdfUtil {
                 for (int j = 0; j < htmlTableCount; j++) {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName(examStudentDto.getStudentName());
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentList1.add(examStudentDto);
                 }
                 for (int j = htmlTableCount; j < subStudents.size(); j++) {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName(examStudentDto.getStudentName());
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentList2.add(examStudentDto);
                 }

+ 3 - 1
distributed-print-business/src/main/resources/mapper/BasicCardRuleMapper.xml

@@ -53,7 +53,9 @@
         FROM
             basic_card_rule a
         WHERE
-            EXISTS( SELECT
+            a.school_id = #{schoolId}
+            AND a.enable = true
+            AND EXISTS( SELECT
                     1
                 FROM
                     basic_template_org b

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

@@ -59,6 +59,7 @@ public class SystemConstant {
     public static final int PAGE_NUMBER = 0;
     public static final int PAGE_SIZE = 10000000;
     public static final int ALL_CARD = -1;
+    public static final String MANUAL = "manual";
     public static final String DELIMITER = ":";
 //    public static final int MAX_RETRY_CREATE_PDF_COUNT = 5;
 

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

@@ -395,7 +395,7 @@ public class ClientController {
     public Result updateProgress(@RequestParam("examDetailId") Long examDetailId,
                                  @RequestParam("machineCode") String machineCode,
                                  @RequestParam("printProgress") Integer printProgress,
-                                 @RequestParam("isPrint") Boolean isPrint) {
+                                 @RequestParam(value = "isPrint", required = false) Boolean isPrint) {
         Boolean isSuccess = clientService.updatePrintProgress(examDetailId, machineCode, printProgress, isPrint);
         return ResultUtil.ok(isSuccess);
     }

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

@@ -90,6 +90,7 @@ public class TBTaskController {
         }
         map.computeIfAbsent(SystemConstant.TASK, v -> tbTask);
         map.computeIfAbsent(SystemConstant.USER, v -> sysUser);
+        map.computeIfAbsent(SystemConstant.MANUAL, v -> true);
         asyncCreatePdfTempleteService.createPdf(map, null);
         return ResultUtil.ok(new EditResult());
     }