首充时间字段缓存处理
This commit is contained in:
parent
977ccff1b8
commit
7e6b8fa5bf
@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user