|
@@ -554,6 +554,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examTaskImportDto.setBatchNo(batchNo);
|
|
|
List<ExamTaskDto> tasks = new ArrayList<>();
|
|
|
Set<String> paperNumbers = new HashSet<>();
|
|
|
+
|
|
|
+ List<BasicCourse> userCourses = printCommonService.list(null, null, null);
|
|
|
// 错误信息
|
|
|
StringJoiner stringJoiner = new StringJoiner(";");
|
|
|
for (int i = 0; i < finalList.size(); i++) {
|
|
@@ -562,6 +564,13 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
for (int y = 0; y < examTaskTempList.size(); y++) {
|
|
|
ExamTaskTempDto examTaskTempDto = (ExamTaskTempDto) examTaskTempList.get(y);
|
|
|
ExamTaskTemp examTaskTemp = gson.fromJson(gson.toJson(examTaskTempDto), ExamTaskTemp.class);
|
|
|
+ // 校验该用户是否有科目
|
|
|
+ long matchCourseCount = userCourses.stream().filter(m -> examTaskTemp.getCourseCode().equals(m.getCode())).count();
|
|
|
+ if (matchCourseCount == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该用户没有科目[" + examTaskTemp.getCourseName() + "(" + examTaskTemp.getCourseCode() + ")]权限");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
examTaskTemp.setId(SystemConstant.getDbUuid());
|
|
|
examTaskTemp.setBatchNo(batchNo);
|
|
|
examTaskTemp.setSchoolId(schoolId);
|
|
@@ -646,7 +655,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
// 异常抛出 by 20230214
|
|
|
String errorMsg = stringJoiner.toString();
|
|
|
- if(errorMsg.length()>0){
|
|
|
+ if (errorMsg.length() > 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(errorMsg);
|
|
|
}
|
|
|
|
|
@@ -928,7 +937,18 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
}
|
|
|
examTaskDetail.setUpdateId(sysUser.getId());
|
|
|
examTaskDetail.setUpdateTime(System.currentTimeMillis());
|
|
|
- return examTaskDetailService.saveOrUpdate(examTaskDetail);
|
|
|
+ examTaskDetailService.saveOrUpdate(examTaskDetail);
|
|
|
+
|
|
|
+ // 将题卡更新为已绑定
|
|
|
+ String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
|
+ List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
|
|
|
+ List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m->CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m->m.getLong("cardId")).collect(Collectors.toList());
|
|
|
+ for (Long cardId : cardIds) {
|
|
|
+ UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
|
|
|
+ examCardService.update(cardUpdateWrapper);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1613,6 +1633,17 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
examTaskDetailService.save(examTaskDetail);
|
|
|
|
|
|
+ // 将题卡更新为已绑定
|
|
|
+ String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
|
+ List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
|
|
|
+ List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m->CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m->m.getLong("cardId")).collect(Collectors.toList());
|
|
|
+ for (Long cardId : cardIds) {
|
|
|
+ UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
|
|
|
+ examCardService.update(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
BasicCourse basicCourse = basicCourseService.findByCourseCode(examTask.getCourseCode(), schoolId);
|
|
|
|
|
|
BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
@@ -1631,8 +1662,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examPrintPlan.setExamEndTime(examDetailParams.getExamEndTime());
|
|
|
List<String> stringList = JSONObject.parseArray(basicPrintConfig.getPrintContent(), String.class);
|
|
|
if (!stringList.contains("PAPER")) {
|
|
|
- List<Map> paperAttachmentIds = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
|
|
|
- long count = paperAttachmentIds.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
|
|
|
+ List<Map> paperAttachmentIdsMap = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
|
|
|
+ long count = paperAttachmentIdsMap.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
|
|
|
if (count == 0) {
|
|
|
stringList.add("PAPER");
|
|
|
}
|