|
@@ -6,7 +6,9 @@ import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
import com.qmth.themis.business.constant.SpringContextHolder;
|
|
import com.qmth.themis.business.constant.SpringContextHolder;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
|
+import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
|
|
import com.qmth.themis.business.enums.*;
|
|
import com.qmth.themis.business.enums.*;
|
|
|
|
+import com.qmth.themis.business.service.TIeInvigilateWarnInfoService;
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
|
|
|
@@ -530,7 +532,18 @@ public class ExamRecordCacheUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static void setClientCurrentIp(Long recordId, String ip) {
|
|
public static void setClientCurrentIp(Long recordId, String ip) {
|
|
- if (Objects.nonNull(getId(recordId))) {
|
|
|
|
|
|
+ if (Objects.nonNull(getId(recordId)) && (Objects.nonNull(ip) && !Objects.equals(ip.trim(), "0:0:0:0:0:0:0:1") && !Objects.equals(ip.trim(), "127.0.0.1")
|
|
|
|
+ && !Objects.equals(ip.trim(), "localhost"))) {
|
|
|
|
+ String historyIp = getClientCurrentIp(recordId);
|
|
|
|
+ if (Objects.nonNull(historyIp) && !Objects.equals(historyIp.trim(), "") && !Objects.equals(historyIp, ip)) {
|
|
|
|
+ Long examId = getExamId(recordId);
|
|
|
|
+ Long examActivityId = getExamActivityId(recordId);
|
|
|
|
+ Long examStudentId = getExamStudentId(recordId);
|
|
|
|
+ TIeInvigilateWarnInfoService tIeInvigilateWarnInfoService = SpringContextHolder.getBean(TIeInvigilateWarnInfoService.class);
|
|
|
|
+ //ip不同则发生预警
|
|
|
|
+ TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, VerifyExceptionEnum.IP_CHANGE_ERROR.getLevel().get(0), VerifyExceptionEnum.IP_CHANGE_ERROR.getTitle(), VerifyExceptionEnum.IP_CHANGE_ERROR, 1);
|
|
|
|
+ tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
|
|
+ }
|
|
redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.client_current_ip.getCode(),
|
|
redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.client_current_ip.getCode(),
|
|
ip);
|
|
ip);
|
|
}
|
|
}
|