123
This commit is contained in:
@@ -49,6 +49,7 @@ public class UserForbidManager {
|
||||
public void batchForbid(UserForbidReq userForbidReq){
|
||||
List<Integer> type = userForbidReq.getType();
|
||||
User user = userService.getById(userForbidReq.getUserId());
|
||||
UserInfo userInfo = userInfoService.getByUserId(userForbidReq.getUserId());
|
||||
ForbidTimeEnum forbidTimeEnum = ForbidTimeEnum.getByCode(userForbidReq.getForbidTime());
|
||||
if(forbidTimeEnum == null){
|
||||
throw new ServiceException("封禁天数错误");
|
||||
@@ -56,12 +57,12 @@ public class UserForbidManager {
|
||||
if(forbidTimeEnum == ForbidTimeEnum.UNFORBID){
|
||||
UserForbidManager userForbidManager = SpringUtil.getBean(UserForbidManager.class);
|
||||
for (Integer integer : type) {
|
||||
if(ForbidTypeEnum.USER.getCode().equals(integer)){
|
||||
userForbidManager.unForbidByTypeAndMember(integer,user.getUsercode(),userForbidReq.getReason());
|
||||
}else if(ForbidTypeEnum.IMEI.getCode().equals(integer)){
|
||||
userForbidManager.unForbidByTypeAndMember(integer,user.getUsercode(),userForbidReq.getReason());
|
||||
}else if(ForbidTypeEnum.IP.getCode().equals(integer)){
|
||||
if(ForbidTypeEnum.USER.getCode().equals(integer) && user != null){
|
||||
userForbidManager.unForbidByTypeAndMember(integer,user.getUsercode(),userForbidReq.getReason());
|
||||
}else if(ForbidTypeEnum.IMEI.getCode().equals(integer) && userInfo != null && StringUtils.isNotBlank(userInfo.getImei())){
|
||||
userForbidManager.unForbidByTypeAndMember(integer,userInfo.getImei(),userForbidReq.getReason());
|
||||
}else if(ForbidTypeEnum.IP.getCode().equals(integer) && userInfo != null && StringUtils.isNotBlank(userInfo.getLastLoginIp())){
|
||||
userForbidManager.unForbidByTypeAndMember(integer,userInfo.getLastLoginIp(),userForbidReq.getReason());
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -75,7 +76,6 @@ public class UserForbidManager {
|
||||
dto.setRemark(userForbidReq.getReason());
|
||||
this.forbid(dto);
|
||||
}else if(ForbidTypeEnum.IMEI.getCode().equals(integer)){
|
||||
UserInfo userInfo = userInfoService.getByUserId(user.getId());
|
||||
if(userInfo != null && StringUtils.isNotEmpty(userInfo.getImei())){
|
||||
UserForbidDTO dto = new UserForbidDTO();
|
||||
dto.setForbidTime(userForbidReq.getForbidTime());
|
||||
@@ -85,7 +85,6 @@ public class UserForbidManager {
|
||||
this.forbid(dto);
|
||||
}
|
||||
}else if(ForbidTypeEnum.IP.getCode().equals(integer)){
|
||||
UserInfo userInfo = userInfoService.getByUserId(user.getId());
|
||||
if(userInfo != null && StringUtils.isNotEmpty(userInfo.getLastLoginIp())){
|
||||
UserForbidDTO dto = new UserForbidDTO();
|
||||
dto.setForbidTime(userForbidReq.getForbidTime());
|
||||
@@ -183,6 +182,9 @@ public class UserForbidManager {
|
||||
.eq(UserForbid::getType,type)
|
||||
.eq(UserForbid::getMember,member)
|
||||
.last("limit 1"));
|
||||
if(userForbid == null){
|
||||
return;
|
||||
}
|
||||
if(ForbidStatusEnum.NORMAL.getCode().equals(userForbid.getForbidStatus())
|
||||
|| userForbid.getEndTime().isBefore(LocalDateTime.now())){ // 无封号
|
||||
log.info("无封号,无需操作! type={},member={}", type,member);
|
||||
|
||||
Reference in New Issue
Block a user