This commit is contained in:
linfso 2024-08-04 18:53:44 +08:00
parent 051d87eff6
commit bc8a22212f

View File

@ -2839,6 +2839,10 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
if (feeItem.getFee().compareTo(BigDecimal.ZERO) != 0) {
// 记录类型,用于判断是否重复
feeTypeMap.put(feeItem.getFeeCode(), 1);
// 币种进行换算
feeList.add(feeItem);
}
}
@ -2847,6 +2851,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 设置费用明细
emisWaybill.setFeeitemList(feeList);
// 币种换算
emisWaybill.setFreight(BigDecimal.valueOf(totalFee));
if(emisWaybill.getFreight().compareTo(BigDecimal.ZERO)==0){
@ -2909,14 +2916,52 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
estFeeMap.put("productType",emisTransProduct.getProdCode());
estFeeMap.put("productTypeName",emisTransProduct.getProdName());
estFeeMap.put("agingDesc",emisTransProduct.getAgingDesc());
for (EmisWaybillFeeitem feeItem:emisWaybill.getFeeitemList()) {
// 只取运输费的最低报价
if("1001".equals(feeItem.getFeeCode()) ){
estFeeMap.put("leastPrice",feeItem.getLeastPrice());
break;
// 计算标准运费
List<EmisWaybillFeeitem> feeitemList=emisWaybill.getFeeitemList();
BigDecimal totalRealFee = BigDecimal.ZERO;
if(!CollectionUtils.isEmpty(feeitemList)) {
for (EmisWaybillFeeitem feeItem : feeitemList) {
// 只取运输费的最低报价
if ("1001".equals(feeItem.getFeeCode())) {
estFeeMap.put("leastPrice", feeItem.getLeastPrice());
}
BigDecimal realFee = feeItem.getFee();
if (realFee == null) {
realFee = feeItem.getRealFee();
}
// 汇率计算
if (!StringUtils.isEmpty(feeItem.getCurrency()) && !"CNY".equals(feeItem.getCurrency())) {
EmisExchangeRate emisExchangeRate = emisExchangeRateMapper.getValidExchangeRate(feeItem.getCurrency(), "CNY");
if (emisExchangeRate != null) {
BigDecimal rate = BigDecimal.valueOf(Double.valueOf(emisExchangeRate.getRate()));
realFee = realFee.multiply(rate);
realFee = realFee.setScale(2, BigDecimal.ROUND_HALF_UP);
}
// 汇率查不到的情况就不计算
else {
// realFee=BigDecimal.ZERO;
}
}
totalRealFee = totalRealFee.add(realFee);
}
totalRealFee = totalRealFee.setScale(2, BigDecimal.ROUND_HALF_UP);
emisWaybill.setFreight(totalRealFee);
}
// for (EmisWaybillFeeitem feeItem:emisWaybill.getFeeitemList()) {
// // 只取运输费的最低报价
// if("1001".equals(feeItem.getFeeCode()) ){
// estFeeMap.put("leastPrice",feeItem.getLeastPrice());
// break;
// }
// }
estFeeMap.put("estFee",emisWaybill.getFreight());
estFeeMap.put("orderNum",emisTransProduct.getOrderNum());