|
@@ -50,7 +50,9 @@ import java.util.stream.Collectors;
|
|
* @Date: 2020/6/25
|
|
* @Date: 2020/6/25
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
-public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper, TEExamActivity> implements TEExamActivityService {
|
|
|
|
|
|
+public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper, TEExamActivity>
|
|
|
|
+ implements TEExamActivityService {
|
|
|
|
+
|
|
private final static Logger log = LoggerFactory.getLogger(TEExamActivityServiceImpl.class);
|
|
private final static Logger log = LoggerFactory.getLogger(TEExamActivityServiceImpl.class);
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -152,7 +154,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public IPage<TEExamActivityQueryDto> examActivityQuery(IPage<Map> iPage, Long id, Long examId, String code, Long startDate, Long finishDate) {
|
|
|
|
|
|
+ public IPage<TEExamActivityQueryDto> examActivityQuery(IPage<Map> iPage, Long id, Long examId, String code,
|
|
|
|
+ Long startDate, Long finishDate) {
|
|
return teExamActivityMapper.examActivityQuery(iPage, id, examId, code, startDate, finishDate);
|
|
return teExamActivityMapper.examActivityQuery(iPage, id, examId, code, startDate, finishDate);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -178,19 +181,18 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public TEExamActivityDto getWaitingExam(Long examActivityId, Long examStudentId, String courseCode, String prefix, Long recordId) {
|
|
|
|
|
|
+ public TEExamActivityDto getWaitingExam(Long examActivityId, Long examStudentId, String courseCode, String prefix,
|
|
|
|
+ Long recordId) {
|
|
TEExamActivityDto teExamActivityDto = teExamActivityMapper.getWaitingExamByExamActivityId(examActivityId);
|
|
TEExamActivityDto teExamActivityDto = teExamActivityMapper.getWaitingExamByExamActivityId(examActivityId);
|
|
ExamCacheBean examCache = teExamService.getExamCacheBean(teExamActivityDto.getExamId());
|
|
ExamCacheBean examCache = teExamService.getExamCacheBean(teExamActivityDto.getExamId());
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService
|
|
|
|
- .getExamStudentCacheBean(examStudentId);
|
|
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
teExamActivityDto.setLeftExamCount(
|
|
teExamActivityDto.setLeftExamCount(
|
|
- (examCache.getExamCount().intValue() - (examStudentCacheBean.getAlreadyExamCount().intValue())
|
|
|
|
- < 0 ?
|
|
|
|
|
|
+ (examCache.getExamCount().intValue() - (examStudentCacheBean.getAlreadyExamCount().intValue()) < 0 ?
|
|
0 :
|
|
0 :
|
|
- examCache.getExamCount().intValue() - (examStudentCacheBean.getAlreadyExamCount()
|
|
|
|
- .intValue())));
|
|
|
|
|
|
+ examCache.getExamCount().intValue() - (examStudentCacheBean.getAlreadyExamCount().intValue())));
|
|
if (Objects.nonNull(teExamActivityDto.getInProcessLivenessFixedRangeStr())) {
|
|
if (Objects.nonNull(teExamActivityDto.getInProcessLivenessFixedRangeStr())) {
|
|
- String[] longs = teExamActivityDto.getInProcessLivenessFixedRangeStr().trim().replaceAll(" ", "").split(",");
|
|
|
|
|
|
+ String[] longs = teExamActivityDto.getInProcessLivenessFixedRangeStr().trim().replaceAll(" ", "")
|
|
|
|
+ .split(",");
|
|
List inProcessLivenessFixedRange = new ArrayList();
|
|
List inProcessLivenessFixedRange = new ArrayList();
|
|
for (int i = 0; i < longs.length; i++) {
|
|
for (int i = 0; i < longs.length; i++) {
|
|
Integer integer = Integer.valueOf(longs[i].trim());
|
|
Integer integer = Integer.valueOf(longs[i].trim());
|
|
@@ -203,63 +205,77 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//取course缓存
|
|
//取course缓存
|
|
- ExamCourseCacheBean examCourseCacheBean = teExamCourseService
|
|
|
|
- .getExamCourseCacheBean(teExamActivityDto.getExamId(), courseCode);
|
|
|
|
|
|
+ ExamCourseCacheBean examCourseCacheBean = teExamCourseService.getExamCourseCacheBean(
|
|
|
|
+ teExamActivityDto.getExamId(), courseCode);
|
|
if (Objects.nonNull(examCourseCacheBean) && Objects.nonNull(examCourseCacheBean.getMobilePhotoUpload())) {
|
|
if (Objects.nonNull(examCourseCacheBean) && Objects.nonNull(examCourseCacheBean.getMobilePhotoUpload())) {
|
|
teExamActivityDto.setMobilePhotoUpload(examCourseCacheBean.getMobilePhotoUpload());
|
|
teExamActivityDto.setMobilePhotoUpload(examCourseCacheBean.getMobilePhotoUpload());
|
|
}
|
|
}
|
|
- if (Objects.nonNull(teExamActivityDto.getMonitorVideoSourceStr()) && !Objects
|
|
|
|
- .equals(teExamActivityDto.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
|
|
|
|
+ if (Objects.nonNull(teExamActivityDto.getMonitorVideoSourceStr()) && !Objects.equals(
|
|
|
|
+ teExamActivityDto.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
Map<String, String> monitorRecordMap = null;
|
|
Map<String, String> monitorRecordMap = null;
|
|
- if (Objects.nonNull(teExamActivityDto.getMonitorRecordStr()) && !Objects.equals(teExamActivityDto.getMonitorRecordStr().trim().replaceAll(" ", ""), "")) {
|
|
|
|
- List<String> monitorRecordList = Arrays.asList(teExamActivityDto.getMonitorRecordStr().trim().toUpperCase().split(","));
|
|
|
|
- monitorRecordMap = monitorRecordList.stream()
|
|
|
|
- .collect(Collectors.toMap(Function.identity(), s -> s));
|
|
|
|
|
|
+ if (Objects.nonNull(teExamActivityDto.getMonitorRecordStr()) && !Objects.equals(
|
|
|
|
+ teExamActivityDto.getMonitorRecordStr().trim().replaceAll(" ", ""), "")) {
|
|
|
|
+ List<String> monitorRecordList = Arrays.asList(
|
|
|
|
+ teExamActivityDto.getMonitorRecordStr().trim().toUpperCase().split(","));
|
|
|
|
+ monitorRecordMap = monitorRecordList.stream().collect(Collectors.toMap(Function.identity(), s -> s));
|
|
}
|
|
}
|
|
- List<String> videoSources = Arrays.asList(teExamActivityDto.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(","));
|
|
|
|
|
|
+ List<String> videoSources = Arrays.asList(
|
|
|
|
+ teExamActivityDto.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(","));
|
|
List<MonitorStreamDto> monitorStreamDtoList = new ArrayList<>();
|
|
List<MonitorStreamDto> monitorStreamDtoList = new ArrayList<>();
|
|
Map<String, String> finalMonitorRecordMap = monitorRecordMap;
|
|
Map<String, String> finalMonitorRecordMap = monitorRecordMap;
|
|
videoSources.forEach(s -> {
|
|
videoSources.forEach(s -> {
|
|
if (Objects.isNull(finalMonitorRecordMap) || finalMonitorRecordMap.size() == 0) {
|
|
if (Objects.isNull(finalMonitorRecordMap) || finalMonitorRecordMap.size() == 0) {
|
|
- monitorStreamDtoList.add(new MonitorStreamDto(MonitorVideoSourceEnum.valueOf(s), SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)), null));
|
|
|
|
|
|
+ monitorStreamDtoList.add(new MonitorStreamDto(MonitorVideoSourceEnum.valueOf(s),
|
|
|
|
+ SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)), null));
|
|
} else {
|
|
} else {
|
|
String monitorRecordStr = finalMonitorRecordMap.get(s);
|
|
String monitorRecordStr = finalMonitorRecordMap.get(s);
|
|
- monitorStreamDtoList.add(new MonitorStreamDto(MonitorVideoSourceEnum.valueOf(s), SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)), Objects.nonNull(monitorRecordStr) ? SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)) : null));
|
|
|
|
|
|
+ monitorStreamDtoList.add(new MonitorStreamDto(MonitorVideoSourceEnum.valueOf(s),
|
|
|
|
+ SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)),
|
|
|
|
+ Objects.nonNull(monitorRecordStr) ?
|
|
|
|
+ SystemConstant.setStreamId(prefix, recordId, MonitorVideoSourceEnum.valueOf(s)) :
|
|
|
|
+ null));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
teExamActivityDto.setMonitorVideoSource(monitorStreamDtoList);
|
|
teExamActivityDto.setMonitorVideoSource(monitorStreamDtoList);
|
|
teExamActivityDto.setMonitorAudioEnable(examCache.getMonitorAudioEnable());
|
|
teExamActivityDto.setMonitorAudioEnable(examCache.getMonitorAudioEnable());
|
|
|
|
|
|
//加入hardwareTest逻辑
|
|
//加入hardwareTest逻辑
|
|
- if (teExamActivityDto.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())
|
|
|
|
- || (Objects.nonNull(teExamActivityDto.getEntryAuthenticationPolicy()) && (
|
|
|
|
- Objects.equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
|
|
- EntryAuthenticationPolicyEnum.LIVENESS_VERIFY.name()) || Objects
|
|
|
|
- .equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
|
|
|
|
+ if (teExamActivityDto.getMonitorVideoSourceStr().toUpperCase()
|
|
|
|
+ .contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name()) || (
|
|
|
|
+ Objects.nonNull(teExamActivityDto.getEntryAuthenticationPolicy()) && (
|
|
|
|
+ Objects.equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
|
|
+ EntryAuthenticationPolicyEnum.LIVENESS_VERIFY.name()) || Objects.equals(
|
|
|
|
+ teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
EntryAuthenticationPolicyEnum.FACE_VERIFY_FORCE.name()))) || (
|
|
EntryAuthenticationPolicyEnum.FACE_VERIFY_FORCE.name()))) || (
|
|
- Objects.nonNull(teExamActivityDto.getCameraPhotoUpload()) && teExamActivityDto.getCameraPhotoUpload() == 1)
|
|
|
|
- || Objects.nonNull(teExamActivityDto.getInProcessFaceVerify()) && teExamActivityDto.getInProcessFaceVerify() == 1
|
|
|
|
- || Objects.nonNull(teExamActivityDto.getInProcessLivenessVerify()) && teExamActivityDto.getInProcessLivenessVerify() == 1) {
|
|
|
|
|
|
+ Objects.nonNull(teExamActivityDto.getCameraPhotoUpload())
|
|
|
|
+ && teExamActivityDto.getCameraPhotoUpload() == 1)
|
|
|
|
+ || Objects.nonNull(teExamActivityDto.getInProcessFaceVerify())
|
|
|
|
+ && teExamActivityDto.getInProcessFaceVerify() == 1
|
|
|
|
+ || Objects.nonNull(teExamActivityDto.getInProcessLivenessVerify())
|
|
|
|
+ && teExamActivityDto.getInProcessLivenessVerify() == 1) {
|
|
List<String> hardwareTest = teExamActivityDto.getHardwareTest();
|
|
List<String> hardwareTest = teExamActivityDto.getHardwareTest();
|
|
if (Objects.isNull(hardwareTest)) {
|
|
if (Objects.isNull(hardwareTest)) {
|
|
hardwareTest = new ArrayList<>();
|
|
hardwareTest = new ArrayList<>();
|
|
}
|
|
}
|
|
hardwareTest.add(HardwareTestEnum.CAMERA.name());
|
|
hardwareTest.add(HardwareTestEnum.CAMERA.name());
|
|
if ((Objects.nonNull(examCourseCacheBean) && Objects.nonNull(examCourseCacheBean.getHasAudio())
|
|
if ((Objects.nonNull(examCourseCacheBean) && Objects.nonNull(examCourseCacheBean.getHasAudio())
|
|
- && examCourseCacheBean.getHasAudio() == 1)
|
|
|
|
- || teExamActivityDto.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
|
|
|
|
|
|
+ && examCourseCacheBean.getHasAudio() == 1) || teExamActivityDto.getMonitorVideoSourceStr()
|
|
|
|
+ .toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
|
|
hardwareTest.add(HardwareTestEnum.AUDIOPLAY.name());
|
|
hardwareTest.add(HardwareTestEnum.AUDIOPLAY.name());
|
|
}
|
|
}
|
|
teExamActivityDto.setHardwareTest(hardwareTest);
|
|
teExamActivityDto.setHardwareTest(hardwareTest);
|
|
}
|
|
}
|
|
} else if ((Objects.nonNull(teExamActivityDto.getEntryAuthenticationPolicy()) && (
|
|
} else if ((Objects.nonNull(teExamActivityDto.getEntryAuthenticationPolicy()) && (
|
|
Objects.equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
Objects.equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
- EntryAuthenticationPolicyEnum.LIVENESS_VERIFY.name()) || Objects
|
|
|
|
- .equals(teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
|
|
- EntryAuthenticationPolicyEnum.FACE_VERIFY_FORCE.name()))) || (
|
|
|
|
- Objects.nonNull(teExamActivityDto.getCameraPhotoUpload()) && teExamActivityDto.getCameraPhotoUpload() == 1)
|
|
|
|
- || Objects.nonNull(teExamActivityDto.getInProcessFaceVerify()) && teExamActivityDto.getInProcessFaceVerify() == 1
|
|
|
|
- || Objects.nonNull(teExamActivityDto.getInProcessLivenessVerify()) && teExamActivityDto.getInProcessLivenessVerify() == 1) {
|
|
|
|
|
|
+ EntryAuthenticationPolicyEnum.LIVENESS_VERIFY.name()) || Objects.equals(
|
|
|
|
+ teExamActivityDto.getEntryAuthenticationPolicy(),
|
|
|
|
+ EntryAuthenticationPolicyEnum.FACE_VERIFY_FORCE.name()))) || (
|
|
|
|
+ Objects.nonNull(teExamActivityDto.getCameraPhotoUpload())
|
|
|
|
+ && teExamActivityDto.getCameraPhotoUpload() == 1)
|
|
|
|
+ || Objects.nonNull(teExamActivityDto.getInProcessFaceVerify())
|
|
|
|
+ && teExamActivityDto.getInProcessFaceVerify() == 1
|
|
|
|
+ || Objects.nonNull(teExamActivityDto.getInProcessLivenessVerify())
|
|
|
|
+ && teExamActivityDto.getInProcessLivenessVerify() == 1) {
|
|
List<String> hardwareTest = teExamActivityDto.getHardwareTest();
|
|
List<String> hardwareTest = teExamActivityDto.getHardwareTest();
|
|
if (Objects.isNull(hardwareTest)) {
|
|
if (Objects.isNull(hardwareTest)) {
|
|
hardwareTest = new ArrayList<>();
|
|
hardwareTest = new ArrayList<>();
|
|
@@ -313,9 +329,9 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
if (ac == null) {
|
|
if (ac == null) {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
-// if (ac.getEnable() != null && ac.getEnable().intValue() == 0) {
|
|
|
|
-// return ret;
|
|
|
|
-// }
|
|
|
|
|
|
+ // if (ac.getEnable() != null && ac.getEnable().intValue() == 0) {
|
|
|
|
+ // return ret;
|
|
|
|
+ // }
|
|
ret = new ExamActivityCacheBean();
|
|
ret = new ExamActivityCacheBean();
|
|
ret.setId(ac.getId());
|
|
ret.setId(ac.getId());
|
|
ret.setCode(ac.getCode());
|
|
ret.setCode(ac.getCode());
|
|
@@ -348,8 +364,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
examId = teExamActivityList.get(0).getExamId();
|
|
examId = teExamActivityList.get(0).getExamId();
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamActivityList.get(0).getExamId());
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamActivityList.get(0).getExamId());
|
|
TEExam teExam = teExamService.cacheConvert(examCacheBean);
|
|
TEExam teExam = teExamService.cacheConvert(examCacheBean);
|
|
- if (Objects.nonNull(teExam.getMonitorStatus()) && Objects
|
|
|
|
- .equals(teExam.getMonitorStatus(), InvigilateMonitorStatusEnum.FINISHED)) {
|
|
|
|
|
|
+ if (Objects.nonNull(teExam.getMonitorStatus()) && Objects.equals(teExam.getMonitorStatus(),
|
|
|
|
+ InvigilateMonitorStatusEnum.FINISHED)) {
|
|
throw new BusinessException("监考结束的考试场次不可以修改");
|
|
throw new BusinessException("监考结束的考试场次不可以修改");
|
|
}
|
|
}
|
|
List<TEAudio> teAudioList = new ArrayList<>();
|
|
List<TEAudio> teAudioList = new ArrayList<>();
|
|
@@ -362,7 +378,10 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
.eq(TEAudio::getAudioDefault, AudioDefaultEnum.SYS.name());
|
|
.eq(TEAudio::getAudioDefault, AudioDefaultEnum.SYS.name());
|
|
int count = teAudioService.count(teAudioQueryWrapper);
|
|
int count = teAudioService.count(teAudioQueryWrapper);
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
- teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.BEFORE_AUDIO_ATTACHMENT_ID, AudioTypeEnum.BEFORE.getTitle(), AudioTypeEnum.BEFORE, AudioDefaultEnum.SYS, tbUser.getId(), SystemConstant.BEFORE_AUDIO_SECOND, teExam, s));//开考前语音
|
|
|
|
|
|
+ teAudioList.add(
|
|
|
|
+ new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.BEFORE_AUDIO_ATTACHMENT_ID,
|
|
|
|
+ AudioTypeEnum.BEFORE.getTitle(), AudioTypeEnum.BEFORE, AudioDefaultEnum.SYS,
|
|
|
|
+ tbUser.getId(), SystemConstant.BEFORE_AUDIO_SECOND, teExam, s));//开考前语音
|
|
}
|
|
}
|
|
|
|
|
|
teAudioQueryWrapper = new QueryWrapper<>();
|
|
teAudioQueryWrapper = new QueryWrapper<>();
|
|
@@ -371,10 +390,14 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
.eq(TEAudio::getAudioDefault, AudioDefaultEnum.SYS.name());
|
|
.eq(TEAudio::getAudioDefault, AudioDefaultEnum.SYS.name());
|
|
count = teAudioService.count(teAudioQueryWrapper);
|
|
count = teAudioService.count(teAudioQueryWrapper);
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
- teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.AFTER_AUDIO_ATTACHMENT_ID, AudioTypeEnum.AFTER.getTitle(), AudioTypeEnum.AFTER, AudioDefaultEnum.SYS, tbUser.getId(), SystemConstant.AFTER_AUDIO_SECOND, teExam, s));//考试结束前语音
|
|
|
|
|
|
+ teAudioList.add(
|
|
|
|
+ new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.AFTER_AUDIO_ATTACHMENT_ID,
|
|
|
|
+ AudioTypeEnum.AFTER.getTitle(), AudioTypeEnum.AFTER, AudioDefaultEnum.SYS,
|
|
|
|
+ tbUser.getId(), SystemConstant.AFTER_AUDIO_SECOND, teExam, s));//考试结束前语音
|
|
}
|
|
}
|
|
if (Objects.nonNull(s.getEnable()) && s.getEnable().intValue() == 0) {
|
|
if (Objects.nonNull(s.getEnable()) && s.getEnable().intValue() == 0) {
|
|
- Integer examCount = tOeExamRecordService.findByExamIdOrExamActivityIdCount(teExam.getId(), s.getId());
|
|
|
|
|
|
+ Integer examCount = tOeExamRecordService.findByExamIdOrExamActivityIdCount(teExam.getId(),
|
|
|
|
+ s.getId());
|
|
if (Objects.nonNull(examCount) && examCount.intValue() > 0) {
|
|
if (Objects.nonNull(examCount) && examCount.intValue() > 0) {
|
|
throw new BusinessException("已有考试记录不能禁用");
|
|
throw new BusinessException("已有考试记录不能禁用");
|
|
}
|
|
}
|
|
@@ -387,7 +410,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
throw new BusinessException("修改的场次结束时间只能大于当前时间");
|
|
throw new BusinessException("修改的场次结束时间只能大于当前时间");
|
|
}
|
|
}
|
|
if (Objects.nonNull(teExam.getForceFinish()) && teExam.getForceFinish().intValue() == 1
|
|
if (Objects.nonNull(teExam.getForceFinish()) && teExam.getForceFinish().intValue() == 1
|
|
- && s.getFinishTime().longValue() != teExamActivityDb.getFinishTime().longValue()) {
|
|
|
|
|
|
+ && s.getFinishTime().longValue() != teExamActivityDb.getFinishTime()
|
|
|
|
+ .longValue()) {
|
|
//删除再新增quartz任务,发送mq消息start
|
|
//删除再新增quartz任务,发送mq消息start
|
|
Map<String, Object> prop = new HashMap<>();
|
|
Map<String, Object> prop = new HashMap<>();
|
|
prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
@@ -406,52 +430,66 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
s.setId(uidUtil.getId());
|
|
s.setId(uidUtil.getId());
|
|
s.setCreateId(tbUser.getId());
|
|
s.setCreateId(tbUser.getId());
|
|
s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence(s.getExamId())));
|
|
s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence(s.getExamId())));
|
|
- teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.BEFORE_AUDIO_ATTACHMENT_ID, AudioTypeEnum.BEFORE.getTitle(), AudioTypeEnum.BEFORE, AudioDefaultEnum.SYS, tbUser.getId(), SystemConstant.BEFORE_AUDIO_SECOND, teExam, s));//开考前语音
|
|
|
|
- teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.AFTER_AUDIO_ATTACHMENT_ID, AudioTypeEnum.AFTER.getTitle(), AudioTypeEnum.AFTER, AudioDefaultEnum.SYS, tbUser.getId(), SystemConstant.AFTER_AUDIO_SECOND, teExam, s));//考试结束前语音
|
|
|
|
|
|
+ teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.BEFORE_AUDIO_ATTACHMENT_ID,
|
|
|
|
+ AudioTypeEnum.BEFORE.getTitle(), AudioTypeEnum.BEFORE, AudioDefaultEnum.SYS, tbUser.getId(),
|
|
|
|
+ SystemConstant.BEFORE_AUDIO_SECOND, teExam, s));//开考前语音
|
|
|
|
+ teAudioList.add(new TEAudio(tbUser.getOrgId(), s.getId(), SystemConstant.AFTER_AUDIO_ATTACHMENT_ID,
|
|
|
|
+ AudioTypeEnum.AFTER.getTitle(), AudioTypeEnum.AFTER, AudioDefaultEnum.SYS, tbUser.getId(),
|
|
|
|
+ SystemConstant.AFTER_AUDIO_SECOND, teExam, s));//考试结束前语音
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- teExamActivityService.saveOrUpdateBatch(teExamActivityList);
|
|
|
|
- for (TEExamActivity ac : teExamActivityList) {
|
|
|
|
- teExamActivityService.updateExamActivityCacheBean(ac.getId());
|
|
|
|
- //加入更新考试列表缓存方法
|
|
|
|
- ExamActivityCacheBean examActivityCacheBean = this.getExamActivityCacheBean(ac.getId());
|
|
|
|
- if (Objects.nonNull(examActivityCacheBean.getEnable()) && examActivityCacheBean.getEnable().intValue() == 1 && Objects.nonNull(teExam.getEnable()) && teExam.getEnable().intValue() == 1 && Objects.nonNull(teExam.getEndTime()) && teExam.getEndTime().longValue() > System.currentTimeMillis()) {
|
|
|
|
- themisCacheService.updateCurrentExamListCache(ac.getExamId().toString(), ac.getId());
|
|
|
|
- themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), ac.getExamId().toString(), ac.getId());
|
|
|
|
- } else {
|
|
|
|
- themisCacheService.removeCurrentExamListCache(ac.getExamId().toString(), ac.getId());
|
|
|
|
- themisCacheService.removeOrgExamListCache(teExam.getOrgId().toString(), ac.getExamId().toString(), ac.getId());
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(teExamActivityList)) {
|
|
|
|
+ teExamActivityService.saveOrUpdateBatch(teExamActivityList);
|
|
|
|
+ for (TEExamActivity ac : teExamActivityList) {
|
|
|
|
+ teExamActivityService.updateExamActivityCacheBean(ac.getId());
|
|
|
|
+ //加入更新考试列表缓存方法
|
|
|
|
+ ExamActivityCacheBean examActivityCacheBean = this.getExamActivityCacheBean(ac.getId());
|
|
|
|
+ if (Objects.nonNull(examActivityCacheBean.getEnable())
|
|
|
|
+ && examActivityCacheBean.getEnable().intValue() == 1 && Objects.nonNull(teExam.getEnable())
|
|
|
|
+ && teExam.getEnable().intValue() == 1 && Objects.nonNull(teExam.getEndTime())
|
|
|
|
+ && teExam.getEndTime().longValue() > System.currentTimeMillis()) {
|
|
|
|
+ themisCacheService.updateCurrentExamListCache(ac.getExamId().toString(), ac.getId());
|
|
|
|
+ themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(),
|
|
|
|
+ ac.getExamId().toString(), ac.getId());
|
|
|
|
+ } else {
|
|
|
|
+ themisCacheService.removeCurrentExamListCache(ac.getExamId().toString(), ac.getId());
|
|
|
|
+ themisCacheService.removeOrgExamListCache(teExam.getOrgId().toString(),
|
|
|
|
+ ac.getExamId().toString(), ac.getId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-// //最后开考时间发送定时任务
|
|
|
|
-// //删除再新增quartz任务,发送mq消息start
|
|
|
|
-// Map<String, Object> prop = new HashMap<>();
|
|
|
|
-// prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
|
|
-// prop.put(SystemConstant.EXAM, teExam);
|
|
|
|
-// MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_ACTIVITY_FINAL_PREPARE_TIME.name(), JacksonUtil.parseJson(ac), MqTagEnum.EXAM_ACTIVITY_FINAL_PREPARE_TIME, String.valueOf(teExam.getId()), prop, tbUser.getName());
|
|
|
|
-// mqDtoService.assembleSendAsyncOrderMsg(mqDto);
|
|
|
|
-// //删除再新增quartz任务,发送mq消息end
|
|
|
|
|
|
+ //最后开考时间发送定时任务
|
|
|
|
+ Map<String, Object> prop = new HashMap<>();
|
|
|
|
+ prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
|
|
+ prop.put(SystemConstant.EXAM, teExam);
|
|
|
|
+ MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_ACTIVITY_FINAL_PREPARE_TIME.name(),
|
|
|
|
+ JacksonUtil.parseJson(teExamActivityList), MqTagEnum.EXAM_ACTIVITY_FINAL_PREPARE_TIME,
|
|
|
|
+ String.valueOf(teExam.getId()), prop, tbUser.getName());
|
|
|
|
+ mqDtoService.assembleSendAsyncOrderMsg(mqDto);
|
|
}
|
|
}
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(teAudioList)) {
|
|
if (!CollectionUtils.isEmpty(teAudioList)) {
|
|
teAudioService.saveOrUpdateBatch(teAudioList);
|
|
teAudioService.saveOrUpdateBatch(teAudioList);
|
|
-// for (TEAudio t : teAudioList) {
|
|
|
|
-// teAudioService.sendAudioMessage(t);
|
|
|
|
-// }
|
|
|
|
|
|
+ // for (TEAudio t : teAudioList) {
|
|
|
|
+ // teAudioService.sendAudioMessage(t);
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
if (size.get() > 0 && (Objects.nonNull(teExam.getForceFinish()) && teExam.getForceFinish().intValue() == 1)) {
|
|
if (size.get() > 0 && (Objects.nonNull(teExam.getForceFinish()) && teExam.getForceFinish().intValue() == 1)) {
|
|
- //新增quartz任务,发送mq消息start
|
|
|
|
- Map<String, Object> prop = new HashMap<>();
|
|
|
|
- prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
|
|
- prop.put(SystemConstant.EXAM, teExam);
|
|
|
|
- MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_ACTIVITY.name(),
|
|
|
|
- JacksonUtil.parseJson(teExamActivityList), MqTagEnum.EXAM_ACTIVITY,
|
|
|
|
- String.valueOf(teExam.getId()), prop, tbUser.getName());
|
|
|
|
- mqDtoService.assembleSendAsyncOrderMsg(mqDto);
|
|
|
|
- //新增quartz任务,发送mq消息end
|
|
|
|
|
|
+ if (Objects.nonNull(teExam.getForceFinish()) && teExam.getForceFinish().intValue() == 1) {
|
|
|
|
+ //新增quartz任务,发送mq消息start
|
|
|
|
+ Map<String, Object> prop = new HashMap<>();
|
|
|
|
+ prop.put(SystemConstant.OPER, SystemConstant.INSERT);
|
|
|
|
+ prop.put(SystemConstant.EXAM, teExam);
|
|
|
|
+ MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_ACTIVITY.name(),
|
|
|
|
+ JacksonUtil.parseJson(teExamActivityList), MqTagEnum.EXAM_ACTIVITY,
|
|
|
|
+ String.valueOf(teExam.getId()), prop, tbUser.getName());
|
|
|
|
+ mqDtoService.assembleSendAsyncOrderMsg(mqDto);
|
|
|
|
+ //新增quartz任务,发送mq消息end
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
- if (Objects.nonNull(examId) && redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_ACTIVITY_CODE_PREFIX + examId, SystemConstant.REDIS_LOCK_EXAM_ACTIVITY_CODE_TIME_OUT)) {
|
|
|
|
|
|
+ if (Objects.nonNull(examId) && redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_ACTIVITY_CODE_PREFIX + examId,
|
|
|
|
+ SystemConstant.REDIS_LOCK_EXAM_ACTIVITY_CODE_TIME_OUT)) {
|
|
try {
|
|
try {
|
|
Integer value = redisUtil.getRedisActivityCodeSequenceValue(examId);
|
|
Integer value = redisUtil.getRedisActivityCodeSequenceValue(examId);
|
|
redisUtil.setRedisActivityCodeSequence(examId, value - size.get());
|
|
redisUtil.setRedisActivityCodeSequence(examId, value - size.get());
|
|
@@ -464,7 +502,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
|
|
.replaceAll("'", "");
|
|
.replaceAll("'", "");
|
|
throw new BusinessException(
|
|
throw new BusinessException(
|
|
- "机构id[" + teExamActivityList.get(0).getExamId() + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
|
|
|
|
|
|
+ "机构id[" + teExamActivityList.get(0).getExamId() + "]下的" + FieldUniqueEnum.convertToCode(
|
|
|
|
+ columnStr) + "数据不允许重复插入");
|
|
} else if (e instanceof BusinessException) {
|
|
} else if (e instanceof BusinessException) {
|
|
throw new BusinessException(e.getMessage());
|
|
throw new BusinessException(e.getMessage());
|
|
} else {
|
|
} else {
|