ソースを参照

Merge branch 'dev_v3.2.1' into release_v3.2.1

xiaof 2 年 前
コミット
69e25b2295

+ 13 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/PdfPackageDto.java

@@ -13,6 +13,11 @@ public class PdfPackageDto {
      */
     private String title;
 
+    /**
+     * 是否要“订”
+     */
+    private Boolean isTag;
+
     /**
      * 卷袋号
      */
@@ -37,6 +42,14 @@ public class PdfPackageDto {
         this.title = title;
     }
 
+    public Boolean getTag() {
+        return isTag;
+    }
+
+    public void setTag(Boolean tag) {
+        isTag = tag;
+    }
+
     public String getPackageNumber() {
         return packageNumber;
     }

+ 58 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -14,10 +14,7 @@ import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintMethodEnum;
 import com.qmth.distributed.print.business.enums.StudentClazzEnum;
-import com.qmth.distributed.print.business.service.BasicTemplateService;
-import com.qmth.distributed.print.business.service.ExamDetailService;
-import com.qmth.distributed.print.business.service.ExamStudentService;
-import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.*;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
@@ -108,6 +105,12 @@ public class CreatePdfUtil {
     @Resource
     BasicSemesterService basicSemesterService;
 
+    @Resource
+    ExamTaskService examTaskService;
+
+    @Resource
+    ExamTaskDetailService examTaskDetailService;
+
     @Resource
     DictionaryConfig dictionaryConfig;
 
@@ -326,6 +329,21 @@ public class CreatePdfUtil {
         pdfPackageDto.setTitle(schoolName);
         pdfPackageDto.setPackageNumber(examDetail.getPackageCode());
 
+        boolean isTag = false;
+        for (ExamDetailCourse detailCourse : examDetailCourseList) {
+            ExamTask examTask = examTaskService.getByCourseCodeAndPaperNumber(examDetail.getSchoolId(), detailCourse.getCourseCode(), detailCourse.getPaperNumber());
+            ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
+            List<JSONObject> objectList = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class);
+            for (JSONObject jsonObject : objectList) {
+                int pages = jsonObject.getIntValue("pages");
+                isTag = pages > 2;
+                pdfPackageDto.setTag(isTag);
+                if (isTag) {
+                    break;
+                }
+            }
+        }
+
         // 标题信息
         List<JSONObject> objectTitleList = JSON.parseArray(object.getString("title"), JSONObject.class);
         List<Map<String, String>> titlePlate = new ArrayList<>();
@@ -406,6 +424,42 @@ public class CreatePdfUtil {
                 } else if ("paperCount".equals(code)) {
                     basicMap.put("value", examStudentList.size() + " + " + printCount);
                 }
+                //开课学院
+                else if ("BCollege".equals(code)) {
+                    Set<String> bollegeSet = new HashSet<>();
+                    for (ExamStudentCourseDto studentCourseDto : examStudentList) {
+                        String extendFields = studentCourseDto.getExtendFields();
+                        Set<String> stringSet = JSON.parseArray(extendFields, JSONObject.class).stream().filter(m -> "BCollege".equals(m.getString("code"))).map(m -> m.getString("value")).collect(Collectors.toSet());
+                        if (!stringSet.isEmpty()) {
+                            bollegeSet.addAll(stringSet);
+                        }
+                    }
+                    basicMap.put("value", String.join(",", bollegeSet));
+                }
+                //派监考学院
+                else if ("STICollege".equals(code)) {
+                    Set<String> stiCollegeSet = new HashSet<>();
+                    for (ExamStudentCourseDto studentCourseDto : examStudentList) {
+                        String extendFields = studentCourseDto.getExtendFields();
+                        Set<String> stringSet = JSON.parseArray(extendFields, JSONObject.class).stream().filter(m -> "STICollege".equals(m.getString("code"))).map(m -> m.getString("value")).collect(Collectors.toSet());
+                        if (!stringSet.isEmpty()) {
+                            stiCollegeSet.addAll(stringSet);
+                        }
+                    }
+                    basicMap.put("value", String.join(",", stiCollegeSet));
+                }
+                //上课教师
+                else if ("CTeacher".equals(code)) {
+                    Set<String> cTeacherSet = new HashSet<>();
+                    for (ExamStudentCourseDto studentCourseDto : examStudentList) {
+                        String extendFields = studentCourseDto.getExtendFields();
+                        Set<String> stringSet = JSON.parseArray(extendFields, JSONObject.class).stream().filter(m -> "CTeacher".equals(m.getString("code"))).map(m -> m.getString("value")).collect(Collectors.toSet());
+                        if (!stringSet.isEmpty()) {
+                            cTeacherSet.addAll(stringSet);
+                        }
+                    }
+                    basicMap.put("value", String.join(",", cTeacherSet));
+                }
                 basicPlate.add(basicMap);
 
             }

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

@@ -225,6 +225,26 @@ public class CreatePrintPdfUtil {
         try {
             // 空格
             Paragraph blank = new Paragraph(" ");
+
+            if (pdfPackageDto.getTag()) {
+                Paragraph para = new Paragraph();
+                para.add(new Chunk("订", PdfFillUtils.textFont12));
+                para.setAlignment(Element.ALIGN_MIDDLE);//设置对齐方式
+
+                float lly = document.getPageSize().getTop() - 40;
+                float ury = document.getPageSize().getTop() - 10;
+
+                Rectangle rects = new Rectangle(15, lly, 50, ury);//文本框位置
+//            rects.setBorder(Rectangle.BOX);//显示边框,默认不显示,常量值:LEFT, RIGHT, TOP, BOTTOM,BOX,
+                rects.setBorderWidth(1f);//边框线条粗细
+                rects.setBorderColor(BaseColor.BLACK);//边框颜色
+                pdfWriter.getDirectContent().rectangle(rects);
+                ColumnText ct = new ColumnText(pdfWriter.getDirectContent());
+                ct.addElement(para);
+                ct.setSimpleColumn(rects);
+                ct.go();
+            }
+
             // 标题table
             PdfPTable titleTable = PdfFillUtils.createTable(new float[]{80, 20});
 
@@ -240,18 +260,16 @@ public class CreatePrintPdfUtil {
             List<Map<String, String>> titlePlate = pdfPackageDto.getTitlePlate();
             for (Map<String, String> stringMap : titlePlate) {
                 String value = stringMap.get("value");
-                if(StringUtils.isNotBlank(value)) {
+                if (StringUtils.isNotBlank(value)) {
                     titleTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont18, null, 30f, Element.ALIGN_CENTER, 15, 1, 2));
                 }
             }
 
             document.add(titleTable);
             document.add(blank);
-            document.add(blank);
-            document.add(blank);
 
             // 基础信息表格
-            PdfPTable basicTable = PdfFillUtils.createTable(new float[]{20, 3, 77});
+            PdfPTable basicTable = PdfFillUtils.createTable(new float[]{24, 3, 73});
             List<Map<String, String>> basicPlate = pdfPackageDto.getBasicPlate();
             for (Map<String, String> stringMap : basicPlate) {
                 basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name"), PdfFillUtils.textFont24, 50f, Element.ALIGN_JUSTIFIED_ALL, 0f));

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfFillUtils.java

@@ -120,6 +120,7 @@ public class PdfFillUtils {
     public static JSONObject packageTempData(String data, String fileName) {
         PdfPackageDto pdfPackageDto = new PdfPackageDto();
         pdfPackageDto.setTitle("卷袋贴样例");
+        pdfPackageDto.setTag(true);
         pdfPackageDto.setPackageNumber("123456789");
 
         JSONObject objectList = JSON.parseObject(data);