|
@@ -105,18 +105,12 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Resource
|
|
|
WarningService warningService;
|
|
|
|
|
|
- @Resource
|
|
|
- MqDtoService mqDtoService;
|
|
|
-
|
|
|
@Resource
|
|
|
TEConfigService teConfigService;
|
|
|
|
|
|
@Resource
|
|
|
UidUtil uidUtil;
|
|
|
|
|
|
- @Resource
|
|
|
- MqUtil mqUtil;
|
|
|
-
|
|
|
@Resource
|
|
|
TencentYunUtil tencentYunUtil;
|
|
|
|
|
@@ -139,12 +133,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Transactional
|
|
|
public void execMqMaxReconsumeTime(MqDto mqDto, String key) {
|
|
|
//超过最大重试次数,保存到数据库,后续可以发短信通知系统管理人员
|
|
|
- Gson gson = new Gson();
|
|
|
- mqDto.setAck(SystemConstant.POSION_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageError(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -156,7 +145,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqUserLogLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
String tag = mqDto.getTag();
|
|
|
if (Objects.equals(MqTagEnum.USER.name(), tag)) {
|
|
|
TEUserLog teUserLog = new TEUserLog(String.valueOf(mqDto.getBody()),
|
|
@@ -188,10 +176,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
}
|
|
|
teExamStudentLogService.save(teExamStudentLog);
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -203,14 +188,16 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqSessionLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
String sessionId = mqDto.getObjId();
|
|
|
TBSession tbSession = (TBSession) redisUtil.getUserSession(sessionId);
|
|
|
- if (Objects.nonNull(tbSession)) {
|
|
|
- tbSessionService.saveOrUpdate(tbSession);
|
|
|
+ if (Objects.isNull(tbSession)) {
|
|
|
+ throw new BusinessException("缓存session为空");
|
|
|
}
|
|
|
+// tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
+ Gson gson = new Gson();
|
|
|
TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
+ tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
redisUtil.delete(key, mqDto.getId());
|
|
|
}
|
|
@@ -223,7 +210,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void execMqTaskLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> map = (Map<String, Object>) mqDto.getBody();
|
|
|
String tag = mqDto.getTag();
|
|
|
// myThreadPool.arbitratePoolTaskExecutor.execute(() -> {
|
|
@@ -259,12 +245,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
}
|
|
|
}
|
|
|
// });
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- mqDto.setBody(JacksonUtil.parseJson(mqDto.getBody()));
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -276,7 +257,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqWebsocketUnNormalLogic(MqDto mqDto, String key) throws NoSuchAlgorithmException {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> tranMap = mqDto.getProperties();
|
|
|
Long recordId = Long.parseLong(String.valueOf(tranMap.get(SystemConstant.RECORD_ID)));
|
|
|
ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(recordId);
|
|
@@ -308,11 +288,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
// SystemConstant.mobileMonitorStatusStop(examStudentCacheBean.getStudentId(), recordId, true);
|
|
|
//发送移动端监考退出考试mq消息 end
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);//表示成功处理
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -325,7 +301,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqTencentVideoLogic(MqDto mqDto, String key) throws NoSuchAlgorithmException, IOException {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> tranMap = mqDto.getProperties();
|
|
|
Long recordId = Long.parseLong(String.valueOf(tranMap.get(SystemConstant.RECORD_ID)));
|
|
|
TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(recordId);
|
|
@@ -381,11 +356,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
TMTencentVideoMessage tencentVideoMessage = new TMTencentVideoMessage(response.getRequestId(), JacksonUtil.parseJson(response));
|
|
|
tencentVideoMessageService.save(tencentVideoMessage);
|
|
|
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);//表示成功处理
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
} else {
|
|
|
mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);//表示成功处理
|
|
@@ -402,14 +373,9 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
// @Override
|
|
|
// @Transactional
|
|
|
// public void execMqCalculateObjectiveScoreLogic(MqDto mqDto, String key) {
|
|
|
-// Gson gson = new Gson();
|
|
|
// Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
// examRecordService.calculateObjectiveScore(param);
|
|
|
-// mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
-// TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
-// tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
-// tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
-// redisUtil.delete(key, mqDto.getId());
|
|
|
+// tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
// }
|
|
|
|
|
|
/**
|
|
@@ -421,7 +387,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqFaceVerifySaveLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
Long id = (Long) param.get(SystemConstant.ID);
|
|
|
Long recordId = (Long) param.get(SystemConstant.RECORD_ID);
|
|
@@ -457,7 +422,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
if (Objects.nonNull(realness) && realness.intValue() == 0) {//真实性异常
|
|
|
String realnessErrorRandom = ExamRecordCacheUtil.getRealnessErrorRandom(recordId);
|
|
|
if (Objects.isNull(realnessErrorRandom)) {
|
|
|
- realnessErrorRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ realnessErrorRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setRealnessErrorRandom(recordId, realnessErrorRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil
|
|
@@ -469,7 +434,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getRealnessErrorNum(recordId).get();
|
|
|
if (count > teConfig.getRealnessCount()) {
|
|
|
ExamRecordCacheUtil.setRealnessErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setRealnessErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.realnessError(warningDto);
|
|
|
}
|
|
@@ -482,7 +447,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
if (faceCount > 1) {//多张人脸
|
|
|
String multipleFaceRandom = ExamRecordCacheUtil.getMultipleFaceCountErrorRandom(recordId);
|
|
|
if (Objects.isNull(multipleFaceRandom)) {
|
|
|
- multipleFaceRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ multipleFaceRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, multipleFaceRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId,
|
|
@@ -494,14 +459,14 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).get();
|
|
|
if (count > teConfig.getMultipleFaceCountError()) {
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCountError(warningDto);
|
|
|
}
|
|
|
} else if (faceCount <= 0) {
|
|
|
String noFaceRandom = ExamRecordCacheUtil.getNoFaceCountErrorRandom(recordId);
|
|
|
if (Objects.isNull(noFaceRandom)) {
|
|
|
- noFaceRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ noFaceRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, noFaceRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId,
|
|
@@ -513,7 +478,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getNoFaceCountErrorNum(recordId).get();
|
|
|
if (count > teConfig.getNoFaceCountError()) {
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCountError(warningDto);
|
|
|
}
|
|
@@ -521,7 +486,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
} else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
|
|
|
String faceCompareErrorRandom = ExamRecordCacheUtil.getFaceCompareErrorRandom(recordId);
|
|
|
if (Objects.isNull(faceCompareErrorRandom)) {
|
|
|
- faceCompareErrorRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ faceCompareErrorRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, faceCompareErrorRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil
|
|
@@ -533,14 +498,14 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).get();
|
|
|
if (count > teConfig.getTotalFaceCompareErrorCount()) {
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCompareError(warningDto);
|
|
|
}
|
|
|
} else if (Objects.equals(VerifyExceptionEnum.EYE_CLOSE_ERROR, warningEnum)) {//闭眼检测异常
|
|
|
String eyeCloseErrorRandom = ExamRecordCacheUtil.getEyeCloseErrorRandom(recordId);
|
|
|
if (Objects.isNull(eyeCloseErrorRandom)) {
|
|
|
- eyeCloseErrorRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ eyeCloseErrorRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setEyeCloseErrorRandom(recordId, eyeCloseErrorRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil
|
|
@@ -552,7 +517,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getEyeCloseErrorNum(recordId).get();
|
|
|
if (count > teConfig.getTotalEyeCloseErrorCount()) {
|
|
|
ExamRecordCacheUtil.setEyeCloseErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setEyeCloseErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.eyeCloseError(warningDto);
|
|
|
}
|
|
@@ -562,11 +527,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
faceVerifyHistoryService
|
|
|
.save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception, null);
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -578,7 +539,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqLivenessVerifySaveLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
Long id = (Long) param.get(SystemConstant.ID);
|
|
|
Long recordId = (Long) param.get(SystemConstant.RECORD_ID);
|
|
@@ -637,7 +597,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
if (faceCount > 1) {//多张人脸
|
|
|
String multipleFaceRandom = ExamRecordCacheUtil.getMultipleFaceCountErrorRandom(recordId);
|
|
|
if (Objects.isNull(multipleFaceRandom)) {
|
|
|
- multipleFaceRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ multipleFaceRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, multipleFaceRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId,
|
|
@@ -649,14 +609,14 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).get();
|
|
|
if (count > teConfig.getMultipleFaceCountError()) {
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCountError(warningDto);
|
|
|
}
|
|
|
} else if (faceCount <= 0) {
|
|
|
String noFaceRandom = ExamRecordCacheUtil.getNoFaceCountErrorRandom(recordId);
|
|
|
if (Objects.isNull(noFaceRandom)) {
|
|
|
- noFaceRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ noFaceRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, noFaceRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId,
|
|
@@ -668,7 +628,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getNoFaceCountErrorNum(recordId).get();
|
|
|
if (count > teConfig.getNoFaceCountError()) {
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCountError(warningDto);
|
|
|
}
|
|
@@ -678,7 +638,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
String.valueOf(jsonObject.get("photoUrl")));
|
|
|
String faceCompareErrorRandom = ExamRecordCacheUtil.getFaceCompareErrorRandom(recordId);
|
|
|
if (Objects.isNull(faceCompareErrorRandom)) {
|
|
|
- faceCompareErrorRandom = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
|
|
|
+ faceCompareErrorRandom = SystemConstant.getUuid();
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, faceCompareErrorRandom);
|
|
|
}
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorNum(recordId,
|
|
@@ -690,7 +650,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Integer count = ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).get();
|
|
|
if (count > teConfig.getTotalFaceCompareErrorCount()) {
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId,
|
|
|
- String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
|
|
|
+ SystemConstant.getUuid());
|
|
|
ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(0));
|
|
|
warningService.faceCompareError(warningDto);
|
|
|
}
|
|
@@ -701,11 +661,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
livenessVerifyHistoryService
|
|
|
.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -717,15 +673,10 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqRecordPersistedLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
Long recordId = (Long) param.get(SystemConstant.RECORD_ID);
|
|
|
commonService.persisted(recordId);
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -737,27 +688,17 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqRecordBreakHistoryPersistedLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Long breakId = Long.parseLong(mqDto.getObjId());
|
|
|
tOeExamBreakHistoryService.examRecordBreakHistoryDataSave(breakId);
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqRecordUpdateLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Long recordId = Long.parseLong(mqDto.getObjId());
|
|
|
examRecordService.examRecordDataSave(recordId);
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -858,11 +799,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
teExamStudentLogService.update(teExamStudentLogUpdateWrapper);
|
|
|
}
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -873,16 +810,11 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void execMqCalculateScoreLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
Long examId = (Long) param.get(SystemConstant.EXAM_ID);
|
|
|
Long taskId = (Long) param.get(SystemConstant.TASK_ID);
|
|
|
teExamService.calculateScore(examId, taskId);
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -891,14 +823,9 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqExamStudentUpdateLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> param = (Map<String, Object>) mqDto.getBody();
|
|
|
teExamStudentService.updateByMqMsg(param);
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -978,12 +905,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
//更新移动端第一机位推流状态为stop
|
|
|
// SystemConstant.mobileMonitorStatusStop(examStudentCacheBean.getStudentId(), recordId, true);
|
|
|
|
|
|
- Gson gson = new Gson();
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -995,7 +917,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void execMqExamBreakDelayLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
Map<String, Object> tranMap = mqDto.getProperties();
|
|
|
Long recordId = Long.parseLong(String.valueOf(tranMap.get(SystemConstant.RECORD_ID)));
|
|
|
ExamRecordStatusEnum statusEnum = ExamRecordCacheUtil.getStatus(recordId);
|
|
@@ -1005,11 +926,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
.equals(statusEnum, ExamRecordStatusEnum.RESUME_PREPARE)) {
|
|
|
examRecordService.examBreakLogic(recordId, false);
|
|
|
}
|
|
|
- mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);//表示成功处理
|
|
|
- TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
|
|
|
- tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+ tmRocketMessageService.saveMqMessageSuccess(mqDto, key);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1140,12 +1057,12 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
// .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
|
|
|
// .add(String.format("%02d", nowTime.getDayOfMonth()));
|
|
|
// if (oss) {//上传至oss
|
|
|
-// stringJoiner.add(File.separator).add(String.valueOf(UUID.randomUUID()).replaceAll("-", "")).add(fileType);
|
|
|
+// stringJoiner.add(File.separator).add(SystemConstant.getUuid()).add(fileType);
|
|
|
// ossUtil.upload(ossUtil.isPublic(type), stringJoiner.toString(), inputStream, md5);
|
|
|
// jsonObject.put("qrCodeUrl", aliYunOssPublicDomain.getPublicUrl() + File.separator + stringJoiner.toString());
|
|
|
// } else {//上传至服务器
|
|
|
// File finalFile = new File(
|
|
|
-// stringJoiner.add(File.separator).add(String.valueOf(UUID.randomUUID()).replaceAll("-", ""))
|
|
|
+// stringJoiner.add(File.separator).add(SystemConstant.getUuid())
|
|
|
// .add(fileType).toString());
|
|
|
// if (!finalFile.exists()) {
|
|
|
// finalFile.getParentFile().mkdirs();
|