|
@@ -1,5 +1,6 @@
|
|
|
package com.qmth.themis.mq.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.BetweenFormater;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -44,10 +45,7 @@ import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
@@ -131,6 +129,9 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
@Resource
|
|
|
TEExamStudentOnlineLogService teExamStudentOnlineLogService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBUserService tbUserService;
|
|
|
+
|
|
|
/**
|
|
|
* mq最大重试次数逻辑
|
|
|
*
|
|
@@ -753,12 +754,30 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
if (Objects.nonNull(tIeExamInvigilateCallLog.getReceiveUserId())) {
|
|
|
tIeExamInvigilateCall.setReceiveUserId(tIeExamInvigilateCallLog.getReceiveUserId());
|
|
|
}
|
|
|
+ if (Objects.equals(tIeExamInvigilateCallLog.getCallStatus(), MonitorCallStatusSourceEnum.START)) {
|
|
|
+ tIeExamInvigilateCall.setStartTime(System.currentTimeMillis());
|
|
|
+ }
|
|
|
if (Objects.equals(tIeExamInvigilateCallLog.getCallStatus(), MonitorCallStatusSourceEnum.CALLING)) {
|
|
|
tIeExamInvigilateCall.setStartTime(tIeExamInvigilateCallLog.getStartTime());
|
|
|
}
|
|
|
if (Objects.equals(tIeExamInvigilateCallLog.getCallStatus(), MonitorCallStatusSourceEnum.STOP)) {
|
|
|
tIeExamInvigilateCall.setEndTime(tIeExamInvigilateCallLog.getEndTime());
|
|
|
- redisUtil.delete(RedisKeyHelper.examInvigilateCallCacheKey(recordId));
|
|
|
+ //往studentLog表里插数据
|
|
|
+ String formUserName = null, receiveUserName = null;
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
+ TBUser formTbUser = tbUserService.getById(tIeExamInvigilateCall.getFormUserId());
|
|
|
+ formUserName = Objects.isNull(formTbUser) ? examStudentCacheBean.getName() : formTbUser.getName();
|
|
|
+ TBUser receiveTbUser = tbUserService.getById(tIeExamInvigilateCall.getReceiveUserId());
|
|
|
+ receiveUserName = Objects.isNull(receiveTbUser) ? examStudentCacheBean.getName() : receiveTbUser.getName();
|
|
|
+ Date startDate = new Date(tIeExamInvigilateCall.getStartTime());
|
|
|
+ Date endDate = new Date(tIeExamInvigilateCall.getEndTime());
|
|
|
+ StringJoiner stringJoiner = new StringJoiner("");
|
|
|
+ stringJoiner.add("发起人:").add(formUserName).add("\r\n").add("接收人:").add(receiveUserName).add("\r\n")
|
|
|
+ .add("通话时间段:").add(DateUtil.format(startDate, Constants.DEFAULT_DATE_PATTERN)).add("~").add(DateUtil.format(endDate, Constants.DEFAULT_DATE_PATTERN)).add("\r\n")
|
|
|
+ .add("持续时长约:").add(DateUtil.formatBetween(startDate, endDate, BetweenFormater.Level.SECOND));
|
|
|
+ TEExamStudentLog teExamStudentLog = new TEExamStudentLog(examStudentCacheBean.getStudentId(), examStudentId,
|
|
|
+ recordId, MessageTypeEnum.MEDIA.name(), formUserName, stringJoiner.toString());
|
|
|
+ teExamStudentLogService.saveOrUpdate(teExamStudentLog);
|
|
|
}
|
|
|
}
|
|
|
if (Objects.nonNull(tIeExamInvigilateCall.getUpdateTime())) {
|
|
@@ -766,17 +785,13 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
tIeExamInvigilateCall.getUpdateTime() :
|
|
|
0L;
|
|
|
//如果mq时间大于则更新
|
|
|
-// if (mqDto.getTimestamp() > dbtimestamp && Objects.nonNull(tIeExamInvigilateCall.getBatchId())) {
|
|
|
- tIeExamInvigilateCallService.updateById(tIeExamInvigilateCall);
|
|
|
-// }
|
|
|
+ if (mqDto.getTimestamp() > dbtimestamp) {
|
|
|
+ tIeExamInvigilateCallService.updateById(tIeExamInvigilateCall);
|
|
|
+ }
|
|
|
} else {//否则新增
|
|
|
-// if (Objects.nonNull(tIeExamInvigilateCall.getBatchId())) {
|
|
|
tIeExamInvigilateCallService.saveOrUpdate(tIeExamInvigilateCall);
|
|
|
-// }
|
|
|
}
|
|
|
-// if (Objects.nonNull(tIeExamInvigilateCallLog.getBatchId())) {
|
|
|
tIeExamInvigilateCallLogService.saveOrUpdate(tIeExamInvigilateCallLog);
|
|
|
-// }
|
|
|
} else if (Objects.equals(MqTagEnum.EXCEPTION_LOG.name(), tag)) {//考试断点异常日志
|
|
|
JSONObject jsonObject = JSONObject.parseObject(String.valueOf(mqDto.getBody()));
|
|
|
// ExceptionEnum exceptionEnum = ExceptionEnum.valueOf(
|