|
@@ -38,10 +38,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.net.URLEncoder;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -88,6 +85,20 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
if (StringUtils.isBlank(examStudent.getCourseCode())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程代码必填");
|
|
|
}
|
|
|
+
|
|
|
+ //文件存储方式校验
|
|
|
+ SimpleObject storeTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.STORE_TYPE);
|
|
|
+ if (StringUtils.isBlank(storeTypeSimpleObject.getValue())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("文件存储方式未设置,请联系管理员设置");
|
|
|
+ }
|
|
|
+ StoreTypeEnum storeType = StoreTypeEnum.valueOf(storeTypeSimpleObject.getValue());
|
|
|
+ if (StoreTypeEnum.ROOM.equals(storeType) && StringUtils.isBlank(examStudent.getExamRoom())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考场必填");
|
|
|
+ }
|
|
|
+ if (StoreTypeEnum.CLASS.equals(storeType) && StringUtils.isBlank(examStudent.getClassName())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("班级必填");
|
|
|
+ }
|
|
|
+
|
|
|
// 验证
|
|
|
ExamStudent byStudentCode = this.getByExamIdAndCourseCodeAndStudentCode(examStudent.getExamId(), examStudent.getCourseCode(), examStudent.getStudentCode());
|
|
|
if (examStudent.getId() == null) {
|
|
@@ -112,18 +123,8 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
if (StringUtils.isBlank(recognitionTypeSimpleObject.getValue())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("识别方式未设置,请联系管理员设置");
|
|
|
}
|
|
|
- SimpleObject storeTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.STORE_TYPE);
|
|
|
- if (StringUtils.isBlank(storeTypeSimpleObject.getValue())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("文件存储方式未设置,请联系管理员设置");
|
|
|
- }
|
|
|
+
|
|
|
RecognitionTypeEnum recognitionType = RecognitionTypeEnum.valueOf(recognitionTypeSimpleObject.getValue());
|
|
|
- StoreTypeEnum storeType = StoreTypeEnum.valueOf(storeTypeSimpleObject.getValue());
|
|
|
- if (StoreTypeEnum.ROOM.equals(storeType) && StringUtils.isBlank(examStudent.getExamRoom())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("考场必填");
|
|
|
- }
|
|
|
- if (StoreTypeEnum.CLASS.equals(storeType) && StringUtils.isBlank(examStudent.getClassName())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("班级必填");
|
|
|
- }
|
|
|
|
|
|
examStudent.setId(SystemConstant.getDbUuid());
|
|
|
examStudent.setSchoolId(sysUser.getSchoolId());
|
|
@@ -146,6 +147,18 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
if (byStudentCode != null && !examStudent.getId().equals(byStudentCode.getId())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]在课程%s(%s)下已存在", examStudent.getStudentCode(), examStudent.getCourseName(), examStudent.getCourseCode()));
|
|
|
}
|
|
|
+ //按照存储方式,不能更改相应的考场、班级
|
|
|
+ ExamStudent existStudent = this.getById(examStudent.getId());
|
|
|
+ if (Objects.isNull(existStudent)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("找不到考生,id:%s", examStudent.getId()));
|
|
|
+ }
|
|
|
+ if(StoreTypeEnum.ROOM.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getExamRoom()).equals(existStudent.getExamRoom())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("不能更改考场");
|
|
|
+ }
|
|
|
+ if(StoreTypeEnum.CLASS.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getClassName()).equals(existStudent.getClassName())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("不能更改班级");
|
|
|
+ }
|
|
|
+
|
|
|
// 考场去掉空格
|
|
|
examStudent.setExamRoom(StringUtils.isNotBlank(examStudent.getExamRoom()) ? StringUtils.deleteWhitespace(examStudent.getExamRoom()) : null);
|
|
|
// 班级去掉空格
|