|
@@ -87,6 +87,7 @@ public class TEExamController {
|
|
}
|
|
}
|
|
TEExam teExam = null;
|
|
TEExam teExam = null;
|
|
Long oldId = null;
|
|
Long oldId = null;
|
|
|
|
+ String activityCode = null;
|
|
try {
|
|
try {
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg();
|
|
TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg();
|
|
@@ -153,7 +154,8 @@ public class TEExamController {
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
TEExamActivity teExamActivity = new TEExamActivity(teExam.getId(), teExam.getPrepareSeconds(), teExam.getMaxDurationSeconds(), teExam.getOpeningSeconds(), teExam.getStartTime(), teExam.getEndTime(), tbUser.getId());
|
|
TEExamActivity teExamActivity = new TEExamActivity(teExam.getId(), teExam.getPrepareSeconds(), teExam.getMaxDurationSeconds(), teExam.getOpeningSeconds(), teExam.getStartTime(), teExam.getEndTime(), tbUser.getId());
|
|
- teExamActivity.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence()));
|
|
|
|
|
|
+ teExamActivity.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence(teExam.getId())));
|
|
|
|
+ activityCode = teExamActivity.getCode();
|
|
teExamActivity.setEnable(1);
|
|
teExamActivity.setEnable(1);
|
|
teExamActivityService.saveOrUpdate(teExamActivity);
|
|
teExamActivityService.saveOrUpdate(teExamActivity);
|
|
|
|
|
|
@@ -169,6 +171,9 @@ public class TEExamController {
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ if (Objects.nonNull(teExam) && Objects.nonNull(teExam.getId()) && Objects.nonNull(activityCode)) {
|
|
|
|
+ redisUtil.setRedisActivityCodeSequence(teExam.getId(), Integer.parseInt(activityCode) - 1);
|
|
|
|
+ }
|
|
if (e instanceof DuplicateKeyException) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
String errorColumn = e.getCause().toString();
|
|
String errorColumn = e.getCause().toString();
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
@@ -277,6 +282,7 @@ public class TEExamController {
|
|
if (Objects.isNull(teExam)) {
|
|
if (Objects.isNull(teExam)) {
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_NO);
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_NO);
|
|
}
|
|
}
|
|
|
|
+ List<TEExamActivity> teExamActivityList = null;
|
|
try {
|
|
try {
|
|
teExam.setId(null);
|
|
teExam.setId(null);
|
|
teExam.setUpdateId(null);
|
|
teExam.setUpdateId(null);
|
|
@@ -289,7 +295,7 @@ public class TEExamController {
|
|
|
|
|
|
QueryWrapper<TEExamActivity> teExamActivityQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TEExamActivity> teExamActivityQueryWrapper = new QueryWrapper<>();
|
|
teExamActivityQueryWrapper.lambda().eq(TEExamActivity::getExamId, examId);
|
|
teExamActivityQueryWrapper.lambda().eq(TEExamActivity::getExamId, examId);
|
|
- List<TEExamActivity> teExamActivityList = teExamActivityService.list(teExamActivityQueryWrapper);
|
|
|
|
|
|
+ teExamActivityList = teExamActivityService.list(teExamActivityQueryWrapper);
|
|
if (Objects.nonNull(teExamActivityList)) {
|
|
if (Objects.nonNull(teExamActivityList)) {
|
|
teExamActivityList.forEach(s -> {
|
|
teExamActivityList.forEach(s -> {
|
|
s.setId(null);
|
|
s.setId(null);
|
|
@@ -297,12 +303,15 @@ public class TEExamController {
|
|
s.setCreateId(teExam.getCreateId());
|
|
s.setCreateId(teExam.getCreateId());
|
|
s.setUpdateId(null);
|
|
s.setUpdateId(null);
|
|
s.setUpdateTime(null);
|
|
s.setUpdateTime(null);
|
|
- s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence()));
|
|
|
|
|
|
+ s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence(teExam.getId())));
|
|
});
|
|
});
|
|
teExamActivityService.saveOrUpdateBatch(teExamActivityList);
|
|
teExamActivityService.saveOrUpdateBatch(teExamActivityList);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ if (Objects.nonNull(examId) && Objects.nonNull(teExam.getId()) && (Objects.nonNull(teExamActivityList) && teExamActivityList.size() > 0 && Objects.nonNull(teExamActivityList.get(0)))) {
|
|
|
|
+ redisUtil.setRedisActivityCodeSequence(examId, Integer.parseInt(teExamActivityList.get(0).getCode()) - 1);
|
|
|
|
+ }
|
|
if (e instanceof DuplicateKeyException) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
String errorColumn = e.getCause().toString();
|
|
String errorColumn = e.getCause().toString();
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|