소스 검색

考试记录新增预警记录未读数修改

wangliang 1 년 전
부모
커밋
2002f45bc4

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -196,8 +196,8 @@ public class SystemConstant {
     public static final String FORM_USER_ID = "formUserId";
     public static final String OPER = "oper";
     public static final String EXAM = "exam";
-    public static final String WARNING_COUNT_UPDATE = "warning_count_update";
-    public static final String WARNING_UNREAD_UPDATE = "warning_unread_update";
+//    public static final String WARNING_COUNT_UPDATE = "warning_count_update";
+//    public static final String WARNING_UNREAD_UPDATE = "warning_unread_update";
     //    public static final String EXEC_TIME = "execTime";
 //    public static final String REAL_EXEC_TIME = "realExecTime";
     public static final String INSERT = "insert";

+ 16 - 16
themis-business/src/main/java/com/qmth/themis/business/service/TOeExamRecordService.java

@@ -60,22 +60,22 @@ public interface TOeExamRecordService extends IService<TOeExamRecord> {
      */
     void sendExamRecordDataSaveMq(Long recordId, Long timestamp);
 
-    /**
-     * 发送mq更新考试预警数量记录
-     *
-     * @param recordId
-     * @param timestamp
-     */
-    void sendExamRecordDataUpdateWarningCountMq(Long recordId, Long timestamp);
-
-    /**
-     * 发送mq更新考试预警未读数量
-     *
-     * @param recordId
-     * @param timestamp
-     * @param number
-     */
-    void sendExamRecordDataUpdateWarningUnreadMq(Long recordId, Long timestamp, Integer number);
+//    /**
+//     * 发送mq更新考试预警数量记录
+//     *
+//     * @param recordId
+//     * @param timestamp
+//     */
+//    void sendExamRecordDataUpdateWarningCountMq(Long recordId, Long timestamp);
+//
+//    /**
+//     * 发送mq更新考试预警未读数量
+//     *
+//     * @param recordId
+//     * @param timestamp
+//     * @param number
+//     */
+//    void sendExamRecordDataUpdateWarningUnreadMq(Long recordId, Long timestamp, Integer number);
 
     /**
      * 发送mq更新考试记录

+ 45 - 45
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -103,8 +103,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
     @Resource
     TSyncExamStudentScoreService tSyncExamStudentScoreService;
 
-    @Resource
-    TOeExamRecordService tOeExamRecordService;
+//    @Resource
+//    TOeExamRecordService tOeExamRecordService;
 
     @Transactional
     @Override
@@ -516,7 +516,6 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      * @param id
      */
     @Override
-    @Transactional
     public void updateWarningCount(Long id) {
         this.baseMapper.updateWarningCount(id);
     }
@@ -552,7 +551,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         } else {
             ExamRecordCacheUtil.setWarningUnread(id, 1, timestamp);
         }
-        this.sendExamRecordDataUpdateWarningCountMq(id, System.currentTimeMillis());
+//        this.sendExamRecordDataUpdateWarningCountMq(id, timestamp);
+        this.sendExamRecordDataSaveMq(id, timestamp);
     }
 
     /**
@@ -562,18 +562,18 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      * @param number
      */
     @Override
-    @Transactional
     public void updateWarningUnreadCache(Long id, Integer number) {
         long timestamp = System.currentTimeMillis();
         Integer warningUnread = ExamRecordCacheUtil.getWarningUnread(id);
-        if (Objects.nonNull(warningUnread) && warningUnread.intValue() == 0) {
+        if (Objects.nonNull(warningUnread) && number.intValue() == 0) {
             ExamRecordCacheUtil.setWarningUnread(id, number, timestamp);
-        } else if (Objects.nonNull(warningUnread) && warningUnread.intValue() > 0) {
+        } else if (Objects.nonNull(warningUnread) && number.intValue() > 0) {
             ExamRecordCacheUtil.setWarningUnread(id, warningUnread - number, timestamp);
         } else {
             ExamRecordCacheUtil.setWarningUnread(id, 0, timestamp);
         }
-        this.sendExamRecordDataUpdateWarningUnreadMq(id, System.currentTimeMillis(), number);
+        this.sendExamRecordDataSaveMq(id, timestamp);
+//        this.sendExamRecordDataUpdateWarningUnreadMq(id, timestamp, number);
     }
 
     @Override
@@ -634,43 +634,43 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         }
     }
 
-    /**
-     * 发送mq更新考试预警数量记录
-     *
-     * @param recordId
-     * @param timestamp
-     */
-    @Override
-    public void sendExamRecordDataUpdateWarningCountMq(Long recordId, Long timestamp) {
-        try {
-            ExamRecordCacheUtil.setUpdateTime(recordId, timestamp);
-            MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_RECORD_UPDATE.name(), recordId.toString(), SystemConstant.WARNING_COUNT_UPDATE, timestamp);
-            mqDtoService.assembleSendAsyncMsg(mqDto);
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-        }
-    }
-
-    /**
-     * 发送mq更新考试预警未读数量
-     *
-     * @param recordId
-     * @param timestamp
-     * @param number
-     */
-    @Override
-    public void sendExamRecordDataUpdateWarningUnreadMq(Long recordId, Long timestamp, Integer number) {
-        try {
-            ExamRecordCacheUtil.setUpdateTime(recordId, timestamp);
-            Map<String, Object> properties = new HashMap<>();
-            properties.put(SystemConstant.NUMBER, number);
-            MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_RECORD_UPDATE.name(), recordId.toString(), SystemConstant.WARNING_UNREAD_UPDATE, timestamp);
-            mqDto.setProperties(properties);
-            mqDtoService.assembleSendAsyncMsg(mqDto);
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-        }
-    }
+//    /**
+//     * 发送mq更新考试预警数量记录
+//     *
+//     * @param recordId
+//     * @param timestamp
+//     */
+//    @Override
+//    public void sendExamRecordDataUpdateWarningCountMq(Long recordId, Long timestamp) {
+//        try {
+//            ExamRecordCacheUtil.setUpdateTime(recordId, timestamp);
+//            MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_RECORD_UPDATE.name(), recordId.toString(), SystemConstant.WARNING_COUNT_UPDATE, timestamp);
+//            mqDtoService.assembleSendAsyncMsg(mqDto);
+//        } catch (Exception e) {
+//            log.error(SystemConstant.LOG_ERROR, e);
+//        }
+//    }
+//
+//    /**
+//     * 发送mq更新考试预警未读数量
+//     *
+//     * @param recordId
+//     * @param timestamp
+//     * @param number
+//     */
+//    @Override
+//    public void sendExamRecordDataUpdateWarningUnreadMq(Long recordId, Long timestamp, Integer number) {
+//        try {
+//            ExamRecordCacheUtil.setUpdateTime(recordId, timestamp);
+//            Map<String, Object> properties = new HashMap<>();
+//            properties.put(SystemConstant.NUMBER, number);
+//            MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_RECORD_UPDATE.name(), recordId.toString(), SystemConstant.WARNING_UNREAD_UPDATE, timestamp);
+//            mqDto.setProperties(properties);
+//            mqDtoService.assembleSendAsyncMsg(mqDto);
+//        } catch (Exception e) {
+//            log.error(SystemConstant.LOG_ERROR, e);
+//        }
+//    }
 
     /**
      * 发送mq更新考试记录

+ 10 - 10
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -701,16 +701,16 @@ public class MqLogicServiceImpl implements MqLogicService {
         Long updateTime = ExamRecordCacheUtil.getUpdateTime(recordId);
         if (Objects.isNull(updateTime) || (Objects.nonNull(updateTime) &&
                 mqDto.getTimestamp().longValue() >= updateTime.longValue())) {
-            if (Objects.nonNull(mqDto.getObjName()) && Objects.equals(mqDto.getObjName(), SystemConstant.WARNING_COUNT_UPDATE)) {
-                examRecordService.updateWarningCount(recordId);
-            } else if (Objects.nonNull(mqDto.getObjName()) && Objects.equals(mqDto.getObjName(), SystemConstant.WARNING_UNREAD_UPDATE)) {
-                Map<String, Object> tranMap = mqDto.getProperties();
-                Integer number = (Integer) tranMap.get(SystemConstant.NUMBER);
-                number = Objects.isNull(number) || number < 0 ? 0 : number;
-                examRecordService.updateWarningUnread(recordId, number);
-            } else {
-                examRecordService.examRecordDataSave(recordId);
-            }
+//            if (Objects.nonNull(mqDto.getObjName()) && Objects.equals(mqDto.getObjName(), SystemConstant.WARNING_COUNT_UPDATE)) {
+//                examRecordService.updateWarningCount(recordId);
+//            } else if (Objects.nonNull(mqDto.getObjName()) && Objects.equals(mqDto.getObjName(), SystemConstant.WARNING_UNREAD_UPDATE)) {
+//                Map<String, Object> tranMap = mqDto.getProperties();
+//                Integer number = (Integer) tranMap.get(SystemConstant.NUMBER);
+//                number = Objects.isNull(number) || number < 0 ? 0 : number;
+//                examRecordService.updateWarningUnread(recordId, number);
+//            } else {
+            examRecordService.examRecordDataSave(recordId);
+//            }
             tIpRegionService.saveIpRegion(recordId);
         }
         tmRocketMessageService.saveMqMessageSuccess(mqDto, key);