Commit 2bca120b authored by 332784038@qq.com's avatar 332784038@qq.com

应收单业务汇率计算业务修改

parent a8b0fd68
......@@ -65,8 +65,21 @@ COMMIT;
ALTER TABLE `ecw_currency_rate` ADD COLUMN `source_currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '原币种代码' AFTER `source_id`;
ALTER TABLE `ecw_currency_rate` ADD COLUMN `target_currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '目标种代码' AFTER `target_id`;
ALTER TABLE `ecw_currency_rate` ADD COLUMN `target_currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '目标种代码' AFTER `target_id`;
update `ecw_currency_rate` r left join `ecw_currency` c1 on r.source_id = c1.id left join `ecw_currency` c2 on r.target_id = c2.id
set r.`source_currency_code` = c1.fuhao, r.`target_currency_code` = c2.fuhao;
ALTER TABLE `ecw_receivable` ADD COLUMN `source_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '原币种基准金额' AFTER `fee_type`;
ALTER TABLE `ecw_receivable` ADD COLUMN `source_currency_code` varchar(255) DEFAULT NULL COMMENT '原币种代码' AFTER `source_amount`;
ALTER TABLE `ecw_receivable` ADD COLUMN `target_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '支付币种基准金额' AFTER `source_currency_code`;
ALTER TABLE `ecw_receivable` ADD COLUMN `target_currency_code` varchar(255) DEFAULT NULL COMMENT '支付币种代码' AFTER `target_amount`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_source_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '目的国币种汇兑原币种基准金额' AFTER `target_currency_code`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_target_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '目的国币种支付基准金额' AFTER `dest_country_source_amount`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_target_currency_code` varchar(255) DEFAULT NULL COMMENT '目的国币种代码' AFTER `dest_country_target_amount`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_sub_source_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '目的国副币种汇兑原币种基准金额' AFTER `dest_country_target_currency_code`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_sub_target_amount` DECIMAL(14, 4) DEFAULT NULL COMMENT '目的国副币种支付基准金额' AFTER `dest_country_sub_source_amount`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_sub_target_currency_code` varchar(255) DEFAULT NULL COMMENT '目的国副币种代码' AFTER `dest_country_sub_target_amount`;
......@@ -113,6 +113,23 @@ public class CurrecyApiImpl implements CurrencyApi {
@Override
public List<ExchangeRateRespDTO> getAllCurrencyRate() {
List<CurrencyRateDO> currencyRateDOS = currencyRateService.queryAll();
return CurrencyRateConvert.INSTANCE.convertList2(currencyRateDOS);
return convertRateRespList(currencyRateDOS);
}
private List<ExchangeRateRespDTO> convertRateRespList(List<CurrencyRateDO> currencyRateDOS) {
return currencyRateDOS.stream().map(this::convertRateResp).collect(Collectors.toList());
}
private ExchangeRateRespDTO convertRateResp(CurrencyRateDO currencyRateDO) {
ExchangeRateRespDTO dto = new ExchangeRateRespDTO();
dto.setSourceCurrencyAmount(currencyRateDO.getSourceAmount());
dto.setSourceCurrencyId(currencyRateDO.getSourceId());
dto.setSourceCurrencyCode(currencyRateDO.getSourceCurrencyCode());
dto.setTargetCurrencyAmount(currencyRateDO.getTargetAmount());
dto.setTargetCurrencyId(currencyRateDO.getTargetId());
dto.setTargetCurrencyCode(currencyRateDO.getTargetCurrencyCode());
dto.setExpireDate(currencyRateDO.getExpiration());
dto.setCurrencyRate(currencyRateService.rate(currencyRateDO.getSourceAmount(), currencyRateDO.getTargetAmount()));
return dto;
}
}
......@@ -68,7 +68,7 @@ public interface CurrencyRateService {
Date now = new Date();
if (now.compareTo(entity.getExpiration()) > 0) {
throw exception(CURRENCY_RATE_EXPIRED, String.valueOf(sourceId), String.valueOf(targetId));
throw exception(CURRENCY_RATE_EXPIRED, entity.getSourceCurrencyCode(), entity.getTargetCurrencyCode());
}
return entity;
......
......@@ -185,4 +185,53 @@ public class ReceivableDO extends BaseDO {
* 额外费用副币种汇率(用于报表,跟费用类型相关)
*/
private BigDecimal destCountrySubRate;
/**
* 原币种基准金额
*/
private BigDecimal sourceAmount;
/**
* 原币种代码
*/
private String sourceCurrencyCode;
/**
* 支付币种基准金额
*/
private BigDecimal targetAmount;
/**
* 支付币种代码
*/
private String targetCurrencyCode;
/**
* 目的国币种汇兑原币种基准金额
*/
private BigDecimal destCountrySourceAmount;
/**
* 目的国币种支付基准金额
*/
private BigDecimal destCountryTargetAmount;
/**
* 目的国币种代码
*/
private String destCountryTargetCurrencyCode;
/**
* 目的国币副种汇兑原币种基准金额
*/
private BigDecimal destCountrySubSourceAmount;
/**
* 目的国副币种支付基准金额
*/
private BigDecimal destCountrySubTargetAmount;
/**
* 目的国副币种代码
*/
private String destCountrySubTargetCurrencyCode;
}
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