黑名单及用户访问拦截
This commit is contained in:
parent
243f8ee259
commit
c9e0f347ba
|
|
@ -61,18 +61,6 @@ public class UserEntity implements Serializable {
|
||||||
@ApiModelProperty("性别 1男 2女")
|
@ApiModelProperty("性别 1男 2女")
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
|
||||||
/**
|
|
||||||
* 姓名
|
|
||||||
*/
|
|
||||||
@TableField("cert_name")
|
|
||||||
private String certName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 身份证号码
|
|
||||||
*/
|
|
||||||
@TableField("cert_no")
|
|
||||||
private String certNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小程序openid
|
* 微信小程序openid
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ import com.sqx.common.utils.IPUtils;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.app.entity.TbUserBlacklist;
|
import com.sqx.modules.app.entity.TbUserBlacklist;
|
||||||
import com.sqx.modules.app.entity.UserEntity;
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
|
import com.sqx.modules.app.entity.UserInfo;
|
||||||
import com.sqx.modules.app.mapper.TbUserBlacklistMapper;
|
import com.sqx.modules.app.mapper.TbUserBlacklistMapper;
|
||||||
|
import com.sqx.modules.app.service.UserInfoService;
|
||||||
import com.sqx.modules.app.service.UserService;
|
import com.sqx.modules.app.service.UserService;
|
||||||
import com.sqx.modules.app.utils.JwtUtils;
|
import com.sqx.modules.app.utils.JwtUtils;
|
||||||
import com.sqx.modules.redisService.RedisService;
|
import com.sqx.modules.redisService.RedisService;
|
||||||
|
|
@ -41,6 +43,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
@Autowired
|
||||||
private TbUserBlacklistMapper tbUserBlacklistMapper;
|
private TbUserBlacklistMapper tbUserBlacklistMapper;
|
||||||
|
|
||||||
private final RedisService redisService;
|
private final RedisService redisService;
|
||||||
|
|
@ -106,9 +110,10 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||||
if (user != null && user.getStatus().equals(0)) {
|
if (user != null && user.getStatus().equals(0)) {
|
||||||
throw new CzgException("异常行为用户: {}" + user.getUserId());
|
throw new CzgException("异常行为用户: {}" + user.getUserId());
|
||||||
}
|
}
|
||||||
|
// 实名认证信息
|
||||||
if (StrUtil.isNotBlank(user.getCertNo())) {
|
UserInfo userInfo = userInfoService.getByUserId(user.getUserId());
|
||||||
TbUserBlacklist blacklist = tbUserBlacklistMapper.selectOne(Wrappers.<TbUserBlacklist>lambdaQuery().eq(TbUserBlacklist::getIdCardNo, user.getCertNo()));
|
if (userInfo != null && StrUtil.isNotBlank(userInfo.getCertNo())) {
|
||||||
|
TbUserBlacklist blacklist = tbUserBlacklistMapper.selectOne(Wrappers.<TbUserBlacklist>lambdaQuery().eq(TbUserBlacklist::getIdCardNo, userInfo.getCertNo()));
|
||||||
if (blacklist != null) {
|
if (blacklist != null) {
|
||||||
throw new CzgException(StrUtil.format("黑名单用户,禁止访问:{} / {}", blacklist.getRealName(), blacklist.getIdCardNo()));
|
throw new CzgException(StrUtil.format("黑名单用户,禁止访问:{} / {}", blacklist.getRealName(), blacklist.getIdCardNo()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue