init
This commit is contained in:
@@ -9,6 +9,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
public enum ForbidTimeEnum {
|
||||
UNFORBID(0,"解封"),
|
||||
HOUSE_6(1,"封6小时"),
|
||||
DAY_1(2,"封1天"),
|
||||
DAY_3(3,"封3天"),
|
||||
|
||||
@@ -5,8 +5,10 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum ForbidTypeEnum {
|
||||
USER(1,"封用户"),
|
||||
@Deprecated
|
||||
UUID(2,"封设备"),
|
||||
IMEI(3,"封IMEI"),
|
||||
IMEI(3,"封IMEI"), // 安卓设备ID
|
||||
@Deprecated
|
||||
MAC(4,"封MAC"),
|
||||
IP(5,"封IP"),
|
||||
;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.ruoyi.cai.mq.CommonDelayTypeEnum;
|
||||
import com.ruoyi.cai.mq.dto.CommonDelayDto;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import com.ruoyi.cai.util.CaiDateUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -47,15 +48,19 @@ public class UserForbidManager {
|
||||
public void batchForbid(UserForbidReq userForbidReq){
|
||||
List<Integer> type = userForbidReq.getType();
|
||||
User user = userService.getById(userForbidReq.getUserId());
|
||||
ForbidTimeEnum forbidTimeEnum = ForbidTimeEnum.getByCode(userForbidReq.getForbidTime());
|
||||
if(forbidTimeEnum == null){
|
||||
throw new ServiceException("封禁天数错误");
|
||||
}
|
||||
for (Integer integer : type) {
|
||||
if(integer == 1){ // 封用户
|
||||
if(ForbidTypeEnum.USER.getCode().equals(integer)){ // 封用户
|
||||
UserForbidDTO dto = new UserForbidDTO();
|
||||
dto.setForbidTime(userForbidReq.getForbidTime());
|
||||
dto.setForbidType(ForbidTypeEnum.USER.getCode());
|
||||
dto.setMember(user.getUsercode());
|
||||
dto.setRemark(userForbidReq.getReason());
|
||||
this.forbid(dto);
|
||||
}else if(integer == 2){ // 封设备
|
||||
}else if(ForbidTypeEnum.IMEI.getCode().equals(integer)){ // 封设备
|
||||
UserInfo userInfo = userInfoService.getByUserId(user.getId());
|
||||
if(userInfo != null && StringUtils.isNotEmpty(userInfo.getImei())){
|
||||
UserForbidDTO dto = new UserForbidDTO();
|
||||
@@ -65,7 +70,7 @@ public class UserForbidManager {
|
||||
dto.setRemark(userForbidReq.getReason());
|
||||
this.forbid(dto);
|
||||
}
|
||||
}else if(integer == 3){ // 封IP
|
||||
}else if(ForbidTypeEnum.IP.getCode().equals(integer)){ // 封IP
|
||||
UserInfo userInfo = userInfoService.getByUserId(user.getId());
|
||||
if(userInfo != null && StringUtils.isNotEmpty(userInfo.getLastLoginIp())){
|
||||
UserForbidDTO dto = new UserForbidDTO();
|
||||
|
||||
Reference in New Issue
Block a user