Browse Source

客户端bug修改

xiaof 4 years ago
parent
commit
945e04f6c1

+ 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 = "序号")
     @ApiModelProperty(value = "序号")
     private Integer index; //序号
     private Integer index; //序号
 
 
+    private String name;
+
     public Integer getIndex() {
     public Integer getIndex() {
         return index;
         return index;
     }
     }
@@ -22,4 +24,12 @@ public class ExamStudentDto extends ExamStudent {
     public void setIndex(Integer index) {
     public void setIndex(Integer index) {
         this.index = 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
     @Override
     public List<BasicCardRule> list(String param) {
     public List<BasicCardRule> list(String param) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         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);
         Set<Long> orgIds = commonService.listSubOrgIds(null);
         return this.baseMapper.list(schoolId, param, orgIds);
         return this.baseMapper.list(schoolId, param, orgIds);
     }
     }

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -232,6 +232,9 @@ public class ClientServiceImpl implements ClientService {
                 List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
                 List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
                 for (Map<String, Object> examDetailCours : examDetailCourses) {
                 for (Map<String, Object> examDetailCours : examDetailCourses) {
                     String attachmentIds = examDetailCours.get("cardAttachmentIds").toString();
                     String attachmentIds = examDetailCours.get("cardAttachmentIds").toString();
+                    if(StringUtils.isBlank(attachmentIds)){
+                        throw ExceptionResultEnum.ERROR.exception("备用题卡未生成");
+                    }
                     JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
                     JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
                     List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
                     List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
                     for (Map backupCard : backupCards) {
                     for (Map backupCard : backupCards) {

+ 43 - 32
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.HexUtils;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Row;
@@ -191,6 +192,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                                     List<PdfDto>... list
                                                     List<PdfDto>... list
     ) throws IOException, DocumentException {
     ) throws IOException, DocumentException {
         if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
         if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
+            String printContent = examPrintPlan.getPrintContent();
+            if (StringUtils.isBlank(printContent)) {
+                return null;
+            }
+
             Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
             Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
             for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
             for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
                 List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
                 List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
@@ -260,7 +266,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     examTaskDetail.setRelatePaperType(paperType);
                     examTaskDetail.setRelatePaperType(paperType);
                     examDetailCourse.setPaperType(paperType);
                     examDetailCourse.setPaperType(paperType);
 
 
-                    PaperPdfDto paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
+                    PaperPdfDto paperPdfDto = null;
+                    if (printContent.contains("PAPER")) {
+                        paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
+                    }
 
 
                     //获取试卷pdf
                     //获取试卷pdf
                     PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
                     PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
@@ -268,39 +277,41 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     list[0].addAll(backupPaperTempPdfList);
                     list[0].addAll(backupPaperTempPdfList);
 
 
                     basicAttachmentList = Objects.isNull(basicAttachmentList) ? basicAttachmentList = new ArrayList<>() : basicAttachmentList;
                     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);
+                            }
+                            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));
                             }
                             }
-                            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());
                 examDetailCourse.setAttachmentId(jsonObject.toJSONString());
                 examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
                 examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
@@ -339,7 +350,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
 
         if (Objects.nonNull(examPrintPlan.getVariableContent())) {
         if (Objects.nonNull(examPrintPlan.getVariableContent())) {
             List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
             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;
             boolean tag = count > 0 ? true : false;
 
 
             //获取变量印品
             //获取变量印品

+ 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++) {
                 for (int j = 0; j < htmlTableCount; j++) {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
                     examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName(examStudentDto.getStudentName());
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentList1.add(examStudentDto);
                     examStudentList1.add(examStudentDto);
                 }
                 }
                 for (int j = htmlTableCount; j < subStudents.size(); j++) {
                 for (int j = htmlTableCount; j < subStudents.size(); j++) {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
                     examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName(examStudentDto.getStudentName());
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
                     examStudentList2.add(examStudentDto);
                     examStudentList2.add(examStudentDto);
                 }
                 }

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

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

+ 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,
     public Result updateProgress(@RequestParam("examDetailId") Long examDetailId,
                                  @RequestParam("machineCode") String machineCode,
                                  @RequestParam("machineCode") String machineCode,
                                  @RequestParam("printProgress") Integer printProgress,
                                  @RequestParam("printProgress") Integer printProgress,
-                                 @RequestParam("isPrint") Boolean isPrint) {
+                                 @RequestParam(value = "isPrint", required = false) Boolean isPrint) {
         Boolean isSuccess = clientService.updatePrintProgress(examDetailId, machineCode, printProgress, isPrint);
         Boolean isSuccess = clientService.updatePrintProgress(examDetailId, machineCode, printProgress, isPrint);
         return ResultUtil.ok(isSuccess);
         return ResultUtil.ok(isSuccess);
     }
     }