wangliang 1 yıl önce
ebeveyn
işleme
e39bbb5fdd

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

@@ -165,6 +165,15 @@ public class MqLogicServiceImpl implements MqLogicService {
             String ip = null, country = null, region = null, province = null, city = null, isp = null;
             if (Objects.nonNull(mqDto.getProperties())) {
                 Long recordId = Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_RECORD_ID)));
+                ip = Objects.nonNull(recordId) ? ExamRecordCacheUtil.getClientCurrentIp(recordId) : mqDto.getObjName();
+                String[] strs = SystemConstant.getIpInfo(ip);
+                if (Objects.nonNull(strs) && strs.length > 0) {
+                    country = strs[0];
+                    region = strs[1];
+                    province = strs[2];
+                    city = strs[3];
+                    isp = strs[4];
+                }
                 String type = Objects.nonNull(mqDto.getProperties().get(SystemConstant.TYPE)) ?
                         String.valueOf(mqDto.getProperties().get(SystemConstant.TYPE)) :
                         SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode();
@@ -199,6 +208,12 @@ public class MqLogicServiceImpl implements MqLogicService {
                         teExamStudentLogService.saveOrUpdateBatch(teExamStudentLogList);
                     }
                     title = jsonObject.toJSONString();
+                    ip = null;
+                    country = null;
+                    region = null;
+                    province = null;
+                    city = null;
+                    isp = null;
                 }
                 teExamStudentLog = new TEExamStudentLog(String.valueOf(mqDto.getBody()), info, remark,
                         Long.parseLong(String.valueOf(mqDto.getObjId())),