Explorar el Código

3.0.0-bug修改

xiaof hace 3 años
padre
commit
ff247e9c27

+ 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> listStudentByExamDetailCourseId(@Param("schoolId") Long schoolId, @Param("examDetailId") Long examDetailId, @Param("ticketNumber") String ticketNumber, @Param("type") String type);
+    List<Map> listStudentByExamDetailCourseId(@Param("schoolId") Long schoolId, @Param("examDetailCourseId") Long examDetailCourseId, @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> listStudentByExamDetailCourseId(Long schoolId, Long examDetailId, String ticketNumber, String type);
+    List<Map> listStudentByExamDetailCourseId(Long schoolId, Long examDetailCourseId, String ticketNumber, String type);
 
     List<ExamDetail> listByCourseCodeAndPaperNumberAndPaperTypeIsNull(Long schoolId, String courseCode, String paperNumber);
 

+ 23 - 21
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -650,10 +650,11 @@ public class ClientServiceImpl implements ClientService {
      * @param map
      */
     private List<ClientPrintDataDto> splicePaperContent(List<Map<String, Object>> examDetailCourses, Map<String, Map<String, String>> map) {
-        return examDetailCourses.stream().map(m -> {
+        List<ClientPrintDataDto> clientPrintDataDtos = new ArrayList<>();
+        for (Map<String, Object> examDetailCours : examDetailCourses) {
             // 取考生列表
-            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());
+            List<Map> studentList = examDetailService.listStudentByExamDetailCourseId(Long.valueOf(examDetailCours.get("schoolId").toString()), Long.valueOf(examDetailCours.get("examDetailCourseId").toString()), null, null);
+            Integer printCount = Integer.parseInt(examDetailCours.get("printCount").toString());
             if (studentList != null && studentList.size() > 0) {
                 for (Map studentMap : studentList) {
                     ClientPrintDataDto printDataDto = newClientPrintDataDto(studentMap);
@@ -661,20 +662,20 @@ public class ClientServiceImpl implements ClientService {
                     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;
+                    clientPrintDataDtos.add(printDataDto);
                 }
-            } else if (printCount != null && printCount > 0) {
+            } else if (printCount > 0) {
                 for (int i = 0; i < printCount; i++) {
-                    ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(examDetailCours);
                     StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
-                    String key = sj.add(printDataDto.getCourseCode()).add(m.get("paperNumber").toString()).add(printDataDto.getPaperType()).toString();
+                    String key = sj.add(printDataDto.getCourseCode()).add(examDetailCours.get("paperNumber").toString()).add(printDataDto.getPaperType()).toString();
                     printDataDto.setMd5(map.get(key).get("md5"));
                     printDataDto.setUrl(map.get(key).get("url"));
-                    return printDataDto;
+                    clientPrintDataDtos.add(printDataDto);
                 }
             }
-            return null;
-        }).collect(Collectors.toList());
+        }
+        return clientPrintDataDtos;
     }
 
     /**
@@ -683,36 +684,37 @@ public class ClientServiceImpl implements ClientService {
      * @param examDetailCourses
      */
     private List<ClientPrintDataDto> spliceCardContent(List<Map<String, Object>> examDetailCourses) {
-        return examDetailCourses.stream().map(m -> {
+        List<ClientPrintDataDto> clientPrintDataDtos = new ArrayList<>();
+        for (Map<String, Object> examDetailCours : examDetailCourses) {
             // 取考生列表
-            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());
+            List<Map> studentList = examDetailService.listStudentByExamDetailCourseId(Long.valueOf(examDetailCours.get("schoolId").toString()), Long.valueOf(examDetailCours.get("examDetailCourseId").toString()), null, null);
+            Integer printCount = Integer.parseInt(examDetailCours.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;
+                    clientPrintDataDtos.add(printDataDto);
                 }
-            } else if (printCount > 0) {
+            } else if (printCount != null && 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());
+                List<JSONObject> commonAttachmentIds = JSONObject.parseArray(examDetailCours.get("commonAttachmentId").toString(), JSONObject.class);
+                List<String> paperTypes = Arrays.stream(examDetailCours.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);
+                    ClientPrintDataDto printDataDto = newClientPrintDataDto(examDetailCours);
                     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;
+                    clientPrintDataDtos.add(printDataDto);
                 }
             }
-            return null;
-        }).collect(Collectors.toList());
+        }
+        return clientPrintDataDtos;
     }
 
     /**

+ 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> listStudentByExamDetailCourseId(Long schoolId, Long examDetailId, String ticketNumber, String type) {
-        return this.baseMapper.listStudentByExamDetailCourseId(schoolId, examDetailId, ticketNumber, type);
+    public List<Map> listStudentByExamDetailCourseId(Long schoolId, Long examDetailCourseId, String ticketNumber, String type) {
+        return this.baseMapper.listStudentByExamDetailCourseId(schoolId, examDetailCourseId, ticketNumber, type);
     }
 
     @Override

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

@@ -31,7 +31,7 @@
             c.exposed_paper_type exposedPaperType,
             c.unexposed_paper_type unexposedPaperType,
             a.paper_type paperType,
-            ed.print_count printCount,
+            ifnull(ed.print_count,0) printCount,
             a.common_attachment_id commonAttachmentId
         FROM
             exam_detail ed

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

@@ -391,7 +391,7 @@
                LEFT JOIN
             exam_student c ON b.id = c.exam_detail_course_id
         WHERE
-            a.id = #{examDetailId}
+            b.id = #{examDetailCourseId}
         <if test="type == 'ONE'">
             and c.ticket_number = #{ticketNumber}
         </if>