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 dc5f9e37..d3893803 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 @@ -5,6 +5,7 @@ import com.mongodb.BasicDBObject; import com.red.circle.other.infra.database.mongo.entity.user.profile.UserRunProfile; import com.red.circle.other.infra.database.mongo.entity.user.profile.UserSpecialId; import com.red.circle.other.infra.database.mongo.service.user.profile.UserRunProfileService; +import com.red.circle.other.inner.enums.material.BadgeConfigTypeEnum; import com.red.circle.other.inner.model.dto.material.UseBadgeDTO; import com.red.circle.other.inner.model.dto.material.UsePropsDTO; import com.red.circle.tool.core.collection.CollectionUtils; @@ -320,7 +321,9 @@ public class UserRunProfileServiceImpl implements UserRunProfileService { mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(id)), new Update() .set("updateTime", TimestampUtils.now()) - .set("wearBadge", filterBadgeNotAvailable(wearBadges)), + .set("wearBadge", filterBadgeNotAvailable(wearBadges)) + .set("wearHonor", filterHonorNotAvailable(wearBadges)) + , UserRunProfile.class); } @@ -360,12 +363,24 @@ public class UserRunProfileServiceImpl implements UserRunProfileService { private List filterBadgeNotAvailable(List wearBadge) { if (CollectionUtils.isNotEmpty(wearBadge)) { - return wearBadge.stream().filter(badge -> checkAvailable(badge.getExpireTime())) + return wearBadge.stream() + .filter(badge -> !BadgeConfigTypeEnum.isHonorType(badge.getType())) + .filter(badge -> checkAvailable(badge.getExpireTime())) .collect(Collectors.toList()); } return wearBadge; } + private List filterHonorNotAvailable(List wearBadge) { + if (CollectionUtils.isNotEmpty(wearBadge)) { + return wearBadge.stream() + .filter(badge -> BadgeConfigTypeEnum.isHonorType(badge.getType())) + .filter(badge -> checkAvailable(badge.getExpireTime())) + .collect(Collectors.toList()); + } + return wearBadge; + } + @Override public UserRunProfile getById(Long id) { return mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), UserRunProfile.class);