日期范围

This commit is contained in:
2025-11-24 14:04:31 +08:00
parent 87d6399e35
commit 57d4c8f794
3 changed files with 8 additions and 14 deletions

View File

@@ -31,8 +31,10 @@ import java.util.stream.Stream;
public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticMapper, ShopProdStatistic> implements ShopProdStatisticService {
@Override
public List<ShopProdStatistic> getArchiveTradeDataBy20(Long shopId, String rangeType, LocalDate start, LocalDate end) {
List<ShopProdStatistic> archiveTradeData = getArchiveTradeData(shopId, null, rangeType, start, end);
public List<ShopProdStatistic> getArchiveTradeDataBy20(Long shopId, Integer day) {
LocalDate currentDate = LocalDate.now();
LocalDate startDate = currentDate.minusDays(day - 1);
List<ShopProdStatistic> archiveTradeData = getArchiveTradeData(shopId, null, "", startDate, currentDate);
// 按照 saleCount 降序排序
return archiveTradeData.stream()
.sorted(
@@ -110,7 +112,7 @@ public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticM
realTimeData = realTimeData.stream()
.filter(ShopProdStatistic::isValid)
.toList();
if(CollUtil.isNotEmpty(realTimeData)) {
if (CollUtil.isNotEmpty(realTimeData)) {
boolean exists = exists(QueryWrapper.create().eq(ShopProdStatistic::getShopId, shopId).eq(ShopProdStatistic::getCreateDay, day));
if (exists) {
remove(QueryWrapper.create().eq(ShopProdStatistic::getShopId, shopId).eq(ShopProdStatistic::getCreateDay, day));