|
@@ -58,7 +58,7 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, String> getUrl(Long schoolId, Long examTaskId) {
|
|
|
+ public Map<String, String> getUrl(Long schoolId, Long examTaskId) {
|
|
|
return examTaskDetailService.getUrl(schoolId, examTaskId);
|
|
|
}
|
|
|
|
|
@@ -87,47 +87,9 @@ public class ClientServiceImpl implements ClientService {
|
|
|
// 取考生
|
|
|
List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
|
|
|
// 生成试卷List
|
|
|
- List<ClientPrintDataDto> paperList = studentList.stream().map(m -> {
|
|
|
- ClientPrintDataDto printDataDto = new ClientPrintDataDto();
|
|
|
- String courseCode = m.get("courseCode").toString();
|
|
|
- String courseName = m.get("courseName").toString();
|
|
|
- String paperNumber = m.get("paperNumber").toString();
|
|
|
- String studentName = m.get("studentName").toString();
|
|
|
- String studentCode = m.get("studentCode").toString();
|
|
|
- String paperType = m.get("paperType").toString();
|
|
|
- printDataDto.setCourseCode(courseCode);
|
|
|
- printDataDto.setCourseName(courseName);
|
|
|
- printDataDto.setStudentName(studentName);
|
|
|
- printDataDto.setStudentCode(studentCode);
|
|
|
- printDataDto.setPaperType(paperType);
|
|
|
-
|
|
|
- StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
- String key = sj.add(courseCode).add(paperNumber).add(paperType).toString();
|
|
|
- printDataDto.setMd5(map.get(key).get("md5"));
|
|
|
- printDataDto.setUrl(map.get(key).get("url"));
|
|
|
- return printDataDto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- finalMap.put("paper", paperList);
|
|
|
+ finalMap.put("paper", splicePaperContent(studentList, map));
|
|
|
// 生成题卡List
|
|
|
- List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
|
|
|
- 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 paperType = m.get("paperType").toString();
|
|
|
- String attachmentId = m.get("attachmentId").toString();
|
|
|
- printDataDto.setCourseCode(courseCode);
|
|
|
- printDataDto.setCourseName(courseName);
|
|
|
- printDataDto.setStudentName(studentName);
|
|
|
- printDataDto.setStudentCode(studentCode);
|
|
|
- printDataDto.setPaperType(paperType);
|
|
|
- Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false);
|
|
|
- printDataDto.setMd5(urlMap.get("md5"));
|
|
|
- printDataDto.setUrl(urlMap.get("url"));
|
|
|
- return printDataDto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- finalMap.put("card", cardList);
|
|
|
+ finalMap.put("card", spliceCardContent(studentList));
|
|
|
//
|
|
|
ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetail.getPrintPlanId());
|
|
@@ -141,35 +103,13 @@ public class ClientServiceImpl implements ClientService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(attachmentPath);
|
|
|
String pathString = jsonObject.getString("path");
|
|
|
List<Map> pathList = JSONObject.parseArray(pathString, Map.class);
|
|
|
- if(!pathList.isEmpty()) {
|
|
|
- for (Map variable : variableList) {
|
|
|
- Map vMap = new HashMap();
|
|
|
- vMap.put("type", variable.get("type"));
|
|
|
- for (Map path : pathList) {
|
|
|
- String printType = path.get("printType").toString();
|
|
|
- if(printType.equals(variable.get("type").toString())){
|
|
|
- vMap.put("htmlUrl", commonService.filePreviewByPathAndType(path.get("htmlPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("htmlMd5", path.get("htmlMd5"));
|
|
|
- vMap.put("pdfUrl", commonService.filePreviewByPathAndType(path.get("pdfPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
- }
|
|
|
- }
|
|
|
- otherList.add(vMap);
|
|
|
+ if (!pathList.isEmpty()) {
|
|
|
+ for (Map contentMap : variableList) {
|
|
|
+ spliceOtherContent(otherList, pathList, contentMap);
|
|
|
}
|
|
|
List<Map> ordinaryList = JSONObject.parseArray(ordinaryContent, Map.class);
|
|
|
- for (Map ordinary : ordinaryList) {
|
|
|
- Map vMap = new HashMap();
|
|
|
- vMap.put("type", ordinary.get("type"));
|
|
|
- for (Map path : pathList) {
|
|
|
- String printType = path.get("printType").toString();
|
|
|
- if(printType.equals(ordinary.get("type").toString())){
|
|
|
- vMap.put("htmlUrl", commonService.filePreviewByPathAndType(path.get("htmlPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("htmlMd5", path.get("htmlMd5"));
|
|
|
- vMap.put("pdfUrl", commonService.filePreviewByPathAndType(path.get("pdfPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
- }
|
|
|
- }
|
|
|
- otherList.add(vMap);
|
|
|
+ for (Map contentMap : ordinaryList) {
|
|
|
+ spliceOtherContent(otherList, pathList, contentMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -214,47 +154,11 @@ public class ClientServiceImpl implements ClientService {
|
|
|
// 3.2取考生
|
|
|
List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, "1", "1");
|
|
|
// 3.3生成试卷List
|
|
|
- List<ClientPrintDataDto> paperList = studentList.stream().map(m -> {
|
|
|
- ClientPrintDataDto printDataDto = new ClientPrintDataDto();
|
|
|
- String courseCode = m.get("courseCode").toString();
|
|
|
- String courseName = m.get("courseName").toString();
|
|
|
- String paperNumber = m.get("paperNumber").toString();
|
|
|
- String studentName = m.get("studentName").toString();
|
|
|
- String studentCode = m.get("studentCode").toString();
|
|
|
- String paperType = m.get("paperType").toString();
|
|
|
- printDataDto.setCourseCode(courseCode);
|
|
|
- printDataDto.setCourseName(courseName);
|
|
|
- printDataDto.setStudentName(studentName);
|
|
|
- printDataDto.setStudentCode(studentCode);
|
|
|
- printDataDto.setPaperType(paperType);
|
|
|
|
|
|
- StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
- String key = sj.add(courseCode).add(paperNumber).add(paperType).toString();
|
|
|
- printDataDto.setMd5(map.get(key).get("md5"));
|
|
|
- printDataDto.setUrl(map.get(key).get("url"));
|
|
|
- return printDataDto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- detailMap.put("paper", paperList);
|
|
|
+ detailMap.put("paper", splicePaperContent(studentList, map));
|
|
|
// 3.4生成题卡List
|
|
|
- List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
|
|
|
- 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 paperType = m.get("paperType").toString();
|
|
|
- String attachmentId = m.get("attachmentId").toString();
|
|
|
- printDataDto.setCourseCode(courseCode);
|
|
|
- printDataDto.setCourseName(courseName);
|
|
|
- printDataDto.setStudentName(studentName);
|
|
|
- printDataDto.setStudentCode(studentCode);
|
|
|
- printDataDto.setPaperType(paperType);
|
|
|
- Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false);
|
|
|
- printDataDto.setMd5(urlMap.get("md5"));
|
|
|
- printDataDto.setUrl(urlMap.get("url"));
|
|
|
- return printDataDto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- detailMap.put("card", cardList);
|
|
|
+
|
|
|
+ detailMap.put("card", spliceCardContent(studentList));
|
|
|
|
|
|
//3.4备用试卷、题卡
|
|
|
ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetail.getPrintPlanId());
|
|
@@ -320,40 +224,18 @@ public class ClientServiceImpl implements ClientService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(attachmentPath);
|
|
|
String pathString = jsonObject.getString("path");
|
|
|
List<Map> pathList = JSONObject.parseArray(pathString, Map.class);
|
|
|
- if(!pathList.isEmpty()) {
|
|
|
- for (Map variable : variableList) {
|
|
|
- int count = Integer.parseInt(variable.get("backupCount").toString());
|
|
|
+ if (!pathList.isEmpty()) {
|
|
|
+ for (Map contentMap : variableList) {
|
|
|
+ int count = Integer.parseInt(contentMap.get("backupCount").toString());
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
- Map vMap = new HashMap();
|
|
|
- vMap.put("type", variable.get("type"));
|
|
|
- for (Map path : pathList) {
|
|
|
- String printType = path.get("printType").toString();
|
|
|
- if(printType.equals(variable.get("type").toString())){
|
|
|
- vMap.put("htmlUrl", commonService.filePreviewByPathAndType(path.get("htmlPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("htmlMd5", path.get("htmlMd5"));
|
|
|
- vMap.put("pdfUrl", commonService.filePreviewByPathAndType(path.get("pdfPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
- }
|
|
|
- }
|
|
|
- otherList.add(vMap);
|
|
|
+ spliceOtherContent(otherList, pathList, contentMap);
|
|
|
}
|
|
|
}
|
|
|
List<Map> ordinaryList = JSONObject.parseArray(ordinaryContent, Map.class);
|
|
|
- for (Map ordinary : ordinaryList) {
|
|
|
- int count = Integer.parseInt(ordinary.get("backupCount").toString());
|
|
|
+ for (Map contentMap : ordinaryList) {
|
|
|
+ int count = Integer.parseInt(contentMap.get("backupCount").toString());
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
- Map vMap = new HashMap();
|
|
|
- vMap.put("type", ordinary.get("type"));
|
|
|
- for (Map path : pathList) {
|
|
|
- String printType = path.get("printType").toString();
|
|
|
- if(printType.equals(ordinary.get("type").toString())){
|
|
|
- vMap.put("htmlUrl", commonService.filePreviewByPathAndType(path.get("htmlPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("htmlMd5", path.get("htmlMd5"));
|
|
|
- vMap.put("pdfUrl", commonService.filePreviewByPathAndType(path.get("pdfPath").toString(), path.get("type").toString(), false));
|
|
|
- vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
- }
|
|
|
- }
|
|
|
- otherList.add(vMap);
|
|
|
+ spliceOtherContent(otherList, pathList, contentMap);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -515,7 +397,6 @@ public class ClientServiceImpl implements ClientService {
|
|
|
for (Map attaMap : attachementIds) {
|
|
|
String name = attaMap.get("name").toString();
|
|
|
String attachmentId = attaMap.get("attachmentId").toString();
|
|
|
- BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
|
|
|
Map<String, String> stringMap = commonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false);
|
|
|
StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
String key = sj.add(courseCode).add(paperNumber).add(name).toString();
|
|
@@ -524,4 +405,84 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成印品url公共方法
|
|
|
+ *
|
|
|
+ * @param otherList
|
|
|
+ * @param pathList
|
|
|
+ * @param contentMap
|
|
|
+ */
|
|
|
+ private void spliceOtherContent(List<Map> otherList, List<Map> pathList, Map contentMap) {
|
|
|
+ Map vMap = new HashMap();
|
|
|
+ vMap.put("type", contentMap.get("type"));
|
|
|
+ for (Map path : pathList) {
|
|
|
+ String printType = path.get("printType").toString();
|
|
|
+ if (printType.equals(contentMap.get("type").toString())) {
|
|
|
+ vMap.put("htmlUrl", commonService.filePreviewByPathAndType(path.get("htmlPath").toString(), path.get("type").toString(), false));
|
|
|
+ vMap.put("htmlMd5", path.get("htmlMd5"));
|
|
|
+ vMap.put("pdfUrl", commonService.filePreviewByPathAndType(path.get("pdfPath").toString(), path.get("type").toString(), false));
|
|
|
+ vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ otherList.add(vMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成试卷url公共方法
|
|
|
+ *
|
|
|
+ * @param studentList
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ 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;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return paperList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成题卡url公共方法
|
|
|
+ *
|
|
|
+ * @param studentList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<ClientPrintDataDto> spliceCardContent(List<Map> studentList) {
|
|
|
+ List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
|
|
|
+ ClientPrintDataDto printDataDto = newClientPrintDataDto(m);
|
|
|
+ Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(m.get("attachmentId").toString()), false);
|
|
|
+ printDataDto.setMd5(urlMap.get("md5"));
|
|
|
+ printDataDto.setUrl(urlMap.get("url"));
|
|
|
+ return printDataDto;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return cardList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * new ClientPrintDataDto
|
|
|
+ *
|
|
|
+ * @param m
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ClientPrintDataDto newClientPrintDataDto(Map m) {
|
|
|
+ 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 paperType = m.get("paperType").toString();
|
|
|
+ printDataDto.setCourseCode(courseCode);
|
|
|
+ printDataDto.setCourseName(courseName);
|
|
|
+ printDataDto.setStudentName(studentName);
|
|
|
+ printDataDto.setStudentCode(studentCode);
|
|
|
+ printDataDto.setPaperType(paperType);
|
|
|
+ return printDataDto;
|
|
|
+ }
|
|
|
}
|