vip赠送记录过滤当日的数据

This commit is contained in:
tianfeng 2026-02-13 15:01:17 +08:00
parent 62baa3a458
commit efeeca6d05

View File

@ -30,6 +30,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -104,13 +106,26 @@ public class CheckInServiceImpl implements CheckInService {
// 1. 调用wallet客户端查询VIP赠送记录仅包含基础record信息
ResultResponse<List<WalletGoldAssetRecordDTO>> response =
walletGoldClient.getLatestVipGiveawayRecords(userId, limit);
List<WalletGoldAssetRecordDTO> records = ResponseAssert.requiredSuccess(response);
if (CollectionUtils.isEmpty(records)) {
List<WalletGoldAssetRecordDTO> body = response.getBody();
if (CollectionUtils.isEmpty(body)) {
return CollectionUtils.newArrayList();
}
// 过滤出 createTime 是当天的记录
List<WalletGoldAssetRecordDTO> records = body.stream()
.filter(record -> {
if (record.getCreateTime() == null) {
return false;
}
LocalDateTime createDateTime = record.getCreateTime().toLocalDateTime();
return createDateTime.toLocalDate().equals(LocalDate.now());
})
.toList();
if (CollectionUtils.isEmpty(body)) {
return CollectionUtils.newArrayList();
}
// 2. 收集所有eventId (商品ID)
Set<Long> commodityIds = records.stream()
.map(WalletGoldAssetRecordDTO::getEventId)