浏览代码

3.2.7 bug修改

xiaofei 1 年之前
父节点
当前提交
6da1c782e4

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

@@ -1447,14 +1447,26 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                         examDetailCourse.setCourseName(examTask.getCourseName());
                         examDetailCourse.setPaperNumber(paperNumber);
                         examDetailCourse.setClazzId(examDetailList.getClassId());
-                        examDetailCourse.setClazzName(examDetailList.getClassName());
                         examDetailCourse.setTotalSubjects(examDetailList.getStudentCount());
                         examDetailCourse.setCreateId(sysUser.getId());
-                        examDetailCourseService.save(examDetailCourse);
 
                         // 更新实际考生数量
                         List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList = examDetailList.getExamTaskStudentObjectParamList();
                         List<ExamStudent> examStudents = printCommonService.createBatchStudentByStudentList(schoolId, examPrintPlan.getExamId(), basicExam.getSemesterId(), paperNumber, examDetailList.getExtendFields(), examTaskStudentObjectParamList, examDetailCourse.getId(), basicPrintConfig.getCardRuleId(), sysUser);
+
+                        Set<String> classNameSet = new HashSet<>();
+                        for (ExamStudent examStudent : examStudents) {
+                            if (StringUtils.isNotBlank(examStudent.getClazzName())) {
+                                classNameSet.add(examStudent.getClazzName());
+                            }
+                            if (StringUtils.isNotBlank(examStudent.getTeachClazzName())) {
+                                classNameSet.add(examStudent.getTeachClazzName());
+                            }
+                        }
+
+                        examDetailCourse.setClazzName(!CollectionUtils.isEmpty(classNameSet) ? String.join(",", classNameSet) : examDetailList.getClassName());
+                        examDetailCourseService.save(examDetailCourse);
+
                         if (!CollectionUtils.isEmpty(examStudents)) {
                             examStudentService.insertBatch(examStudents);
                         }

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

@@ -118,8 +118,8 @@ public class CreatePrintPdfUtil {
         Paragraph blank = new Paragraph(" ");
         // 标题table
         PdfPTable titleTable = PdfFillUtils.createTable(new float[]{33, 34, 33});
-        titleTable.addCell(PdfFillUtils.createCell("", null, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
-        titleTable.addCell(PdfFillUtils.createCell(pdfFillDto.getTitle(), PdfFillUtils.textFont14, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
+        titleTable.addCell(PdfFillUtils.createCell("", null, null, Element.ALIGN_CENTER, 15, 3, 1));
+        titleTable.addCell(PdfFillUtils.createCell(pdfFillDto.getTitle(), PdfFillUtils.textFont14, null, Element.ALIGN_CENTER, 15, 3, 1));
         // 条码
         Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfFillDto.getPackageNumber(), false, null, null);
         code128Image.scalePercent(100);
@@ -131,10 +131,10 @@ public class CreatePrintPdfUtil {
         PdfPTable basicTable = PdfFillUtils.createTable(6);
         List<Map<String, String>> basicPlate = pdfFillDto.getBasicPlate();
         for (Map<String, String> stringMap : basicPlate) {
-            basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont11, null, 22f, Element.ALIGN_LEFT, 0, 1, 3));
+            basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont11, null, Element.ALIGN_LEFT, 0, 1, 3));
         }
         if (basicPlate.size() % 2 > 0) {
-            basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont11, null, 22f, Element.ALIGN_LEFT, 0, 1, 3));
+            basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont11, null, Element.ALIGN_LEFT, 0, 1, 3));
         }
         document.add(basicTable);
 
@@ -159,7 +159,7 @@ public class CreatePrintPdfUtil {
                     if ("座位号".equals(value)) {
                         value = "座号";
                     }
-                    studentTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont11, BaseColor.LIGHT_GRAY, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                    studentTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont11, BaseColor.LIGHT_GRAY, Element.ALIGN_CENTER, 0, 1, 1));
                     j++;
                 }
             }
@@ -173,19 +173,19 @@ public class CreatePrintPdfUtil {
                 Map<String, String> stringMap1 = studentPlate.get(2 * i);
                 for (int j = 0; j < stringMap1.size(); j++) {
                     String value = stringMap1.get(headKeys[j]);
-                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j]), null, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j]), null, Element.ALIGN_CENTER, 0, 1, 1));
                 }
 
                 if (studentPlateCount % 2 > 0 && 2 * i + 1 == studentPlate.size()) {
                     for (int i1 = 0; i1 < columnCount; i1++) {
-                        studentTable.addCell(PdfFillUtils.createCell("", PdfFillUtils.textFont11, null, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                        studentTable.addCell(PdfFillUtils.createCell("", PdfFillUtils.textFont11, null, Element.ALIGN_CENTER, 0, 1, 1));
                     }
                     continue;
                 }
                 Map<String, String> stringMap2 = studentPlate.get(2 * i + 1);
                 for (int j = 0; j < stringMap2.size(); j++) {
                     String value = stringMap2.get(headKeys[j + columnCount]);
-                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j + columnCount]), null, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j + columnCount]), null, Element.ALIGN_CENTER, 0, 1, 1));
                 }
             }
         }
@@ -199,7 +199,7 @@ public class CreatePrintPdfUtil {
                 if ("座位号".equals(value)) {
                     value = "座号";
                 }
-                studentTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont11, BaseColor.LIGHT_GRAY, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                studentTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont11, BaseColor.LIGHT_GRAY, Element.ALIGN_CENTER, 0, 1, 1));
                 k++;
             }
 
@@ -211,7 +211,7 @@ public class CreatePrintPdfUtil {
                 Map<String, String> stringMap1 = studentPlate.get(i);
                 for (int j = 0; j < stringMap1.size(); j++) {
                     String value = stringMap1.get(headKeys[j]);
-                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j]), null, 22f, Element.ALIGN_CENTER, 0, 1, 1));
+                    studentTable.addCell(PdfFillUtils.createCell(value, chooseFont(value, columnWidth[j]), null, Element.ALIGN_CENTER, 0, 1, 1));
                 }
             }
         }
@@ -295,16 +295,16 @@ public class CreatePrintPdfUtil {
             Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfPackageDto.getPackageNumber(), false, null, null);
             code128Image.scalePercent(100);
             titleTable.setPaddingTop(1);
-            titleTable.addCell(PdfFillUtils.createCell("", null, null, 30f, Element.ALIGN_CENTER, 15, 1, 1));
+            titleTable.addCell(PdfFillUtils.createCell("", null, null, Element.ALIGN_CENTER, 15, 1, 1));
             titleTable.addCell(PdfFillUtils.createCell(code128Image, 30f, Element.ALIGN_CENTER, 15, 1, 1));
 
-            titleTable.addCell(PdfFillUtils.createCell(pdfPackageDto.getTitle(), PdfFillUtils.textFont22, null, 35f, Element.ALIGN_CENTER, 15, 1, 2));
+            titleTable.addCell(PdfFillUtils.createCell(pdfPackageDto.getTitle(), PdfFillUtils.textFont22, null, Element.ALIGN_CENTER, 15, 1, 2));
 
             List<Map<String, String>> titlePlate = pdfPackageDto.getTitlePlate();
             for (Map<String, String> stringMap : titlePlate) {
                 String value = stringMap.get("value");
                 if (StringUtils.isNotBlank(value)) {
-                    titleTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont16, null, 30f, Element.ALIGN_CENTER, 15, 1, 2));
+                    titleTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont16, null, Element.ALIGN_CENTER, 15, 1, 2));
                 }
             }
 

+ 3 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfFillUtils.java

@@ -337,14 +337,14 @@ public class PdfFillUtils {
      * @param value       cell内容
      * @param font        字体
      * @param cellColor   背景色
-     * @param fixedHeight 垂直对齐方式
      */
-    public static PdfPCell createCell(String value, Font font, BaseColor cellColor, float fixedHeight, int horizontalAlignment, int disableBorderSide, int rowspan, int colspan) {
+    public static PdfPCell createCell(String value, Font font, BaseColor cellColor, int horizontalAlignment, int disableBorderSide, int rowspan, int colspan) {
         PdfPCell cell = new PdfPCell();
         cell.setBorderWidth(0.5F);
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
         cell.setHorizontalAlignment(horizontalAlignment);
         cell.setUseAscender(true);
+        cell.setNoWrap(false);
         if (font != null) {
             cell.setPhrase(new Phrase(value, font));
         } else {
@@ -353,9 +353,7 @@ public class PdfFillUtils {
         if (cellColor != null) {
             cell.setBackgroundColor(cellColor);
         }
-        if (fixedHeight > 0) {
-            cell.setFixedHeight(fixedHeight);
-        }
+        cell.setMinimumHeight(20f);
         if (disableBorderSide > 0) {
             cell.disableBorderSide(disableBorderSide);
         }

+ 3 - 1
distributed-print-business/src/main/resources/db/log/脚本-xiaof.sql

@@ -332,4 +332,6 @@ SET
                       WHERE
                           clazz_name IS NOT NULL
                         AND edc.id = es.exam_detail_course_id
-                      GROUP BY es.exam_detail_course_id);
+                      GROUP BY es.exam_detail_course_id);
+
+ALTER TABLE `client_status` ADD INDEX `idx_1` (`school_id` ASC, `exam_detail_id` ASC, `course_code` ASC, `paper_number` ASC, `machine_code` ASC);

+ 3 - 1
distributed-print-business/src/main/resources/db/upgrade/3.2.7.sql

@@ -238,4 +238,6 @@ SET
                       WHERE
                           clazz_name IS NOT NULL
                         AND edc.id = es.exam_detail_course_id
-                      GROUP BY es.exam_detail_course_id);
+                      GROUP BY es.exam_detail_course_id);
+
+ALTER TABLE `client_status` ADD INDEX `idx_1` (`school_id` ASC, `exam_detail_id` ASC, `course_code` ASC, `paper_number` ASC, `machine_code` ASC);