|
@@ -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;
|
|
|
}
|
|
|
|
|
|
/**
|