|
@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -66,9 +67,9 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
|
|
|
@Resource
|
|
|
TOeExamRecordService examRecordService;
|
|
|
-
|
|
|
+
|
|
|
@Resource
|
|
|
- TOeFaceVerifyHistoryService faceVerifyHistoryService;
|
|
|
+ TOeFaceVerifyHistoryService faceVerifyHistoryService;
|
|
|
|
|
|
/**
|
|
|
* mq最大重试次数逻辑
|
|
@@ -187,7 +188,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Map<String, Object> tranMap = mqDto.getProperties();
|
|
|
Long recordId = Long.parseLong(String.valueOf(tranMap.get("recordId")));
|
|
|
Date clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
|
|
|
- if ((System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000 / 60 >= 2) {//大于等于当前时间,说明未重连或重登录
|
|
|
+ if (Objects.nonNull(clientLastSyncTime) && (System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000 / 60 >= 2) {//大于等于当前时间,说明未重连或重登录
|
|
|
String deviceId = String.valueOf(tranMap.get("deviceId"));
|
|
|
String ip = String.valueOf(tranMap.get("ip"));
|
|
|
Long updateTime = Long.parseLong(String.valueOf(tranMap.get("updateTime")));
|
|
@@ -199,8 +200,6 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
//todo 没有断点次数,则强制交卷
|
|
|
tOeExamRecord.setStatus(ExamRecordStatusEnum.finished);
|
|
|
tOeExamRecordService.updateById(tOeExamRecord);
|
|
|
-
|
|
|
- //加入踢下线mq
|
|
|
} else {
|
|
|
breakCount--;
|
|
|
//增加断点记录
|
|
@@ -220,9 +219,11 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
}
|
|
|
teExamStudentLogService.saveStudentLogInfo(mqDto.getTimestamp(), MqEnum.valueOf(String.valueOf(mqDto.getType())).getId(), SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode(), JacksonUtil.parseJson(mqDto));
|
|
|
TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
|
|
|
- tmRocketMessage.setProp(JacksonUtil.parseJson(tmRocketMessage.getProperties()));
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put(SystemConstant.MQDTO_OBJ, JacksonUtil.parseJson(mqDto));
|
|
|
+ tmRocketMessage.setProp(JacksonUtil.parseJson(map));
|
|
|
tmRocketMessageService.saveOrUpdate(tmRocketMessage);
|
|
|
- redisUtil.delete(key, mqDto.getId());
|
|
|
+// redisUtil.delete(key, mqDto.getId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -244,28 +245,28 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
redisUtil.delete(key, mqDto.getId());
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *人脸验证保存
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void execMqFaceVerifySaveLogic(MqDto mqDto, String key) {
|
|
|
- Gson gson = new Gson();
|
|
|
+ /**
|
|
|
+ * 人脸验证保存
|
|
|
+ */
|
|
|
+ @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("id");
|
|
|
- Long recordId=(Long)param.get("recordId");
|
|
|
- String type=(String)param.get("type");
|
|
|
- String photoUrl=(String)param.get("photoUrl");
|
|
|
- Integer faceCount=(Integer)param.get("faceCount");
|
|
|
- Double similarity=(Double)param.get("similarity");
|
|
|
- Double realness=(Double)param.get("realness");
|
|
|
- Long time=(Long)param.get("time");
|
|
|
- String exception=(String)param.get("exception");
|
|
|
+ Long id = (Long) param.get("id");
|
|
|
+ Long recordId = (Long) param.get("recordId");
|
|
|
+ String type = (String) param.get("type");
|
|
|
+ String photoUrl = (String) param.get("photoUrl");
|
|
|
+ Integer faceCount = (Integer) param.get("faceCount");
|
|
|
+ Double similarity = (Double) param.get("similarity");
|
|
|
+ Double realness = (Double) param.get("realness");
|
|
|
+ Long time = (Long) param.get("time");
|
|
|
+ String exception = (String) param.get("exception");
|
|
|
faceVerifyHistoryService.save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception);
|
|
|
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());
|
|
|
- }
|
|
|
+ }
|
|
|
}
|