فهرست منبع

Merge branch 'dev_v3.2.0' into release_v3.2.0

xiaof 2 سال پیش
والد
کامیت
2edd6e927e

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

@@ -475,7 +475,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
         if (examCardDetail == null) {
             throw ExceptionResultEnum.ERROR.exception("题卡内容不存在");
         }
-// 复制题卡内容
+        // 复制题卡内容
         ExamCardDetail copyExamCardDetail = new ExamCardDetail();
         BeanUtils.copyProperties(examCardDetail, copyExamCardDetail);
         copyExamCardDetail.setId(SystemConstant.getDbUuid());

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

@@ -1,13 +1,9 @@
 package com.qmth.distributed.print.business.util;
 
-import com.alibaba.fastjson.JSONObject;
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.*;
 import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
 import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
-import com.qmth.distributed.print.business.service.PrintCommonService;
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
-import com.qmth.teachcloud.common.enums.ClassifyEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -126,7 +122,7 @@ public class CreatePrintPdfUtil {
         // 条码
         Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfFillDto.getPackageNumber(), false, null, null);
         code128Image.scalePercent(100);
-        titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, 15, 3));
+        titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, Element.ALIGN_RIGHT, 15, 3, 1));
         document.add(titleTable);
 
 
@@ -134,7 +130,7 @@ 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.textFont12, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
+            basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont12, null, 0f, Element.ALIGN_LEFT, 0, 1, 3));
         }
         if (basicPlate.size() % 2 > 0) {
             basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont12, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
@@ -230,23 +226,28 @@ 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(pdfPackageDto.getTitle(), PdfFillUtils.textFont28, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
+            PdfPTable titleTable = PdfFillUtils.createTable(new float[]{80, 20});
+
             // 条码
             Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfPackageDto.getPackageNumber(), false, null, null);
             code128Image.scalePercent(100);
-            titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, 15, 3));
-            document.add(titleTable);
+            titleTable.setPaddingTop(1);
+            titleTable.addCell(PdfFillUtils.createCell("", null, null, 40f, 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.textFont28, null, 50f, Element.ALIGN_CENTER, 15, 1, 2));
+            // 条码
+            document.add(titleTable);
+            document.add(blank);
+            document.add(blank);
             document.add(blank);
 
             // 基础信息表格
-            PdfPTable basicTable = PdfFillUtils.createTable(1);
+            PdfPTable basicTable = PdfFillUtils.createTable(new float[]{30, 70});
             List<Map<String, String>> basicPlate = pdfPackageDto.getBasicPlate();
             for (Map<String, String> stringMap : basicPlate) {
-                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont24, 50f, Element.ALIGN_LEFT, 20f));
-                document.add(blank);
+                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":", PdfFillUtils.textFont24, 50f, Element.ALIGN_RIGHT, 18f));
+                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("value"), PdfFillUtils.textFont24, 50f, Element.ALIGN_LEFT, 18f));
             }
             document.add(basicTable);
             document.add(blank);
@@ -281,11 +282,11 @@ public class CreatePrintPdfUtil {
         } else if (size == 2) {
             columnWidth = new float[]{20, 30, 20, 30};
         } else if (size == 3) {
-            columnWidth = new float[]{10, 25, 25, 10, 25, 25};
+            columnWidth = new float[]{15, 20, 15, 15, 20, 15};
         } else if (size == 4) {
-            columnWidth = new float[]{6, 12, 16, 16, 6, 12, 16, 16};
+            columnWidth = new float[]{12, 13, 13, 12, 12, 13, 13, 12};
         } else if (size == 5) {
-            columnWidth = new float[]{6, 10, 11, 12, 11, 6, 10, 11, 12, 11};
+            columnWidth = new float[]{10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
         } else if (size == 6) {
             columnWidth = new float[]{6, 9, 9, 9, 9, 8, 6, 9, 9, 9, 9, 8};
         } else {

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

@@ -235,12 +235,12 @@ public class PdfFillUtils {
      * @param image       cell内容
      * @param fixedHeight 垂直对齐方式
      */
-    public static PdfPCell createCell(Image image, float fixedHeight, int disableBorderSide, int rowspan) {
+    public static PdfPCell createCell(Image image, float fixedHeight, int horizontalAlignment, int disableBorderSide, int rowspan, int colspan) {
         PdfPCell cell = new PdfPCell(image);
         cell.setBorderWidth(0.1F);
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
         cell.setUseAscender(true);
-        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+        cell.setHorizontalAlignment(horizontalAlignment);
 //        cell.setExtraParagraphSpace(10);
         if (fixedHeight > 0) {
             cell.setFixedHeight(fixedHeight);
@@ -251,6 +251,9 @@ public class PdfFillUtils {
         if (rowspan > 0) {
             cell.setRowspan(rowspan);
         }
+        if (colspan > 0) {
+            cell.setColspan(colspan);
+        }
         return cell;
     }
 

+ 5 - 0
distributed-print-business/src/main/resources/mapper/BasicPrintConfigMapper.xml

@@ -52,8 +52,13 @@
             *
         FROM
             basic_print_config a
+                JOIN
+            basic_template_org b ON a.school_id = b.school_id
+                AND a.id = b.rule_id
         WHERE
             a.school_id = #{schoolId}
           AND a.exam_id = #{examId}
+          AND b.org_id = #{orgId}
+          AND b.type = #{type}
     </select>
 </mapper>

+ 5 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ImageTrajectoryUtil.java

@@ -15,6 +15,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.Objects;
 import java.util.StringJoiner;
 
@@ -48,7 +49,7 @@ public class ImageTrajectoryUtil {
             // 设置字体
             g.setFont(new Font(FONT_FORMAT, Font.LAYOUT_LEFT_TO_RIGHT, FONT_SIZE));
             // 写入签名
-            if(jsonArray != null && !jsonArray.isEmpty()) {
+            if (jsonArray != null && !jsonArray.isEmpty()) {
                 for (int i = 0; i < jsonArray.size(); i++) {
                     JSONObject jsonObject = jsonArray.getJSONObject(i);
                     JSONArray contentJsonArray = (JSONArray) jsonObject.get("content");
@@ -56,7 +57,9 @@ public class ImageTrajectoryUtil {
                     for (int k = 0; k < contentJsonArray.size(); k++) {
                         stringJoiner.add(contentJsonArray.get(k).toString());
                     }
-                    g.drawString(stringJoiner.toString(), (Integer) jsonObject.get("left"), (Integer) jsonObject.get("top"));
+                    BigDecimal left = new BigDecimal(jsonObject.get("left").toString());
+                    BigDecimal top = new BigDecimal(jsonObject.get("top").toString());
+                    g.drawString(stringJoiner.toString(), left.intValue(), top.intValue());
                 }
             }
             g.dispose();