user_expand 新增 设备名单标记字段

This commit is contained in:
tianfeng 2026-02-27 12:07:18 +08:00
parent 341ac90455
commit a2a063f46e
5 changed files with 58 additions and 1 deletions

View File

@ -46,4 +46,13 @@ public interface RegisterDeviceGateway {
* @return 设备指纹MD5字符串
*/
String getEnhancedDeviceFingerprintByUserId(Long userId);
/**
* 检查用户设备名单状态.
* 黑名单返回 "BLOCK"白名单返回 ""未设置返回 null.
*
* @param userId 用户ID
* @return 名单状态字符串
*/
String checkDeviceListStatus(Long userId);
}

View File

@ -77,4 +77,10 @@ public class UserExpand extends TimestampBaseEntity {
@TableField("register_country_code")
private String registerCountryCode;
/**
* 设备名单标记: true-黑名单 false-白名单 null-不限制.
*/
@TableField("device_list_block")
private Boolean deviceListBlock;
}

View File

@ -123,4 +123,13 @@ public interface ExpandService extends BaseService<UserExpand> {
* @return list
*/
List<ActiveUserCountryCodeDTO> findLatestActiveUserCountryCode(LocalDateTime lastActiveTime);
/**
* 查询用户设备名单状态.
* 返回 null 表示不限制 true 表示黑名单 false 表示白名单.
*
* @param userId 用户id
* @return 名单标记
*/
Boolean getDeviceListBlock(Long userId);
}

View File

@ -152,8 +152,19 @@ public class ExpandServiceImpl extends BaseServiceImpl<ExpandDAO, UserExpand> im
@Override
public List<ActiveUserCountryCodeDTO> findLatestActiveUserCountryCode(
LocalDateTime lastActiveTime) {
return findLatestActiveUserCountryCode(lastActiveTime);
// return findLatestActiveUserCountryCode(lastActiveTime);
return null;
}
@Override
public Boolean getDeviceListBlock(Long userId) {
return Optional.ofNullable(
query().select(UserExpand::getDeviceListBlock)
.eq(UserExpand::getUserId, userId)
.last(PageConstant.LIMIT_ONE)
.getOne())
.map(UserExpand::getDeviceListBlock)
.orElse(null);
}
}

View File

@ -81,6 +81,10 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
@Override
public String getDeviceFingerprintByUserId(Long userId) {
String status = checkDeviceListStatus(userId);
if (status != null) {
return status;
}
return latestMobileDeviceService.getDeviceFingerprintByUserId(userId);
}
@ -90,6 +94,11 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
return false;
}
String status = checkDeviceListStatus(userId);
if (status != null) {
return "BLOCK".equals(status);
}
com.red.circle.other.domain.model.user.UserProfile userProfile = userProfileGateway.getByUserId(userId);
if (userProfile == null) {
return false;
@ -132,7 +141,20 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
@Override
public String getEnhancedDeviceFingerprintByUserId(Long userId) {
String status = checkDeviceListStatus(userId);
if (status != null) {
return status;
}
return latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId);
}
@Override
public String checkDeviceListStatus(Long userId) {
Boolean deviceListBlock = expandService.getDeviceListBlock(userId);
if (deviceListBlock == null) {
return null;
}
return deviceListBlock ? "BLOCK" : "";
}
}