|
@@ -566,7 +566,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
|
|
|
|
// 单次导入限制不超过150条数据,否则页面渲染会导致页面崩溃(2024-11-11 add)
|
|
// 单次导入限制不超过150条数据,否则页面渲染会导致页面崩溃(2024-11-11 add)
|
|
- if(examTaskImportDtoList.size() > 150){
|
|
|
|
|
|
+ if (examTaskImportDtoList.size() > 150) {
|
|
throw ExceptionResultEnum.ERROR.exception("单次导入命题任务数量不超过150条");
|
|
throw ExceptionResultEnum.ERROR.exception("单次导入命题任务数量不超过150条");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -676,7 +676,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
} else {
|
|
} else {
|
|
examTaskDto.setUsers(sysUserList);
|
|
examTaskDto.setUsers(sysUserList);
|
|
}
|
|
}
|
|
- examTaskDto.setUsers(sysUserList);
|
|
|
|
examTaskDtos.add(examTaskDto);
|
|
examTaskDtos.add(examTaskDto);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -914,8 +913,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
List<Long> cardIds = paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList());
|
|
List<Long> cardIds = paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList());
|
|
for (Long cardId : cardIds) {
|
|
for (Long cardId : cardIds) {
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
- if(!examTask.getOpenAb().equals(examCard.getOpenAb())){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception(examTask.getOpenAb() && !examCard.getOpenAb() ? "命题任务开启了AB卷,请选择AB卷题卡或者编辑题卡开启AB卷": "命题任务未开启了AB卷,请选择单题卡或者编辑题卡关闭AB卷");
|
|
|
|
|
|
+ if (!examTask.getOpenAb().equals(examCard.getOpenAb())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(examTask.getOpenAb() && !examCard.getOpenAb() ? "命题任务开启了AB卷,请选择AB卷题卡或者编辑题卡开启AB卷" : "命题任务未开启了AB卷,请选择单题卡或者编辑题卡关闭AB卷");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 将题卡更新为已绑定
|
|
// 将题卡更新为已绑定
|
|
@@ -1034,42 +1033,46 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
.add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
|
|
.add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
|
|
.add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
|
|
.add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
|
|
.add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator);
|
|
.add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator);
|
|
- List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailPdfDownloadDto.getPaperAttachmentIds());
|
|
|
|
- // 试卷
|
|
|
|
- for (PaperInfoVo paperInfoVo : paperInfoVoList) {
|
|
|
|
- Long attachmentId = Long.valueOf(paperInfoVo.getAttachmentId());
|
|
|
|
- String name = paperInfoVo.getName();
|
|
|
|
- if (Objects.nonNull(attachmentId)) {
|
|
|
|
- BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
- Optional.ofNullable(attachment).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("附件数据异常"));
|
|
|
|
- String fileName = dirPath + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
|
|
|
|
- fileUploadService.downloadFile(attachment, fileName);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- // 题卡
|
|
|
|
- Long cardId = Long.valueOf(paperInfoVo.getCardId());
|
|
|
|
- if (cardId != null) {
|
|
|
|
- ExamCard examCard = examCardService.getById(cardId);
|
|
|
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(examTaskId);
|
|
|
|
+ for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
|
|
|
|
+ List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
|
|
|
|
+ // 试卷
|
|
|
|
+ for (PaperInfoVo paperInfoVo : paperInfoVoList) {
|
|
|
|
+ Long attachmentId = Long.valueOf(paperInfoVo.getAttachmentId());
|
|
|
|
+ String name = paperInfoVo.getName();
|
|
|
|
+ if (Objects.nonNull(attachmentId)) {
|
|
|
|
+ BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
+ Optional.ofNullable(attachment).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("附件数据异常"));
|
|
|
|
+ String fileName = dirPath + "卷" + examTaskDetail.getSerialNumber() + SystemConstant.HYPHEN + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
|
|
|
|
+ fileUploadService.downloadFile(attachment, fileName);
|
|
|
|
+ }
|
|
|
|
|
|
- String cardHtmlPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.HTML_PREFIX;
|
|
|
|
- String cardPdfPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.PDF_PREFIX;
|
|
|
|
|
|
+ // 题卡
|
|
|
|
+ Long cardId = Long.valueOf(paperInfoVo.getCardId());
|
|
|
|
+ if (cardId != null) {
|
|
|
|
+ ExamCard examCard = examCardService.getById(cardId);
|
|
|
|
|
|
- String htmlContent = createPdfUtil.replaceBlankHtmlContent(examCard.getHtmlContent(), examCard.getCourseId());
|
|
|
|
- // html
|
|
|
|
- File htmlFile = new File(cardHtmlPath);
|
|
|
|
- if (!htmlFile.exists()) {
|
|
|
|
- htmlFile.getParentFile().mkdirs();
|
|
|
|
- htmlFile.createNewFile();
|
|
|
|
- }
|
|
|
|
- // 生成html文件
|
|
|
|
- FileUtil.writeContent(htmlFile, htmlContent);
|
|
|
|
- // 转pdf文件
|
|
|
|
- File pdfFile = new File(cardPdfPath);
|
|
|
|
- if (!pdfFile.exists()) {
|
|
|
|
- pdfFile.getParentFile().mkdirs();
|
|
|
|
- pdfFile.createNewFile();
|
|
|
|
|
|
+ String cardHtmlPath = dirPath + "卷" + examTaskDetail.getSerialNumber() + SystemConstant.HYPHEN + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.HTML_PREFIX;
|
|
|
|
+ String cardPdfPath = dirPath + "卷" + examTaskDetail.getSerialNumber() + SystemConstant.HYPHEN + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.PDF_PREFIX;
|
|
|
|
+
|
|
|
|
+ String htmlContent = createPdfUtil.replaceBlankHtmlContent(examCard.getHtmlContent(), examCard.getCourseId());
|
|
|
|
+ // html
|
|
|
|
+ File htmlFile = new File(cardHtmlPath);
|
|
|
|
+ if (!htmlFile.exists()) {
|
|
|
|
+ htmlFile.getParentFile().mkdirs();
|
|
|
|
+ htmlFile.createNewFile();
|
|
|
|
+ }
|
|
|
|
+ // 生成html文件
|
|
|
|
+ FileUtil.writeContent(htmlFile, htmlContent);
|
|
|
|
+ // 转pdf文件
|
|
|
|
+ File pdfFile = new File(cardPdfPath);
|
|
|
|
+ if (!pdfFile.exists()) {
|
|
|
|
+ pdfFile.getParentFile().mkdirs();
|
|
|
|
+ pdfFile.createNewFile();
|
|
|
|
+ }
|
|
|
|
+ HtmlToPdfUtil.convert(cardHtmlPath, cardPdfPath, PageSizeEnum.A3);
|
|
}
|
|
}
|
|
- HtmlToPdfUtil.convert(cardHtmlPath, cardPdfPath, PageSizeEnum.A3);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
String zipFileName = downloadPathFile.getName() + SystemConstant.ZIP_PREFIX;
|
|
String zipFileName = downloadPathFile.getName() + SystemConstant.ZIP_PREFIX;
|
|
@@ -1211,7 +1214,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
throw ExceptionResultEnum.ERROR.exception("正在校验试卷编号,请稍后再试");
|
|
throw ExceptionResultEnum.ERROR.exception("正在校验试卷编号,请稍后再试");
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- ExamTask task = this.getByExamIdAndCourseIdAndPaperNumber(examTask.getExamId(), null, examTask.getPaperNumber());
|
|
|
|
|
|
+ ExamTask task = this.getByExamIdAndPaperNumber(examTask.getExamId(), examTask.getPaperNumber());
|
|
if (task != null) {
|
|
if (task != null) {
|
|
throw ExceptionResultEnum.ERROR.exception("试卷编号已使用");
|
|
throw ExceptionResultEnum.ERROR.exception("试卷编号已使用");
|
|
}
|
|
}
|
|
@@ -1311,8 +1314,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
List<Long> cardIds = paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList());
|
|
List<Long> cardIds = paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList());
|
|
for (Long cardId : cardIds) {
|
|
for (Long cardId : cardIds) {
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
- if(!examTask.getOpenAb().equals(examCard.getOpenAb())){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception(examTask.getOpenAb() && !examCard.getOpenAb() ? "命题任务开启了AB卷,请选择AB卷题卡或者编辑题卡开启AB卷": "命题任务未开启了AB卷,请选择单题卡或者编辑题卡关闭AB卷");
|
|
|
|
|
|
+ if (!examTask.getOpenAb().equals(examCard.getOpenAb())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(examTask.getOpenAb() && !examCard.getOpenAb() ? "命题任务开启了AB卷,请选择AB卷题卡或者编辑题卡开启AB卷" : "命题任务未开启了AB卷,请选择单题卡或者编辑题卡关闭AB卷");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 将题卡更新为已绑定
|
|
// 将题卡更新为已绑定
|
|
@@ -1327,15 +1330,17 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
.eq(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId())
|
|
.eq(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId())
|
|
.eq(ExamTaskPaperData::getUuid, paperInfoVo.getUuid());
|
|
.eq(ExamTaskPaperData::getUuid, paperInfoVo.getUuid());
|
|
examTaskPaperDataService.update(updateWrapper);
|
|
examTaskPaperDataService.update(updateWrapper);
|
|
-
|
|
|
|
- // 删除临时数据
|
|
|
|
- QueryWrapper<ExamTaskPaperData> deleteWrapper = new QueryWrapper<>();
|
|
|
|
- deleteWrapper.lambda().eq(ExamTaskPaperData::getExamId, examTask.getExamId())
|
|
|
|
- .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
|
|
|
|
- .ne(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId());
|
|
|
|
- examTaskPaperDataService.remove(deleteWrapper);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(paperInfoVoList.get(0).getUuid())) {
|
|
|
|
+ // 删除临时数据
|
|
|
|
+ QueryWrapper<ExamTaskPaperData> deleteWrapper = new QueryWrapper<>();
|
|
|
|
+ deleteWrapper.lambda().eq(ExamTaskPaperData::getExamId, examTask.getExamId())
|
|
|
|
+ .eq(ExamTaskPaperData::getPaperNumber, paperInfoVoList.get(0).getUuid())
|
|
|
|
+ .notIn(ExamTaskPaperData::getPaperId, paperInfoVoList.stream().filter(m -> m.getPaperId() != null).map(PaperInfoVo::getPaperId).collect(Collectors.toList()));
|
|
|
|
+ examTaskPaperDataService.remove(deleteWrapper);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
@@ -1431,7 +1436,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
if (basicStudentIdUserMap.containsKey(i)) {
|
|
if (basicStudentIdUserMap.containsKey(i)) {
|
|
BasicExamStudent basicExamStudent = basicExamStudentService.getById(i);
|
|
BasicExamStudent basicExamStudent = basicExamStudentService.getById(i);
|
|
if (basicExamStudent != null) {
|
|
if (basicExamStudent != null) {
|
|
- throw ExceptionResultEnum.ERROR.exception("教学班[" + basicExamStudent.getTeachClassName() + "]内有考生已被[" + basicStudentIdUserMap.get(i) + "]选择");
|
|
|
|
|
|
+// throw ExceptionResultEnum.ERROR.exception("教学班[" + basicExamStudent.getTeachClassName() + "]内有考生已被[" + basicStudentIdUserMap.get(i) + "]选择");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -1829,6 +1834,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
// 删除命题任务及试卷信息
|
|
// 删除命题任务及试卷信息
|
|
this.removeByExamTaskId(id);
|
|
this.removeByExamTaskId(id);
|
|
|
|
+ // 删除题库试卷包信息
|
|
|
|
+ examTaskPaperDataService.deleteByExamIdAndPaperNumber(examTask.getExamId(), examTask.getPaperNumber());
|
|
// 删除考场信息
|
|
// 删除考场信息
|
|
examDetailService.deleteByExamIdAndPaperNumber(examTask.getSchoolId(), examTask.getExamId(), examTask.getPaperNumber());
|
|
examDetailService.deleteByExamIdAndPaperNumber(examTask.getSchoolId(), examTask.getExamId(), examTask.getPaperNumber());
|
|
}
|
|
}
|