|
|
@@ -1211,11 +1211,17 @@ class common {
|
|
|
//这里的问题跟 top 一样 。总的排放量查询有问题。目前是总的排放量 暂时等于 sea的排放量
|
|
|
if ($type == "co2e_orgin"){
|
|
|
$co2e_shippr_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
|
+ sum(case when (1<>1 or (transport_mode='air')) then 1 else 0 end) as air_rc,
|
|
|
+ sum(case when (1<>1 or (transport_mode='sea')) then 1 else 0 end) as sea_rc,
|
|
|
+ sum(case when (1<>1 or (transport_mode='road')) then 1 else 0 end) as road_rc,
|
|
|
shippr_uncode as station from public.kln_ocean where 1=1 and COALESCE(shippr_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by shippr_uncode order by catnum desc limit 10";
|
|
|
$co2e_aLL = common::excuteListSql($co2e_shippr_sql);
|
|
|
}
|
|
|
if ($type == "co2e_destination"){
|
|
|
$co2e_consignee_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
|
+ sum(case when (1<>1 or (transport_mode='air')) then 1 else 0 end) as air_rc,
|
|
|
+ sum(case when (1<>1 or (transport_mode='sea')) then 1 else 0 end) as sea_rc,
|
|
|
+ sum(case when (1<>1 or (transport_mode='road')) then 1 else 0 end) as road_rc,
|
|
|
consignee_uncode as station from public.kln_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by consignee_uncode order by catnum desc limit 10";
|
|
|
$co2e_aLL = common::excuteListSql($co2e_consignee_sql);
|
|
|
}
|
|
|
@@ -1229,36 +1235,21 @@ class common {
|
|
|
$stations[] = $val['station'];
|
|
|
}
|
|
|
}
|
|
|
- $station_str = utils::implode(',',$stations);
|
|
|
|
|
|
$ContainerCounSeries = array();
|
|
|
$shipment_mode_arr = array("air","sea","road");
|
|
|
foreach($shipment_mode_arr as $_shipment_mode){
|
|
|
//类型有 sea air road,目前之类只查询sea的,其他为空
|
|
|
$shipment_mode = $_shipment_mode;
|
|
|
- $co2e = array();
|
|
|
- if ($type == "co2e_orgin"){
|
|
|
- $co2e_shippr_sql_union = utils::_getSql($station_str,$type,$shipment_mode,$sqlWhere);
|
|
|
- if(!empty($co2e_shippr_sql_union)){
|
|
|
- $co2e = common::excuteListSql($co2e_shippr_sql_union);
|
|
|
- }
|
|
|
- $download_name = "CO2e Emission by Origin (Top 10)";
|
|
|
- }
|
|
|
- if ($type == "co2e_destination"){
|
|
|
- $co2e_consignee_union = utils::_getSql($station_str,$type,$shipment_mode,$sqlWhere);
|
|
|
- if(!empty($co2e_consignee_union)){
|
|
|
- $co2e = common::excuteListSql($co2e_consignee_union);
|
|
|
- }
|
|
|
- $download_name = "CO2e Emission by Destination (Top 10)";
|
|
|
- }
|
|
|
|
|
|
$total = 0;
|
|
|
$max = 0;
|
|
|
$data = array();
|
|
|
- foreach($co2e as $val){
|
|
|
- $data[] = empty($val['catnum'])? 0 : round($val['catnum'], 4);
|
|
|
- $total = $total + $val['catnum'];
|
|
|
- $max = $max < $val['catnum'] ? $val['catnum'] : $max;
|
|
|
+ foreach($co2e_aLL as $val){
|
|
|
+ $catnum = $shipment_mode."_rc";
|
|
|
+ $data[] = empty($val[$catnum])? 0 : round($val[$catnum], 4);
|
|
|
+ $total = $total + $val[$catnum];
|
|
|
+ $max = $max < $val[$catnum] ? $val[$catnum] : $max;
|
|
|
}
|
|
|
$ContainerCounSeries[$shipment_mode] = array("data"=>$data,"total"=>$total,"max"=>$max);
|
|
|
}
|