|
@@ -167,12 +167,13 @@ 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) {
|
|
@@ -188,15 +189,17 @@ 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);
|
|
@@ -228,7 +231,8 @@ 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();
|
|
@@ -255,9 +259,11 @@ 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();
|
|
|
|
|
@@ -277,7 +283,8 @@ 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);
|
|
|
|
|
@@ -327,14 +334,17 @@ 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) {
|
|
@@ -607,6 +617,36 @@ public class ExamController extends ControllerSupport {
|
|
|
return one.getValue();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询考试批次多个属性")
|
|
|
+ @GetMapping("propertys/{examId}/{keys}")
|
|
|
+ public Map<String, String> getExamPropertyList(@PathVariable Long examId,
|
|
|
+ @PathVariable String keys) {
|
|
|
+ String[] keyArray = StringUtils.splitByWholeSeparator(keys, ",");
|
|
|
+ ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ if (null == examEntity) {
|
|
|
+ throw new StatusException("001250", "examId is wrong");
|
|
|
+ }
|
|
|
+ validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
+
|
|
|
+ Map<String, String> properties = Maps.newHashMap();
|
|
|
+ for (String key : keyArray) {
|
|
|
+ DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
+ DynamicEnum de = manager.getByName(key);
|
|
|
+ ExamPropertyEntity one = examPropertyRepo.findByExamIdAndKeyId(examId, de.getId());
|
|
|
+ if (null != one) {
|
|
|
+ properties.put(key, one.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return properties;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|
|
@@ -639,7 +679,8 @@ 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("001250", "examId is wrong");
|
|
@@ -661,7 +702,8 @@ 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);
|
|
@@ -697,7 +739,8 @@ 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);
|
|
@@ -744,8 +787,10 @@ 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();
|
|
|
|
|
@@ -786,8 +831,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);
|
|
@@ -837,7 +882,8 @@ 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());
|
|
@@ -918,7 +964,8 @@ 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();
|
|
@@ -944,8 +991,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();
|
|
@@ -976,8 +1023,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());
|
|
@@ -1029,7 +1076,8 @@ 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);
|
|
|
}
|
|
|
|
|
@@ -1116,12 +1164,14 @@ 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()) {
|
|
@@ -1134,15 +1184,17 @@ 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);
|
|
@@ -1164,7 +1216,8 @@ 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);
|