|
@@ -853,13 +853,18 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
if (StringUtils.isBlank(examTaskDetail.getOperateType())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("命题任务提交类型不能为空");
|
|
|
}
|
|
|
+
|
|
|
+ // 更新examTask状态status
|
|
|
+ ExamTask examTask = this.getById(examTaskDetail.getExamTaskId());
|
|
|
// 提交时,校验
|
|
|
if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
|
|
|
- validSubmitParam(examTaskDetail);
|
|
|
+ BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(examTask.getExamId(), examTask.getCourseCode());
|
|
|
+ if (basicPrintConfig == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印品配置未设置");
|
|
|
+ }
|
|
|
+ validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent());
|
|
|
}
|
|
|
|
|
|
- // 更新examTask状态status
|
|
|
- ExamTask examTask = this.getById(examTaskDetail.getExamTaskId());
|
|
|
|
|
|
if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
|
|
|
//TODO 加入从前端获取userId
|
|
@@ -959,7 +964,15 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
@Override
|
|
|
public ExamTaskDetailCardDto applyGetOne(Long examTaskId, String source) {
|
|
|
- return this.baseMapper.applyGetOne(examTaskId, source);
|
|
|
+ ExamTaskDetailCardDto detailCardDto = this.baseMapper.applyGetOne(examTaskId, source);
|
|
|
+ if(detailCardDto != null) {
|
|
|
+ ExamTask examTask = examTaskService.getById(examTaskId);
|
|
|
+ BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(examTask.getExamId(), examTask.getCourseCode());
|
|
|
+ if (basicPrintConfig != null) {
|
|
|
+ detailCardDto.setPrintContent(basicPrintConfig.getPrintContent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return detailCardDto;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1405,7 +1418,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
// 提交时,校验
|
|
|
if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
|
|
|
//TODO 加入从前端获取userId
|
|
|
- validSubmitParam(examTaskDetail);
|
|
|
+ BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(examTask.getExamId(), examTask.getCourseCode());
|
|
|
+ if (basicPrintConfig == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印品配置未设置");
|
|
|
+ }
|
|
|
+ validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent());
|
|
|
if (Objects.nonNull(examTask.getFlowId())) {
|
|
|
// 审核一级
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
|
|
@@ -1546,7 +1563,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
// 新建试卷
|
|
|
ExamTaskDetail examTaskDetail = JSONObject.parseObject(String.valueOf(jsonObject.get("examTaskDetail")), ExamTaskDetail.class);
|
|
|
- validSubmitParam(examTaskDetail);
|
|
|
+ validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent());
|
|
|
// 已曝光试卷和未曝光试卷赋值(新增时,已曝光试卷为null,未曝光试卷为paper_type)
|
|
|
examTaskDetail.setId(SystemConstant.getDbUuid());
|
|
|
examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
|
|
@@ -1576,7 +1593,15 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examPrintPlan.setName(examTask.getCourseName() + examTask.getPaperNumber());
|
|
|
examPrintPlan.setExamStartTime(examDetailParams.getExamStartTime());
|
|
|
examPrintPlan.setExamEndTime(examDetailParams.getExamEndTime());
|
|
|
- examPrintPlan.setPrintContent(String.join(",", JSONObject.parseArray(basicPrintConfig.getPrintContent(), String.class)));
|
|
|
+ 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();
|
|
|
+ if (count == 0){
|
|
|
+ stringList.add("PAPER");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ examPrintPlan.setPrintContent(String.join(",", stringList));
|
|
|
examPrintPlan.setBackupMethod(BackupMethodEnum.valueOf(basicPrintConfig.getBackupMethod()));
|
|
|
examPrintPlan.setBackupCount(basicPrintConfig.getBackupCount());
|
|
|
examPrintPlan.setDrawRule(basicPrintConfig.getDrawRule());
|
|
@@ -1880,8 +1905,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
if (!SystemConstant.strNotNull(courseCode)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("缺少考试课程编号");
|
|
|
}
|
|
|
- BasicCourse basicCourse = basicCourseService.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId,schoolId).eq(BasicCourse::getCode,courseCode));
|
|
|
- if (Objects.isNull(basicCourse)){
|
|
|
+ BasicCourse basicCourse = basicCourseService.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode));
|
|
|
+ if (Objects.isNull(basicCourse)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到课程编号对应的课程");
|
|
|
}
|
|
|
Long basicCourseId = basicCourse.getId();
|
|
@@ -2036,7 +2061,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
// 导入的excel创建或查询的学生集合
|
|
|
List<BasicStudentResult> studentDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, null);
|
|
|
|
|
|
- List<ExamStudentImportDto> existStudentList = examStudentImportDtoList
|
|
|
+ List<ExamStudentImportDto> existStudentList = examStudentImportDtoList
|
|
|
.stream()
|
|
|
.filter(e -> studentDatasource.stream().map(BasicStudentResult::getStudentCode).collect(Collectors.toList()).contains(e.getStudentCode()))
|
|
|
.collect(Collectors.toList());
|
|
@@ -2048,8 +2073,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
String impClazzName = examStudentImportDto.getClazzName();
|
|
|
|
|
|
|
|
|
- List<BasicStudentResult> basicStudentList = studentDatasource.stream().filter(e -> e.getStudentCode().equals(studentCode)).collect(Collectors.toList());
|
|
|
- if (basicStudentList.size() != 1){
|
|
|
+ List<BasicStudentResult> basicStudentList = studentDatasource.stream().filter(e -> e.getStudentCode().equals(studentCode)).collect(Collectors.toList());
|
|
|
+ if (basicStudentList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学号为:" + studentCode + "的考生数据异常");
|
|
|
}
|
|
|
BasicStudentResult basicStudent = basicStudentList.get(0);
|
|
@@ -2059,19 +2084,19 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
String realityClazzName = basicStudent.getClazz();
|
|
|
|
|
|
// 学院核对
|
|
|
- if (!impCollegeName.equals(realityCollegeName)){
|
|
|
+ if (!impCollegeName.equals(realityCollegeName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在学院【" + impCollegeName +
|
|
|
"】与该考生实际所在学院【" + realityCollegeName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
}
|
|
|
|
|
|
// 专业核对
|
|
|
- if (!impMajorName.equals(realityMajorName)){
|
|
|
+ if (!impMajorName.equals(realityMajorName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在专业【" + impMajorName +
|
|
|
"】与该考生实际所在专业【" + realityMajorName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
}
|
|
|
|
|
|
// 班级核对
|
|
|
- if (!impClazzName.equals(realityClazzName)){
|
|
|
+ if (!impClazzName.equals(realityClazzName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在班级【" + impClazzName +
|
|
|
"】与该考生实际所在班级【" + realityClazzName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
}
|
|
@@ -2102,14 +2127,14 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
List<BasicStudentResult> basicStudentResultDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, studentCodeDatasource);
|
|
|
|
|
|
// 考试对象键(考点、考场)
|
|
|
- List<Map<String,String>> examObjectKeyList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
- Map<String,String> key = new HashMap<>();
|
|
|
- key.put("examPlace",e.getExamPlace());
|
|
|
- key.put("examRoom",e.getExamRoom());
|
|
|
+ List<Map<String, String>> examObjectKeyList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
+ Map<String, String> key = new HashMap<>();
|
|
|
+ key.put("examPlace", e.getExamPlace());
|
|
|
+ key.put("examRoom", e.getExamRoom());
|
|
|
return Stream.of(key);
|
|
|
}).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- for (Map<String,String> key : examObjectKeyList) {
|
|
|
+ for (Map<String, String> key : examObjectKeyList) {
|
|
|
// 考点
|
|
|
String examPlace = key.get("examPlace");
|
|
|
// 考场
|
|
@@ -2164,12 +2189,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
*
|
|
|
* @param examTaskDetail
|
|
|
*/
|
|
|
- void validSubmitParam(ExamTaskDetail examTaskDetail) {
|
|
|
+ void validSubmitParam(ExamTaskDetail examTaskDetail, String printContent) {
|
|
|
if (StringUtils.isBlank(examTaskDetail.getPaperType())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
|
|
|
}
|
|
|
|
|
|
- BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId();
|
|
|
List<Map> paperAttachmentIds = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
|
|
|
for (Map paperAttachmentId : paperAttachmentIds) {
|
|
|
// 校验试卷必须绑定题卡
|
|
@@ -2192,7 +2216,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
// 是否强制包含试卷
|
|
|
// 未上传试卷的类型个数
|
|
|
long count = paperAttachmentIds.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
|
|
|
- if (basicExamRule.getIncludePaper()) {
|
|
|
+ if (printContent.contains("PAPER")) {
|
|
|
if (CollectionUtils.isEmpty(paperAttachmentIds)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
|
|
|
}
|