md
This commit is contained in:
parent
bce68aefd0
commit
8e8473c683
@ -184,10 +184,16 @@ public class EmisBaseService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmisCountryAreaMapper emisCountryAreaMapper;
|
private EmisCountryAreaMapper emisCountryAreaMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisExchangeRateMapper emisExchangeRateMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RedissonService redissonService;
|
RedissonService redissonService;
|
||||||
|
|
||||||
|
public EmisExchangeRate getValidExchangeRate(String from, String to,String rateDate){
|
||||||
|
return emisExchangeRateMapper.getValidExchangeRate(from, to,rateDate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断获取主单号
|
* 判断获取主单号
|
||||||
* @param billCode
|
* @param billCode
|
||||||
|
|||||||
@ -3011,7 +3011,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
// 记录类型,用于判断是否重复
|
// 记录类型,用于判断是否重复
|
||||||
feeTypeMap.put(feeItem.getFeeCode(), 1);
|
feeTypeMap.put(feeItem.getFeeCode(), 1);
|
||||||
|
|
||||||
// 币种进行换算
|
|
||||||
|
|
||||||
|
|
||||||
feeList.add(feeItem);
|
feeList.add(feeItem);
|
||||||
@ -3020,12 +3019,47 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对非人民币重新进行计算费用总额
|
||||||
|
BigDecimal realTotalFee = BigDecimal.ZERO;
|
||||||
|
if(!CollectionUtils.isEmpty(feeList)){
|
||||||
|
for (EmisWaybillFeeitem feeItem:feeList) {
|
||||||
|
// 币种进行换算
|
||||||
|
if(!"CNY".equals(feeItem.getCurrency())){
|
||||||
|
|
||||||
|
Date calcDate = emisWaybill.getSendDate();
|
||||||
|
if(calcDate==null){
|
||||||
|
calcDate= new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
EmisExchangeRate exchangeRate= getValidExchangeRate(feeItem.getCurrency(), "CNY",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,calcDate));
|
||||||
|
if(exchangeRate!=null){
|
||||||
|
|
||||||
|
BigDecimal cnyRealFee = feeItem.getRealFee().multiply( BigDecimal.valueOf( Double.valueOf(exchangeRate.getRate()) ) );
|
||||||
|
String feeItemRemark = "汇率:"+exchangeRate.getRate()+","+ cnyRealFee.stripTrailingZeros().toPlainString();
|
||||||
|
feeItem.setRemark(feeItemRemark);
|
||||||
|
realTotalFee=realTotalFee.add(cnyRealFee);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
BigDecimal cnyRealFee = feeItem.getRealFee();
|
||||||
|
realTotalFee=realTotalFee.add(cnyRealFee);
|
||||||
|
String feeItemRemark = "汇率:0.0,"+ cnyRealFee.stripTrailingZeros().toPlainString();
|
||||||
|
feeItem.setRemark(feeItemRemark);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
realTotalFee=realTotalFee.add(feeItem.getRealFee());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("费用明细:"+JSON.toJSONString(feeList));
|
||||||
|
}
|
||||||
|
|
||||||
// 设置费用明细
|
// 设置费用明细
|
||||||
emisWaybill.setFeeitemList(feeList);
|
emisWaybill.setFeeitemList(feeList);
|
||||||
|
|
||||||
// 币种换算
|
// 币种换算
|
||||||
|
|
||||||
emisWaybill.setFreight(BigDecimal.valueOf(totalFee));
|
// emisWaybill.setFreight(BigDecimal.valueOf(totalFee));
|
||||||
|
emisWaybill.setFreight(BigDecimal.valueOf(realTotalFee));
|
||||||
|
|
||||||
if(emisWaybill.getFreight().compareTo(BigDecimal.ZERO)==0){
|
if(emisWaybill.getFreight().compareTo(BigDecimal.ZERO)==0){
|
||||||
throw new EmisBizError(EmisBizErrorType.CALC_QUOTE_ERROR, "报价未配置");
|
throw new EmisBizError(EmisBizErrorType.CALC_QUOTE_ERROR, "报价未配置");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user