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 933f39eb..f9e618f4 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 @@ -103,7 +103,9 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo if (Objects.nonNull(userSpecialId)) { userRunProfile.setOwnSpecialId(userSpecialId); } - return userProfileInfraConvertor.toUserProfile(userRunProfile); + //处理首充字段缓存 + checkAndUpdateFirstCharge(userRunProfile); + return userProfileInfraConvertor.toUserProfile(userRunProfile); } return getFirstUserRunProfile(listByUserIds(Collections.singleton(userId))); } @@ -112,6 +114,8 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo public UserProfile getByAccount(String account) { UserRunProfile userRunProfile = userRunProfileService.getByAccount(account); if (Objects.nonNull(userRunProfile)) { + //处理首充字段缓存 + checkAndUpdateFirstCharge(userRunProfile); return userProfileInfraConvertor.toUserProfile(userRunProfile); } @@ -123,6 +127,17 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo assembleUserRunProfiles(Collections.singletonList(baseInfo))); } + private static void checkAndUpdateFirstCharge(UserRunProfile userRunProfile) { + if (userRunProfile.getFirstRecharge() != null && userRunProfile.getFirstRecharge()) { + LocalDateTime createTime = userRunProfile.getCreateTime().toLocalDateTime(); + Duration duration = Duration.between(createTime, LocalDateTime.now()); + if (duration.toDays() >= 7) { + userRunProfile.setFirstRecharge(false); + userRunProfile.setFirstRechargeEndTime(null); + } + } + } + @Override public UserProfile getByAccount(String account, String sysOrigin) { BaseInfo baseInfo = baseInfoService.getByAccount(account,sysOrigin); @@ -266,7 +281,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo OneTimeTask response = oneTimeTaskService.queryCompletedFirstCharge(newUserRunProfile.getId(), newUserRunProfile.getOriginSys()); if (response == null) { newUserRunProfile.setFirstRecharge(true); - newUserRunProfile.setFirstRechargeEndTime(ZonedDateTimeUtils.toTimestamp(createTime.plusDays(7))); + newUserRunProfile.setFirstRechargeEndTime(ZonedDateTimeUtils.toTimestampDefault(createTime.plusDays(7))); } }