diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java index b7c4c173..eb0149ec 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java @@ -1252,14 +1252,14 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati private Map averageOrder(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) { List> dateOrder = xhpcStatisticsServiceMapper.getDateOrderCount(type,status,logOperatorId,operatorId,chargingStationId,chargingPileId,tenantId,conditionBeginOfDay,conditionEndOfDay); - int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderCountNUmber(type, status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, conditionBeginOfDay, conditionEndOfDay); + // int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderCountNUmber(type, status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, conditionBeginOfDay, conditionEndOfDay); Map map =new HashMap<>(); if(dateOrder !=null && dateOrder.size()>0 ){ - BigDecimal divide = new BigDecimal(dateOrderNUmber).divide(BigDecimal.valueOf(dateOrder.size()), 2, BigDecimal.ROUND_HALF_UP); - map.put("averageOrder",divide); + // BigDecimal divide = new BigDecimal(dateOrderNUmber).divide(BigDecimal.valueOf(dateOrder.size()), 2, BigDecimal.ROUND_HALF_UP); + // map.put("averageOrder",divide); map.put("list",dateOrder); }else{ - map.put("averageOrder",0); + // map.put("averageOrder",0); map.put("list",new ArrayList<>()); } @@ -1267,14 +1267,14 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } private Map extracted(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) { List> dateOrder = xhpcStatisticsServiceMapper.getDateOrder(type,status,logOperatorId,operatorId,chargingStationId,chargingPileId,tenantId,conditionBeginOfDay,conditionEndOfDay); - int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderNUmber(type, status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, conditionBeginOfDay, conditionEndOfDay); + //int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderNUmber(type, status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, conditionBeginOfDay, conditionEndOfDay); Map map =new HashMap<>(); if(dateOrder !=null && dateOrder.size()>0 ){ - BigDecimal divide = new BigDecimal(dateOrderNUmber).divide(BigDecimal.valueOf(dateOrder.size()), 2, BigDecimal.ROUND_HALF_UP); - map.put("averagePower",divide); + //BigDecimal divide = new BigDecimal(dateOrderNUmber).divide(BigDecimal.valueOf(dateOrder.size()), 2, BigDecimal.ROUND_HALF_UP); + //map.put("averagePower",divide); map.put("list",dateOrder); }else{ - map.put("averagePower",0); + //map.put("averagePower",0); map.put("list",new ArrayList<>()); } return map; 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 415d6fc0..94d53f3a 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1310,34 +1310,7 @@ ifnull(sum(total_price),0) totalPrice, ifnull(sum(power_price_total),0) powerPriceTotal, ifnull(sum(service_price_total),0)servicePriceTotal, - 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, +-- format(ifnull(sum(total_power),0)/ifnull(count(history_order_id),0),3) averageOrderPower, date_format(end_time, '%Y-%m') time @@ -1396,6 +1369,7 @@