userProfile 新增荣誉字段

This commit is contained in:
tianfeng 2025-11-20 17:56:25 +08:00
parent 10f5f90857
commit 6574bafbd1
3 changed files with 27 additions and 1 deletions

View File

@ -203,6 +203,19 @@ public class UserRunProfile implements Serializable {
wearBadge.addAll(useBadgeEntities);
}
/**
* 添加使用徽章.
*/
public void addWearHonor(List<UseBadgeDTO> useBadgeEntities) {
if (Objects.isNull(wearHonor)) {
wearHonor = CollectionUtils.newArrayList();
}
if (CollectionUtils.isEmpty(useBadgeEntities)) {
return;
}
wearHonor.addAll(useBadgeEntities);
}
public List<UsePropsDTO> getUseProps() {
if (CollectionUtils.isNotEmpty(useProps)) {
return useProps.stream()
@ -221,6 +234,15 @@ public class UserRunProfile implements Serializable {
return wearBadge;
}
public List<UseBadgeDTO> getWearHonor() {
if (CollectionUtils.isNotEmpty(wearHonor)) {
wearHonor = wearHonor.stream()
.filter(props -> Objects.nonNull(props) && checkAvailable(props.getExpireTime()))
.collect(Collectors.toList());
}
return wearHonor;
}
/**
* true 可用. false 不可用.
*/

View File

@ -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;
}

View File

@ -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());
}