优化首页充电数据显示
This commit is contained in:
parent
8fd8d12b27
commit
9c60a1a5a5
@ -1252,14 +1252,14 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
|
||||
private Map<String, Object> averageOrder(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) {
|
||||
List<Map<String, Object>> 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<String ,Object> 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<String, Object> extracted(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) {
|
||||
List<Map<String, Object>> 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<String ,Object> 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;
|
||||
|
||||
@ -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
|
||||
<if test="operatorId !=null and ''!=operatorId">
|
||||
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and charging_station_id=#{chargingStationId}
|
||||
</if>
|
||||
<if test="chargingPileId !=null">
|
||||
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
|
||||
</if>
|
||||
<if test="status==1">
|
||||
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="status==2">
|
||||
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="type!=null and type ==4">
|
||||
GROUP BY date_format(end_time, '%Y-%m')
|
||||
</if>
|
||||
<if test="type !=4">
|
||||
GROUP BY DATE_FORMAT(end_time, '%Y-%m-%d')
|
||||
</if>
|
||||
),0), 3) averagePower,
|
||||
-- format(ifnull(sum(total_power),0)/ifnull(count(history_order_id),0),3) averageOrderPower,
|
||||
<if test="type!=null and type ==4">
|
||||
date_format(end_time, '%Y-%m') time
|
||||
</if>
|
||||
@ -1396,6 +1369,7 @@
|
||||
<select id="getDateOrderCount" resultType="map">
|
||||
select
|
||||
count(history_order_id) number,
|
||||
|
||||
<if test="type!=null and type ==4">
|
||||
date_format(end_time, '%Y-%m') time
|
||||
</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user