|
@@ -167,13 +167,12 @@ public class ExamController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
DataSyncCloudService dataSyncCloudService;
|
|
|
|
|
|
- private static final String[] EXAM_ORG_SETTINGS_EXCEL_HEADER = new String[]{"学习中心ID", "学习中心代码",
|
|
|
- "学习中心名称", "是否可以考试(是/否)", "开始考试时间 yyyy-MM-dd hh:mm:ss", "结束考试时间 yyyy-MM-dd hh:mm:ss"};
|
|
|
+ private static final String[] EXAM_ORG_SETTINGS_EXCEL_HEADER = new String[] { "学习中心ID", "学习中心代码", "学习中心名称",
|
|
|
+ "是否可以考试(是/否)", "开始考试时间 yyyy-MM-dd hh:mm:ss", "结束考试时间 yyyy-MM-dd hh:mm:ss" };
|
|
|
|
|
|
@ApiOperation(value = "查询考试课程的试卷类型集合")
|
|
|
@GetMapping("queryExamCoursePaperTypeList")
|
|
|
- public List<ExamPaperTypeRelationEntity> queryExamCoursePaperTypeList(
|
|
|
- @RequestParam(required = true) Long examId,
|
|
|
+ public List<ExamPaperTypeRelationEntity> queryExamCoursePaperTypeList(@RequestParam(required = true) Long examId,
|
|
|
@RequestParam(required = true) Long courseId) {
|
|
|
|
|
|
if (null == examId) {
|
|
@@ -189,17 +188,15 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
validateRootOrgIsolation(one.getRootOrgId());
|
|
|
|
|
|
- List<ExamPaperTypeRelationEntity> list = examPaperTypeRelationRepo
|
|
|
- .findByExamIdAndCourseId(examId, courseId);
|
|
|
+ List<ExamPaperTypeRelationEntity> list = examPaperTypeRelationRepo.findByExamIdAndCourseId(examId, courseId);
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询考试的课程集合")
|
|
|
@GetMapping("queryExamCourseList")
|
|
|
- public List<ExamCourseRelationEntity> getExamCourseList(
|
|
|
- @RequestParam(required = true) Long examId, @RequestParam(required = false) String name,
|
|
|
- @RequestParam(required = false) String level,
|
|
|
+ public List<ExamCourseRelationEntity> getExamCourseList(@RequestParam(required = true) Long examId,
|
|
|
+ @RequestParam(required = false) String name, @RequestParam(required = false) String level,
|
|
|
@RequestParam(required = false) Boolean enable) {
|
|
|
|
|
|
ExamEntity one = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
@@ -231,8 +228,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
PageRequest pageRequest = PageRequest.of(0, 50, new Sort(Direction.DESC, "updateTime"));
|
|
|
|
|
|
- Page<ExamCourseRelationEntity> page = examCourseRelationRepo.findAll(specification,
|
|
|
- pageRequest);
|
|
|
+ Page<ExamCourseRelationEntity> page = examCourseRelationRepo.findAll(specification, pageRequest);
|
|
|
|
|
|
Iterator<ExamCourseRelationEntity> iterator = page.iterator();
|
|
|
List<ExamCourseRelationEntity> list = Lists.newArrayList();
|
|
@@ -259,11 +255,9 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "分页查询考试批次")
|
|
|
@GetMapping("queryPage/{curPage}/{pageSize}")
|
|
|
- public PageInfo<ExamDomain> queryPage(@PathVariable Integer curPage,
|
|
|
- @PathVariable Integer pageSize, @RequestParam(required = false) String name,
|
|
|
- @RequestParam(required = false) String examType,
|
|
|
- @RequestParam(required = false) Boolean enable,
|
|
|
- @RequestParam(required = false) String propertyKeys) {
|
|
|
+ public PageInfo<ExamDomain> queryPage(@PathVariable Integer curPage, @PathVariable Integer pageSize,
|
|
|
+ @RequestParam(required = false) String name, @RequestParam(required = false) String examType,
|
|
|
+ @RequestParam(required = false) Boolean enable, @RequestParam(required = false) String propertyKeys) {
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
|
|
|
@@ -283,8 +277,7 @@ public class ExamController extends ControllerSupport {
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
|
- PageRequest pageRequest = PageRequest.of(curPage, pageSize,
|
|
|
- new Sort(Direction.DESC, "updateTime"));
|
|
|
+ PageRequest pageRequest = PageRequest.of(curPage, pageSize, new Sort(Direction.DESC, "updateTime"));
|
|
|
|
|
|
Page<ExamEntity> page = examRepo.findAll(specification, pageRequest);
|
|
|
|
|
@@ -302,6 +295,7 @@ public class ExamController extends ControllerSupport {
|
|
|
list.add(bean);
|
|
|
|
|
|
bean.setId(next.getId());
|
|
|
+ bean.setCode(next.getCode());
|
|
|
bean.setName(next.getName());
|
|
|
bean.setEnable(next.getEnable());
|
|
|
bean.setRootOrgId(next.getRootOrgId());
|
|
@@ -333,17 +327,14 @@ public class ExamController extends ControllerSupport {
|
|
|
* @param name
|
|
|
* @param examTypes
|
|
|
* @param enable
|
|
|
- * @param studentId
|
|
|
- * 筛选学生关联的考试
|
|
|
+ * @param studentId 筛选学生关联的考试
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "查询考试批次")
|
|
|
@GetMapping("queryByNameLike")
|
|
|
public List<ExamDomain> query(@RequestParam(required = true) String name,
|
|
|
- @RequestParam(required = false) String examTypes,
|
|
|
- @RequestParam(required = false) Boolean enable,
|
|
|
- @RequestParam(required = false) String propertyKeys,
|
|
|
- @RequestParam(required = false) Long studentId,
|
|
|
+ @RequestParam(required = false) String examTypes, @RequestParam(required = false) Boolean enable,
|
|
|
+ @RequestParam(required = false) String propertyKeys, @RequestParam(required = false) Long studentId,
|
|
|
@RequestParam(required = false) Long rootOrgId) {
|
|
|
|
|
|
if (null == rootOrgId) {
|
|
@@ -440,7 +431,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
for (String key : propertyKeys) {
|
|
|
DynamicEnum de = manager.getByName(key);
|
|
|
- ExamPropertyEntity one = examPropertyRepo.findByexamIdAndKeyId(examId, de.getId());
|
|
|
+ ExamPropertyEntity one = examPropertyRepo.findByExamIdAndKeyId(examId, de.getId());
|
|
|
if (null != one) {
|
|
|
map.put(key, one.getValue());
|
|
|
}
|
|
@@ -581,7 +572,7 @@ public class ExamController extends ControllerSupport {
|
|
|
validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
|
|
|
Map<String, String> map = Maps.newHashMap();
|
|
|
- List<ExamPropertyEntity> list = examPropertyRepo.findByexamId(examId);
|
|
|
+ List<ExamPropertyEntity> list = examPropertyRepo.findByExamId(examId);
|
|
|
DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
for (ExamPropertyEntity cur : list) {
|
|
|
DynamicEnum de = manager.getById(cur.getKeyId());
|
|
@@ -608,7 +599,7 @@ public class ExamController extends ControllerSupport {
|
|
|
validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
DynamicEnum de = manager.getByName(key);
|
|
|
- ExamPropertyEntity one = examPropertyRepo.findByexamIdAndKeyId(examId, de.getId());
|
|
|
+ ExamPropertyEntity one = examPropertyRepo.findByExamIdAndKeyId(examId, de.getId());
|
|
|
if (null == one) {
|
|
|
return null;
|
|
|
}
|
|
@@ -647,8 +638,7 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询考试批次机构属性")
|
|
|
@GetMapping("examOrgProperty/{examId}/{orgId}/{key}")
|
|
|
- public String getExamOrgProperty(@PathVariable Long examId, @PathVariable Long orgId,
|
|
|
- @PathVariable String key) {
|
|
|
+ public String getExamOrgProperty(@PathVariable Long examId, @PathVariable Long orgId, @PathVariable String key) {
|
|
|
ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
if (null == examEntity) {
|
|
|
throw new StatusException("E-001250", "examId is wrong");
|
|
@@ -670,8 +660,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "启用考试", notes = "启用考试")
|
|
|
@PutMapping("enable/{ids}")
|
|
|
public void enableUser(@PathVariable String ids) {
|
|
|
- List<Long> examIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<Long> examIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
|
|
|
for (Long examId : examIds) {
|
|
|
ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
exam.setEnable(true);
|
|
@@ -707,8 +696,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "禁用考试", notes = "禁用考试")
|
|
|
@PutMapping("disable/{ids}")
|
|
|
public void disableUser(@PathVariable String ids) {
|
|
|
- List<Long> examIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<Long> examIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
|
|
|
for (Long examId : examIds) {
|
|
|
ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
exam.setEnable(false);
|
|
@@ -755,10 +743,8 @@ public class ExamController extends ControllerSupport {
|
|
|
public List<ExamCourseGroupDomain> getCourseGroupListByExamId(@PathVariable Long examId,
|
|
|
@PathVariable Integer curPage, @PathVariable Integer pageSize) {
|
|
|
|
|
|
- Pageable pageable = PageRequest.of(curPage - 1, pageSize, Sort.Direction.DESC,
|
|
|
- "updateTime");
|
|
|
- List<ExamCourseGroupSettingsEntity> groupList = examCourseGroupSettingsRepo
|
|
|
- .findAllByExamId(examId, pageable);
|
|
|
+ Pageable pageable = PageRequest.of(curPage - 1, pageSize, Sort.Direction.DESC, "updateTime");
|
|
|
+ List<ExamCourseGroupSettingsEntity> groupList = examCourseGroupSettingsRepo.findAllByExamId(examId, pageable);
|
|
|
|
|
|
List<ExamCourseGroupDomain> ret = Lists.newArrayList();
|
|
|
|
|
@@ -799,8 +785,8 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "通过课程ID查询课程组集合", notes = "")
|
|
|
@GetMapping("getCourseGroupListByExamIdAndCourseId/{examId}/{courseId}")
|
|
|
- public List<ExamCourseGroupDomain> getCourseGroupListByExamIdAndCourseId(
|
|
|
- @PathVariable Long examId, @PathVariable Long courseId) {
|
|
|
+ public List<ExamCourseGroupDomain> getCourseGroupListByExamIdAndCourseId(@PathVariable Long examId,
|
|
|
+ @PathVariable Long courseId) {
|
|
|
|
|
|
List<ExamCourseGroupRelationEntity> relationList = examCourseGroupRelationRepo
|
|
|
.findAllByCourseIdAndExamId(courseId, examId);
|
|
@@ -850,8 +836,7 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "更新课程组", notes = "")
|
|
|
@PutMapping("courseGroup")
|
|
|
- public void updateCourseGroup(@RequestBody ExamCourseGroupDomain courseGroupBean,
|
|
|
- HttpServletRequest request) {
|
|
|
+ public void updateCourseGroup(@RequestBody ExamCourseGroupDomain courseGroupBean, HttpServletRequest request) {
|
|
|
|
|
|
ExamCourseGroupSettingsEntity courseGroup = new ExamCourseGroupSettingsEntity();
|
|
|
courseGroup.setBeginTime(courseGroupBean.getBeginTime());
|
|
@@ -932,8 +917,7 @@ public class ExamController extends ControllerSupport {
|
|
|
};
|
|
|
|
|
|
Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
|
- Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification,
|
|
|
- pageable);
|
|
|
+ Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification, pageable);
|
|
|
|
|
|
Iterator<ExamSpecialSettingsEntity> iterator = page.iterator();
|
|
|
List<ExamOrgSettingsDomain> domainList = Lists.newArrayList();
|
|
@@ -959,8 +943,8 @@ public class ExamController extends ControllerSupport {
|
|
|
bean.setOrgName(org.getName());
|
|
|
bean.setOrgCode(org.getCode());
|
|
|
|
|
|
- List<ExamOrgPropertyEntity> propList = examOrgPropertyRepo
|
|
|
- .findByexamIdAndOrgId(next.getExamId(), next.getOrgId());
|
|
|
+ List<ExamOrgPropertyEntity> propList = examOrgPropertyRepo.findByexamIdAndOrgId(next.getExamId(),
|
|
|
+ next.getOrgId());
|
|
|
|
|
|
Map<String, String> map = Maps.newHashMap();
|
|
|
DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
@@ -991,8 +975,8 @@ public class ExamController extends ControllerSupport {
|
|
|
StudentBean student = getStudent(accessUser.getUserId());
|
|
|
Long orgId = student.getOrgId();
|
|
|
|
|
|
- ExamSpecialSettingsEntity examOrgEntity = examSpecialSettingsRepo
|
|
|
- .findByExamIdAndOrgIdAndCourseIdIsNull(examId, orgId);
|
|
|
+ ExamSpecialSettingsEntity examOrgEntity = examSpecialSettingsRepo.findByExamIdAndOrgIdAndCourseIdIsNull(examId,
|
|
|
+ orgId);
|
|
|
|
|
|
ExamDomain domain = new ExamDomain();
|
|
|
domain.setBeginTime(examEntity.getBeginTime());
|
|
@@ -1044,8 +1028,7 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "更新考试相关的学习中心设置", notes = "")
|
|
|
@PutMapping("examOrgSettings")
|
|
|
- public ExamSpecialSettingsEntity updateExamOrgSettings(
|
|
|
- @RequestBody ExamOrgSettingsDomain domain) {
|
|
|
+ public ExamSpecialSettingsEntity updateExamOrgSettings(@RequestBody ExamOrgSettingsDomain domain) {
|
|
|
return saveExamOrgSettings(domain);
|
|
|
}
|
|
|
|
|
@@ -1132,14 +1115,12 @@ public class ExamController extends ControllerSupport {
|
|
|
orgIdSet.add(cur.getOrgId());
|
|
|
OrgBean orgBean = orgMap.get(cur.getOrgId());
|
|
|
String examLimit = null == cur.getExamLimit() ? "否" : cur.getExamLimit() ? "否" : "是";
|
|
|
- String beginTime = null == cur.getBeginTime()
|
|
|
- ? null
|
|
|
+ String beginTime = null == cur.getBeginTime() ? null
|
|
|
: DateUtil.format(cur.getBeginTime(), DatePatterns.CHINA_DEFAULT);
|
|
|
- String endTime = null == cur.getEndTime()
|
|
|
- ? null
|
|
|
+ String endTime = null == cur.getEndTime() ? null
|
|
|
: DateUtil.format(cur.getEndTime(), DatePatterns.CHINA_DEFAULT);
|
|
|
- datas.add(new Object[]{String.valueOf(orgBean.getId()), orgBean.getCode(),
|
|
|
- orgBean.getName(), examLimit, beginTime, endTime});
|
|
|
+ datas.add(new Object[] { String.valueOf(orgBean.getId()), orgBean.getCode(), orgBean.getName(), examLimit,
|
|
|
+ beginTime, endTime });
|
|
|
}
|
|
|
|
|
|
for (Entry<Long, OrgBean> entry : orgMap.entrySet()) {
|
|
@@ -1152,17 +1133,15 @@ public class ExamController extends ControllerSupport {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- datas.add(new Object[]{String.valueOf(orgBean.getId()), orgBean.getCode(),
|
|
|
- orgBean.getName(), null, null, null});
|
|
|
+ datas.add(new Object[] { String.valueOf(orgBean.getId()), orgBean.getCode(), orgBean.getName(), null, null,
|
|
|
+ null });
|
|
|
}
|
|
|
|
|
|
- String filePath = systemConfig.getTempDataDir() + File.separator
|
|
|
- + System.currentTimeMillis() + ".xlsx";
|
|
|
+ String filePath = systemConfig.getTempDataDir() + File.separator + System.currentTimeMillis() + ".xlsx";
|
|
|
File file = new File(filePath);
|
|
|
|
|
|
- ExcelWriter.write(
|
|
|
- EXAM_ORG_SETTINGS_EXCEL_HEADER, new Class[]{String.class, String.class,
|
|
|
- String.class, String.class, String.class, String.class},
|
|
|
+ ExcelWriter.write(EXAM_ORG_SETTINGS_EXCEL_HEADER,
|
|
|
+ new Class[] { String.class, String.class, String.class, String.class, String.class, String.class },
|
|
|
datas, new File(filePath));
|
|
|
|
|
|
exportFile("学习中心特殊设置-" + getRootOrgId() + ".xlsx", file);
|
|
@@ -1184,8 +1163,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
|
File storeLocation = item.getStoreLocation();
|
|
|
- List<Map<String, Object>> failRecords = examService.importExamSpecialSettings(examId,
|
|
|
- storeLocation);
|
|
|
+ List<Map<String, Object>> failRecords = examService.importExamSpecialSettings(examId, storeLocation);
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
map.put("hasError", CollectionUtils.isNotEmpty(failRecords));
|
|
|
map.put("failRecords", failRecords);
|
|
@@ -1243,7 +1221,7 @@ public class ExamController extends ControllerSupport {
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
|
DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
- ExamPropertyEntity ipLimitProperty = examPropertyRepo.findByexamIdAndKeyId(exam.getId(),
|
|
|
+ ExamPropertyEntity ipLimitProperty = examPropertyRepo.findByExamIdAndKeyId(exam.getId(),
|
|
|
manager.getByName("IP_LIMIT").getId());
|
|
|
|
|
|
Boolean ipLimit = null;
|
|
@@ -1268,7 +1246,7 @@ public class ExamController extends ControllerSupport {
|
|
|
}
|
|
|
realIp = realIp.trim();
|
|
|
|
|
|
- ExamPropertyEntity ipAddressesProperty = examPropertyRepo.findByexamIdAndKeyId(exam.getId(),
|
|
|
+ ExamPropertyEntity ipAddressesProperty = examPropertyRepo.findByExamIdAndKeyId(exam.getId(),
|
|
|
manager.getByName("IP_ADDRESSES").getId());
|
|
|
|
|
|
String ipAddresses = null;
|