From 8fd8d12b279621dac2aa605e37624214d235cdcb Mon Sep 17 00:00:00 2001 From: yuyang Date: Wed, 27 Jul 2022 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5=E5=85=85?= =?UTF-8?q?=E7=94=B5=E6=95=B0=E6=8D=AE=E5=B9=B3=E5=9D=87=E7=94=B5=E9=87=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/service/IXhpcStatisticsService.java | 2 +- .../resources/mapper/XhpcStatisticsMapper.xml | 40 ++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java index 5efbd8e5..782379a6 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java @@ -296,7 +296,7 @@ public interface IXhpcStatisticsService { List> getTodayTerminal(Long operatorId,Long chargingStationId,Long chargingPileId); /** - * 今日电枪实时状态 + * 充电数据 * * @param state 1 充电数据 2.创建订单量 */ diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 163fd844..415d6fc0 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1310,12 +1310,40 @@ ifnull(sum(total_price),0) totalPrice, ifnull(sum(power_price_total),0) powerPriceTotal, ifnull(sum(service_price_total),0)servicePriceTotal, - - date_format(end_time, '%Y-%m') time - - - DATE_FORMAT(end_time, '%Y-%m-%d') time - + format(ifnull(sum(total_power)/ + (select count(history_order_id) from xhpc_history_order + where end_time >=#{beginOfDay} and end_time <= #{endOfDay} and total_price !=0 + + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId}) + + + and tenant_id = #{tenantId} + + + and charging_station_id=#{chargingStationId} + + + and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId}) + + + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) + + + and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) + + + GROUP BY date_format(end_time, '%Y-%m') + + + GROUP BY DATE_FORMAT(end_time, '%Y-%m-%d') + + ),0), 3) averagePower, + + date_format(end_time, '%Y-%m') time + + + DATE_FORMAT(end_time, '%Y-%m-%d') time + from xhpc_history_order where end_time >=#{beginOfDay} and end_time <= #{endOfDay}