vip赠送记录过滤当日的数据
This commit is contained in:
parent
62baa3a458
commit
efeeca6d05
@ -30,6 +30,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -104,13 +106,26 @@ public class CheckInServiceImpl implements CheckInService {
|
|||||||
// 1. 调用wallet客户端查询VIP赠送记录(仅包含基础record信息)
|
// 1. 调用wallet客户端查询VIP赠送记录(仅包含基础record信息)
|
||||||
ResultResponse<List<WalletGoldAssetRecordDTO>> response =
|
ResultResponse<List<WalletGoldAssetRecordDTO>> response =
|
||||||
walletGoldClient.getLatestVipGiveawayRecords(userId, limit);
|
walletGoldClient.getLatestVipGiveawayRecords(userId, limit);
|
||||||
|
|
||||||
List<WalletGoldAssetRecordDTO> records = ResponseAssert.requiredSuccess(response);
|
List<WalletGoldAssetRecordDTO> body = response.getBody();
|
||||||
|
if (CollectionUtils.isEmpty(body)) {
|
||||||
if (CollectionUtils.isEmpty(records)) {
|
|
||||||
return CollectionUtils.newArrayList();
|
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)
|
// 2. 收集所有eventId (商品ID)
|
||||||
Set<Long> commodityIds = records.stream()
|
Set<Long> commodityIds = records.stream()
|
||||||
.map(WalletGoldAssetRecordDTO::getEventId)
|
.map(WalletGoldAssetRecordDTO::getEventId)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user