|
@@ -7,12 +7,12 @@ import com.qmth.themis.business.dto.WebsocketDto;
|
|
|
import com.qmth.themis.business.enums.ExamRecordFieldEnum;
|
|
|
import com.qmth.themis.business.enums.WebsocketTypeEnum;
|
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
-import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Collections;
|
|
@@ -29,9 +29,6 @@ import java.util.Objects;
|
|
|
public class WebSocketOeMessageTemplete {
|
|
|
private final static Logger log = LoggerFactory.getLogger(WebSocketOeMessageTemplete.class);
|
|
|
|
|
|
- @Resource
|
|
|
- RedisUtil redisUtil;
|
|
|
-
|
|
|
@Resource
|
|
|
TOeExamRecordService tOeExamRecordService;
|
|
|
|
|
@@ -39,9 +36,11 @@ public class WebSocketOeMessageTemplete {
|
|
|
* 客户端已下载试卷
|
|
|
*
|
|
|
* @param body
|
|
|
+ * @param time
|
|
|
* @return
|
|
|
*/
|
|
|
- public WebsocketDto clientPaperDownload(String body) {
|
|
|
+ @Transactional
|
|
|
+ public WebsocketDto clientPaperDownload(String body, Long time) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
log.info("clientPaperDownload jsonObject:{}", jsonObject.toJSONString());
|
|
|
if (Objects.isNull(jsonObject.get("recordId")) || Objects.equals(jsonObject.get("recordId"), "")) {
|
|
@@ -60,9 +59,11 @@ public class WebSocketOeMessageTemplete {
|
|
|
* 状态同步
|
|
|
*
|
|
|
* @param body
|
|
|
+ * @param time
|
|
|
* @return
|
|
|
*/
|
|
|
- public WebsocketDto syncStatus(String body) {
|
|
|
+ @Transactional
|
|
|
+ public WebsocketDto syncStatus(String body, Long time) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
log.info("syncStatus jsonObject:{}", jsonObject.toJSONString());
|
|
|
if (Objects.isNull(jsonObject.get("recordId")) || Objects.equals(jsonObject.get("recordId"), "")) {
|
|
@@ -88,26 +89,28 @@ public class WebSocketOeMessageTemplete {
|
|
|
String[] columns = new String[]{ExamRecordFieldEnum.answer_progress.name(), ExamRecordFieldEnum.duration_seconds.name(), ExamRecordFieldEnum.client_last_sync_time.name()};
|
|
|
Object[] values = new Object[]{progress, durationSeconds, clientLastSyncTime};
|
|
|
tOeExamRecordService.dataUpdatesMq(recordId, columns, values);
|
|
|
- return this.syncAck(body);
|
|
|
+ return this.syncAck(body, time);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 同步确认
|
|
|
*
|
|
|
* @param body
|
|
|
+ * @param time
|
|
|
* @return
|
|
|
*/
|
|
|
- public WebsocketDto syncAck(String body) {
|
|
|
- return new WebsocketDto(WebsocketTypeEnum.convertToName(Thread.currentThread().getStackTrace()[1].getMethodName()), Collections.singletonMap(SystemConstant.ACK_MESSAGE, System.currentTimeMillis()));
|
|
|
+ public WebsocketDto syncAck(String body, Long time) {
|
|
|
+ return new WebsocketDto(WebsocketTypeEnum.convertToName(Thread.currentThread().getStackTrace()[1].getMethodName()), Collections.singletonMap(SystemConstant.ACK_MESSAGE, time));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 监考消息确认
|
|
|
*
|
|
|
* @param body
|
|
|
+ * @param time
|
|
|
* @return
|
|
|
*/
|
|
|
- public WebsocketDto invigilateNoticeAck(String body) {
|
|
|
- return new WebsocketDto(WebsocketTypeEnum.convertToName(Thread.currentThread().getStackTrace()[1].getMethodName()), Collections.singletonMap(SystemConstant.ACK_MESSAGE, System.currentTimeMillis()));
|
|
|
+ public WebsocketDto invigilateNoticeAck(String body, Long time) {
|
|
|
+ return new WebsocketDto(WebsocketTypeEnum.convertToName(Thread.currentThread().getStackTrace()[1].getMethodName()), Collections.singletonMap(SystemConstant.ACK_MESSAGE, time));
|
|
|
}
|
|
|
}
|