xiaof преди 3 години
родител
ревизия
dd8e526689

+ 0 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ClientLoginParam.java

@@ -30,7 +30,6 @@ public class ClientLoginParam {
     private String schoolCode;
 
     @ApiModelProperty(value = "登录类型")
-    @NotBlank(message = "登录参数错误")
     private String type;
 
     public String getLoginName() {

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamDetailCourse.java

@@ -66,6 +66,10 @@ public class ExamDetailCourse extends BaseEntity implements Serializable {
     @TableField("attachment_id")
     private String attachmentId;
 
+    @ApiModelProperty(value = "模式2下考生题卡json")
+    @TableField("common_attachment_id")
+    private String commonAttachmentId;
+
     public Long getSchoolId() {
         return schoolId;
     }
@@ -165,4 +169,12 @@ public class ExamDetailCourse extends BaseEntity implements Serializable {
     public void setClazzId(String clazzId) {
         this.clazzId = clazzId;
     }
+
+    public String getCommonAttachmentId() {
+        return commonAttachmentId;
+    }
+
+    public void setCommonAttachmentId(String commonAttachmentId) {
+        this.commonAttachmentId = commonAttachmentId;
+    }
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamDetailMapper.java

@@ -81,7 +81,7 @@ public interface ExamDetailMapper extends BaseMapper<ExamDetail> {
 
     IPage<ClientExamStudentDto> listClientExamStudentPage(Page<ClientExamStudentDto> page, @Param("schoolId") Long schoolId, @Param("examDetailId") Long examDetailId, @Param("ticketNumber") String ticketNumber, @Param("studentName") String studentName, @Param("courseCode") String courseCode);
 
-    List<Map> listStudentByExamDetailId(@Param("schoolId") Long schoolId, @Param("examDetailId") Long examDetailId, @Param("ticketNumber") String ticketNumber, @Param("type") String type);
+    List<Map> listStudentByExamDetailCourseId(@Param("schoolId") Long schoolId, @Param("examDetailId") Long examDetailId, @Param("ticketNumber") String ticketNumber, @Param("type") String type);
 
     Integer selectPaperCount(@Param("schoolId") Long schoolId,
                              @Param("printPlanId") Long printPlanId,

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

@@ -189,7 +189,7 @@ public interface ExamDetailService extends IService<ExamDetail> {
 
     IPage<ClientExamStudentDto> listStudent(Long schoolId, Long examDetailId, String ticketNumber, String studentName, String courseCode, Integer pageNumber, Integer pageSize);
 
-    List<Map> listStudentByExamDetailId(Long schoolId, Long examDetailId, String ticketNumber, String type);
+    List<Map> listStudentByExamDetailCourseId(Long schoolId, Long examDetailId, String ticketNumber, String type);
 
     List<ExamDetail> listByCourseCodeAndPaperNumberAndPaperTypeIsNull(Long schoolId, String courseCode, String paperNumber);
 

+ 15 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicPrintConfigServiceImpl.java

@@ -19,6 +19,7 @@ import com.qmth.teachcloud.common.entity.BasicExam;
 import com.qmth.teachcloud.common.entity.BasicPrintConfig;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExamModelEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.SysOrgService;
@@ -200,17 +201,21 @@ public class BasicPrintConfigServiceImpl extends ServiceImpl<BasicPrintConfigMap
         SysOrg sysOrg = sysOrgService.getById(orgId);
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         List<BasicPrintConfig> basicPrintConfigs = this.baseMapper.listBySchoolIdAndExamIdAndOrgId(schoolId, examId, orgId, TemplateTypeEnum.PRINT_CONFIG.name());
-        if (basicPrintConfigs == null || basicPrintConfigs.size() == 0) {
-            throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]未设置印品");
-        }
-        if (basicPrintConfigs.size() != 1) {
-            throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]查询出多个印品配置");
-        }
-        BasicPrintConfig printConfig = basicPrintConfigs.get(0);
-        if (!printConfig.getEnable()) {
-            throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]印品配置已禁用,请先开启");
+        if(!ExamModelEnum.MODEL3.equals(basicExam.getExamModel())) {
+            if (basicPrintConfigs == null || basicPrintConfigs.size() == 0) {
+                throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]未设置印品");
+            }
+            if (basicPrintConfigs.size() != 1) {
+                throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]查询出多个印品配置");
+            }
+
+            BasicPrintConfig printConfig = basicPrintConfigs.get(0);
+            if (!printConfig.getEnable()) {
+                throw ExceptionResultEnum.ERROR.exception("考试[" + basicExam.getName() + "],教研室[" + sysOrg.getName() + "]印品配置已禁用,请先开启");
+            }
+            return printConfig;
         }
-        return printConfig;
+        return null;
     }
 
     @Override

+ 65 - 30
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -27,6 +27,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -115,15 +116,13 @@ public class ClientServiceImpl implements ClientService {
         // 取试卷
         List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
         Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
-        // 取考生
-        List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
         // 生成试卷List
         if (printContent.contains("PAPER")) {
-            finalMap.put("paper", splicePaperContent(studentList, map));
+            finalMap.put("paper", splicePaperContent(examDetailCourses, map));
         }
         if (printContent.contains("CARD")) {
             // 生成题卡List
-            finalMap.put("card", spliceCardContent(studentList));
+            finalMap.put("card", spliceCardContent(examDetailCourses));
         }
         //
 
@@ -188,8 +187,6 @@ public class ClientServiceImpl implements ClientService {
             Map<String, Object> backupMap = new HashMap<>();
             // 备份数量
             int backupCount = examPrintPlan.getBackupCount();
-            // 取考生列表
-            List<Map> studentList = examDetailService.listStudentByExamDetailId(examDetail.getSchoolId(), examDetailId, null, null);
             if (printContent.contains("PAPER")) {
                 if (examDetail.getAttachmentId() == null) {
                     throw ExceptionResultEnum.ERROR.exception("考场pdf文件未生成");
@@ -209,9 +206,9 @@ public class ClientServiceImpl implements ClientService {
                 // 取试卷
                 Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
                 // 生成试卷List
-                detailMap.put("paper", splicePaperContent(studentList, map));
+                detailMap.put("paper", splicePaperContent(examDetailCourses, map));
                 //试卷
-                List<Map<String, String>> keyMaps = studentList.stream().map(m -> {
+                List<Map<String, String>> keyMaps = examDetailCourses.stream().map(m -> {
                     Map<String, String> stringMap = new HashMap<>();
                     stringMap.put("courseCode", m.get("courseCode").toString());
                     stringMap.put("courseName", m.get("courseName").toString());
@@ -243,7 +240,7 @@ public class ClientServiceImpl implements ClientService {
                 finalMap.put("cardTotal", totalCardPathUrl);
 
                 // 生成题卡List
-                detailMap.put("card", spliceCardContent(studentList));
+                detailMap.put("card", spliceCardContent(examDetailCourses));
 
                 // 备用题卡
                 List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
@@ -649,35 +646,73 @@ public class ClientServiceImpl implements ClientService {
     /**
      * 生成试卷url公共方法
      *
-     * @param studentList
+     * @param examDetailCourses
      * @param map
      */
-    private List<ClientPrintDataDto> splicePaperContent(List<Map> studentList, Map<String, Map<String, String>> map) {
-        List<ClientPrintDataDto> paperList = studentList.stream().map(m -> {
-            ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
-            StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
-            String key = sj.add(printDataDto.getCourseCode()).add(m.get("paperNumber").toString()).add(printDataDto.getPaperType()).toString();
-            printDataDto.setMd5(map.get(key).get("md5"));
-            printDataDto.setUrl(map.get(key).get("url"));
-            return printDataDto;
+    private List<ClientPrintDataDto> splicePaperContent(List<Map<String, Object>> examDetailCourses, Map<String, Map<String, String>> map) {
+        return examDetailCourses.stream().map(m -> {
+            // 取考生列表
+            List<Map> studentList = examDetailService.listStudentByExamDetailCourseId(Long.valueOf(m.get("schoolId").toString()), Long.valueOf(m.get("examDetailCourseId").toString()), null, null);
+            Integer printCount = Integer.parseInt(m.get("printCount").toString());
+            if (studentList != null && studentList.size() > 0) {
+                for (Map studentMap : studentList) {
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(studentMap);
+                    StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
+                    String key = sj.add(printDataDto.getCourseCode()).add(studentMap.get("paperNumber").toString()).add(printDataDto.getPaperType()).toString();
+                    printDataDto.setMd5(map.get(key).get("md5"));
+                    printDataDto.setUrl(map.get(key).get("url"));
+                    return printDataDto;
+                }
+            } else if (printCount != null && printCount > 0) {
+                for (int i = 0; i < printCount; i++) {
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
+                    StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
+                    String key = sj.add(printDataDto.getCourseCode()).add(m.get("paperNumber").toString()).add(printDataDto.getPaperType()).toString();
+                    printDataDto.setMd5(map.get(key).get("md5"));
+                    printDataDto.setUrl(map.get(key).get("url"));
+                    return printDataDto;
+                }
+            }
+            return null;
         }).collect(Collectors.toList());
-        return paperList;
     }
 
     /**
      * 生成题卡url公共方法
      *
-     * @param studentList
+     * @param examDetailCourses
      */
-    private List<ClientPrintDataDto> spliceCardContent(List<Map> studentList) {
-        List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
-            ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
-            Map<String, String> urlMap = teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(m.get("attachmentId").toString()), false);
-            printDataDto.setMd5(urlMap.get("md5"));
-            printDataDto.setUrl(urlMap.get("url"));
-            return printDataDto;
+    private List<ClientPrintDataDto> spliceCardContent(List<Map<String, Object>> examDetailCourses) {
+        return examDetailCourses.stream().map(m -> {
+            // 取考生列表
+            List<Map> studentList = examDetailService.listStudentByExamDetailCourseId(Long.valueOf(m.get("schoolId").toString()), Long.valueOf(m.get("examDetailCourseId").toString()), null, null);
+            Integer printCount = Integer.parseInt(m.get("printCount").toString());
+            if (studentList != null && studentList.size() > 0) {
+                for (Map studentMap : studentList) {
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(studentMap);
+                    Map<String, String> urlMap = teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(studentMap.get("attachmentId").toString()), false);
+                    printDataDto.setMd5(urlMap.get("md5"));
+                    printDataDto.setUrl(urlMap.get("url"));
+                    return printDataDto;
+                }
+            } else if (printCount > 0) {
+                AtomicInteger atomicInteger = new AtomicInteger(0);
+                List<JSONObject> commonAttachmentIds = JSONObject.parseArray(m.get("commonAttachmentId").toString(), JSONObject.class) ;
+                List<String> paperTypes = Arrays.stream(m.get("paperType").toString().split(",")).sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
+                for (int i = 0; i < printCount; i++) {
+                    int seq = atomicInteger.getAndIncrement();
+                    int mod = seq % commonAttachmentIds.size();
+                    String tempPaperType = paperTypes.get(mod);
+                    JSONObject jsonObject = commonAttachmentIds.stream().filter(j -> tempPaperType.equals(j.getString("name"))).findFirst().get();
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
+                    Map<String, String> urlMap = teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(jsonObject.get("attachmentId").toString()), false);
+                    printDataDto.setMd5(urlMap.get("md5"));
+                    printDataDto.setUrl(urlMap.get("url"));
+                    return printDataDto;
+                }
+            }
+            return null;
         }).collect(Collectors.toList());
-        return cardList;
     }
 
     /**
@@ -689,8 +724,8 @@ public class ClientServiceImpl implements ClientService {
         ClientPrintDataDto printDataDto = new ClientPrintDataDto();
         String courseCode = m.get("courseCode").toString();
         String courseName = m.get("courseName").toString();
-        String studentName = m.get("studentName").toString();
-        String studentCode = m.get("studentCode").toString();
+        String studentName = m.containsKey("studentName") ? m.get("studentName").toString() : "";
+        String studentCode = m.containsKey("studentCode") ? m.get("studentCode").toString() : "";
         String paperType = m.get("paperType").toString();
         printDataDto.setCourseCode(courseCode);
         printDataDto.setCourseName(courseName);

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

@@ -812,8 +812,8 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     }
 
     @Override
-    public List<Map> listStudentByExamDetailId(Long schoolId, Long examDetailId, String ticketNumber, String type) {
-        return this.baseMapper.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
+    public List<Map> listStudentByExamDetailCourseId(Long schoolId, Long examDetailId, String ticketNumber, String type) {
+        return this.baseMapper.listStudentByExamDetailCourseId(schoolId, examDetailId, ticketNumber, type);
     }
 
     @Override

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

@@ -263,6 +263,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
                 JSONObject jsonObject = new JSONObject();
                 JSONArray jsonArray = new JSONArray();
+                JSONArray stuJsonArray = new JSONArray();
                 for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
                     //查询题卡
                     ExamCard examCard = examCardService.getById(examTaskDetail.getCardId());
@@ -382,13 +383,29 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         if (examStudentList != null && examStudentList.size() > 0) {
                             for (ExamStudent t : examStudentList) {
                                 // 用带条码的模板
-                                basicAttachmentList.add(createPdfUtil.examStudentHtml(examCardDetail.getHtmlContent(), t, examDetail, examDetailCourse, sysUser.getId(), studentCardPdfList, basicCardRule));
+                                basicAttachmentList.add(createPdfUtil.examStudentHtml(examCardDetail.getHtmlContent(), t, paperType, examDetail, examDetailCourse, sysUser.getId(), studentCardPdfList, basicCardRule));
                             }
                         } else if (examDetail.getPrintCount() != null) {
+                            AtomicInteger atomicInteger = new AtomicInteger(0);
+                            Map<String, BasicAttachment> stringBasicAttachmentMap = new HashMap<>();
                             int i = 0;
                             while (i < examDetail.getPrintCount()) {
+                                int seq = atomicInteger.getAndIncrement();
+                                int mod = seq % examTaskDetail.getDrawCount();
+                                String tempPaperType = paperTypes.get(mod);
+                                BasicAttachment basicAttachment;
+                                if (!stringBasicAttachmentMap.containsKey(tempPaperType)) {
+                                    basicAttachment = createPdfUtil.examStudentHtml(cardContent, null, tempPaperType, examDetail, examDetailCourse, sysUser.getId(), studentCardPdfList, basicCardRule);
+                                    stringBasicAttachmentMap.put(tempPaperType, basicAttachment);
+                                    JSONObject object = new JSONObject();
+                                    object.put("name", tempPaperType);
+                                    object.put("attachmentId", basicAttachment.getId());
+                                    stuJsonArray.add(object);
+                                } else {
+                                    basicAttachment = stringBasicAttachmentMap.get(tempPaperType);
+                                }
                                 // 用不带条码的模板
-                                basicAttachmentList.add(createPdfUtil.examStudentHtml(cardContent, null, examDetail, examDetailCourse, sysUser.getId(), studentCardPdfList, basicCardRule));
+                                basicAttachmentList.add(basicAttachment);
                                 i++;
                             }
                         } else {
@@ -398,6 +415,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         list[3].addAll(studentCardPdfList);
                         jsonObject.put("card", jsonArray);
                         examDetailCourse.setAttachmentId(jsonObject.toJSONString());
+                        examDetailCourse.setCommonAttachmentId(stuJsonArray.toJSONString());
                     }
                     examStudentService.saveOrUpdateBatch(examStudentList);
                 }

+ 62 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -242,7 +242,7 @@ public class CreatePdfUtil {
 
         htmlMap.put("minSite", Optional.ofNullable(minSite).map(s -> s.get().getSiteNumber()).orElse(""));
         htmlMap.put("maxSite", Optional.ofNullable(maxSite).map(s -> s.get().getSiteNumber()).orElse(""));
-        htmlMap.put("studentCount", examStudentList.size());
+        htmlMap.put("studentCount", examStudentList != null && examStudentList.size() > 0 ? examStudentList.size() : examDetail.getPrintCount());
 
         String tagValue = tag ? "订" : null;
         htmlMap.put("tag", tagValue);
@@ -302,10 +302,10 @@ public class CreatePdfUtil {
         htmlMap.put("paperCode", examDetail.getPackageCode());
         htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetail.getPackageCode(), false));
 
-        int totalCount = examStudentList.size();
-        if (totalCount > 0) {
+        if (examStudentList.size() > 0) {
+            int totalCount = examStudentList.size();
             List<Map> subList = new ArrayList<>();
-            int pageCount = totalCount % 80 == 0 ? totalCount / 80 : totalCount / 80 + 1;
+            int pageCount = totalCount % 70 == 0 ? totalCount / 70 : totalCount / 70 + 1;
             for (int i = 0; i < pageCount; i++) {
                 Map subMap = new HashMap();
                 subMap.put("index", i + 1);
@@ -314,14 +314,14 @@ public class CreatePdfUtil {
                 if (pageCount == 1) {
                     studentCount = totalCount;
                     subStudents = examStudentList;
-                } else if (pageCount > 1 && i == pageCount - 1) {
-                    studentCount = totalCount - (pageCount - 1) * 80;
-                    subStudents = examStudentList.subList(80 * i, examStudentList.size());
+                } else if (i == pageCount - 1) {
+                    studentCount = totalCount - (pageCount - 1) * 70;
+                    subStudents = examStudentList.subList(70 * i, examStudentList.size());
                 } else {
-                    studentCount = 80;
-                    subStudents = examStudentList.subList(80 * i, 80 * (i + 1));
+                    studentCount = 70;
+                    subStudents = examStudentList.subList(70 * i, 70 * (i + 1));
                 }
-                subMap.put("studentCount", studentCount);
+                subMap.put("studentCount", totalCount);
                 List<ExamStudentDto> examStudentList1 = new ArrayList<>();
                 List<ExamStudentDto> examStudentList2 = new ArrayList<>();
 
@@ -356,6 +356,53 @@ public class CreatePdfUtil {
                 subList.add(subMap);
             }
             htmlMap.put("subList", subList);
+        } else {
+            int totalCount = examDetail.getPrintCount();
+            List<Map> subList = new ArrayList<>();
+            int pageCount = totalCount % 70 == 0 ? totalCount / 70 : totalCount / 70 + 1;
+            for (int i = 0; i < pageCount; i++) {
+                Map subMap = new HashMap();
+                subMap.put("index", i + 1);
+                int studentCount;
+                if (pageCount == 1) {
+                    studentCount = 70;
+                } else if (i == pageCount - 1) {
+                    studentCount = totalCount - (pageCount - 1) * 70;
+                } else {
+                    studentCount = 70;
+                }
+                subMap.put("studentCount", totalCount);
+                List<ExamStudentDto> examStudentList1 = new ArrayList<>();
+                List<ExamStudentDto> examStudentList2 = new ArrayList<>();
+
+                int mod = studentCount % 2;
+                int htmlTableCount = mod == 0 ? studentCount / 2 : studentCount / 2 + 1;
+                for (int j = 0; j < htmlTableCount; j++) {
+                    ExamStudentDto examStudentDto = new ExamStudentDto();
+                    examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName("");
+                    examStudentDto.setExtendColumn("");
+                    examStudentDto.setExtendFields("");
+                    examStudentList1.add(examStudentDto);
+                }
+                for (int j = htmlTableCount; j < studentCount; j++) {
+                    ExamStudentDto examStudentDto = new ExamStudentDto();
+                    examStudentDto.setIndex(j + 1);
+                    examStudentDto.setName("");
+                    examStudentDto.setExtendColumn("");
+                    examStudentDto.setExtendFields("");
+                    examStudentList2.add(examStudentDto);
+                }
+                if (examStudentList1.size() > examStudentList2.size()) {
+                    for (int j = studentCount - htmlTableCount; j < examStudentList1.size(); j++) {
+                        examStudentList2.add(new ExamStudentDto());
+                    }
+                }
+                subMap.put("studentList1", examStudentList1);
+                subMap.put("studentList2", examStudentList2);
+                subList.add(subMap);
+            }
+            htmlMap.put("subList", subList);
         }
         htmlMap.computeIfAbsent("basicAttachment", v -> basicAttachment);
         htmlMap.computeIfAbsent("variablePdfList", v -> variablePdfList);
@@ -778,13 +825,14 @@ public class CreatePdfUtil {
      *
      * @param studentContent     题卡html内容
      * @param examStudent        考生对象
+     * @param tempPaperType
      * @param examDetail         考场对象
      * @param examDetailCourse   考场课程对象
      * @param userId             当前用户ID
      * @param examStudentPdfList 考生题卡集合
      * @param basicCardRule      题卡规则
      */
-    public BasicAttachment examStudentHtml(String studentContent, ExamStudent examStudent, ExamDetail examDetail, ExamDetailCourse examDetailCourse, Long userId, List<PdfDto> examStudentPdfList, BasicCardRule basicCardRule) throws IOException {
+    public BasicAttachment examStudentHtml(String studentContent, ExamStudent examStudent, String paperType, ExamDetail examDetail, ExamDetailCourse examDetailCourse, Long userId, List<PdfDto> examStudentPdfList, BasicCardRule basicCardRule) throws IOException {
         String studentHtml = studentContent;
             /*if (Objects.nonNull(examStudent.getExtendFields())) {
                 JSONArray jsonObjectExtend = (JSONArray) JSONArray.parse(examStudent.getExtendFields());//扩展字段
@@ -801,9 +849,9 @@ public class CreatePdfUtil {
         studentHtml = studentHtml.replaceAll("\\$\\{examNumber\\}", examStudent != null && examStudent.getTicketNumber() != null ? GoogleBarCodeUtil.createBarCode(examStudent.getTicketNumber(), false) : "");
         studentHtml = studentHtml.replaceAll("\\$\\{examNumberStr\\}", examStudent != null && examStudent.getTicketNumber() != null ? examStudent.getTicketNumber() : "");
         // 随机生成学生试卷条码并将图片转成base64
-        studentHtml = studentHtml.replaceAll("\\$\\{paperType\\}", examStudent != null && examStudent.getPaperType() != null ? GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(examStudent.getPaperType()), false) : "");
+        studentHtml = studentHtml.replaceAll("\\$\\{paperType\\}", examStudent != null && examStudent.getPaperType() != null ? GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(examStudent.getPaperType()), false) : StringUtils.isNotBlank(paperType) ? GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(paperType), false) : "");
         // 替换考生卷型
-        studentHtml = studentHtml.replaceAll("\\$\\{paperTypeName\\}", examStudent != null && examStudent.getPaperType() != null ? examStudent.getPaperType() : "");
+        studentHtml = studentHtml.replaceAll("\\$\\{paperTypeName\\}", examStudent != null && examStudent.getPaperType() != null ? examStudent.getPaperType() : StringUtils.isNotBlank(paperType) ? paperType : "");
 
         // 根据题卡规则必选字段,替换相应值,没有则“”
         List<StudentExtendDto> studentExtendDtos = createExtendObject(examStudent, basicCardRule);
@@ -833,7 +881,7 @@ public class CreatePdfUtil {
 
         //学生题卡
         BasicAttachment examStudentAttachment = printCommonService.saveAttachmentHtml(examDetail.getSchoolId() + "|" + examDetailCourse.getCourseCode() + (examStudent != null && examStudent.getTicketNumber() != null ? "|" + examStudent.getTicketNumber() : ""), studentHtml, userId, examStudentPdfList);
-        if(examStudent != null) {
+        if (examStudent != null) {
             examStudent.setAttachmentId(examStudentAttachment.getId());
         }
         return examStudentAttachment;

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

@@ -19,6 +19,8 @@
     </sql>
     <select id="listByExamDetailId" resultType="java.util.Map">
         SELECT
+            ed.id examDetailId,
+            ed.school_id schoolId,
             a.id examDetailCourseId,
             a.course_code courseCode,
             a.course_name courseName,
@@ -27,9 +29,14 @@
             a.attachment_id cardAttachmentIds,
             b.id examTaskId,
             c.exposed_paper_type exposedPaperType,
-            c.unexposed_paper_type unexposedPaperType
+            c.unexposed_paper_type unexposedPaperType,
+            a.paper_type paperType,
+            ed.print_count printCount,
+            a.common_attachment_id commonAttachmentId
         FROM
-            exam_detail_course a
+            exam_detail ed
+                LEFT JOIN
+            exam_detail_course a ON ed.id = a.exam_detail_id
                 LEFT JOIN
             exam_task b ON a.school_id = b.school_id
                 AND a.course_code = b.course_code

+ 3 - 3
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -375,7 +375,7 @@
             </if>
         </where>
     </select>
-    <select id="listStudentByExamDetailId" resultType="java.util.Map">
+    <select id="listStudentByExamDetailCourseId" resultType="java.util.Map">
         SELECT
             b.course_code courseCode,
             b.course_name courseName,
@@ -386,9 +386,9 @@
             c.paper_type paperType
         FROM
             exam_detail a
-                JOIN
+               LEFT JOIN
             exam_detail_course b ON a.id = b.exam_detail_id
-                JOIN
+               LEFT JOIN
             exam_student c ON b.id = c.exam_detail_course_id
         WHERE
             a.id = #{examDetailId}