|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
+import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.util.ExcelUtil;
|
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
@@ -14,6 +15,7 @@ import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
@@ -52,6 +54,9 @@ public class ClientServiceImpl implements ClientService {
|
|
|
@Autowired
|
|
|
private ExamCardDetailService examCardDetailService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentService examStudentService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<ClientExamTaskDto> listTryTask(Long schoolId, String machineCode, Long orgId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize) {
|
|
|
return examTaskService.listTryTask(schoolId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, pageNumber, pageSize);
|
|
@@ -82,7 +87,7 @@ public class ClientServiceImpl implements ClientService {
|
|
|
public Map<String, Object> getReprintData(Long schoolId, Long examDetailId, String ticketNumber, String type) {
|
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
|
// 取试卷
|
|
|
- List<Map<String, String>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
+ List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
|
|
|
// 取考生
|
|
|
List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
|
|
@@ -125,9 +130,10 @@ public class ClientServiceImpl implements ClientService {
|
|
|
return pirntTaskDtoIPage;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
- public Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, String printUser) {
|
|
|
- List<Map<String, String>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
+ public Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, Boolean isPrint, String printUser) {
|
|
|
+ List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
|
// 2.取生成的完整的pdf
|
|
|
ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
@@ -193,15 +199,15 @@ public class ClientServiceImpl implements ClientService {
|
|
|
|
|
|
// 备用题卡
|
|
|
List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
|
|
|
- for (Map<String, String> examDetailCours : examDetailCourses) {
|
|
|
- String attachmentIds = examDetailCours.get("attachmentIds");
|
|
|
+ for (Map<String, Object> examDetailCours : examDetailCourses) {
|
|
|
+ String attachmentIds = examDetailCours.get("attachmentIds").toString();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
|
|
|
List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
|
|
|
for (Map backupCard : backupCards) {
|
|
|
ClientPrintBackupDataDto clientPrintBackupDataDto = new ClientPrintBackupDataDto();
|
|
|
- clientPrintBackupDataDto.setCourseCode(examDetailCours.get("courseCode"));
|
|
|
- clientPrintBackupDataDto.setCourseName(examDetailCours.get("courseName"));
|
|
|
- clientPrintBackupDataDto.setPaperNumber(examDetailCours.get("paperNumber"));
|
|
|
+ clientPrintBackupDataDto.setCourseCode(examDetailCours.get("courseCode").toString());
|
|
|
+ clientPrintBackupDataDto.setCourseName(examDetailCours.get("courseName").toString());
|
|
|
+ clientPrintBackupDataDto.setPaperNumber(examDetailCours.get("paperNumber").toString());
|
|
|
clientPrintBackupDataDto.setPaperType(backupCard.get("name").toString());
|
|
|
Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(backupCard.get("attachmentId").toString()), false);
|
|
|
clientPrintBackupDataDto.setMd5(urlMap.get("md5"));
|
|
@@ -242,6 +248,38 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
}
|
|
|
finalMap.put("other", otherList);
|
|
|
+
|
|
|
+ // 更新印刷中状态,更新曝光卷型、未曝光卷型
|
|
|
+ if (isPrint) {
|
|
|
+ // 更新exam_detail状态为印刷中
|
|
|
+ UpdateWrapper<ExamDetail> examDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ examDetailUpdateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.PRINTING).eq(ExamDetail::getId, examDetailId);
|
|
|
+ examDetailService.update(examDetailUpdateWrapper);
|
|
|
+
|
|
|
+ // 更新曝光卷型、未曝光卷型
|
|
|
+ for (Map<String, Object> examDetailCours : examDetailCourses) {
|
|
|
+ String examDetailCourseId = examDetailCours.get("examDetailCourseId").toString();
|
|
|
+ // 考生使用卷型
|
|
|
+ List<String> studentPaperTypes = examStudentService.listByExamDetailCourseId(examDetailCourseId);
|
|
|
+ Object exposedPaperType = examDetailCours.get("exposedPaperType");
|
|
|
+ Set<String> exposedPaperSet = Objects.isNull(exposedPaperType) ? new HashSet<>() : new HashSet<>(Arrays.asList(exposedPaperType.toString().split(",")));
|
|
|
+ Object unexposedPaperType = examDetailCours.get("unexposedPaperType").toString();
|
|
|
+ Set<String> unexposedPaperSet = Objects.isNull(unexposedPaperType) ? new HashSet<>() : new HashSet<>(Arrays.asList(unexposedPaperType.toString().split(",")));
|
|
|
+ if (!studentPaperTypes.isEmpty()) {
|
|
|
+ for (String studentPaperType : studentPaperTypes) {
|
|
|
+ exposedPaperSet.add(studentPaperType);
|
|
|
+ unexposedPaperSet.remove(studentPaperType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String examTaskId = examDetailCours.get("examTaskId").toString();
|
|
|
+ UpdateWrapper<ExamTaskDetail> examTaskDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ examTaskDetailUpdateWrapper.lambda()
|
|
|
+ .set(ExamTaskDetail::getExposedPaperType, String.join(",", exposedPaperSet))
|
|
|
+ .set(ExamTaskDetail::getUnexposedPaperType, String.join(",", unexposedPaperSet))
|
|
|
+ .eq(ExamTaskDetail::getExamTaskId, examTaskId);
|
|
|
+ examTaskDetailService.update(examTaskDetailUpdateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
return finalMap;
|
|
|
}
|
|
|
|
|
@@ -251,7 +289,7 @@ public class ClientServiceImpl implements ClientService {
|
|
|
List<ClientPrintTaskDto> pirntTaskDtoList = examPrintPlanService.listClientPrintTask(schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
|
|
|
List<Map<String, Object>> finalList = new ArrayList<>();
|
|
|
for (ClientPrintTaskDto clientPrintTaskDto : pirntTaskDtoList) {
|
|
|
- Map<String, Object> map = getPrintData(schoolId, Long.valueOf(clientPrintTaskDto.getExamDetailId()), null, null);
|
|
|
+ Map<String, Object> map = getPrintData(schoolId, Long.valueOf(clientPrintTaskDto.getExamDetailId()), null, false, null);
|
|
|
map.put("examDetailId", clientPrintTaskDto.getExamDetailId());
|
|
|
finalList.add(map);
|
|
|
}
|
|
@@ -387,12 +425,12 @@ public class ClientServiceImpl implements ClientService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Map<String, String>> mapCourseUrl(List<Map<String, String>> mapList) {
|
|
|
+ public Map<String, Map<String, String>> mapCourseUrl(List<Map<String, Object>> 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");
|
|
|
- String paperAttachmentIds = taskDetail.get("paperAttachmentIds");
|
|
|
+ for (Map<String, Object> taskDetail : mapList) {
|
|
|
+ String courseCode = taskDetail.get("courseCode").toString();
|
|
|
+ String paperNumber = taskDetail.get("paperNumber").toString();
|
|
|
+ String paperAttachmentIds = taskDetail.get("paperAttachmentIds").toString();
|
|
|
List<Map> attachementIds = JSONObject.parseArray(paperAttachmentIds, Map.class);
|
|
|
for (Map attaMap : attachementIds) {
|
|
|
String name = attaMap.get("name").toString();
|