佩戴道具缓存处理

This commit is contained in:
tianfeng 2025-11-20 18:12:30 +08:00
parent 6574bafbd1
commit 3c0b4f5958

View File

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