|
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-import com.google.gson.JsonObject;
|
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.service.*;
|
|
import com.qmth.distributed.print.business.service.*;
|
|
@@ -47,6 +46,9 @@ public class ClientServiceImpl implements ClientService {
|
|
@Autowired
|
|
@Autowired
|
|
private ExamPrintPlanService examPrintPlanService;
|
|
private ExamPrintPlanService examPrintPlanService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamCardDetailService examCardDetailService;
|
|
|
|
+
|
|
@Override
|
|
@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) {
|
|
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);
|
|
return examTaskService.listTryTask(schoolId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, pageNumber, pageSize);
|
|
@@ -58,8 +60,8 @@ public class ClientServiceImpl implements ClientService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Boolean tagPass(Long schoolId, Long examTaskId, String machineCode, Boolean isPass, Long userId) {
|
|
|
|
- return clientStatusService.tagPass(schoolId, examTaskId, machineCode, isPass, userId);
|
|
|
|
|
|
+ public Boolean tagPass(Long schoolId, String courseCode, String courseName, String paperNumber, String machineCode, Boolean isPass, Long userId) {
|
|
|
|
+ return clientStatusService.tagPass(schoolId, courseCode, courseName, paperNumber, machineCode, isPass, userId);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -153,7 +155,7 @@ public class ClientServiceImpl implements ClientService {
|
|
public IPage<ClientPrintTaskDto> listClientPrintTask(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize) {
|
|
public IPage<ClientPrintTaskDto> listClientPrintTask(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize) {
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
Page<ClientPrintTaskDto> page = new Page<>(pageNumber, pageSize);
|
|
Page<ClientPrintTaskDto> page = new Page<>(pageNumber, pageSize);
|
|
- IPage<ClientPrintTaskDto> pirntTaskDtoIPage = examPrintPlanService.listClientPrintTask(page, schoolId,machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime,isDownload,validate, orgIds);
|
|
|
|
|
|
+ IPage<ClientPrintTaskDto> pirntTaskDtoIPage = examPrintPlanService.listClientPrintTask(page, schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
|
|
return pirntTaskDtoIPage;
|
|
return pirntTaskDtoIPage;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -163,18 +165,18 @@ public class ClientServiceImpl implements ClientService {
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
// 2.取生成的完整的pdf
|
|
// 2.取生成的完整的pdf
|
|
ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
- if(examDetail.getAttachmentId() == null) {
|
|
|
|
|
|
+ if (examDetail.getAttachmentId() == null) {
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf未生成");
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf未生成");
|
|
}
|
|
}
|
|
|
|
|
|
BasicAttachment attachment = basicAttachmentService.getById(examDetail.getAttachmentId());
|
|
BasicAttachment attachment = basicAttachmentService.getById(examDetail.getAttachmentId());
|
|
- if(attachment == null){
|
|
|
|
|
|
+ if (attachment == null) {
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件记录异常");
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件记录异常");
|
|
}
|
|
}
|
|
|
|
|
|
Map<String, String> attachMap = commonService.filePreview(examDetail.getAttachmentId().toString(), false);
|
|
Map<String, String> attachMap = commonService.filePreview(examDetail.getAttachmentId().toString(), false);
|
|
String totalPathUrl = attachMap.get("pathUrl");
|
|
String totalPathUrl = attachMap.get("pathUrl");
|
|
- if(StringUtils.isNotBlank(totalPathUrl)) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(totalPathUrl)) {
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件丢失");
|
|
throw ExceptionResultEnum.ERROR.exception("考场pdf文件丢失");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -232,7 +234,7 @@ public class ClientServiceImpl implements ClientService {
|
|
Map<String, Object> backupMap = new HashMap<>();
|
|
Map<String, Object> backupMap = new HashMap<>();
|
|
int backupCount = examPrintPlan.getBackupCount().intValue();
|
|
int backupCount = examPrintPlan.getBackupCount().intValue();
|
|
//试卷
|
|
//试卷
|
|
- List<Map<String, String>> keyMaps = studentList.stream().map(m->{
|
|
|
|
|
|
+ List<Map<String, String>> keyMaps = studentList.stream().map(m -> {
|
|
Map<String, String> stringMap = new HashMap<>();
|
|
Map<String, String> stringMap = new HashMap<>();
|
|
stringMap.put("courseCode", m.get("courseCode"));
|
|
stringMap.put("courseCode", m.get("courseCode"));
|
|
stringMap.put("courseName", m.get("courseName"));
|
|
stringMap.put("courseName", m.get("courseName"));
|
|
@@ -312,7 +314,7 @@ public class ClientServiceImpl implements ClientService {
|
|
@Override
|
|
@Override
|
|
public List<Map<String, Object>> getPrintDataBatch(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) {
|
|
public List<Map<String, Object>> getPrintDataBatch(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) {
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
- List<ClientPrintTaskDto> pirntTaskDtoList = examPrintPlanService.listClientPrintTask(schoolId,machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime,isDownload,validate, orgIds);
|
|
|
|
|
|
+ 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<>();
|
|
List<Map<String, Object>> finalList = new ArrayList<>();
|
|
for (ClientPrintTaskDto clientPrintTaskDto : pirntTaskDtoList) {
|
|
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, null);
|
|
@@ -321,6 +323,103 @@ public class ClientServiceImpl implements ClientService {
|
|
return finalList;
|
|
return finalList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public 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());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean updateDownload(Long schoolId, Long examDetailId, String machineCode, Boolean isDownload) {
|
|
|
|
+ QueryWrapper<ExamDetailCourse> examDetailCourseQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getSchoolId, schoolId).eq(ExamDetailCourse::getExamDetailId, examDetailId);
|
|
|
|
+ List<ExamDetailCourse> examDetailCourses = examDetailCourseService.list(examDetailCourseQueryWrapper);
|
|
|
|
+ for (ExamDetailCourse examDetailCours : examDetailCourses) {
|
|
|
|
+ QueryWrapper<ClientStatus> clientStatusQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ clientStatusQueryWrapper.lambda().eq(ClientStatus::getSchoolId, schoolId).eq(ClientStatus::getCourseCode, examDetailCours.getCourseCode()).eq(ClientStatus::getPaperNumber, examDetailCours.getPaperNumber()).eq(ClientStatus::getMachineCode, machineCode);
|
|
|
|
+ ClientStatus clientStatus = clientStatusService.getOne(clientStatusQueryWrapper);
|
|
|
|
+ if (clientStatus == null) {
|
|
|
|
+ clientStatus = new ClientStatus();
|
|
|
|
+ clientStatus.setId(SystemConstant.getDbUuid());
|
|
|
|
+ clientStatus.setSchoolId(schoolId);
|
|
|
|
+ clientStatus.setMachineCode(machineCode);
|
|
|
|
+ clientStatus.setCourseCode(examDetailCours.getCourseCode());
|
|
|
|
+ clientStatus.setCourseName(examDetailCours.getCourseName());
|
|
|
|
+ clientStatus.setPaperNumber(examDetailCours.getPaperNumber());
|
|
|
|
+ clientStatus.setTry(false);
|
|
|
|
+ clientStatus.setPass(false);
|
|
|
|
+ clientStatus.setDownload(isDownload);
|
|
|
|
+ clientStatusService.save(clientStatus);
|
|
|
|
+ } else {
|
|
|
|
+ clientStatus.setDownload(isDownload);
|
|
|
|
+ clientStatusService.updateById(clientStatus);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean validateData(Long schoolId, Long examDetailId, String packageCode, String lastCode) {
|
|
|
|
+ ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
|
+ if (examDetail == null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考场数据有误");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(packageCode)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("卷袋编号不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (!packageCode.equals(examDetail.getPackageCode())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("卷袋编号与系统数据不一致");
|
|
|
|
+ }
|
|
|
|
+ // 取最后一张备卡
|
|
|
|
+ QueryWrapper<ExamDetailCourse> courseQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ courseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetailId).orderByDesc(ExamDetailCourse::getPaperNumber);
|
|
|
|
+ List<ExamDetailCourse> examDetailCourses = examDetailCourseService.list(courseQueryWrapper);
|
|
|
|
+ if (examDetailCourses.isEmpty()) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考场下课程数据异常");
|
|
|
|
+ }
|
|
|
|
+ ExamDetailCourse examDetailCourse = examDetailCourses.get(0);
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getCourseCode, examDetailCourse.getCourseCode()).eq(ExamTask::getPaperNumber, examDetailCourse.getPaperNumber());
|
|
|
|
+ ExamTask examTask = examTaskService.getOne(taskQueryWrapper);
|
|
|
|
+ if (examTask == null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ExamTaskDetail> taskDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ taskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTask.getId());
|
|
|
|
+ ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(taskDetailQueryWrapper);
|
|
|
|
+ if (examTaskDetail == null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
|
|
|
|
+ }
|
|
|
|
+ ExamCardDetail examCardDetail = examCardDetailService.getByCardId(examTaskDetail.getCardId());
|
|
|
|
+ if (examCardDetail == null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("题卡数据异常");
|
|
|
|
+ }
|
|
|
|
+ String attachmentIds = examCardDetail.getAttachmentId();
|
|
|
|
+ if (StringUtils.isBlank(attachmentIds)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("备卡数据异常");
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
|
|
|
|
+ String backupAttachmentIds = JSONObject.toJSONString(jsonObject.get("card"));
|
|
|
|
+ List<Map> list = JSONObject.parseArray(backupAttachmentIds, Map.class);
|
|
|
|
+ Map map = list.get(list.size() - 1);
|
|
|
|
+ String backupPackageCode = map.get("packageCode").toString();
|
|
|
|
+ if (StringUtils.isBlank(lastCode)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("最后一张备卡数据异常");
|
|
|
|
+ }
|
|
|
|
+ if (!lastCode.equals(backupPackageCode)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与系统数据不一致");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String lastCodeSub = lastCode.substring(0, lastCode.length() - 2);
|
|
|
|
+ if (packageCode.equals(lastCodeSub)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("最后一张备卡条码与试卷编号不一致");
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据考场生成试卷map
|
|
* 根据考场生成试卷map
|
|
*
|
|
*
|