From 91acf6e8cd32b554d818fd29f98a45d1fe363e5e Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 11 Nov 2025 11:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/inner/enums/config/EnumConfigKey.java | 7 ++++++- .../infra/gateway/user/RegisterDeviceGatewayImpl.java | 11 +++++++++++ .../device/impl/RegisterDeviceClientServiceImpl.java | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java index a44d8877..d87fb553 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java @@ -380,7 +380,12 @@ public enum EnumConfigKey { /** * H5用户账号处理白名单 */ - ACCOUNT_PROCESS_WHITELIST; + ACCOUNT_PROCESS_WHITELIST, + + /** + * 设备注册白名单 + */ + DEVICE_REGISTER_WHITELIST; public String concatSysOrigin(SysOriginPlatformEnum sysOrigin) { diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java index 36cae06e..5c22fcea 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java @@ -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 userIds = latestMobileDeviceService.listUserIdsByDeviceFingerprint( fingerprint, userProfile.getOriginSys()); diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/device/impl/RegisterDeviceClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/device/impl/RegisterDeviceClientServiceImpl.java index ee5445eb..82166c00 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/device/impl/RegisterDeviceClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/device/impl/RegisterDeviceClientServiceImpl.java @@ -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 userIds = latestMobileDeviceService.listUserIdsByDeviceFingerprint( fingerprint, userProfile.getOriginSys());