فهرست منبع

Merge remote-tracking branch 'origin/dev_v3.0.0' into dev_v3.0.0

wangliang 3 سال پیش
والد
کامیت
fc1fea7b91

+ 24 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/StudentExtendDto.java

@@ -0,0 +1,24 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+public class StudentExtendDto {
+
+    private String fieldName;
+
+    private Object value;
+
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+}

+ 8 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -247,10 +247,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 List<PdfDto> backupPaperTempPdfList = new ArrayList<>();//备份试卷
                 List<PdfDto> cardPdfTempList = new ArrayList<>();//备份题卡
 
-                // 印品
-                BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByCourseCodeAndPaperNumber(examDetailCourse.getCourseCode(), examDetailCourse.getPaperNumber());
-
-                String printContent = StringUtils.isNotBlank(examPrintPlan.getPrintContent()) ? examPrintPlan.getPrintContent() : basicPrintConfig.getPrintContent();
+                String printContent = examPrintPlan.getPrintContent();
                 if (StringUtils.isBlank(printContent)) {
                     return null;
                 }
@@ -307,8 +304,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         paperType = paperTypeParam;
                         CreatePdfCacheUtil.setPaperType(key, paperType);
                     } else {
-                        DrawRuleEnum drawRuleEnum = examPrintPlan.getDrawRule() != null ? examPrintPlan.getDrawRule() : basicPrintConfig.getDrawRule();
-                        paperType = createPdfUtil.getPaperType(drawRuleEnum, examTaskDetail, key);//抽取卷型
+                        paperType = createPdfUtil.getPaperType(examPrintPlan.getDrawRule(), examTaskDetail, key);//抽取卷型
                     }
                     examTaskDetail.setRelatePaperType(paperType);
                     examDetailCourse.setPaperType(paperType);
@@ -322,7 +318,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     List<String> paperTypes = Arrays.asList(paperType.split(",")).stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
                     int i1 = 0;
                     for (ExamStudent t : examStudentList) {
-                        int mod = i1 % examTaskDetail.getDrawCount().intValue();
+                        int mod = i1 % examTaskDetail.getDrawCount();
                         String stuPaperType = paperTypes.get(mod);
                         t.setPaperType(stuPaperType);
                         i1++;
@@ -330,7 +326,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
                     List<PaperPdfDto> paperPdfDto = null;
 
-                    int backupCount = examPrintPlan.getBackupCount() != null ? examPrintPlan.getBackupCount().intValue() : basicPrintConfig.getBackupCount();
+                    int backupCount = examPrintPlan.getBackupCount() != null ? examPrintPlan.getBackupCount() : 0;
 
                     if (printContent.contains("PAPER")) {
                         paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
@@ -372,7 +368,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             list[1].addAll(cardPdfTempList);
 
                             for (ExamStudent t : examStudentList) {
-                                basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
+                                basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList, basicCardRule));
                             }
                             // 题卡
                             list[3].addAll(examStudentTempPdfList);
@@ -405,11 +401,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Transactional
     public void createA4File(ExamPrintPlan examPrintPlan, ExamDetail examDetail, BasicSchool basicSchool, Set<File> ftlList, List<ExamDetailCourse> examDetailCourseList, List<PdfDto>... list) throws Exception {
         // 印品
-        ExamDetailCourse examDetailCourse = examDetailCourseList.get(0);
-        BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByCourseCodeAndPaperNumber(examDetailCourse.getCourseCode(), examDetailCourse.getPaperNumber());
         List<Long> examDetailCourseListIds = examDetailCourseList.stream().map(s -> s.getId()).collect(Collectors.toList());
 
-        String ordinaryContent = StringUtils.isNotBlank(examPrintPlan.getOrdinaryContent()) ? examPrintPlan.getOrdinaryContent() : basicPrintConfig.getOrdinaryContent();
+        String ordinaryContent = examPrintPlan.getOrdinaryContent();
 
         if (StringUtils.isNotBlank(ordinaryContent)) {
             //获取普通印品
@@ -424,12 +418,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             }
         }
 
-        String variableContent = StringUtils.isNotBlank(examPrintPlan.getVariableContent()) ? examPrintPlan.getVariableContent() : basicPrintConfig.getVariableContent();
+        String variableContent = examPrintPlan.getVariableContent();
 
         if (StringUtils.isNotBlank(variableContent)) {
             List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
             int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() != null && s.getPaperPageA3() > 2).count();
-            boolean tag = count > 0 ? true : false;
+            boolean tag = count > 0;
 
             //获取变量印品
             JSONArray jsonArrayVariable = JSONArray.parseArray(variableContent);

+ 7 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -5,12 +5,10 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.Gson;
-import com.qmth.distributed.print.business.bean.dto.ExamStudentCourseDto;
-import com.qmth.distributed.print.business.bean.dto.ExamStudentDto;
-import com.qmth.distributed.print.business.bean.dto.PaperPdfDto;
-import com.qmth.distributed.print.business.bean.dto.PdfDto;
+import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
+import com.qmth.distributed.print.business.service.BasicCardRuleService;
 import com.qmth.teachcloud.common.enums.DrawRuleEnum;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintMethodEnum;
@@ -785,7 +783,7 @@ public class CreatePdfUtil {
      * @return
      * @throws IOException
      */
-    public BasicAttachment examStudentHtml(Set<Long> attachmentIds, String studentContent, ExamStudent t, ExamDetail examDetail, ExamDetailCourse examDetailCourse, Long userId, List<PdfDto> examStudentPdfList) throws IOException {
+    public BasicAttachment examStudentHtml(Set<Long> attachmentIds, String studentContent, ExamStudent t, ExamDetail examDetail, ExamDetailCourse examDetailCourse, Long userId, List<PdfDto> examStudentPdfList, BasicCardRule basicCardRule) throws IOException {
         if (Objects.nonNull(t.getAttachmentId())) {
             attachmentIds.add(t.getAttachmentId());
         }
@@ -832,6 +830,10 @@ public class CreatePdfUtil {
         return examStudentAttachment;
     }
 
+    private List<StudentExtendDto> createExtendObject(ExamStudent examStudent, BasicCardRule basicCardRule){
+        return null;
+    }
+
     /**
      * 通用题卡html
      *

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

@@ -195,7 +195,11 @@
             a.create_id createId,
             a.create_time createTime,
             e.setup,
-            a.flow_id flowId
+            a.flow_id flowId,
+            a.exam_id examId,
+            f.name examName,
+            f.semester_id semesterId,
+            g.name semesterName
         FROM
             exam_task a
         LEFT JOIN
@@ -206,6 +210,10 @@
             sys_org d ON a.teaching_room_id = d.id
         LEFT JOIN
             t_f_flow_approve e ON a.flow_id = e.flow_id
+        LEFT JOIN
+            basic_exam f on a.school_id = b.school_id and a.exam_id = f.id
+        LEFT JOIN
+            basic_semester g on f.school_id = g.school_id and f.semester_id = g.id
         <where>
             a.enable = true
             <if test="userId != null and userId != ''">
@@ -267,6 +275,10 @@
         a.teacher_name teacherName,
         a.lecturer_name lecturerName,
         so.name teachingRoomName,
+        a.exam_id examId,
+        be.name examName,
+        bs.id semesterId,
+        bs.name semesterName,
         true as myself
         FROM ACT_RU_TASK art
         left join t_exam_task_flow tetf on
@@ -287,6 +299,10 @@
         t_f_flow_approve f ON a.school_id = f.school_id and a.flow_id = f.flow_id
         LEFT JOIN
         sys_org so ON a.teaching_room_id = so.id
+        LEFT JOIN
+            basic_exam be on a.school_id = be.school_id and a.exam_id = be.id
+        LEFT JOIN
+            basic_semester bs on be.school_id = bs.school_id and be.semester_id = bs.id
         <where>
             a.enable = true
             AND a.review = true

+ 1 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java

@@ -179,11 +179,7 @@ public class ExamCardController {
      */
     @ApiOperation(value = "选择已有题卡列表")
     @RequestMapping(value = "/select_card_list", method = RequestMethod.POST)
-    public Result selectCardList(@RequestParam(required = false) String examId,@RequestParam String courseCode, @RequestParam String paperType) {
-        // TODO: 2022/2/23 模拟前端参数 examId
-        if (!SystemConstant.strNotNull(examId)){
-            examId = "228554176387354624";
-        }
+    public Result selectCardList(@RequestParam String examId,@RequestParam String courseCode, @RequestParam String paperType) {
         BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(SystemConstant.convertIdToLong(examId),courseCode);
         List<ExamCard> list = examCardService.listSelectCard(courseCode, basicPrintConfig.getCardRuleId(), paperType);
         return ResultUtil.ok(list);