Commit d0d0d989 authored by 332784038@qq.com's avatar 332784038@qq.com

汇率冗余业务补充

parent 5b805209
...@@ -123,6 +123,10 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec ...@@ -123,6 +123,10 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivable.setBaseCurrencyId(Long.parseLong(regionInfo.getImportCurrency5())); receivable.setBaseCurrencyId(Long.parseLong(regionInfo.getImportCurrency5()));
ExchangeRateRespDTO baseCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getBaseCurrencyId()); ExchangeRateRespDTO baseCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getBaseCurrencyId());
BigDecimal baseAmount = receivable.getTotalAmount().multiply(baseCurrencyRate.getTargetCurrencyAmount()).divide(baseCurrencyRate.getSourceCurrencyAmount(), 2, RoundingMode.HALF_UP); BigDecimal baseAmount = receivable.getTotalAmount().multiply(baseCurrencyRate.getTargetCurrencyAmount()).divide(baseCurrencyRate.getSourceCurrencyAmount(), 2, RoundingMode.HALF_UP);
receivable.setSourceAmount(baseCurrencyRate.getSourceCurrencyAmount());
receivable.setSourceCurrencyCode(baseCurrencyRate.getSourceCurrencyCode());
receivable.setTargetAmount(baseCurrencyRate.getTargetCurrencyAmount());
receivable.setTargetCurrencyCode(baseCurrencyRate.getTargetCurrencyCode());
receivable.setBaseAmount(baseAmount); receivable.setBaseAmount(baseAmount);
int feeType = getFeeType(receivable.getFeeType()); int feeType = getFeeType(receivable.getFeeType());
// 运费 // 运费
...@@ -139,6 +143,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec ...@@ -139,6 +143,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
ExchangeRateRespDTO destCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getDestCountryCurrencyId()); ExchangeRateRespDTO destCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getDestCountryCurrencyId());
receivable.setDestCountryRate(destCurrencyRate.getTargetCurrencyAmount().divide(destCurrencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP)); receivable.setDestCountryRate(destCurrencyRate.getTargetCurrencyAmount().divide(destCurrencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP));
receivable.setDestCountrySourceAmount(destCurrencyRate.getSourceCurrencyAmount()); receivable.setDestCountrySourceAmount(destCurrencyRate.getSourceCurrencyAmount());
receivable.setDestCountryTargetCurrencyCode(destCurrencyRate.getTargetCurrencyCode());
receivable.setDestCountryTargetAmount(destCurrencyRate.getTargetCurrencyAmount()); receivable.setDestCountryTargetAmount(destCurrencyRate.getTargetCurrencyAmount());
} }
// 额外费用 // 额外费用
...@@ -147,11 +152,13 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec ...@@ -147,11 +152,13 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
ExchangeRateRespDTO destCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getDestCountryCurrencyId()); ExchangeRateRespDTO destCurrencyRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), receivable.getDestCountryCurrencyId());
receivable.setDestCountryRate(destCurrencyRate.getTargetCurrencyAmount().divide(destCurrencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP)); receivable.setDestCountryRate(destCurrencyRate.getTargetCurrencyAmount().divide(destCurrencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP));
receivable.setDestCountrySourceAmount(destCurrencyRate.getSourceCurrencyAmount()); receivable.setDestCountrySourceAmount(destCurrencyRate.getSourceCurrencyAmount());
receivable.setDestCountryTargetCurrencyCode(destCurrencyRate.getTargetCurrencyCode());
receivable.setDestCountryTargetAmount(destCurrencyRate.getTargetCurrencyAmount()); receivable.setDestCountryTargetAmount(destCurrencyRate.getTargetCurrencyAmount());
} }
ExchangeRateRespDTO destCurrencySubRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), Long.parseLong(regionInfo.getImportCurrency4())); ExchangeRateRespDTO destCurrencySubRate = currencyApi.getCurrencyRate(receivable.getCurrencyId(), Long.parseLong(regionInfo.getImportCurrency4()));
receivable.setDestCountrySubRate(destCurrencySubRate.getTargetCurrencyAmount().divide(destCurrencySubRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP)); receivable.setDestCountrySubRate(destCurrencySubRate.getTargetCurrencyAmount().divide(destCurrencySubRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP));
receivable.setDestCountrySubSourceAmount(destCurrencySubRate.getSourceCurrencyAmount()); receivable.setDestCountrySubSourceAmount(destCurrencySubRate.getSourceCurrencyAmount());
receivable.setDestCountrySubTargetCurrencyCode(destCurrencySubRate.getTargetCurrencyCode());
receivable.setDestCountrySubTargetAmount(destCurrencySubRate.getTargetCurrencyAmount()); receivable.setDestCountrySubTargetAmount(destCurrencySubRate.getTargetCurrencyAmount());
} }
this.save(receivable); this.save(receivable);
...@@ -305,7 +312,11 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec ...@@ -305,7 +312,11 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableBackVO.setActualAmount(receivableBackVO.getNotIncludedTaxAmount().subtract(receivableBackVO.getDiscountTotal())); receivableBackVO.setActualAmount(receivableBackVO.getNotIncludedTaxAmount().subtract(receivableBackVO.getDiscountTotal()));
ExchangeRateRespDTO currencyRate = currencyApi.getCurrencyRate(receivableBackVO.getCurrencyId(), receivableBackVO.getBaseCurrencyId()); ExchangeRateRespDTO currencyRate = currencyApi.getCurrencyRate(receivableBackVO.getCurrencyId(), receivableBackVO.getBaseCurrencyId());
receivableBackVO.setExchangeRate(currencyRate.getTargetCurrencyAmount().divide(currencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP)); receivableBackVO.setExchangeRate(currencyRate.getTargetCurrencyAmount().divide(currencyRate.getSourceCurrencyAmount(), 6, RoundingMode.HALF_UP));
receivableBackVO.setBaseAmount(receivableBackVO.getActualAmount().multiply(currencyRate.getCurrencyRate())); receivableBackVO.setSourceAmount(currencyRate.getSourceCurrencyAmount());
receivableBackVO.setSourceCurrencyCode(currencyRate.getSourceCurrencyCode());
receivableBackVO.setTargetAmount(currencyRate.getTargetCurrencyAmount());
receivableBackVO.setTargetCurrencyCode(currencyRate.getTargetCurrencyCode());
receivableBackVO.setBaseAmount(receivableBackVO.getActualAmount().multiply(currencyRate.getTargetCurrencyAmount()).divide(currencyRate.getSourceCurrencyAmount(),2, RoundingMode.HALF_UP));
}); });
return PageResult.of(mpPage); return PageResult.of(mpPage);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment