新增是否首充字段

This commit is contained in:
tianfeng 2025-12-04 17:30:44 +08:00
parent 69b8185421
commit 882666245e
5 changed files with 63 additions and 9 deletions

View File

@ -207,6 +207,16 @@ public class UserProfileDTO implements Serializable {
*/
private Boolean isSuperFreightAgent;
/**
* 是否未完成首充
*/
private Boolean firstRecharge;
/**
* 首充结束时间
*/
private Timestamp firstRechargeEndTime;
/**
* 用户使用的徽章.
*/

View File

@ -162,6 +162,16 @@ public class UserProfile implements Serializable {
private String checkStatus;
/**
* 是否未完成首充
*/
private Boolean firstRecharge;
/**
* 首充结束时间
*/
private Timestamp firstRechargeEndTime;
/**
* 覆盖get过滤已过期靓号.
*/

View File

@ -164,6 +164,17 @@ public class UserRunProfile implements Serializable {
*/
private List<UseBadgeDTO> wearHonor;
/**
* 是否未完成首充
*/
private Boolean firstRecharge;
/**
* 首充结束时间
*/
private Timestamp firstRechargeEndTime;
/**
* 添加使用道具.
*/

View File

@ -241,6 +241,12 @@ public class UserRunProfileServiceImpl implements UserRunProfileService {
if (Objects.nonNull(userRunProfile.getWearHonor())) {
update.set("wearHonor", userRunProfile.getWearHonor());
}
if (Objects.nonNull(userRunProfile.getFirstRecharge())) {
update.set("firstRecharge", userRunProfile.getFirstRecharge());
}
if (Objects.nonNull(userRunProfile.getFirstRechargeEndTime())) {
update.set("firstRechargeEndTime", userRunProfile.getFirstRechargeEndTime());
}
return update;
}

View File

@ -2,6 +2,9 @@ package com.red.circle.other.infra.gateway.user;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.order.inner.endpoint.TotalRechargeClient;
import com.red.circle.order.inner.model.dto.UserTotalRechargeDTO;
import com.red.circle.other.domain.gateway.props.PropsNobleVipGateway;
import com.red.circle.other.domain.gateway.user.UserRunProfileTransportGateway;
import com.red.circle.other.domain.model.user.UserProfile;
@ -25,6 +28,7 @@ import com.red.circle.other.infra.database.rds.service.props.PropsSourceRecordSe
import com.red.circle.other.infra.database.rds.service.props.RoomThemeUserBackpackService;
import com.red.circle.other.infra.database.rds.service.props.RoomThemeUserCustomizeService;
import com.red.circle.other.infra.database.rds.service.user.user.BaseInfoService;
import com.red.circle.other.infra.utils.ZonedDateTimeUtils;
import com.red.circle.other.inner.enums.material.BadgeBackpackExpireType;
import com.red.circle.other.inner.enums.material.BadgeConfigTypeEnum;
import com.red.circle.other.inner.enums.material.PropsCommodityType;
@ -39,17 +43,18 @@ 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.props.PropsNobleVipAbilityDTO;
import com.red.circle.tool.core.collection.CollectionUtils;
import com.red.circle.tool.core.date.DateUtils;
import com.red.circle.tool.core.date.TimestampUtils;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
import com.red.circle.tool.core.json.JacksonUtils;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalUnit;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
@ -83,6 +88,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
private final RoomThemeUserBackpackService roomThemeUserBackpackService;
private final PropsResourcesInfraConvertor propsResourcesInfraConvertor;
private final RoomThemeUserCustomizeService roomThemeUserCustomizeService;
private final TotalRechargeClient totalRechargeClient;
@Override
public UserProfile getByUserId(Long userId) {
@ -240,8 +246,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
userBaseInfos.stream().map(BaseInfo::getId).collect(Collectors.toSet()));
return userBaseInfos.stream().map(userBaseInfo -> {
UserRunProfile newUserRunProfile = userProfileInfraConvertor.toUserRunProfile(
userBaseInfo);
UserRunProfile newUserRunProfile = userProfileInfraConvertor.toUserRunProfile(userBaseInfo);
List<UseBadgeDTO> useBadgeDTOS = userUseBadgeEntities.get(userBaseInfo.getId());
if (!CollectionUtils.isEmpty(useBadgeDTOS)) {
@ -251,6 +256,18 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
.filter(e -> BadgeConfigTypeEnum.isHonorType(e.getType())).toList());
}
LocalDateTime createTime = newUserRunProfile.getCreateTime().toLocalDateTime();
Duration duration = Duration.between(createTime, LocalDateTime.now());
if (duration.toDays() < 7) {
ResultResponse<Map<Long, List<UserTotalRechargeDTO>>> response = totalRechargeClient.mapGroup(Set.of(newUserRunProfile.getId()));
if (response.getStatus()) {
List<UserTotalRechargeDTO> dtos = response.getBody().get(newUserRunProfile.getId());
newUserRunProfile.setFirstRecharge(CollectionUtils.isEmpty(dtos));
newUserRunProfile.setFirstRechargeEndTime(ZonedDateTimeUtils.toTimestamp(createTime.plusDays(7)));
}
}
newUserRunProfile.addUseProps(userUsePropsEntityMap.get(userBaseInfo.getId()));
newUserRunProfile.addUseProps(userUseRoomTheme.get(userBaseInfo.getId()));
newUserRunProfile.setOwnSpecialId(userSpecialIdMap.get(userBaseInfo.getId()));