|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
@@ -56,7 +57,7 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getUrl(Long schoolId, Long examTaskId) {
|
|
|
+ public Map<String, String> getUrl(Long schoolId, Long examTaskId) {
|
|
|
return examTaskDetailService.getUrl(schoolId, examTaskId);
|
|
|
}
|
|
|
|
|
@@ -81,18 +82,18 @@ public class ClientServiceImpl implements ClientService {
|
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
|
// 取试卷
|
|
|
List<Map<String, String>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
- Map<String, String> map = mapCourseUrl(examDetailCourses);
|
|
|
+ Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
|
|
|
// 取考生
|
|
|
- List<Map<String, String>> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
|
|
|
+ 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");
|
|
|
- String courseName = m.get("courseName");
|
|
|
- String paperNumber = m.get("paperNumber");
|
|
|
- String studentName = m.get("studentName");
|
|
|
- String studentCode = m.get("studentCode");
|
|
|
- String paperType = m.get("paperType");
|
|
|
+ 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);
|
|
@@ -101,26 +102,28 @@ public class ClientServiceImpl implements ClientService {
|
|
|
|
|
|
StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
String key = sj.add(courseCode).add(paperNumber).add(paperType).toString();
|
|
|
- printDataDto.setUrl(map.get(key));
|
|
|
+ printDataDto.setMd5(map.get(key).get("md5"));
|
|
|
+ printDataDto.setUrl(map.get(key).get("url"));
|
|
|
return printDataDto;
|
|
|
}).collect(Collectors.toList());
|
|
|
finalMap.put("paper", paperList);
|
|
|
// 生成题卡List
|
|
|
List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
|
|
|
ClientPrintDataDto printDataDto = new ClientPrintDataDto();
|
|
|
- String courseCode = m.get("courseCode");
|
|
|
- String courseName = m.get("courseName");
|
|
|
- String studentName = m.get("studentName");
|
|
|
- String studentCode = m.get("studentCode");
|
|
|
- String paperType = m.get("paperType");
|
|
|
- String attachmentId = m.get("attachmentId");
|
|
|
+ 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.filePreview(attachmentId, false);
|
|
|
- printDataDto.setUrl(urlMap.get("pathUrl"));
|
|
|
+ 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);
|
|
@@ -134,18 +137,20 @@ public class ClientServiceImpl implements ClientService {
|
|
|
for (Map variable : variableList) {
|
|
|
Map vMap = new HashMap();
|
|
|
vMap.put("type", variable.get("type"));
|
|
|
- Map<String, String> urlMap = commonService.filePreview(variable.get("attachmentId").toString(), false);
|
|
|
+ // todo
|
|
|
+ /*Map<String, String> urlMap = commonService.filePreview(variable.get("attachmentId").toString(), false);
|
|
|
vMap.put("htmlUrl", urlMap.get("htmlUrl"));
|
|
|
- vMap.put("pdfUrl", urlMap.get("pdfUrl"));
|
|
|
+ vMap.put("pdfUrl", urlMap.get("pdfUrl"));*/
|
|
|
otherList.add(vMap);
|
|
|
}
|
|
|
List<Map> ordinaryList = JSONObject.parseArray(ordinaryContent, Map.class);
|
|
|
for (Map ordinary : ordinaryList) {
|
|
|
Map vMap = new HashMap();
|
|
|
vMap.put("type", ordinary.get("type"));
|
|
|
- Map<String, String> urlMap = commonService.filePreview(ordinary.get("attachmentId").toString(), false);
|
|
|
+ // todo
|
|
|
+ /*Map<String, String> urlMap = commonService.filePreview(ordinary.get("attachmentId").toString(), false);
|
|
|
vMap.put("htmlUrl", urlMap.get("htmlUrl"));
|
|
|
- vMap.put("pdfUrl", urlMap.get("pdfUrl"));
|
|
|
+ vMap.put("pdfUrl", urlMap.get("pdfUrl"));*/
|
|
|
otherList.add(vMap);
|
|
|
}
|
|
|
finalMap.put("other", otherList);
|
|
@@ -175,9 +180,8 @@ public class ClientServiceImpl implements ClientService {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件记录异常");
|
|
|
}
|
|
|
|
|
|
- Map<String, String> attachMap = commonService.filePreview(examDetail.getAttachmentId().toString(), false);
|
|
|
- String totalPathUrl = attachMap.get("pathUrl");
|
|
|
- if (StringUtils.isNotBlank(totalPathUrl)) {
|
|
|
+ Map<String, String> totalPathUrl = commonService.filePreviewByAttachmentId(examDetail.getAttachmentId(), false);
|
|
|
+ if (StringUtils.isBlank(totalPathUrl.get("url"))) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件丢失");
|
|
|
}
|
|
|
|
|
@@ -186,18 +190,18 @@ public class ClientServiceImpl implements ClientService {
|
|
|
// 3.取学生试卷、题卡、备用试卷、题卡,印品
|
|
|
Map<String, Object> detailMap = new HashMap<>();
|
|
|
// 3.1取试卷
|
|
|
- Map<String, String> map = mapCourseUrl(examDetailCourses);
|
|
|
+ Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
|
|
|
// 3.2取考生
|
|
|
- List<Map<String, String>> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, "1", "1");
|
|
|
+ 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");
|
|
|
- String courseName = m.get("courseName");
|
|
|
- String paperNumber = m.get("paperNumber");
|
|
|
- String studentName = m.get("studentName");
|
|
|
- String studentCode = m.get("studentCode");
|
|
|
- String paperType = m.get("paperType");
|
|
|
+ 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);
|
|
@@ -206,26 +210,28 @@ public class ClientServiceImpl implements ClientService {
|
|
|
|
|
|
StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
String key = sj.add(courseCode).add(paperNumber).add(paperType).toString();
|
|
|
- printDataDto.setUrl(map.get(key));
|
|
|
+ printDataDto.setMd5(map.get(key).get("md5"));
|
|
|
+ printDataDto.setUrl(map.get(key).get("url"));
|
|
|
return printDataDto;
|
|
|
}).collect(Collectors.toList());
|
|
|
detailMap.put("paper", paperList);
|
|
|
// 3.4生成题卡List
|
|
|
List<ClientPrintDataDto> cardList = studentList.stream().map(m -> {
|
|
|
ClientPrintDataDto printDataDto = new ClientPrintDataDto();
|
|
|
- String courseCode = m.get("courseCode");
|
|
|
- String courseName = m.get("courseName");
|
|
|
- String studentName = m.get("studentName");
|
|
|
- String studentCode = m.get("studentCode");
|
|
|
- String paperType = m.get("paperType");
|
|
|
- String attachmentId = m.get("attachmentId");
|
|
|
+ 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.filePreview(attachmentId, false);
|
|
|
- printDataDto.setUrl(urlMap.get("pathUrl"));
|
|
|
+ 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);
|
|
@@ -237,10 +243,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
//试卷
|
|
|
List<Map<String, String>> keyMaps = studentList.stream().map(m -> {
|
|
|
Map<String, String> stringMap = new HashMap<>();
|
|
|
- stringMap.put("courseCode", m.get("courseCode"));
|
|
|
- stringMap.put("courseName", m.get("courseName"));
|
|
|
- stringMap.put("paperNumber", m.get("paperNumber"));
|
|
|
- stringMap.put("paperType", m.get("paperType"));
|
|
|
+ stringMap.put("courseCode", m.get("courseCode").toString());
|
|
|
+ stringMap.put("courseName", m.get("courseName").toString());
|
|
|
+ stringMap.put("paperNumber", m.get("paperNumber").toString());
|
|
|
+ stringMap.put("paperType", m.get("paperType").toString());
|
|
|
return stringMap;
|
|
|
}).distinct().collect(Collectors.toList());
|
|
|
List<ClientPrintBackupDataDto> paperBackupList = new ArrayList<>();
|
|
@@ -253,7 +259,8 @@ public class ClientServiceImpl implements ClientService {
|
|
|
clientPrintBackupDataDto.setPaperType(keyMap.get("paperType"));
|
|
|
StringJoiner sj = new StringJoiner(SystemConstant.DELIMITER);
|
|
|
String key = sj.add(keyMap.get("courseCode")).add(keyMap.get("paperNumber")).add(keyMap.get("paperType")).toString();
|
|
|
- clientPrintBackupDataDto.setUrl(map.get(key));
|
|
|
+ clientPrintBackupDataDto.setMd5(map.get(key).get("md5"));
|
|
|
+ clientPrintBackupDataDto.setUrl(map.get(key).get("url"));
|
|
|
paperBackupList.add(clientPrintBackupDataDto);
|
|
|
}
|
|
|
}
|
|
@@ -268,16 +275,19 @@ public class ClientServiceImpl implements ClientService {
|
|
|
List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
|
|
|
for (Map backupCard : backupCards) {
|
|
|
ClientPrintBackupDataDto clientPrintBackupDataDto = new ClientPrintBackupDataDto();
|
|
|
- clientPrintBackupDataDto.setCourseCode(backupCard.get("courseCode").toString());
|
|
|
- clientPrintBackupDataDto.setCourseName(backupCard.get("courseName").toString());
|
|
|
- clientPrintBackupDataDto.setPaperNumber(backupCard.get("paperNumber").toString());
|
|
|
+ clientPrintBackupDataDto.setCourseCode(examDetailCours.get("courseCode"));
|
|
|
+ clientPrintBackupDataDto.setCourseName(examDetailCours.get("courseName"));
|
|
|
+ clientPrintBackupDataDto.setPaperNumber(examDetailCours.get("paperNumber"));
|
|
|
clientPrintBackupDataDto.setPaperType(backupCard.get("name").toString());
|
|
|
- Map<String, String> urlMap = commonService.filePreview(backupCard.get("attachmentId").toString(), false);
|
|
|
- clientPrintBackupDataDto.setUrl(urlMap.get("pathUrl"));
|
|
|
+ Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(backupCard.get("attachmentId").toString()), false);
|
|
|
+ clientPrintBackupDataDto.setMd5(urlMap.get("md5"));
|
|
|
+ clientPrintBackupDataDto.setUrl(urlMap.get("url"));
|
|
|
cardBackupList.add(clientPrintBackupDataDto);
|
|
|
}
|
|
|
}
|
|
|
backupMap.put("card", cardBackupList);
|
|
|
+ detailMap.put("backup", backupMap);
|
|
|
+ finalMap.put("detail", detailMap);
|
|
|
|
|
|
//3.5
|
|
|
String variableContent = examPrintPlan.getVariableContent();
|
|
@@ -289,9 +299,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
Map vMap = new HashMap();
|
|
|
vMap.put("type", variable.get("type"));
|
|
|
- Map<String, String> urlMap = commonService.filePreview(variable.get("attachmentId").toString(), false);
|
|
|
+ // todo
|
|
|
+ /*Map<String, String> urlMap = commonService.filePreview(variable.get("attachmentId").toString(), false);
|
|
|
vMap.put("htmlUrl", urlMap.get("htmlUrl"));
|
|
|
- vMap.put("pdfUrl", urlMap.get("pdfUrl"));
|
|
|
+ vMap.put("pdfUrl", urlMap.get("pdfUrl"));*/
|
|
|
otherList.add(vMap);
|
|
|
}
|
|
|
}
|
|
@@ -301,9 +312,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
Map vMap = new HashMap();
|
|
|
vMap.put("type", ordinary.get("type"));
|
|
|
- Map<String, String> urlMap = commonService.filePreview(ordinary.get("attachmentId").toString(), false);
|
|
|
+ // todo
|
|
|
+ /*Map<String, String> urlMap = commonService.filePreview(ordinary.get("attachmentId").toString(), false);
|
|
|
vMap.put("htmlUrl", urlMap.get("htmlUrl"));
|
|
|
- vMap.put("pdfUrl", urlMap.get("pdfUrl"));
|
|
|
+ vMap.put("pdfUrl", urlMap.get("pdfUrl"));*/
|
|
|
otherList.add(vMap);
|
|
|
}
|
|
|
|
|
@@ -326,10 +338,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getUrlByExamDetailId(Long schoolId, Long examDetailId) {
|
|
|
+ public Map<String, String> getUrlByExamDetailId(Long schoolId, Long examDetailId) {
|
|
|
ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
BasicAttachment attachment = basicAttachmentService.getById(examDetail.getAttachmentId());
|
|
|
- return attachment == null ? null : commonService.filePreview(attachment.getPath());
|
|
|
+ return attachment == null ? null : commonService.filePreviewByAttachmentId(attachment.getId(), false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -416,10 +428,14 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
|
|
|
String lastCodeSub = lastCode.substring(0, lastCode.length() - 2);
|
|
|
- if (packageCode.equals(lastCodeSub)) {
|
|
|
+ if (!packageCode.equals(lastCodeSub)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与试卷编号不一致");
|
|
|
}
|
|
|
- return true;
|
|
|
+
|
|
|
+ UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(ExamDetail::getValidate, true).eq(ExamDetail::getId, examDetailId);
|
|
|
+
|
|
|
+ return examDetailService.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -431,8 +447,8 @@ public class ClientServiceImpl implements ClientService {
|
|
|
map.put("courseCode", clientExamTaskDto.getCourseCode());
|
|
|
map.put("courseName", clientExamTaskDto.getCourseName());
|
|
|
map.put("paperNumber", clientExamTaskDto.getPaperNumber());
|
|
|
- String url = examTaskDetailService.getUrl(schoolId, Long.valueOf(clientExamTaskDto.getExamTaskId()));
|
|
|
- map.put("url", url);
|
|
|
+ Map<String, String> stringMap = examTaskDetailService.getUrl(schoolId, Long.valueOf(clientExamTaskDto.getExamTaskId()));
|
|
|
+ map.putAll(stringMap);
|
|
|
list.add(map);
|
|
|
}
|
|
|
return list;
|
|
@@ -451,8 +467,8 @@ public class ClientServiceImpl implements ClientService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, String> mapCourseUrl(List<Map<String, String>> mapList) {
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
+ public Map<String, Map<String, String>> mapCourseUrl(List<Map<String, String>> mapList) {
|
|
|
+ Map<String, Map<String, String>> map = new HashMap<>();
|
|
|
for (Map<String, String> taskDetail : mapList) {
|
|
|
String courseCode = taskDetail.get("courseCode");
|
|
|
String paperNumber = taskDetail.get("paperNumber");
|
|
@@ -462,10 +478,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
String name = attaMap.get("name").toString();
|
|
|
String attachmentId = attaMap.get("attachmentId").toString();
|
|
|
BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
|
|
|
- String url = commonService.filePreview(attachment.getPath());
|
|
|
+ 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();
|
|
|
- map.put(key, url);
|
|
|
+ map.put(key, stringMap);
|
|
|
}
|
|
|
}
|
|
|
return map;
|