|
@@ -430,10 +430,13 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
ExamSpecialSettingsEntity examSpecialSettingsEntity = null;
|
|
ExamSpecialSettingsEntity examSpecialSettingsEntity = null;
|
|
|
|
|
|
|
|
+ Long rootOrgId = examSpecialInfo.getRootOrgId();
|
|
Long examId = examSpecialInfo.getExamId();
|
|
Long examId = examSpecialInfo.getExamId();
|
|
Date beginTime = examSpecialInfo.getBeginTime();
|
|
Date beginTime = examSpecialInfo.getBeginTime();
|
|
Date endTime = examSpecialInfo.getEndTime();
|
|
Date endTime = examSpecialInfo.getEndTime();
|
|
Long orgId = examSpecialInfo.getOrgId();
|
|
Long orgId = examSpecialInfo.getOrgId();
|
|
|
|
+ Long studentId = examSpecialInfo.getStudentId();
|
|
|
|
+ Long courseId = examSpecialInfo.getCourseId();
|
|
|
|
|
|
// 上锁
|
|
// 上锁
|
|
Object[] locker = new Object[]{"E_EXAM_SPECIAL_SETTINGS", examId};
|
|
Object[] locker = new Object[]{"E_EXAM_SPECIAL_SETTINGS", examId};
|
|
@@ -447,29 +450,28 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
if (null == examSpecialInfo.getId()) {
|
|
if (null == examSpecialInfo.getId()) {
|
|
// 机构特殊设置
|
|
// 机构特殊设置
|
|
- if (null != orgId) {
|
|
|
|
|
|
+ if (null != orgId && null == courseId && null == studentId) {
|
|
examSpecialSettingsEntity = examSpecialSettingsRepo
|
|
examSpecialSettingsEntity = examSpecialSettingsRepo
|
|
- .findByExamIdAndOrgIdAndCourseIdIsNull(examSpecialInfo.getExamId(),
|
|
|
|
- examSpecialInfo.getOrgId());
|
|
|
|
|
|
+ .findByExamIdAndOrgIdAndCourseIdIsNullAndStudentIdIsNull(
|
|
|
|
+ examSpecialInfo.getExamId(), examSpecialInfo.getOrgId());
|
|
|
|
+ }
|
|
|
|
+ // 学生特殊设置
|
|
|
|
+ else if (null == orgId && null == courseId && null != studentId) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 课程特殊设置
|
|
|
|
+ else if (null == orgId && null != courseId && null == studentId) {
|
|
|
|
+
|
|
}
|
|
}
|
|
// 考试设置
|
|
// 考试设置
|
|
- else {
|
|
|
|
- List<ExamSpecialSettingsEntity> all = examSpecialSettingsRepo
|
|
|
|
- .findAllByExamIdAndOrgIdIsNullAndCourseIdIsNull(
|
|
|
|
|
|
+ else if (null == orgId && null == courseId && null == studentId) {
|
|
|
|
+ examSpecialSettingsEntity = examSpecialSettingsRepo
|
|
|
|
+ .findAllByExamIdAndOrgIdIsNullAndCourseIdIsNullAndStudentIdIsNull(
|
|
examSpecialInfo.getExamId());
|
|
examSpecialInfo.getExamId());
|
|
- // 容错
|
|
|
|
- if (CollectionUtils.isNotEmpty(all)) {
|
|
|
|
- for (int i = 0; i < all.size(); i++) {
|
|
|
|
- ExamSpecialSettingsEntity cur = all.get(i);
|
|
|
|
- if (0 == i) {
|
|
|
|
- examSpecialSettingsEntity = cur;
|
|
|
|
- } else {
|
|
|
|
- examSpecialSettingsRepo.delete(cur);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ } else {
|
|
|
|
+ throw new StatusException("001501", "参数错误");
|
|
}
|
|
}
|
|
|
|
+
|
|
if (null == examSpecialSettingsEntity) {
|
|
if (null == examSpecialSettingsEntity) {
|
|
examSpecialSettingsEntity = new ExamSpecialSettingsEntity();
|
|
examSpecialSettingsEntity = new ExamSpecialSettingsEntity();
|
|
}
|
|
}
|
|
@@ -481,24 +483,29 @@ public class ExamServiceImpl implements ExamService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- examSpecialSettingsEntity.setBeginTime(examSpecialInfo.getBeginTime());
|
|
|
|
- examSpecialSettingsEntity.setEndTime(examSpecialInfo.getEndTime());
|
|
|
|
- examSpecialSettingsEntity.setRootOrgId(examSpecialInfo.getRootOrgId());
|
|
|
|
- examSpecialSettingsEntity.setExamId(examSpecialInfo.getExamId());
|
|
|
|
- examSpecialSettingsEntity.setOrgId(examSpecialInfo.getOrgId());
|
|
|
|
|
|
+ examSpecialSettingsEntity.setRootOrgId(rootOrgId);
|
|
|
|
+ examSpecialSettingsEntity.setExamId(examId);
|
|
examSpecialSettingsEntity.setExamType(examEntity.getExamType());
|
|
examSpecialSettingsEntity.setExamType(examEntity.getExamType());
|
|
examSpecialSettingsEntity.setExamEnable(examEntity.getEnable());
|
|
examSpecialSettingsEntity.setExamEnable(examEntity.getEnable());
|
|
|
|
+
|
|
|
|
+ examSpecialSettingsEntity.setOrgId(orgId);
|
|
|
|
+ examSpecialSettingsEntity.setCourseId(courseId);
|
|
|
|
+ examSpecialSettingsEntity.setStudentId(studentId);
|
|
|
|
+
|
|
|
|
+ examSpecialSettingsEntity.setBeginTime(examSpecialInfo.getBeginTime());
|
|
|
|
+ examSpecialSettingsEntity.setEndTime(examSpecialInfo.getEndTime());
|
|
|
|
+
|
|
Boolean examLimit = examSpecialInfo.getExamLimit();
|
|
Boolean examLimit = examSpecialInfo.getExamLimit();
|
|
examLimit = null == examLimit ? false : examLimit;
|
|
examLimit = null == examLimit ? false : examLimit;
|
|
examSpecialSettingsEntity.setExamLimit(examLimit);
|
|
examSpecialSettingsEntity.setExamLimit(examLimit);
|
|
|
|
|
|
ExamSpecialSettingsEntity saved = examSpecialSettingsRepo.save(examSpecialSettingsEntity);
|
|
ExamSpecialSettingsEntity saved = examSpecialSettingsRepo.save(examSpecialSettingsEntity);
|
|
|
|
|
|
- Map<String, String> orgProperties = examSpecialInfo.getOrgProperties();
|
|
|
|
|
|
+ Map<String, String> props = examSpecialInfo.getProperties();
|
|
|
|
|
|
- if (null != orgProperties) {
|
|
|
|
|
|
+ if (null != props) {
|
|
Map<DynamicEnum, String> map = checkAndGetExamProperties(examEntity.getRootOrgId(),
|
|
Map<DynamicEnum, String> map = checkAndGetExamProperties(examEntity.getRootOrgId(),
|
|
- orgProperties);
|
|
|
|
|
|
+ props);
|
|
|
|
|
|
for (Entry<DynamicEnum, String> entry : map.entrySet()) {
|
|
for (Entry<DynamicEnum, String> entry : map.entrySet()) {
|
|
DynamicEnum de = entry.getKey();
|
|
DynamicEnum de = entry.getKey();
|
|
@@ -508,17 +515,30 @@ public class ExamServiceImpl implements ExamService {
|
|
} else {
|
|
} else {
|
|
value = value.trim();
|
|
value = value.trim();
|
|
}
|
|
}
|
|
- ExamOrgPropertyEntity entity = examOrgPropertyRepo.findByExamIdAndOrgIdAndKeyId(
|
|
|
|
- saved.getExamId(), saved.getOrgId(), de.getId());
|
|
|
|
- if (null == entity) {
|
|
|
|
- entity = new ExamOrgPropertyEntity();
|
|
|
|
- entity.setExamId(saved.getExamId());
|
|
|
|
- entity.setOrgId(saved.getOrgId());
|
|
|
|
- entity.setKeyId(de.getId());
|
|
|
|
|
|
+
|
|
|
|
+ // 机构特殊设置
|
|
|
|
+ if (null != orgId && null == courseId && null == studentId) {
|
|
|
|
+ ExamOrgPropertyEntity entity = examOrgPropertyRepo.findByExamIdAndOrgIdAndKeyId(
|
|
|
|
+ saved.getExamId(), saved.getOrgId(), de.getId());
|
|
|
|
+ if (null == entity) {
|
|
|
|
+ entity = new ExamOrgPropertyEntity();
|
|
|
|
+ entity.setExamId(saved.getExamId());
|
|
|
|
+ entity.setOrgId(saved.getOrgId());
|
|
|
|
+ entity.setKeyId(de.getId());
|
|
|
|
+ }
|
|
|
|
+ entity.setValue(value);
|
|
|
|
+
|
|
|
|
+ examOrgPropertyRepo.save(entity);
|
|
|
|
+ }
|
|
|
|
+ // 学生特殊设置
|
|
|
|
+ else if (null == orgId && null == courseId && null != studentId) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 课程特殊设置
|
|
|
|
+ else if (null == orgId && null != courseId && null == studentId) {
|
|
|
|
+
|
|
}
|
|
}
|
|
- entity.setValue(value);
|
|
|
|
|
|
|
|
- examOrgPropertyRepo.save(entity);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -548,7 +568,7 @@ public class ExamServiceImpl implements ExamService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Map<String, Object>> importExamSpecialSettings(Long examId, File file) {
|
|
|
|
|
|
+ public List<Map<String, Object>> importExamOrgSettings(Long examId, File file) {
|
|
|
|
|
|
ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
List<String[]> lineList = null;
|
|
List<String[]> lineList = null;
|
|
@@ -661,7 +681,8 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
for (ExamSpecialSettingsEntity cur : specialSettingsList) {
|
|
for (ExamSpecialSettingsEntity cur : specialSettingsList) {
|
|
ExamSpecialSettingsEntity query = examSpecialSettingsRepo
|
|
ExamSpecialSettingsEntity query = examSpecialSettingsRepo
|
|
- .findByExamIdAndOrgIdAndCourseIdIsNull(examId, cur.getOrgId());
|
|
|
|
|
|
+ .findByExamIdAndOrgIdAndCourseIdIsNullAndStudentIdIsNull(examId,
|
|
|
|
+ cur.getOrgId());
|
|
|
|
|
|
if (null != query) {
|
|
if (null != query) {
|
|
query.setExamType(examEntity.getExamType());
|
|
query.setExamType(examEntity.getExamType());
|