xiaof hace 3 años
padre
commit
077dcdd89c

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

@@ -13,7 +13,7 @@ import java.util.Map;
 public interface ClientService {
     IPage<ClientExamTaskDto> listTryTask(String machineCode, Long orgId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize);
 
-    Map<String, String> getUrl(Long printPlanId, Long examTaskId);
+    List<Map<String, String>> getUrl(Long printPlanId, Long examTaskId);
 
     Boolean tagPass(Long printPlanId, String courseCode, String courseName, String paperNumber, String machineCode, Boolean isPass, Long userId);
 

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

@@ -35,7 +35,7 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
 
     List<ExamTaskDetail> listByTemplateId(Long templateId);
 
-    Map<String, String>  getUrl(Long schoolId, Long printPlanId, Long examTaskId);
+    List<Map<String, String>>  getUrl(Long schoolId, Long printPlanId, Long examTaskId);
 
     boolean paperUpdate(ExamTaskDetail examTaskDetail);
 

+ 6 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -76,7 +76,7 @@ public class ClientServiceImpl implements ClientService {
     }
 
     @Override
-    public Map<String, String> getUrl(Long printPlanId, Long examTaskId) {
+    public List<Map<String, String>> getUrl(Long printPlanId, Long examTaskId) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         return examTaskDetailService.getUrl(schoolId, printPlanId, examTaskId);
     }
@@ -526,9 +526,11 @@ public class ClientServiceImpl implements ClientService {
             map.put("courseCode", clientExamTaskDto.getCourseCode());
             map.put("courseName", clientExamTaskDto.getCourseName());
             map.put("paperNumber", clientExamTaskDto.getPaperNumber());
-            Map<String, String> stringMap = examTaskDetailService.getUrl(schoolId, Long.valueOf(clientExamTaskDto.getPrintPlanId()), Long.valueOf(clientExamTaskDto.getExamTaskId()));
-            map.putAll(stringMap);
-            list.add(map);
+            List<Map<String, String>> mapList = examTaskDetailService.getUrl(schoolId, Long.valueOf(clientExamTaskDto.getPrintPlanId()), Long.valueOf(clientExamTaskDto.getExamTaskId()));
+            for (Map<String, String> stringMap : mapList) {
+                stringMap.putAll(map);
+                list.add(stringMap);
+            }
         }
         return list;
     }

+ 25 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -10,7 +10,6 @@ import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
-import com.qmth.distributed.print.business.enums.ExamStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.mapper.ExamTaskDetailMapper;
 import com.qmth.distributed.print.business.service.*;
@@ -290,31 +289,37 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
     }
 
     @Override
-    public Map<String, String> getUrl(Long schoolId, Long printPlanId, Long examTaskId) {
+    public List<Map<String, String>> getUrl(Long schoolId, Long printPlanId, Long examTaskId) {
         ExamTask examTask = examTaskService.getById(examTaskId);
         List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByPrintPlanIdAndCourseCodeAndPaperNumber(schoolId, printPlanId, examTask.getCourseCode(), examTask.getPaperNumber());
         if (!CollectionUtils.isEmpty(examDetailCourses)) {
-            ExamDetailCourse examDetailCourse = examDetailCourses.get(0);
-            QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
-            examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
-            ExamTaskDetail examTaskDetail = this.getOne(examTaskDetailQueryWrapper);
-            if (examTaskDetail != null) {
-                String relatePaperType = examTaskDetail.getRelatePaperType();
-                if (StringUtils.isNotBlank(relatePaperType)) {
-                    String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
-                    List<Map> list = JSONObject.parseArray(paperAttachmentIds, Map.class);
-                    String attachmentId = null;
-                    for (Map map : list) {
-                        String name = map.get("name").toString();
-                        if (name.equals(examDetailCourse.getPaperType())) {
-                            attachmentId = map.get("attachmentId").toString();
+            List<Map<String, String>> paperList = new ArrayList<>();
+            for (ExamDetailCourse examDetailCourse : examDetailCourses) {
+                QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
+                examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
+                ExamTaskDetail examTaskDetail = this.getOne(examTaskDetailQueryWrapper);
+                if (examTaskDetail != null) {
+                    String relatePaperType = examDetailCourse.getPaperType();
+                    if (StringUtils.isNotBlank(relatePaperType)) {
+                        String[] paperTypes = relatePaperType.split(",");
+                        String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+                        List<Map> list = JSONObject.parseArray(paperAttachmentIds, Map.class);
+                        String attachmentId;
+                        for (Map map : list) {
+                            String name = map.get("name").toString();
+                            for (String paperType : paperTypes) {
+                                if (name.equals(paperType)) {
+                                    attachmentId = map.get("attachmentId").toString();
+                                    if (StringUtils.isNotBlank(attachmentId)) {
+                                        paperList.add(teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false));
+                                    }
+                                }
+                            }
                         }
                     }
-                    if (StringUtils.isNotBlank(attachmentId)) {
-                        return teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false);
-                    }
                 }
             }
+            return paperList;
         }
         return null;
     }
@@ -347,7 +352,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
 
         ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
         List<ExamDetail> examDetails = examDetailService.listByCourseCodeAndPaperNumber(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber());
-        if(!CollectionUtils.isEmpty(examDetails)) {
+        if (!CollectionUtils.isEmpty(examDetails)) {
             List<ExamDetail> examDetailList = examDetails.stream().filter(m -> m.getStatus().equals(ExamDetailStatusEnum.WAITING)).collect(Collectors.toList());
             for (ExamDetail examDetail : examDetailList) {
                 examDetail.setStatus(ExamDetailStatusEnum.NEW);

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

@@ -353,8 +353,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             for (ExamStudent t : examStudentList) {
                                 basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
                             }
-                            // 试卷
-                            list[2].addAll(paperPdfTempList);
                             // 题卡
                             list[3].addAll(examStudentTempPdfList);
                             jsonObject.put("card", jsonArray);

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

@@ -124,8 +124,8 @@ public class ClientController {
     @RequestMapping(value = "/paper_try/print", method = RequestMethod.POST)
     public Result paperTryPrint(@RequestParam("printPlanId") Long printPlanId,
                                 @RequestParam("examTaskId") Long examTaskId) {
-        Map<String, String> map = clientService.getUrl(printPlanId, examTaskId);
-        return ResultUtil.ok(map);
+        List<Map<String, String>> list = clientService.getUrl(printPlanId, examTaskId);
+        return ResultUtil.ok(list);
     }
 
     /**