From bc973c1bcc1803bc81fc27ce4adabe35c7b74c00 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 23 Jan 2026 17:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=A3=E8=AA=89=E5=8B=8B=E7=AB=A0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0use=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inner/model/dto/material/UseBadgeDTO.java | 5 +++++ .../model/dto/user/props/UserUseBadgeDTO.java | 6 ++++++ .../other/infra/common/props/UserBadgeCommon.java | 2 +- .../rds/service/badge/BadgeBackpackService.java | 5 +++++ .../badge/impl/BadgeBackpackServiceImpl.java | 15 +++++++++++++++ .../user/UserRunProfileTransportGatewayImpl.java | 3 ++- 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/material/UseBadgeDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/material/UseBadgeDTO.java index 5e3fdafa..f35e5b3e 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/material/UseBadgeDTO.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/material/UseBadgeDTO.java @@ -50,6 +50,11 @@ public class UseBadgeDTO implements Serializable { */ private String type; + /** + * 是否佩戴上 + */ + private Boolean use; + /** * 徽章key. */ diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/props/UserUseBadgeDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/props/UserUseBadgeDTO.java index fef5052e..95db3580 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/props/UserUseBadgeDTO.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/props/UserUseBadgeDTO.java @@ -50,6 +50,12 @@ public class UserUseBadgeDTO implements Serializable { */ private String type; + + /** + * 是否佩戴上 + */ + private Boolean use; + /** * 徽章key. */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/props/UserBadgeCommon.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/props/UserBadgeCommon.java index 1f5a9319..f9699d2c 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/props/UserBadgeCommon.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/props/UserBadgeCommon.java @@ -122,6 +122,6 @@ public class UserBadgeCommon { */ public List listUseNotExpireTimeByUserIds(Set userIds) { return badgeInfraConvertor.toListBadgeBackpackDTO( - badgeBackpackService.listUseNotExpireTimeByUserIds(userIds)); + badgeBackpackService.listNotExpireTimeByUserIds(userIds)); } } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/BadgeBackpackService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/BadgeBackpackService.java index 81e5b632..560b3973 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/BadgeBackpackService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/BadgeBackpackService.java @@ -72,6 +72,11 @@ public interface BadgeBackpackService extends BaseService { */ List listUseNotExpireTimeByUserIds(Set userIds); + /** + * 获取一组用户未过期的徽章. + */ + List listNotExpireTimeByUserIds(Set userIds); + /** * 获取一组指定的徽章信息. */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/impl/BadgeBackpackServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/impl/BadgeBackpackServiceImpl.java index 47281173..ca11de8f 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/impl/BadgeBackpackServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/badge/impl/BadgeBackpackServiceImpl.java @@ -141,6 +141,21 @@ public class BadgeBackpackServiceImpl extends .orElseGet(CollectionUtils::newArrayList); } + @Override + public List listNotExpireTimeByUserIds(Set userIds) { + if (CollectionUtils.isEmpty(userIds)) { + return CollectionUtils.newArrayList(); + } + + return Optional.ofNullable(query() + .in(userIds.size() > 1, BadgeBackpack::getUserId, userIds) + .eq(Objects.equals(userIds.size(), 1), BadgeBackpack::getUserId, userIds.iterator().next()) + .list()) + .map(badgeBackpacks -> badgeBackpacks.stream().filter(this::filterAvailable) + .collect(Collectors.toList())) + .orElseGet(CollectionUtils::newArrayList); + } + @Override public List listUserNotExpireTimeByBadgeIds(Long userId, Collection badgeIds) { if (CollectionUtils.isEmpty(badgeIds)) { diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java index d4d77699..5213ddc7 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java @@ -91,7 +91,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo @Override public UserProfile getByUserId(Long userId) { - UserRunProfile userRunProfile = userRunProfileService.getById(userId); + UserRunProfile userRunProfile = null; if (Objects.nonNull(userRunProfile)) { // 拥有靓号 UserSpecialId userSpecialId = userSpecialIdService.getByUserId(userId); @@ -356,6 +356,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo entity.setSelectUrl(badgePictureConfig.getSelectUrl()); entity.setNotSelectUrl(badgePictureConfig.getNotSelectUrl()); entity.setAnimationUrl(badgePictureConfig.getAnimationUrl()); + entity.setUse(badgeBackpack.getUseProps()); entity.setExpireTime( Objects.equals(badgeBackpack.getExpireType(), BadgeBackpackExpireType.PERMANENT.name()) ? TimestampUtils.nowPlusYear(10).getTime()