diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index bbfa3abc5..b27ed2854 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -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 getMyBizStatListByCountry(EmisWaybill emisWaybill) { - return emisWaybillMapper.getMyBizStatListByCountry(emisWaybill); + + List mySortList = new ArrayList(); + + + 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 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 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() { + @Override + public int compare(Map a, Map b) { + return MapUtils.getIntValue(a,"orderNum")-MapUtils.getIntValue(b,"orderNum"); + } + }); + } + + return mySortList; } diff --git a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml index 90a2f9acd..89c902dd8 100644 --- a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml @@ -1948,17 +1948,40 @@