|
@@ -88,13 +88,15 @@ import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.ExamService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamInfo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamSpecialSettingsInfo;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.cache.ExamSettingsCache;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.impl.ExamStudentServiceImpl;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.ExamOrgSettingsCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.ExamOrgPropertyCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamOrgSettingsCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
|
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
|
import cn.com.qmth.examcloud.task.api.request.SyncExamReq;
|
|
@@ -161,6 +163,9 @@ public class ExamController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
DataSyncCloudService dataSyncCloudService;
|
|
|
|
|
|
+ @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"};
|
|
|
|
|
@@ -454,26 +459,24 @@ public class ExamController extends ControllerSupport {
|
|
|
@ApiOperation(value = "按ID查询考试批次", notes = "ID查询")
|
|
|
@GetMapping("{examId}")
|
|
|
public ExamDomain getExamById(@PathVariable Long examId) {
|
|
|
- ExamEntity one = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
- if (null == one) {
|
|
|
- throw new StatusException("001250", "examId is wrong");
|
|
|
- }
|
|
|
- validateRootOrgIsolation(one.getRootOrgId());
|
|
|
+
|
|
|
+ ExamSettingsCacheBean cache = examSettingsCache.get(examId);
|
|
|
+ validateRootOrgIsolation(cache.getRootOrgId());
|
|
|
|
|
|
ExamDomain domain = new ExamDomain();
|
|
|
- domain.setBeginTime(one.getBeginTime());
|
|
|
- domain.setDuration(one.getDuration());
|
|
|
- domain.setEnable(one.getEnable());
|
|
|
- domain.setEndTime(one.getEndTime());
|
|
|
- domain.setExamTimes(one.getExamTimes());
|
|
|
- domain.setExamType(one.getExamType());
|
|
|
- domain.setId(one.getId());
|
|
|
- domain.setName(one.getName());
|
|
|
- domain.setCode(one.getCode());
|
|
|
- domain.setRemark(one.getRemark());
|
|
|
- domain.setRootOrgId(one.getRootOrgId());
|
|
|
- domain.setStarted(isStarted(one.getId()));
|
|
|
- domain.setExamLimit(one.getExamLimit());
|
|
|
+ domain.setBeginTime(cache.getBeginTime());
|
|
|
+ domain.setDuration(cache.getDuration());
|
|
|
+ domain.setEnable(cache.getEnable());
|
|
|
+ domain.setEndTime(cache.getEndTime());
|
|
|
+ domain.setExamTimes(cache.getExamTimes());
|
|
|
+ domain.setExamType(ExamType.valueOf(cache.getExamType()));
|
|
|
+ domain.setId(cache.getId());
|
|
|
+ domain.setName(cache.getName());
|
|
|
+ domain.setCode(cache.getCode());
|
|
|
+ domain.setRemark(cache.getRemark());
|
|
|
+ domain.setRootOrgId(cache.getRootOrgId());
|
|
|
+ domain.setStarted(isStarted(cache.getId()));
|
|
|
+ domain.setExamLimit(cache.getExamLimit());
|
|
|
return domain;
|
|
|
}
|
|
|
|
|
@@ -556,6 +559,8 @@ public class ExamController extends ControllerSupport {
|
|
|
|
|
|
ExamEntity saved = examService.saveExam(examInfo, es);
|
|
|
|
|
|
+ examSettingsCache.remove(saved.getId());
|
|
|
+
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
@@ -662,9 +667,8 @@ public class ExamController extends ControllerSupport {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询考生的考试批次配置")
|
|
|
- @GetMapping("examConfigFromCache4StudentSession/{examId}")
|
|
|
- public ExamOrgSettingsCacheBean getExamConfigFromCacheByStudentSession(
|
|
|
- @PathVariable Long examId) {
|
|
|
+ @GetMapping("examOrgSettingsFromCacheByStudentSession/{examId}")
|
|
|
+ public ExamDomain getExamOrgSettingsFromCacheByStudentSession(@PathVariable Long examId) {
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
|
if (!accessUser.getUserType().equals(UserType.STUDENT)) {
|
|
@@ -676,13 +680,27 @@ public class ExamController extends ControllerSupport {
|
|
|
StudentCacheBean student = CacheHelper.getStudent(studentId);
|
|
|
Long orgId = student.getOrgId();
|
|
|
|
|
|
- ExamOrgSettingsCacheBean orgExamConfig = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
- return orgExamConfig;
|
|
|
+ ExamOrgSettingsCacheBean examCache = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
+
|
|
|
+ ExamDomain domain = new ExamDomain();
|
|
|
+ domain.setBeginTime(examCache.getBeginTime());
|
|
|
+ domain.setDuration(examCache.getDuration());
|
|
|
+ domain.setEnable(examCache.getEnable());
|
|
|
+ domain.setEndTime(examCache.getEndTime());
|
|
|
+ domain.setExamTimes(examCache.getExamTimes());
|
|
|
+ domain.setExamType(ExamType.valueOf(examCache.getExamType()));
|
|
|
+ domain.setId(examCache.getId());
|
|
|
+ domain.setName(examCache.getName());
|
|
|
+ domain.setRemark(examCache.getRemark());
|
|
|
+ domain.setRootOrgId(examCache.getRootOrgId());
|
|
|
+ domain.setStarted(examCache.getBeginTime().before(new Date()));
|
|
|
+
|
|
|
+ return domain;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询考生的考试批次属性集")
|
|
|
- @GetMapping("examPropertyFromCache4StudentSession/{examId}/{keys}")
|
|
|
- public Map<String, String> getExamPropertyFromCacheByStudentSession(@PathVariable Long examId,
|
|
|
+ @GetMapping("examOrgPropertyFromCache4StudentSession/{examId}/{keys}")
|
|
|
+ public Map<String, String> examOrgPropertyFromCache4StudentSession(@PathVariable Long examId,
|
|
|
@PathVariable String keys) {
|
|
|
|
|
|
String[] keyArray = StringUtils.splitByWholeSeparator(keys, ",");
|
|
@@ -761,29 +779,6 @@ public class ExamController extends ControllerSupport {
|
|
|
return properties;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询考生考试批次单个属性")
|
|
|
- @GetMapping("examOrgProperty/{examId}/{key}")
|
|
|
- public String getExamOrgProperty(@PathVariable Long examId, @PathVariable String key) {
|
|
|
- User accessUser = getAccessUser();
|
|
|
- ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
- if (null == examEntity) {
|
|
|
- throw new StatusException("001250", "examId is wrong");
|
|
|
- }
|
|
|
- validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
-
|
|
|
- StudentBean student = getStudent(accessUser.getUserId());
|
|
|
- Long orgId = student.getOrgId();
|
|
|
-
|
|
|
- return examService.getOrgProperty(examId, orgId, key);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|
|
@@ -848,6 +843,10 @@ public class ExamController extends ControllerSupport {
|
|
|
dataSyncCloudService.syncExam(req);
|
|
|
}
|
|
|
|
|
|
+ for (Long examId : examIds) {
|
|
|
+ examSettingsCache.remove(examId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "禁用考试", notes = "禁用考试")
|
|
@@ -885,6 +884,10 @@ public class ExamController extends ControllerSupport {
|
|
|
dataSyncCloudService.syncExam(req);
|
|
|
}
|
|
|
|
|
|
+ for (Long examId : examIds) {
|
|
|
+ examSettingsCache.remove(examId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -972,50 +975,6 @@ public class ExamController extends ControllerSupport {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "查询考生考试机构配置", notes = "")
|
|
|
- @PostMapping("examOrgSettings/{examId}")
|
|
|
- public ExamDomain getExamOrgSettings(@PathVariable Long examId) {
|
|
|
- User accessUser = getAccessUser();
|
|
|
- ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
- if (null == examEntity) {
|
|
|
- throw new StatusException("001250", "examId is wrong");
|
|
|
- }
|
|
|
- validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
-
|
|
|
- StudentBean student = getStudent(accessUser.getUserId());
|
|
|
- Long orgId = student.getOrgId();
|
|
|
-
|
|
|
- ExamSpecialSettingsEntity examOrgEntity = examSpecialSettingsRepo
|
|
|
- .findByExamIdAndOrgIdAndCourseIdIsNull(examId, orgId);
|
|
|
-
|
|
|
- ExamDomain domain = new ExamDomain();
|
|
|
- domain.setBeginTime(examEntity.getBeginTime());
|
|
|
- domain.setDuration(examEntity.getDuration());
|
|
|
- domain.setEnable(examEntity.getEnable());
|
|
|
- domain.setEndTime(examEntity.getEndTime());
|
|
|
- domain.setExamTimes(examEntity.getExamTimes());
|
|
|
- domain.setExamType(examEntity.getExamType());
|
|
|
- domain.setId(examEntity.getId());
|
|
|
- domain.setName(examEntity.getName());
|
|
|
- domain.setRemark(examEntity.getRemark());
|
|
|
- domain.setRootOrgId(examEntity.getRootOrgId());
|
|
|
- domain.setStarted(examEntity.getBeginTime().before(new Date()));
|
|
|
-
|
|
|
- if (null != examOrgEntity) {
|
|
|
- if (null != examOrgEntity.getBeginTime()) {
|
|
|
- domain.setBeginTime(examOrgEntity.getBeginTime());
|
|
|
- }
|
|
|
- if (null != examOrgEntity.getEndTime()) {
|
|
|
- domain.setEndTime(examOrgEntity.getEndTime());
|
|
|
- }
|
|
|
- if (null != examOrgEntity.getExamLimit()) {
|
|
|
- domain.setExamLimit(examOrgEntity.getExamLimit());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return domain;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|