支付宝黑名单及用户访问拦截
This commit is contained in:
@@ -2,13 +2,16 @@ package com.sqx.modules.app.interceptor;
|
||||
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.sqx.common.exception.CzgException;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.IPUtils;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.AlipayBlacklist;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.mapper.AlipayBlacklistMapper;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.utils.JwtUtils;
|
||||
import com.sqx.modules.redisService.RedisService;
|
||||
@@ -36,6 +39,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
private JwtUtils jwtUtils;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private AlipayBlacklistMapper alipayBlacklistMapper;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
@@ -101,6 +106,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
throw new CzgException("异常行为用户: {}" + user.getUserId());
|
||||
}
|
||||
|
||||
if(StrUtil.isNotBlank(user.getZhiFuBao())){
|
||||
AlipayBlacklist blacklist = alipayBlacklistMapper.selectById(user.getZhiFuBao());
|
||||
if(blacklist != null){
|
||||
throw new CzgException("禁止访问");
|
||||
}
|
||||
}
|
||||
|
||||
if (redisService.isRecordUserOnLineTime(userId)) {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
// 记录用户最后一次调用接口的时间
|
||||
|
||||
@@ -127,6 +127,7 @@ spring:
|
||||
- qrtz_cron_triggers
|
||||
- qrtz_calendars
|
||||
- qrtz_blob_triggers
|
||||
- alipay_blacklist
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
Reference in New Issue
Block a user