mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-24 04:55:08 +08:00
update
This commit is contained in:
@@ -6302,10 +6302,32 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
|
||||
long orderCount = pageInfo.getTotal();
|
||||
|
||||
// 3. 统计总金额(使用聚合 SQL,避免查询所有数据到内存
|
||||
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
|
||||
BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
|
||||
? statistics.getOrderAmount() : BigDecimal.ZERO;
|
||||
// 3. 统计总金额 (分批处理)
|
||||
BigDecimal totalOrderAmount = BigDecimal.ZERO;
|
||||
int batchSize = 500; // 每批最多 500 个站点ID
|
||||
if (stationIdList.size() > batchSize) {
|
||||
// 分批查询统计
|
||||
List<List<String>> batches = Lists.partition(stationIdList, batchSize);
|
||||
for (List<String> batch : batches) {
|
||||
QueryOrderDTO batchDTO = QueryOrderDTO.builder()
|
||||
.stationIdList(batch)
|
||||
.startTime(dto.getCreateTime())
|
||||
.endTime(dto.getEndTime())
|
||||
.orderStatus(dto.getOrderStatus())
|
||||
.startMode(dto.getStartMode())
|
||||
.stationName(dto.getStationName())
|
||||
.build();
|
||||
OrderStatisticsVO batchStatistics = orderBasicInfoMapper.countBusinessOrderStatistics(batchDTO);
|
||||
if (batchStatistics != null && batchStatistics.getOrderAmount() != null) {
|
||||
totalOrderAmount = totalOrderAmount.add(batchStatistics.getOrderAmount());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 直接查询
|
||||
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
|
||||
totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
|
||||
? statistics.getOrderAmount() : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
//4. 转换为 BusinessOrderListVO
|
||||
List<BusinessOrderListVO> businessOrderList = orderListVOS.stream()
|
||||
|
||||
Reference in New Issue
Block a user