瀏覽代碼

违纪处理接口修改

wangliang 2 年之前
父節點
當前提交
ab482aec08

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

@@ -15,9 +15,9 @@ import com.qmth.themis.business.dto.ExpireTimeDTO;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.*;
-import com.qmth.themis.business.service.ThemisCacheService;
 import com.qmth.themis.business.service.TEExamPaperService;
 import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.business.service.ThemisCacheService;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.SessionUtil;
@@ -172,6 +172,9 @@ public class SystemConstant {
     /**
      * 系统相关
      */
+    public static final String BREACH_LOG_STATUS = "breachLogStatus";
+    public static final String OBJ_ID = "objId";
+    public static final String TITLE = "title";
     public static final String BODY = "body";
     public static final String SUB_QUESTIONS = "subQuestions";
     public static final String ANSWER = "answer";
@@ -199,7 +202,7 @@ public class SystemConstant {
     public static final Long AFTER_AUDIO_ATTACHMENT_Id = 2L;
     public static final Integer BEFORE_AUDIO_SECOND = 60;
     public static final Integer AFTER_AUDIO_SECOND = 900;
-//    public static final String AUTH_INFO_CACHE = "auth:info:cache";
+    //    public static final String AUTH_INFO_CACHE = "auth:info:cache";
     public static final String EXAM_AUDIO_CACHE = "exam:audio:cache";
     public static final String ATTACHMENT_CACHE = "attachment:cache";
     public static final String BLACK_LIST_CACHE = "blacklist:cache";

+ 3 - 2
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamBreachLogServiceImpl.java

@@ -105,7 +105,7 @@ public class TEExamBreachLogServiceImpl extends ServiceImpl<TEExamBreachLogMappe
                     }
                 }
             } else {//撤销违纪
-                Long breachLogId = (Long) mapParameter.get("breachLogId");
+                Long breachLogId = Long.parseLong(String.valueOf(mapParameter.get("breachLogId")));
                 BreachCancelTypeEnum type = BreachCancelTypeEnum.valueOf(String.valueOf(mapParameter.get(SystemConstant.TYPE)));
                 TEExamBreachLog teExamBreachLog = teExamBreachLogService.getById(breachLogId);
                 Optional.ofNullable(teExamBreachLog).orElseThrow(() -> new BusinessException("未找到违纪记录"));
@@ -128,7 +128,8 @@ public class TEExamBreachLogServiceImpl extends ServiceImpl<TEExamBreachLogMappe
                 properties.put(SystemConstant.REMARK, eb.getType());
                 properties.put(SystemConstant.EXAM_STUDENT_ID, eb.getExamStudentId());
                 properties.put(SystemConstant.EXAM_RECORD_ID, eb.getExamRecordId());
-                properties.put("objId", eb.getId());
+                properties.put(SystemConstant.OBJ_ID, eb.getId());
+                properties.put(SystemConstant.BREACH_LOG_STATUS, status);
                 ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(eb.getExamStudentId());
                 MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.STUDENT.name(), eb.getStatus() == 0 ? SystemOperationEnum.BREACH_HANDLE : SystemOperationEnum.BREACH_REVOKE, MqTagEnum.STUDENT, String.valueOf(examStudentCacheBean.getStudentId()), properties, examStudentCacheBean.getIdentity());
                 mqDtoService.assembleSendOneWayMsg(mqDto);

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

@@ -125,9 +125,6 @@ public class MqLogicServiceImpl implements MqLogicService {
     @Resource
     TMTencentVideoMessageService tencentVideoMessageService;
 
-    @Resource
-    TOeExamRecordService tOeExamRecordService;
-
     @Resource
     TIpRegionService tIpRegionService;
 
@@ -173,6 +170,8 @@ public class MqLogicServiceImpl implements MqLogicService {
                 SystemOperationEnum systemOperationEnum = SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody()));
                 String remark = String.valueOf(mqDto.getProperties().get(SystemConstant.REMARK));
                 Long objId = null;
+                Integer breachLogStatus = null;
+                JSONObject jsonObject = new JSONObject();
                 if (systemOperationEnum == SystemOperationEnum.BREACH_HANDLE || systemOperationEnum == SystemOperationEnum.BREACH_REVOKE) {
                     if (systemOperationEnum == SystemOperationEnum.BREACH_HANDLE) {
                         remark = BreachTypeEnum.valueOf(remark).getCode();
@@ -180,16 +179,29 @@ public class MqLogicServiceImpl implements MqLogicService {
                         remark = BreachCancelTypeEnum.valueOf(remark).getCode();
                     }
                     info = "【" + systemOperationEnum.getTitle() + ",原因:" + remark + "】" + type;
-                    objId = Long.parseLong(String.valueOf(mqDto.getProperties().get("objId")));
+                    objId = Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.OBJ_ID)));
+                    breachLogStatus = Integer.parseInt(String.valueOf(mqDto.getProperties().get(SystemConstant.BREACH_LOG_STATUS)));
+                    jsonObject.put(SystemConstant.BREACH_LOG_STATUS, breachLogStatus);
+                    jsonObject.put(SystemConstant.TITLE, systemOperationEnum.getTitle());
+
+                    List<TEExamStudentLog> teExamStudentLogList = teExamStudentLogService.list(new QueryWrapper<TEExamStudentLog>().lambda()
+                            .eq(TEExamStudentLog::getObjId, objId)
+                            .eq(TEExamStudentLog::getType, SystemOperationEnum.BREACH_HANDLE));
+                    if (!CollectionUtils.isEmpty(teExamStudentLogList)) {
+                        for (TEExamStudentLog t : teExamStudentLogList) {
+                            JSONObject object = JSONObject.parseObject(t.getTitle());
+                            object.put(SystemConstant.BREACH_LOG_STATUS, breachLogStatus);
+                            t.setTitle(object.toJSONString());
+                        }
+                        teExamStudentLogService.saveOrUpdateBatch(teExamStudentLogList);
+                    }
                 }
                 teExamStudentLog = new TEExamStudentLog(String.valueOf(mqDto.getBody()), info, remark,
                         Long.parseLong(String.valueOf(mqDto.getObjId())),
                         Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_STUDENT_ID))),
                         Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_RECORD_ID))),
-                        systemOperationEnum.getTitle());
-                if (Objects.nonNull(objId)) {
-                    teExamStudentLog.setObjId(objId);
-                }
+                        jsonObject.toJSONString());
+                teExamStudentLog.setObjId(objId);
             } else {
                 teExamStudentLog = new TEExamStudentLog(String.valueOf(mqDto.getBody()),
                         SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode(),