汇率管理修改
This commit is contained in:
+13
-1
@@ -78,7 +78,7 @@ public class BmsExchangeRateServiceImpl implements IBmsExchangeRateService
|
||||
String from = normalizeCurrency(fromCurrency);
|
||||
String to = normalizeCurrency(toCurrency);
|
||||
String type = StringUtils.isNotEmpty(rateType) ? rateType : BmsExchangeRate.RATE_TYPE_SPOT;
|
||||
Date date = bizDate != null ? bizDate : DateUtils.getNowDate();
|
||||
Date date = truncateToDay(bizDate != null ? bizDate : DateUtils.getNowDate());
|
||||
|
||||
// 同币种
|
||||
if (from.equals(to))
|
||||
@@ -147,6 +147,18 @@ public class BmsExchangeRateServiceImpl implements IBmsExchangeRateService
|
||||
|
||||
/* ============================ 私有方法 ============================ */
|
||||
|
||||
/**
|
||||
* 截断到日历日 00:00:00。
|
||||
* 汇率表 effective_date/expire_date 为 date 类型(精确到天),业务时间(如收款时间带时分秒)
|
||||
* 直接参与比较时,"失效日当天"会因 expire_date 被提升为当天 00:00:00 而提前失效,
|
||||
* 故所有业务日统一按日历日落入 [生效日, 失效日] 闭区间。
|
||||
*/
|
||||
private Date truncateToDay(Date date)
|
||||
{
|
||||
return Date.from(date.toInstant().atZone(java.time.ZoneId.systemDefault())
|
||||
.toLocalDate().atStartOfDay(java.time.ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找单跳汇率(先正向,再反向取倒数),查不到返回 null
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user