|
@@ -116,8 +116,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
if (!accessUser.getUserType().equals(UserType.STUDENT)) {
|
|
|
throw new StatusException("005002", "用户类型错误");
|
|
|
}
|
|
|
- List<String> querySpecialtyNameList = examStudentRepo
|
|
|
- .querySpecialtyNameList(accessUser.getUserId());
|
|
|
+ List<String> querySpecialtyNameList = examStudentRepo.querySpecialtyNameList(accessUser.getUserId());
|
|
|
querySpecialtyNameList.removeAll(Collections.singleton(null));
|
|
|
return querySpecialtyNameList;
|
|
|
}
|
|
@@ -162,28 +161,19 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
* @return
|
|
|
* @author WANGWEI
|
|
|
*/
|
|
|
- @DataRule(type = {DataRuleType.ORG, DataRuleType.COURSE})
|
|
|
+ @DataRule(type = { DataRuleType.ORG, DataRuleType.COURSE })
|
|
|
@ApiOperation(value = "查询考试学生带条件和分页", notes = "带条件带分页")
|
|
|
@GetMapping("examStudentPage/{curPage}/{pageSize}")
|
|
|
- public PageInfo<ExamStudentDomain> getExamStudentPage(
|
|
|
- @PathVariable Integer curPage,
|
|
|
- @PathVariable Integer pageSize,
|
|
|
- @RequestParam(required = false) Long orgId,
|
|
|
- @RequestParam(required = false) Long examId,
|
|
|
- @RequestParam(required = false) Long examStageId,
|
|
|
- @RequestParam(required = false) String studentName,
|
|
|
- @RequestParam(required = false) String studentCode,
|
|
|
- @RequestParam(required = false) Long courseId,
|
|
|
- @RequestParam(required = false) String courseCode,
|
|
|
- @RequestParam(required = false) String courseLevel,
|
|
|
- @RequestParam(required = false) String courseName,
|
|
|
- @RequestParam(required = false) String examSite,
|
|
|
+ public PageInfo<ExamStudentDomain> getExamStudentPage(@PathVariable Integer curPage, @PathVariable Integer pageSize,
|
|
|
+ @RequestParam(required = false) Long orgId, @RequestParam(required = false) Long examId,
|
|
|
+ @RequestParam(required = false) Long examStageId, @RequestParam(required = false) String studentName,
|
|
|
+ @RequestParam(required = false) String studentCode, @RequestParam(required = false) Long courseId,
|
|
|
+ @RequestParam(required = false) String courseCode, @RequestParam(required = false) String courseLevel,
|
|
|
+ @RequestParam(required = false) String courseName, @RequestParam(required = false) String examSite,
|
|
|
@RequestParam(required = false) String identityNumber,
|
|
|
@RequestParam(required = false) Boolean identityNumberLike,
|
|
|
- @RequestParam(required = false) String specialtyName,
|
|
|
- @RequestParam(required = false) String infoCollector,
|
|
|
- @RequestParam(required = false) BooleanSelect enable,
|
|
|
- @RequestParam(required = false) Boolean withStarted,
|
|
|
+ @RequestParam(required = false) String specialtyName, @RequestParam(required = false) String infoCollector,
|
|
|
+ @RequestParam(required = false) BooleanSelect enable, @RequestParam(required = false) Boolean withStarted,
|
|
|
@RequestParam(required = false, defaultValue = "false") Boolean skipRule) {
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
@@ -279,7 +269,8 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
return PageUtils.toPageInfo(Page.empty());
|
|
|
}
|
|
|
|
|
|
- Set<Long> orgIds = new HashSet<>(), examIds = new HashSet<>(), examStageIds = new HashSet<>(), studentIds = new HashSet<>();
|
|
|
+ Set<Long> orgIds = new HashSet<>(), examIds = new HashSet<>(), examStageIds = new HashSet<>(),
|
|
|
+ studentIds = new HashSet<>();
|
|
|
for (ExamStudentEntity entity : page.getContent()) {
|
|
|
orgIds.add(entity.getOrgId());
|
|
|
examIds.add(entity.getExamId());
|
|
@@ -305,10 +296,12 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
studentMapsReq.setStudentIds(studentIds);
|
|
|
Map<Long, StudentBean> studentMaps = studentCloudService.getStudentMaps(studentMapsReq).getStudentMaps();
|
|
|
|
|
|
- ExamPropertyCacheBean isFaceEnableProperty = CacheHelper.getExamProperty(examId, ExamProperties.IS_FACE_ENABLE.name());
|
|
|
+ ExamPropertyCacheBean isFaceEnableProperty = CacheHelper.getExamProperty(examId,
|
|
|
+ ExamProperties.IS_FACE_ENABLE.name());
|
|
|
boolean isFaceEnable = isFaceEnableProperty != null && StringUtil.isTrue(isFaceEnableProperty.getValue());
|
|
|
|
|
|
- ExamPropertyCacheBean isFaceCheckProperty = CacheHelper.getExamProperty(examId, ExamProperties.IS_FACE_CHECK.name());
|
|
|
+ ExamPropertyCacheBean isFaceCheckProperty = CacheHelper.getExamProperty(examId,
|
|
|
+ ExamProperties.IS_FACE_CHECK.name());
|
|
|
boolean isFaceCheck = isFaceCheckProperty != null && StringUtil.isTrue(isFaceCheckProperty.getValue());
|
|
|
|
|
|
boolean hidden = IdentityNumberHelper.identityNumbeConceal(accessUser.getRootOrgId());
|
|
@@ -357,7 +350,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
bean.setExt1(cur.getExt1());
|
|
|
// 特殊处理:把ext2当作隐私模式下的身份证号
|
|
|
bean.setExt2(cur.getIdentityNumber());
|
|
|
- if(hidden) {
|
|
|
+ if (hidden) {
|
|
|
bean.setExt2(IdentityNumberHelper.conceal(cur.getIdentityNumber()));
|
|
|
}
|
|
|
|
|
@@ -429,9 +422,9 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
examStudent.setRootOrgId(rootOrgId);
|
|
|
examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
ExamStudentDomain ret = saveExamStudent(examStudent);
|
|
|
- //操作日志
|
|
|
- ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(), ret.getStudentId(), ret.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_ADD.getDesc()));
|
|
|
+ // 操作日志
|
|
|
+ ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(),
|
|
|
+ ret.getStudentId(), ret.getId(), UserType.COMMON, OperateContent.EXAM_STUDENT_ADD.getDesc()));
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -451,13 +444,13 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
examStudent.setRootOrgId(rootOrgId);
|
|
|
examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
ExamStudentDomain ret = saveExamStudent(examStudent);
|
|
|
- //操作日志
|
|
|
+ // 操作日志
|
|
|
if (examStudent.getId() != null) {
|
|
|
- ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(), ret.getStudentId(), ret.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_UPDATE.getDesc()));
|
|
|
+ ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(),
|
|
|
+ ret.getStudentId(), ret.getId(), UserType.COMMON, OperateContent.EXAM_STUDENT_UPDATE.getDesc()));
|
|
|
} else {
|
|
|
- ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(), ret.getStudentId(), ret.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_ADD.getDesc()));
|
|
|
+ ReportsUtil.report(new OperateReport(examStudent.getRootOrgId(), getAccessUser().getUserId(),
|
|
|
+ ret.getStudentId(), ret.getId(), UserType.COMMON, OperateContent.EXAM_STUDENT_ADD.getDesc()));
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -470,6 +463,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
* @author WANGWEI
|
|
|
*/
|
|
|
private ExamStudentDomain saveExamStudent(ExamStudentDomain examStudent) {
|
|
|
+ checkExamArchived(examStudent.getExamId());
|
|
|
SaveStudentReq saveStudentReq = new SaveStudentReq();
|
|
|
saveStudentReq.setIdentityNumber(examStudent.getIdentityNumber().toUpperCase(Locale.US));
|
|
|
saveStudentReq.setName(examStudent.getStudentName());
|
|
@@ -509,7 +503,8 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
|
|
|
info.setExamStageId(examStudent.getExamStageId());
|
|
|
if (null != examStudent.getExamStageId()) {
|
|
|
- ExamStageEntity examStageEntity = GlobalHelper.getEntity(examStageRepo, examStudent.getExamStageId(), ExamStageEntity.class);
|
|
|
+ ExamStageEntity examStageEntity = GlobalHelper.getEntity(examStageRepo, examStudent.getExamStageId(),
|
|
|
+ ExamStageEntity.class);
|
|
|
if (null == examStageEntity) {
|
|
|
throw new StatusException("005001", "场次id不正确");
|
|
|
}
|
|
@@ -533,6 +528,29 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ private void checkExamArchived(Long examId) {
|
|
|
+ ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ if (exam.getArchived()) {
|
|
|
+ throw new StatusException("考试已归档");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkExamArchived(Map<Long, Boolean> status, Long examId) {
|
|
|
+ Boolean archived = null;
|
|
|
+ archived = status.get(examId);
|
|
|
+ if (archived == null) {
|
|
|
+ ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ if (exam == null) {
|
|
|
+ throw new StatusException("未找到考试信息");
|
|
|
+ }
|
|
|
+ archived = exam.getArchived();
|
|
|
+ status.put(examId, archived);
|
|
|
+ }
|
|
|
+ if (archived) {
|
|
|
+ throw new StatusException("考试已归档");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|
|
@@ -544,8 +562,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@DeleteMapping("/{ids}")
|
|
|
@Transactional
|
|
|
public List<Long> deleteExamStudent(@PathVariable String ids) {
|
|
|
- List<Long> idList = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<Long> idList = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
|
|
|
examStudentService.deleteExamStudentsByStudentIds(idList);
|
|
|
return idList;
|
|
|
}
|
|
@@ -561,6 +578,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@DeleteMapping("exam/{examId}")
|
|
|
@Transactional
|
|
|
public Long deleteExamStudents(@PathVariable Long examId) {
|
|
|
+ checkExamArchived(examId);
|
|
|
examStudentService.deleteExamStudentsByExamId(examId);
|
|
|
return examId;
|
|
|
}
|
|
@@ -579,17 +597,18 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
+ Map<Long, Boolean> status = new HashMap<>();
|
|
|
for (Long cur : examStuIds) {
|
|
|
ExamStudentEntity s = GlobalHelper.getEntity(examStudentRepo, cur, ExamStudentEntity.class);
|
|
|
if (s == null) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ checkExamArchived(status, s.getExamId());
|
|
|
s.setEnable(true);
|
|
|
examStudentRepo.save(s);
|
|
|
- //操作日志
|
|
|
- ReportsUtil.report(new OperateReport(s.getRootOrgId(), getAccessUser().getUserId(), s.getStudentId(), s.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_ENABLE.getDesc()));
|
|
|
+ // 操作日志
|
|
|
+ ReportsUtil.report(new OperateReport(s.getRootOrgId(), getAccessUser().getUserId(), s.getStudentId(),
|
|
|
+ s.getId(), UserType.COMMON, OperateContent.EXAM_STUDENT_ENABLE.getDesc()));
|
|
|
ret.add(s.getId() + ":" + s.getName());
|
|
|
}
|
|
|
|
|
@@ -614,17 +633,18 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
+ Map<Long, Boolean> status = new HashMap<>();
|
|
|
for (Long cur : examStuIds) {
|
|
|
ExamStudentEntity s = GlobalHelper.getEntity(examStudentRepo, cur, ExamStudentEntity.class);
|
|
|
if (s == null) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ checkExamArchived(status, s.getExamId());
|
|
|
s.setEnable(false);
|
|
|
examStudentRepo.save(s);
|
|
|
- //操作日志
|
|
|
- ReportsUtil.report(new OperateReport(s.getRootOrgId(), getAccessUser().getUserId(), s.getStudentId(), s.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_DISABLE.getDesc()));
|
|
|
+ // 操作日志
|
|
|
+ ReportsUtil.report(new OperateReport(s.getRootOrgId(), getAccessUser().getUserId(), s.getStudentId(),
|
|
|
+ s.getId(), UserType.COMMON, OperateContent.EXAM_STUDENT_DISABLE.getDesc()));
|
|
|
ret.add(s.getId() + ":" + s.getName());
|
|
|
}
|
|
|
|