|
@@ -193,15 +193,14 @@ public class ExamController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
ExamSettingsCache examSettingsCache;
|
|
|
|
|
|
- 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" };
|
|
|
|
|
|
- private static final String[] EXCEL_IP_LIMIT_HEADER = new String[]{"IP地址", "限制类型", "备注"};
|
|
|
+ private static final String[] EXCEL_IP_LIMIT_HEADER = new String[] { "IP地址", "限制类型", "备注" };
|
|
|
|
|
|
@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) {
|
|
@@ -217,18 +216,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);
|
|
@@ -276,13 +272,11 @@ public class ExamController extends ControllerSupport {
|
|
|
@DataRule(type = DataRuleType.EXAM)
|
|
|
@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,
|
|
|
- @RequestParam(required = false) Long rootOrgId) {
|
|
|
+ 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,
|
|
|
+ @RequestParam(required = false) Long rootOrgId, @RequestParam(required = false) Boolean archived,
|
|
|
+ @RequestParam(required = false) Boolean ignoreArchived) {
|
|
|
User accessUser = getAccessUser();
|
|
|
PageRequest pageable = PageRequest.of(curPage, pageSize, Sort.by(Direction.DESC, "updateTime", "id"));
|
|
|
|
|
@@ -297,10 +291,10 @@ public class ExamController extends ControllerSupport {
|
|
|
if (userDataRule.assertNeedQueryRefIds()) {
|
|
|
predicates.add(root.get("id").in(userDataRule.getRefIds()));
|
|
|
}
|
|
|
- if(rootOrgId!=null) {
|
|
|
- predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
|
|
|
- }else {
|
|
|
- predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
|
|
|
+ if (rootOrgId != null) {
|
|
|
+ predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(name)) {
|
|
|
predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
|
|
@@ -311,7 +305,13 @@ public class ExamController extends ControllerSupport {
|
|
|
if (StringUtils.isNotBlank(examType)) {
|
|
|
predicates.add(cb.equal(root.get("examType"), ExamType.valueOf(examType)));
|
|
|
}
|
|
|
-
|
|
|
+ if (ignoreArchived == null || !ignoreArchived) {
|
|
|
+ predicates.add(cb.equal(root.get("archived"), false));
|
|
|
+ } else {
|
|
|
+ if (archived != null) {
|
|
|
+ predicates.add(cb.equal(root.get("archived"), archived));
|
|
|
+ }
|
|
|
+ }
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
@@ -328,7 +328,6 @@ public class ExamController extends ControllerSupport {
|
|
|
propertyKeyList.add(ExamProperties.IP_LIMIT.name());
|
|
|
propertyKeyList.add(ExamProperties.WEIXIN_ANSWER_ENABLED.name());
|
|
|
|
|
|
-
|
|
|
Iterator<ExamEntity> iterator = page.iterator();
|
|
|
List<ExamDomain> list = Lists.newArrayList();
|
|
|
while (iterator.hasNext()) {
|
|
@@ -357,9 +356,11 @@ public class ExamController extends ControllerSupport {
|
|
|
Map<String, String> properties = this.getProperties(bean.getId(), propertyKeyList);
|
|
|
bean.setProperties(properties);
|
|
|
|
|
|
- // String weixinAnswerEnabled = properties.get(ExamProperties.WEIXIN_ANSWER_ENABLED.name());
|
|
|
+ // String weixinAnswerEnabled =
|
|
|
+ // properties.get(ExamProperties.WEIXIN_ANSWER_ENABLED.name());
|
|
|
String ipLimitValue = properties.get(ExamProperties.IP_LIMIT.name());
|
|
|
bean.setIpLimitSettingsEnabled(StringUtil.isTrue(ipLimitValue));
|
|
|
+ bean.setArchived(next.getArchived());
|
|
|
}
|
|
|
|
|
|
return PageUtils.toPageInfo(page, list);
|
|
@@ -371,7 +372,8 @@ public class ExamController extends ControllerSupport {
|
|
|
* @param name
|
|
|
* @param examTypes
|
|
|
* @param enable
|
|
|
- * @param studentId 筛选学生关联的考试
|
|
|
+ * @param studentId
|
|
|
+ * 筛选学生关联的考试
|
|
|
* @return
|
|
|
* @author WANGWEI
|
|
|
*/
|
|
@@ -379,11 +381,9 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "查询考试批次")
|
|
|
@GetMapping("queryByNameLike")
|
|
|
public List<ExamDomain> query(@RequestParam(required = false) 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) Long rootOrgId) {
|
|
|
+ @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) {
|
|
|
rootOrgId = getRootOrgId();
|
|
|
}
|
|
@@ -396,7 +396,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
Specification<ExamEntity> specification = (root, query, cb) -> {
|
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
|
-
|
|
|
+ predicates.add(cb.equal(root.get("archived"), false));
|
|
|
if (userDataRule.assertNeedQueryRefIds()) {
|
|
|
predicates.add(root.get("id").in(userDataRule.getRefIds()));
|
|
|
}
|
|
@@ -433,7 +433,8 @@ public class ExamController extends ControllerSupport {
|
|
|
Root<ExamStudentEntity> subRoot = subquery.from(ExamStudentEntity.class);
|
|
|
// subquery.select(subRoot.get("id"));
|
|
|
// Predicate p1 = cb.equal(subRoot.get("studentId"), studentId);
|
|
|
- // Predicate p2 = cb.equal(subRoot.get("examId"), root.get("id"));
|
|
|
+ // Predicate p2 = cb.equal(subRoot.get("examId"),
|
|
|
+ // root.get("id"));
|
|
|
// subquery.where(cb.and(p1, p2));
|
|
|
// predicates.add(cb.exists(subquery));
|
|
|
subquery.distinct(true).select(subRoot.get("examId"));
|
|
@@ -445,8 +446,7 @@ public class ExamController extends ControllerSupport {
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
|
- PageRequest pageRequest = PageRequest.of(0, 100,
|
|
|
- Sort.by(Direction.DESC, "updateTime", "id"));
|
|
|
+ PageRequest pageRequest = PageRequest.of(0, 100, Sort.by(Direction.DESC, "updateTime", "id"));
|
|
|
Page<ExamEntity> page = examRepo.findAll(specification, pageRequest);
|
|
|
|
|
|
Iterator<ExamEntity> iterator = page.iterator();
|
|
@@ -632,7 +632,8 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
if (CURD.CREATION == es) {
|
|
|
// 用户与考试的数据权限
|
|
|
- userDataRuleCloudService.addUserDataRule(new AddUserDataRuleReq(accessUser.getUserId(), DataRuleType.EXAM, saved.getId()));
|
|
|
+ userDataRuleCloudService
|
|
|
+ .addUserDataRule(new AddUserDataRuleReq(accessUser.getUserId(), DataRuleType.EXAM, saved.getId()));
|
|
|
}
|
|
|
|
|
|
return saved;
|
|
@@ -757,8 +758,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
if (specialSettingsType.equals(ExamSpecialSettingsType.ORG_BASED)) {
|
|
|
|
|
|
- ExamOrgSettingsCacheBean examOrgSettings = CacheHelper.getExamOrgSettings(examId,
|
|
|
- orgId);
|
|
|
+ ExamOrgSettingsCacheBean examOrgSettings = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
|
|
|
if (null != examOrgSettings.getBeginTime()) {
|
|
|
domain.setBeginTime(examOrgSettings.getBeginTime());
|
|
@@ -779,8 +779,8 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
} else if (specialSettingsType.equals(ExamSpecialSettingsType.STUDENT_BASED)) {
|
|
|
|
|
|
- ExamStudentSettingsCacheBean examStudentSettings = CacheHelper
|
|
|
- .getExamStudentSettings(examId, studentId);
|
|
|
+ ExamStudentSettingsCacheBean examStudentSettings = CacheHelper.getExamStudentSettings(examId,
|
|
|
+ studentId);
|
|
|
|
|
|
if (null != examStudentSettings.getBeginTime()) {
|
|
|
domain.setBeginTime(examStudentSettings.getBeginTime());
|
|
@@ -808,7 +808,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "查询考生的考试批次属性集")
|
|
|
@GetMapping("getExamPropertyFromCacheByStudentSession/{examId}/{keys}")
|
|
|
public Map<String, String> getExamPropertyFromCacheByStudentSession(@PathVariable Long examId,
|
|
|
- @PathVariable String keys) {
|
|
|
+ @PathVariable String keys) {
|
|
|
|
|
|
String[] keyArray = StringUtils.splitByWholeSeparator(keys, ",");
|
|
|
|
|
@@ -837,16 +837,14 @@ public class ExamController extends ControllerSupport {
|
|
|
if (specialSettingsEnabled || null != specialSettingsType) {
|
|
|
if (specialSettingsType.equals(ExamSpecialSettingsType.ORG_BASED)) {
|
|
|
for (String key : keyArray) {
|
|
|
- ExamOrgPropertyCacheBean propCache = CacheHelper.getExamOrgProperty(examId,
|
|
|
- orgId, key);
|
|
|
+ ExamOrgPropertyCacheBean propCache = CacheHelper.getExamOrgProperty(examId, orgId, key);
|
|
|
if (StringUtils.isNotBlank(propCache.getValue())) {
|
|
|
map.put(key, propCache.getValue());
|
|
|
}
|
|
|
}
|
|
|
} else if (specialSettingsType.equals(ExamSpecialSettingsType.STUDENT_BASED)) {
|
|
|
for (String key : keyArray) {
|
|
|
- ExamStudentPropertyCacheBean propCache = CacheHelper
|
|
|
- .getExamStudentProperty(examId, studentId, key);
|
|
|
+ ExamStudentPropertyCacheBean propCache = CacheHelper.getExamStudentProperty(examId, studentId, key);
|
|
|
if (StringUtils.isNotBlank(propCache.getValue())) {
|
|
|
map.put(key, propCache.getValue());
|
|
|
}
|
|
@@ -890,8 +888,7 @@ public class ExamController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询考试批次多个属性")
|
|
|
@GetMapping("propertys/{examId}/{keys}")
|
|
|
- public Map<String, String> getExamPropertyList(@PathVariable Long examId,
|
|
|
- @PathVariable String 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) {
|
|
@@ -920,8 +917,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("001250", "examId is wrong");
|
|
@@ -944,8 +940,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@PutMapping("enable/{ids}")
|
|
|
@Transactional
|
|
|
public void enableExam(@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);
|
|
@@ -988,8 +983,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@PutMapping("disable/{ids}")
|
|
|
@Transactional
|
|
|
public void disableExam(@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);
|
|
@@ -1040,8 +1034,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "查询考试相关的学习中心设置", notes = "")
|
|
|
@GetMapping("getExamOrgSettingsList/{curPage}/{pageSize}")
|
|
|
public PageInfo<ExamOrgSettingsDomain> getExamOrgSettingsList(@PathVariable Integer curPage,
|
|
|
- @PathVariable Integer pageSize,
|
|
|
- @ModelAttribute ExamOrgSettingsDomain examOrgDomain) {
|
|
|
+ @PathVariable Integer pageSize, @ModelAttribute ExamOrgSettingsDomain examOrgDomain) {
|
|
|
|
|
|
Long examId = examOrgDomain.getExamId();
|
|
|
if (null == examOrgDomain.getExamId()) {
|
|
@@ -1068,10 +1061,8 @@ public class ExamController extends ControllerSupport {
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
|
- Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime",
|
|
|
- "id");
|
|
|
- Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification,
|
|
|
- pageable);
|
|
|
+ Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime", "id");
|
|
|
+ Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification, pageable);
|
|
|
|
|
|
Iterator<ExamSpecialSettingsEntity> iterator = page.iterator();
|
|
|
List<ExamOrgSettingsDomain> domainList = Lists.newArrayList();
|
|
@@ -1097,8 +1088,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();
|
|
@@ -1140,8 +1131,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "更新考试相关的学习中心设置", notes = "")
|
|
|
@PutMapping("examOrgSettings")
|
|
|
@Transactional
|
|
|
- public ExamSpecialSettingsEntity updateExamOrgSettings(
|
|
|
- @RequestBody ExamOrgSettingsDomain domain) {
|
|
|
+ public ExamSpecialSettingsEntity updateExamOrgSettings(@RequestBody ExamOrgSettingsDomain domain) {
|
|
|
return saveExamOrgSettings(domain);
|
|
|
}
|
|
|
|
|
@@ -1228,14 +1218,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()) {
|
|
@@ -1248,17 +1236,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);
|
|
@@ -1270,7 +1256,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@PostMapping("importExamOrgSettings/{examId}")
|
|
|
@Transactional
|
|
|
public Map<String, Object> importExamOrgSettings(@PathVariable Long examId,
|
|
|
- @RequestParam CommonsMultipartFile file) {
|
|
|
+ @RequestParam CommonsMultipartFile file) {
|
|
|
|
|
|
ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
if (null == exam) {
|
|
@@ -1281,8 +1267,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
|
File storeLocation = item.getStoreLocation();
|
|
|
- List<Map<String, Object>> failRecords = examService.importExamOrgSettings(examId,
|
|
|
- storeLocation);
|
|
|
+ List<Map<String, Object>> failRecords = examService.importExamOrgSettings(examId, storeLocation);
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
map.put("hasError", CollectionUtils.isNotEmpty(failRecords));
|
|
|
map.put("failRecords", failRecords);
|
|
@@ -1359,7 +1344,7 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "ip限制分页", notes = "ip限制分页")
|
|
|
@GetMapping("ipLimited/page/{curPage}/{pageSize}")
|
|
|
public PageInfo<ExamIpLimitInfo> ipLimited(@PathVariable Integer curPage, @PathVariable Integer pageSize,
|
|
|
- Long examId, IpLimitType limitType, String ip) {
|
|
|
+ Long examId, IpLimitType limitType, String ip) {
|
|
|
return examService.pageIpLimited(curPage, pageSize, examId, limitType, ip);
|
|
|
}
|
|
|
|
|
@@ -1402,8 +1387,7 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
@ApiOperation(value = "导入考试ip限制", notes = "导入")
|
|
|
@PostMapping("ipLimited/import/{examId}")
|
|
|
- public Map<String, Object> importExamIpLimit(@PathVariable Long examId,
|
|
|
- @RequestParam CommonsMultipartFile file) {
|
|
|
+ public Map<String, Object> importExamIpLimit(@PathVariable Long examId, @RequestParam CommonsMultipartFile file) {
|
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
|
File storeLocation = item.getStoreLocation();
|
|
|
|
|
@@ -1442,22 +1426,23 @@ public class ExamController extends ControllerSupport {
|
|
|
msg.append(" IP地址不能为空");
|
|
|
hasError = true;
|
|
|
} else {
|
|
|
-// String reg = "^(?:(?:1[0-9][0-9]\\.)|(?:2[0-4][0-9]\\.)|(?:25[0-5]\\.)|(?:[1-9][0-9]\\.)|(?:[0-9/*]\\.)){3}(?:(?:1[0-9][0-9])|(?:2[0-4][0-9])|(?:25[0-5])|(?:[1-9][0-9])|(?:[0-9/*]))$";
|
|
|
-// Pattern pattern = Pattern.compile(reg);
|
|
|
-// Matcher matcher = pattern.matcher(ip);
|
|
|
-// if (matcher.find()) {
|
|
|
-// entity.setIp(ip);
|
|
|
-// } else {
|
|
|
-// msg.append(" ip格式不正确");
|
|
|
-// hasError = true;
|
|
|
-// }
|
|
|
- try {
|
|
|
- IpUtil.checkIp(ip);
|
|
|
- entity.setIp(ip);
|
|
|
- } catch (StatusException e) {
|
|
|
- msg.append(" "+e.getDesc());
|
|
|
- hasError = true;
|
|
|
- }
|
|
|
+ // String reg =
|
|
|
+ // "^(?:(?:1[0-9][0-9]\\.)|(?:2[0-4][0-9]\\.)|(?:25[0-5]\\.)|(?:[1-9][0-9]\\.)|(?:[0-9/*]\\.)){3}(?:(?:1[0-9][0-9])|(?:2[0-4][0-9])|(?:25[0-5])|(?:[1-9][0-9])|(?:[0-9/*]))$";
|
|
|
+ // Pattern pattern = Pattern.compile(reg);
|
|
|
+ // Matcher matcher = pattern.matcher(ip);
|
|
|
+ // if (matcher.find()) {
|
|
|
+ // entity.setIp(ip);
|
|
|
+ // } else {
|
|
|
+ // msg.append(" ip格式不正确");
|
|
|
+ // hasError = true;
|
|
|
+ // }
|
|
|
+ try {
|
|
|
+ IpUtil.checkIp(ip);
|
|
|
+ entity.setIp(ip);
|
|
|
+ } catch (StatusException e) {
|
|
|
+ msg.append(" " + e.getDesc());
|
|
|
+ hasError = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isBlank(line[1])) {
|
|
@@ -1472,9 +1457,9 @@ public class ExamController extends ControllerSupport {
|
|
|
entity.setLimitType(ipLimitType);
|
|
|
|
|
|
// 备注
|
|
|
- if(line.length == columnCount && line[2] != null){
|
|
|
+ if (line.length == columnCount && line[2] != null) {
|
|
|
String remark = line[2];
|
|
|
- if(StringUtils.length(remark) > 30){
|
|
|
+ if (StringUtils.length(remark) > 30) {
|
|
|
msg.append(" 备注长度不能超过30个字");
|
|
|
hasError = true;
|
|
|
}
|
|
@@ -1518,14 +1503,13 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
for (ExamIpLimitEntity cur : list) {
|
|
|
String type = cur.getLimitType() == null ? "" : cur.getLimitType().getTitle();
|
|
|
- datas.add(new Object[]{cur.getIp(), type, cur.getRemark()});
|
|
|
+ datas.add(new Object[] { cur.getIp(), type, cur.getRemark() });
|
|
|
}
|
|
|
|
|
|
- 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(EXCEL_IP_LIMIT_HEADER, new Class[]{String.class, String.class, String.class}, datas,
|
|
|
+ ExcelWriter.write(EXCEL_IP_LIMIT_HEADER, new Class[] { String.class, String.class, String.class }, datas,
|
|
|
new File(filePath));
|
|
|
|
|
|
exportFile("Ip访问限制列表-" + getRootOrgId() + ".xlsx", file);
|
|
@@ -1633,10 +1617,9 @@ public class ExamController extends ControllerSupport {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- String IdentificationOfLivingBody =
|
|
|
- PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.IdentificationOfLivingBody.CODE;
|
|
|
- Boolean hasIdentificationOfLivingBodyFunction = PrivilegeManager
|
|
|
- .judge(examSettings.getRootOrgId(), IdentificationOfLivingBody);
|
|
|
+ String IdentificationOfLivingBody = PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.IdentificationOfLivingBody.CODE;
|
|
|
+ Boolean hasIdentificationOfLivingBodyFunction = PrivilegeManager.judge(examSettings.getRootOrgId(),
|
|
|
+ IdentificationOfLivingBody);
|
|
|
|
|
|
ExamPropertyCacheBean examConf = CacheHelper.getExamProperty(examId, "IS_FACE_VERIFY");
|
|
|
String examValue = examConf.getValue();
|
|
@@ -1658,9 +1641,8 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
@ApiOperation(value = "查询考试相关的学生设置", notes = "")
|
|
|
@GetMapping("getStudentSpecialSettingsList/{curPage}/{pageSize}")
|
|
|
- public PageInfo<StudentSpecialSettingsDomain> getStudentSpecialSettingsList(
|
|
|
- @PathVariable Integer curPage, @PathVariable Integer pageSize,
|
|
|
- @ModelAttribute StudentSpecialSettingsDomain domain) {
|
|
|
+ public PageInfo<StudentSpecialSettingsDomain> getStudentSpecialSettingsList(@PathVariable Integer curPage,
|
|
|
+ @PathVariable Integer pageSize, @ModelAttribute StudentSpecialSettingsDomain domain) {
|
|
|
|
|
|
Long examId = domain.getExamId();
|
|
|
if (null == domain.getExamId()) {
|
|
@@ -1693,10 +1675,8 @@ public class ExamController extends ControllerSupport {
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
|
- Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime",
|
|
|
- "id");
|
|
|
- Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification,
|
|
|
- pageable);
|
|
|
+ Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime", "id");
|
|
|
+ Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification, pageable);
|
|
|
|
|
|
Iterator<ExamSpecialSettingsEntity> iterator = page.iterator();
|
|
|
List<StudentSpecialSettingsDomain> domainList = Lists.newArrayList();
|