佩戴道具缓存处理
This commit is contained in:
parent
6574bafbd1
commit
3c0b4f5958
@ -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,12 +363,24 @@ 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());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return wearBadge;
|
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());
|
||||||
|
}
|
||||||
|
return wearBadge;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserRunProfile getById(Long id) {
|
public UserRunProfile getById(Long id) {
|
||||||
return mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), UserRunProfile.class);
|
return mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), UserRunProfile.class);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user