diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java index b8972ce4..4a3f50d2 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java @@ -203,6 +203,19 @@ public class UserRunProfile implements Serializable { wearBadge.addAll(useBadgeEntities); } + /** + * 添加使用徽章. + */ + public void addWearHonor(List useBadgeEntities) { + if (Objects.isNull(wearHonor)) { + wearHonor = CollectionUtils.newArrayList(); + } + if (CollectionUtils.isEmpty(useBadgeEntities)) { + return; + } + wearHonor.addAll(useBadgeEntities); + } + public List getUseProps() { if (CollectionUtils.isNotEmpty(useProps)) { return useProps.stream() @@ -221,6 +234,15 @@ public class UserRunProfile implements Serializable { return wearBadge; } + public List getWearHonor() { + if (CollectionUtils.isNotEmpty(wearHonor)) { + wearHonor = wearHonor.stream() + .filter(props -> Objects.nonNull(props) && checkAvailable(props.getExpireTime())) + .collect(Collectors.toList()); + } + return wearHonor; + } + /** * true 可用. false 不可用. */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/user/profile/impl/UserRunProfileServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/user/profile/impl/UserRunProfileServiceImpl.java index 4985b829..dc5f9e37 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/user/profile/impl/UserRunProfileServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/user/profile/impl/UserRunProfileServiceImpl.java @@ -237,6 +237,10 @@ public class UserRunProfileServiceImpl implements UserRunProfileService { if (Objects.nonNull(userRunProfile.getWearBadge())) { update.set("wearBadge", userRunProfile.getWearBadge()); } + if (Objects.nonNull(userRunProfile.getWearHonor())) { + update.set("wearHonor", userRunProfile.getWearHonor()); + } + return update; } 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 7dde1e48..c04acd6d 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 @@ -247,7 +247,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo if (!CollectionUtils.isEmpty(useBadgeDTOS)) { newUserRunProfile.addWearBadge(useBadgeDTOS.stream() .filter(e -> !BadgeConfigTypeEnum.isHonorType(e.getType())).toList()); - newUserRunProfile.setWearHonor(useBadgeDTOS.stream() + newUserRunProfile.addWearHonor(useBadgeDTOS.stream() .filter(e -> BadgeConfigTypeEnum.isHonorType(e.getType())).toList()); }