瀏覽代碼

Merge branch 'dev_v3.2.1' into dev_v3.2.2

# Conflicts:
#	distributed-print/src/main/resources/application-test.properties
wangliang 2 年之前
父節點
當前提交
776c1f4e35

+ 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);
 
             }

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

@@ -152,7 +152,7 @@ public class CreatePrintPdfUtil {
             int j = 0;
             for (Map.Entry<String, String> entry : studentHeadPlate.entrySet()) {
                 headKeys[columnCount * i + j] = entry.getKey();
-                studentTable.addCell(PdfFillUtils.createCell(entry.getValue(), PdfFillUtils.textFont12, BaseColor.GRAY, 16f, Element.ALIGN_CENTER, 0, 1, 1));
+                studentTable.addCell(PdfFillUtils.createCell(entry.getValue(), PdfFillUtils.textFont12, BaseColor.LIGHT_GRAY, 16f, Element.ALIGN_CENTER, 0, 1, 1));
                 j++;
             }
         }
@@ -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});
 
@@ -232,31 +252,31 @@ 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, 40f, Element.ALIGN_CENTER, 15, 1, 1));
+            titleTable.addCell(PdfFillUtils.createCell("", null, null, 30f, 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));
+            titleTable.addCell(PdfFillUtils.createCell(pdfPackageDto.getTitle(), PdfFillUtils.textFont22, null, 35f, 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.textFont18, null, 30f, Element.ALIGN_CENTER, 15, 1, 2));
+                if (StringUtils.isNotBlank(value)) {
+                    titleTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont16, 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[]{3, 15, 3, 79});
             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));
-                basicTable.addCell(PdfFillUtils.createCell(": ", PdfFillUtils.textFont24, 50f, Element.ALIGN_JUSTIFIED_ALL, 0f));
-                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("value"), PdfFillUtils.textFont24, 50f, Element.ALIGN_LEFT, 0f));
+                basicTable.addCell(PdfFillUtils.createCell("", PdfFillUtils.textFont14, 50f, Element.ALIGN_JUSTIFIED_ALL, 0f));
+                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name"), PdfFillUtils.textFont14, 50f, Element.ALIGN_JUSTIFIED_ALL, 0f));
+                basicTable.addCell(PdfFillUtils.createCell(": ", PdfFillUtils.textFont14, 50f, Element.ALIGN_JUSTIFIED_ALL, 0f));
+                basicTable.addCell(PdfFillUtils.createCell(stringMap.get("value"), PdfFillUtils.textFont14, 50f, Element.ALIGN_LEFT, 0f));
             }
             document.add(basicTable);
             document.add(blank);

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

@@ -27,7 +27,10 @@ public class PdfFillUtils {
     // 定义全局的字体静态变量
     public static Font textFont28;
     public static Font textFont24;
+    public static Font textFont22;
     public static Font textFont18;
+    public static Font textFont16;
+    public static Font textFont14;
     public static Font textFont12;
     public static Font textFont11;
     public static Font textFont10;
@@ -41,7 +44,10 @@ public class PdfFillUtils {
             BaseFont bfChinese = BaseFont.createFont(AsianFontMapper.ChineseSimplifiedFont, AsianFontMapper.ChineseSimplifiedEncoding_H, BaseFont.NOT_EMBEDDED);
             textFont28 = new Font(bfChinese, 28);
             textFont24 = new Font(bfChinese, 24);
+            textFont22 = new Font(bfChinese, 22);
             textFont18 = new Font(bfChinese, 18);
+            textFont16 = new Font(bfChinese, 16);
+            textFont14 = new Font(bfChinese, 14);
             textFont12 = new Font(bfChinese, 12);
             textFont11 = new Font(bfChinese, 11);
             textFont10 = new Font(bfChinese, 10);
@@ -120,6 +126,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);
@@ -197,7 +204,7 @@ public class PdfFillUtils {
      */
     public static PdfPCell createCell(String value, Font font, BaseColor cellColor, float fixedHeight, int horizontalAlignment, int disableBorderSide, int rowspan, int colspan) {
         PdfPCell cell = new PdfPCell();
-        cell.setBorderWidth(0.1F);
+        cell.setBorderWidth(0.5F);
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
         cell.setHorizontalAlignment(horizontalAlignment);
         cell.setUseAscender(true);
@@ -233,7 +240,7 @@ public class PdfFillUtils {
      */
     public static PdfPCell createCell(String value, Font font, float fixedHeight, int horizontalAlignment, float paddingLeft) {
         PdfPCell cell = new PdfPCell();
-        cell.setBorderWidth(0.1F);
+        cell.setBorderWidth(0.5F);
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
         cell.setHorizontalAlignment(horizontalAlignment);
         cell.setUseAscender(true);
@@ -259,7 +266,7 @@ public class PdfFillUtils {
      */
     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.setBorderWidth(0.5F);
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
         cell.setUseAscender(true);
         cell.setHorizontalAlignment(horizontalAlignment);

+ 1 - 0
distributed-print-business/src/main/resources/db/2、init-table-data.sql

@@ -691,6 +691,7 @@ INSERT INTO `sys_privilege` VALUES (767, '同步机构数据', '/api/admin/auth/
 INSERT INTO `sys_privilege` VALUES (768, '题库单点登录', '/api/admin/exam/sso/question_library_login', 'URL', 149, 2, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (769, '题库管理', 'questionLibrary', 'MENU', NULL, 3, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (770, '题库管理', 'QuestionLibraryManage', 'MENU', 769, 1, NULL, NULL, 1, 0, 1);
+INSERT INTO `sys_privilege` VALUES (391, '查询条件', 'Condition', 'CONDITION', 357, 1, 'AUTH', '359', 1, 0, 1);
 
 INSERT INTO `sys_user` VALUES (1, NULL, 'sysadmin', 'sysadmin', NULL, 'MTIzNDU2', NULL, NULL, 1, 1, 1629353956868, NULL, NULL, NULL, NULL, 1629353956881, NULL);
 

+ 2 - 2
distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml

@@ -101,14 +101,14 @@
                 and es.school_id = #{schoolId}
             </if>
             <if test="examDetailCourseIds != null and examDetailCourseIds != '' and examDetailCourseIds.size > 0">
-                AND edc.id IN
+                AND es.exam_detail_course_id IN
                 <foreach collection="examDetailCourseIds" item="examDetailCourseId" index="index" open="(" separator=","
                          close=")">
                     #{examDetailCourseId}
                 </foreach>
             </if>
         </where>
-        order by edc.course_code, 0+ cast(es.site_number as char)
+        order by edc.course_code, 0+ cast(es.site_number as char), es.ticket_number
     </select>
     <select id="listStudentByPrintPlanIdAndSyncStatus"
             resultType="com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto">

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

@@ -581,7 +581,7 @@
                 </foreach>
             </if>
         </where>
-        order by a.create_time desc
+        order by IFNULL(g.update_time, a.update_time) desc, a.paper_number desc
     </select>
     <select id="listPaperNumbers" resultType="com.qmth.distributed.print.business.bean.dto.RelatePaperDto">
         SELECT

+ 2 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/OpenApiController.java

@@ -16,10 +16,7 @@ import com.qmth.teachcloud.common.enums.AppSourceEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
-import com.qmth.teachcloud.common.util.AuthThirdUtil;
-import com.qmth.teachcloud.common.util.JacksonUtil;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.common.util.*;
 import io.swagger.annotations.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -152,7 +149,7 @@ public class OpenApiController {
         if (Objects.isNull(signature) || Objects.equals(signature, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("鉴权信息不能为空");
         }
-        signature = URLDecoder.decode(signature, SystemConstant.CHARSET_NAME);
+        signature = new String(Base64Util.decode(signature), SystemConstant.CHARSET_NAME);
         if (Objects.isNull(account) || Objects.equals(account, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("工号不能为空");
         }

+ 1 - 1
distributed-print/src/main/resources/application-36dev.properties

@@ -90,7 +90,7 @@ prefix.url.sys=admin/sys
 prefix.url.basic=admin/basic
 prefix.url.exam=admin/exam
 prefix.url.data=admin/data
-prefix.url.work=admin/work
+prefix.url.work=admin/workcom.qmth.solar.access-key
 prefix.url.client=admin/client
 prefix.url.statistics=admin/statistics
 prefix.url.sync=admin/sync