新增设备注册白名单
This commit is contained in:
parent
09a35ed351
commit
91acf6e8cd
@ -380,7 +380,12 @@ public enum EnumConfigKey {
|
||||
/**
|
||||
* H5用户账号处理白名单
|
||||
*/
|
||||
ACCOUNT_PROCESS_WHITELIST;
|
||||
ACCOUNT_PROCESS_WHITELIST,
|
||||
|
||||
/**
|
||||
* 设备注册白名单
|
||||
*/
|
||||
DEVICE_REGISTER_WHITELIST;
|
||||
|
||||
|
||||
public String concatSysOrigin(SysOriginPlatformEnum sysOrigin) {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.red.circle.other.infra.gateway.user;
|
||||
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.EnumConfigService;
|
||||
import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
import com.red.circle.tool.core.thread.ThreadPoolManager;
|
||||
@ -11,6 +13,7 @@ import com.red.circle.other.infra.database.rds.service.user.device.DeviceRegiste
|
||||
import com.red.circle.other.infra.database.rds.service.user.device.IpRegisterQuantityService;
|
||||
import com.red.circle.other.inner.model.cmd.user.IncrDeviceRegisterCmd;
|
||||
import com.red.circle.other.inner.model.cmd.user.device.AllowDeviceRegisterCmd;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -28,6 +31,7 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
|
||||
private final LatestMobileDeviceService latestMobileDeviceService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final EnumConfigCacheService enumConfigCacheService;
|
||||
|
||||
/**
|
||||
* 累计注册数量.
|
||||
@ -94,6 +98,13 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 跳过白名单用户
|
||||
String whitelistConfig = enumConfigCacheService.getValue(
|
||||
EnumConfigKey.DEVICE_REGISTER_WHITELIST, userProfile.getOriginSys());
|
||||
if (StringUtils.isNotBlank(whitelistConfig) && whitelistConfig.contains(String.valueOf(userProfile.getAccount()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
java.util.List<Long> userIds = latestMobileDeviceService.listUserIdsByDeviceFingerprint(
|
||||
fingerprint, userProfile.getOriginSys());
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor;
|
||||
import com.red.circle.other.app.inner.service.user.device.RegisterDeviceClientService;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.rds.entity.user.user.LatestMobileDevice;
|
||||
@ -16,6 +17,7 @@ import com.red.circle.other.infra.database.rds.service.user.device.DeviceRegiste
|
||||
import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.other.inner.model.cmd.user.device.ArchiveDeviceQryCmd;
|
||||
import com.red.circle.other.inner.model.cmd.user.device.DeviceRegisterQuantityQryCmd;
|
||||
import com.red.circle.other.inner.model.cmd.user.device.PageLatestMobileDeviceQryCmd;
|
||||
@ -52,6 +54,7 @@ public class RegisterDeviceClientServiceImpl implements RegisterDeviceClientServ
|
||||
private final RegisterDeviceInnerConvertor registerDeviceInnerConvertor;
|
||||
private final DeviceRegisterQuantityService deviceRegisterQuantityService;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final EnumConfigCacheService enumConfigCacheService;
|
||||
|
||||
@Override
|
||||
public Boolean existsDevice(String deviceNo, String sysOrigin) {
|
||||
@ -254,6 +257,13 @@ public class RegisterDeviceClientServiceImpl implements RegisterDeviceClientServ
|
||||
return false;
|
||||
}
|
||||
|
||||
// 跳过白名单用户
|
||||
String whitelistConfig = enumConfigCacheService.getValue(
|
||||
EnumConfigKey.DEVICE_REGISTER_WHITELIST, userProfile.getOriginSys());
|
||||
if (StringUtils.isNotBlank(whitelistConfig) && whitelistConfig.contains(String.valueOf(userProfile.getAccount()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Long> userIds = latestMobileDeviceService.listUserIdsByDeviceFingerprint(
|
||||
fingerprint, userProfile.getOriginSys());
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user