This commit is contained in:
linfso 2025-01-15 13:14:13 +08:00
parent 6bc3500124
commit 1938731daf
2 changed files with 105 additions and 11 deletions

View File

@ -47,6 +47,7 @@ package com.xdadan.erp.emis.service.impl;
import com.xdadan.erp.system.service.ISysFileInfoService;
import com.xdadan.erp.system.service.ISysNoticeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -234,7 +235,77 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Override
public List<Map> getMyBizStatListByCountry(EmisWaybill emisWaybill)
{
return emisWaybillMapper.getMyBizStatListByCountry(emisWaybill);
List<Map> mySortList = new ArrayList<Map>();
Integer otherKdTotalNum=0;
BigDecimal otherKdTotalBillWeight=BigDecimal.ZERO;
Integer otherKyTotalNum=0;
BigDecimal otherKyTotalBillWeight=BigDecimal.ZERO;
Integer otherWlTotalNum=0;
BigDecimal otherWlTotalBillWeight=BigDecimal.ZERO;
Integer otherTotalNum=0;
BigDecimal otherTotalBillWeight=BigDecimal.ZERO;
// bizList 排序
List<Map> myBizStatList = emisWaybillMapper.getMyBizStatListByCountry(emisWaybill);
if(!CollectionUtils.isEmpty(myBizStatList)){
for ( Map itemMap:myBizStatList) {
Integer orderNum = MapUtils.getInteger(itemMap,"orderNum");
if(orderNum!=99){
mySortList.add(itemMap);
}
// 合并其他国家的数据
else{
otherKdTotalNum=otherKdTotalNum+MapUtils.getInteger(itemMap,"kdTotalNum");
otherKdTotalBillWeight=otherKdTotalBillWeight.add(BigDecimal.valueOf(MapUtils.getDouble(itemMap,"kdTotalBillWeight")));
otherKyTotalNum=otherKyTotalNum+MapUtils.getInteger(itemMap,"kyTotalNum");
otherKyTotalBillWeight=otherKyTotalBillWeight.add(BigDecimal.valueOf(MapUtils.getDouble(itemMap,"kyTotalBillWeight")));
otherWlTotalNum=otherWlTotalNum+MapUtils.getInteger(itemMap,"wlTotalNum");
otherWlTotalBillWeight=otherWlTotalBillWeight.add(BigDecimal.valueOf(MapUtils.getDouble(itemMap,"wlTotalBillWeight")));
otherTotalNum=otherTotalNum+MapUtils.getInteger(itemMap,"totalNum");
otherTotalBillWeight=otherTotalBillWeight.add(BigDecimal.valueOf(MapUtils.getDouble(itemMap,"totalBillWeight")));
}
}
// 加入
// b.CODE AS countryCode,
// b.NAME AS countryName,
Map<String,Object> otherCountryItemMap = new HashMap<>();
otherCountryItemMap.put("countryCode","-1");
otherCountryItemMap.put("countryName","其它国家");
otherCountryItemMap.put("orderNum",99);
otherCountryItemMap.put("kdTotalNum",otherKdTotalNum);
otherCountryItemMap.put("kyTotalNum",otherKyTotalNum);
otherCountryItemMap.put("wlTotalNum",otherWlTotalNum);
otherCountryItemMap.put("totalNum",otherTotalNum);
otherCountryItemMap.put("kdTotalBillWeight",otherKdTotalBillWeight);
otherCountryItemMap.put("kyTotalBillWeight",otherKyTotalBillWeight);
otherCountryItemMap.put("wlTotalBillWeight",otherWlTotalBillWeight);
otherCountryItemMap.put("totalBillWeight",otherTotalBillWeight);
mySortList.add(otherCountryItemMap);
}
// 排序
if(!CollectionUtils.isEmpty(mySortList)) {
Collections.sort(mySortList, new Comparator<Map>() {
@Override
public int compare(Map a, Map b) {
return MapUtils.getIntValue(a,"orderNum")-MapUtils.getIntValue(b,"orderNum");
}
});
}
return mySortList;
}

View File

@ -1948,17 +1948,40 @@
</select>
<select id="getMyBizStatListByCountry" parameterType="EmisWaybill" resultType="map">
<!--
'柬埔寨','越南','缅甸','孟加拉','老挝','中国'
0086 中国
0880 孟加拉
0855 柬埔寨
0095 缅甸
0856 老挝
0084 越南
-->
select
b.CODE AS countryCode,
b.NAME AS countryName,
sum(if(c.trans_type=1,1,0) ) as kdTotalNum,
round(sum(if(c.trans_type=1,a.bill_weight,0) ),2) as kdTotalBillWeight,
sum(if(c.trans_type=2,1,0) ) as kyTotalNum,
round(sum(if(c.trans_type=2,a.bill_weight,0) ),2) as kyTotalBillWeight,
sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ),1,0) ) as wlTotalNum,
round(sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ) ,a.bill_weight,0) ),2) as wlTotalBillWeight,
count( 1 ) AS totalNum,
round( sum( a.bill_weight ), 2 ) AS totalBillWeight
b.CODE AS countryCode,
b.NAME AS countryName,
(
CASE
WHEN b.CODE = '0855' THEN 1
WHEN b.CODE = '0084' THEN 2
WHEN b.CODE = '0095' THEN 3
WHEN b.CODE = '0880' THEN 4
WHEN b.CODE = '0856' THEN 5
ELSE 99
END
) as orderNum,
sum(if(c.trans_type=1,1,0) ) as kdTotalNum,
round(sum(if(c.trans_type=1,a.bill_weight,0) ),2) as kdTotalBillWeight,
sum(if(c.trans_type=2,1,0) ) as kyTotalNum,
round(sum(if(c.trans_type=2,a.bill_weight,0) ),2) as kyTotalBillWeight,
sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ),1,0) ) as wlTotalNum,
round(sum(if( ( c.trans_type=3 or c.trans_type=4 or c.trans_type=5 ) ,a.bill_weight,0) ),2) as
wlTotalBillWeight,
count( 1 ) AS totalNum,
round( sum( a.bill_weight ), 2 ) AS totalBillWeight
from emis_waybill a, emis_country b,emis_trans_line c
<where>
a.del_flag='0' and a.order_status !='0' and a.order_status!='2'