|
@@ -641,7 +641,7 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
List<Map<String, Object>> failRecords = Collections
|
|
|
.synchronizedList(new ArrayList<Map<String, Object>>());
|
|
|
- List<ExamSpecialSettingsEntity> specialSettingsList = Lists.newArrayList();
|
|
|
+ List<ExamSpecialSettingsInfo> specialSettingsList = Lists.newArrayList();
|
|
|
|
|
|
for (int i = 0; i < lineList.size(); i++) {
|
|
|
String[] line = lineList.get(i);
|
|
@@ -655,9 +655,9 @@ public class ExamServiceImpl implements ExamService {
|
|
|
boolean hasError = false;
|
|
|
StringBuilder msg = new StringBuilder();
|
|
|
|
|
|
- ExamSpecialSettingsEntity specialSettings = new ExamSpecialSettingsEntity();
|
|
|
- specialSettings.setRootOrgId(examEntity.getRootOrgId());
|
|
|
- specialSettings.setExamId(examId);
|
|
|
+ ExamSpecialSettingsInfo examSpecialInfo = new ExamSpecialSettingsInfo();
|
|
|
+ examSpecialInfo.setRootOrgId(examEntity.getRootOrgId());
|
|
|
+ examSpecialInfo.setExamId(examId);
|
|
|
|
|
|
String orgId = trimAndNullIfBlank(line[0]);
|
|
|
if (StringUtils.isBlank(orgId)) {
|
|
@@ -677,7 +677,7 @@ public class ExamServiceImpl implements ExamService {
|
|
|
msg.append(" 学习中心ID非法");
|
|
|
hasError = true;
|
|
|
} else {
|
|
|
- specialSettings.setOrgId(orgIdLong);
|
|
|
+ examSpecialInfo.setOrgId(orgIdLong);
|
|
|
}
|
|
|
} catch (NumberFormatException e) {
|
|
|
msg.append(" 学习中心ID必须为整数");
|
|
@@ -688,22 +688,22 @@ public class ExamServiceImpl implements ExamService {
|
|
|
String examLimit = trimAndNullIfBlank(line[3]);
|
|
|
if (StringUtils.isNotBlank(examLimit)) {
|
|
|
if (examLimit.equals("是")) {
|
|
|
- specialSettings.setExamLimit(false);
|
|
|
+ examSpecialInfo.setExamLimit(false);
|
|
|
} else if (examLimit.equals("否")) {
|
|
|
- specialSettings.setExamLimit(true);
|
|
|
+ examSpecialInfo.setExamLimit(true);
|
|
|
} else {
|
|
|
msg.append(" 是否可以开始考试必须为['是','否',空]");
|
|
|
hasError = true;
|
|
|
}
|
|
|
} else {
|
|
|
- specialSettings.setExamLimit(false);
|
|
|
+ examSpecialInfo.setExamLimit(false);
|
|
|
}
|
|
|
|
|
|
String beginTime = trimAndNullIfBlank(line[4]);
|
|
|
if (StringUtils.isNotBlank(beginTime)) {
|
|
|
try {
|
|
|
Date beginDate = DateUtil.parse(beginTime, DatePatterns.CHINA_DEFAULT);
|
|
|
- specialSettings.setBeginTime(beginDate);
|
|
|
+ examSpecialInfo.setBeginTime(beginDate);
|
|
|
} catch (Exception e) {
|
|
|
msg.append(" 开始考试时间格式错误. 正确格式为 " + DatePatterns.CHINA_DEFAULT);
|
|
|
hasError = true;
|
|
@@ -713,7 +713,7 @@ public class ExamServiceImpl implements ExamService {
|
|
|
if (StringUtils.isNotBlank(endTime)) {
|
|
|
try {
|
|
|
Date endDate = DateUtil.parse(endTime, DatePatterns.CHINA_DEFAULT);
|
|
|
- specialSettings.setEndTime(endDate);
|
|
|
+ examSpecialInfo.setEndTime(endDate);
|
|
|
} catch (Exception e) {
|
|
|
msg.append(" 结束考试时间格式错误. 正确格式为 " + DatePatterns.CHINA_DEFAULT);
|
|
|
hasError = true;
|
|
@@ -723,7 +723,7 @@ public class ExamServiceImpl implements ExamService {
|
|
|
if (hasError) {
|
|
|
failRecords.add(newError(i + 1, msg.toString()));
|
|
|
} else {
|
|
|
- specialSettingsList.add(specialSettings);
|
|
|
+ specialSettingsList.add(examSpecialInfo);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -732,23 +732,8 @@ public class ExamServiceImpl implements ExamService {
|
|
|
return failRecords;
|
|
|
}
|
|
|
|
|
|
- for (ExamSpecialSettingsEntity cur : specialSettingsList) {
|
|
|
- ExamSpecialSettingsEntity query = examSpecialSettingsRepo
|
|
|
- .findByExamIdAndOrgIdAndCourseIdIsNullAndStudentIdIsNull(examId,
|
|
|
- cur.getOrgId());
|
|
|
-
|
|
|
- if (null != query) {
|
|
|
- query.setExamType(examEntity.getExamType());
|
|
|
- query.setExamEnable(examEntity.getEnable());
|
|
|
- query.setExamLimit(cur.getExamLimit());
|
|
|
- query.setBeginTime(cur.getBeginTime());
|
|
|
- query.setEndTime(cur.getEndTime());
|
|
|
- examSpecialSettingsRepo.save(query);
|
|
|
- } else {
|
|
|
- cur.setExamType(examEntity.getExamType());
|
|
|
- cur.setExamEnable(examEntity.getEnable());
|
|
|
- examSpecialSettingsRepo.save(cur);
|
|
|
- }
|
|
|
+ for (ExamSpecialSettingsInfo cur : specialSettingsList) {
|
|
|
+ saveExamSpecialSettings(cur);
|
|
|
}
|
|
|
|
|
|
return failRecords;
|