luodangjia
2025-01-14 ea6bf9042d9ad4faaf328bdc68a41ef36b47f13d
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -301,8 +301,12 @@
                .orderByAsc(Order::getCreateTime));
        Map<String, List<Order>> map = orderList.stream().collect(Collectors.groupingBy(item -> item.getCreateTime()
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
        Map<String, List<Order>> map = orderList.stream()
                .collect(Collectors.groupingBy(
                        item -> item.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
                        TreeMap::new, // 使用 TreeMap 按键排序
                        Collectors.toList()
                ));
        List<OrderStatisticsDetail> orderStatisticsDetails = new ArrayList<>();
        map.forEach((key, value) -> {
@@ -317,12 +321,14 @@
                if (order.getOrderType().equals(1)) {
                    serviceTotal++;
                    serviceTotalMoney = serviceTotalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2)){
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2) && 1 == order.getDistributionMode()){
                    singleTotal++;
                    singleTotalMoney = singleTotalMoney.add(order.getPaymentAmount());
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }
                total++;
                totalMoney = totalMoney.add(order.getPaymentAmount());
            }
            orderStatisticsDetail.setDate(key);
            orderStatisticsDetail.setServiceTotal(serviceTotal);