diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserProfileDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserProfileDTO.java index 97703b6e..c554f079 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserProfileDTO.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserProfileDTO.java @@ -207,6 +207,16 @@ public class UserProfileDTO implements Serializable { */ private Boolean isSuperFreightAgent; + /** + * 是否未完成首充 + */ + private Boolean firstRecharge; + + /** + * 首充结束时间 + */ + private Timestamp firstRechargeEndTime; + /** * 用户使用的徽章. */ diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/model/user/UserProfile.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/model/user/UserProfile.java index 55113ae3..619375f3 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/model/user/UserProfile.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/model/user/UserProfile.java @@ -162,6 +162,16 @@ public class UserProfile implements Serializable { private String checkStatus; + /** + * 是否未完成首充 + */ + private Boolean firstRecharge; + + /** + * 首充结束时间 + */ + private Timestamp firstRechargeEndTime; + /** * 覆盖get,过滤已过期靓号. */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java index 4a3f50d2..8504fd23 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/user/profile/UserRunProfile.java @@ -164,6 +164,17 @@ public class UserRunProfile implements Serializable { */ private List wearHonor; + + /** + * 是否未完成首充 + */ + private Boolean firstRecharge; + + /** + * 首充结束时间 + */ + private Timestamp firstRechargeEndTime; + /** * 添加使用道具. */ 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 d3893803..266ac977 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 @@ -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; } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java index c04acd6d..35f899eb 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java @@ -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 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>> response = totalRechargeClient.mapGroup(Set.of(newUserRunProfile.getId())); + if (response.getStatus()) { + List 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()));