汇率接口

栏目:云苍穹知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

汇率接口

# 1. 计算交叉汇率 ## 1.1 接口描述 接口名:kd.bos.i18n.api.IExchangeRateService.getCrossRate(List<Map<String,Object>> exchangeRateList) 根据已有汇率计算交叉汇率。 ## 1.2 输入参数 | **参数名称** | **数据类型** | **必填** | **说明** | | ------------------------------ | ------------------------ | -------- | ------------------------- | | exchangeRateList | List<Map<String,Object>> | 是 | 需要计算的汇率数组 | | exchangeRateList[0] | Map<String,Object> | 是 | 汇率参数集合 | | exchangeRateList[0].exctable | Long | 是 | 汇率表 | | exchangeRateList[0].orgcur | Long | 是 | 原币 | | exchangeRateList[0].cur | Long | 是 | 目标币 | | exchangeRateList[0].excval | String | 是 | 直接汇率 | | exchangeRateList[0].effectdate | String | 是 | 生效日期 格式:yyyy-MM-dd | | exchangeRateList[0].expirydate | String | 否 | 失效日期 格式:yyyy-MM-dd | **入参示例**: ``` [ { "exctable": 1546279945058173952, "orgcur": 6, "cur": 1, "excval": "6.888000000000", "effectdate": "2023-03-22" }, { "exctable": 1546279945058173952, "orgcur": 7, "cur": 1, "excval": "7.417700000000", "effectdate": "2023-03-22" }, { "exctable": 1546279945058173952, "orgcur": 8, "cur": 1, "excval": "8.4247000000", "effectdate": "2023-03-22" } ] ``` ## 1.3 输出参数 | **参数名称** | **数据类型** | **说明** | | ------------------------ | ------------------------ | ------------------------- | | | List<Map<String,Object>> | 计算成功的交叉汇率数组 | | | Map<String,Object> | 交叉汇率参数集合 | | List[0].exctable | Long | 汇率表 | | List[0].orgcur | Long | 原币 | | List[0].cur | Long | 目标币 | | List[0].excval | String | 直接汇率 | | List[0].effectdate | String | 生效日期 格式:yyyy-MM-dd | | List[0].expirydate | String | 失效日期 格式:yyyy-MM-dd | | List[0].computationrules | String | 计算规则 | **返回值示例**: ``` [ { "exctable": 1546279945058173952, "orgcur": 6, "cur": 8, "excval": "0.817596", "effectdate": "2023-03-22", "expirydate": null, "computationrules": "USD/CNY,GBP/CNY" }, { "exctable": 1546279945058173952, "orgcur": 6, "cur": 7, "excval": "0.928590", "effectdate": "2023-03-22", "expirydate": null, "computationrules": "USD/CNY,EUR/CNY" } ] ``` ## 1.4 代码示例 ```java //方式一 数据未入库 List<Map<String, Object>> exchangeRateList = new ArrayList<>(); Map<String, Object> map1 = new HashMap<>(); Map<String, Object> map2 = new HashMap<>(); Map<String, Object> map3 = new HashMap<>(); map1.put("exctable",1546279945058173952L); map1.put("orgcur",6L); map1.put("cur",1L); map1.put("excval","6.888000000000"); map1.put("effectdate","2023-03-22"); map2.put("exctable",1546279945058173952L); map2.put("orgcur",7L); map2.put("cur",1L); map2.put("excval","7.417700000000"); map2.put("effectdate","2023-03-22"); map3.put("exctable",1546279945058173952L); map3.put("orgcur",8L); map3.put("cur",1L); map3.put("excval","8.4247000000"); map3.put("effectdate","2023-03-22"); exchangeRateList.add(map1); exchangeRateList.add(map2); exchangeRateList.add(map3); List<Map<String, Object>> result1 = I18nServiceHelper.getCrossRate(exchangeRateList); //方式二 数据已入库 List<Long> exchangeRateListIds = new ArrayList<>(); exchangeRateListIds.add(1617484034563231744L); exchangeRateListIds.add(1617484034563231745L); exchangeRateListIds.add(1617484034563231746L); List<Map<String, Object>> result2 = I18nServiceHelper.getCrossRateByIds(exchangeRateListIds); ``` # 2. 查询是否启用间接汇率 ## 2.1 接口描述 接口名:kd.bos.servicehelper.basedata.BaseDataServiceHelper.isEnableIndirectRateConversion() 查询是否启用间接汇率 ## 2.2 输入参数 无。 ## 2.3 输出参数 返回结果为 **boolean** 类型的值,**true** 即为开启,**false** 即为关闭。 ## 2.4 代码示例 ```java boolean enableIndirectRate = BaseDataServiceHelper.isEnableIndirectRateConversion(); ``` # 3. 查询币种对换算方式 ## 3.1 接口描述 接口名:kd.bos.servicehelper.basedata.BaseDataServiceHelper.getRateConversionConfig(Long originalCurrency, Long targetCurrency, Date conversionDate) 根据原币、目标币、折算日期,获取当前币种对启用的换算方式。 ## 3.2 输入参数 | **字段** | **必填** | **类型** | **示例** | **说明** | | ---------------- | -------- | -------- | ---------- | -------- | | originalCurrency | 是 | Long | 10L | 原币ID | | targetCurrency | 是 | Long | 12L | 目标币ID | | conversionDate | 是 | Date | 2021-01-01 | 折算日期 | ## 3.3 输出参数 返回结果为 **boolean** 类型的值,**true** 即为使用间接汇率,**false** 即为使用直接汇率。 ## 3.4 代码示例 ```java boolean enableIndirectRate = BaseDataServiceHelper.getRateConversionConfig(10L, 12L, Calendar.getInstance().getTime()); ``` # 4. 查询币种对换算方式及其汇率值 ## 4.1 接口描述 接口名:kd.bos.servicehelper.basedata.BaseDataServiceHelper.getExchangeRateMap(Long originalCurrency, Long targetCurrency, Long exchangeRateType, Date conversionDate) 根据原币、目标币、汇率表、折算日期,获取当前币种对启用的换算方式及其直接/间接汇率值。 ## 4.2 输入参数 | **字段** | **必填** | **类型** | **示例** | **说明** | | ---------------- | -------- | -------- | -------------- | ---------- | | originalCurrency | 是 | Long | 10L | 原币ID | | targetCurrency | 是 | Long | 11L | 目标币ID | | exchangeRateType | 是 | Long | 1232563627882L | 汇率类型ID | | conversionDate | 是 | Date | 2021-01-01 | 折算日期 | ## 4.3 输出参数 | **字段** | **类型** | **示例** | **说明** | | ------------ | ---------- | -------- | ------------------------------------------ | | quoteType | boolean | true | 换算方式 (true:间接汇率;false:直接汇率) | | exchangeRate | Bigdecimal | 0.56433 | 直接/间接汇率值 | ## 4.4 代码示例 ```java Map<String, Object> exchangeRateByRules = BaseDataServiceHelper.getExchangeRateMap(6L, 1L, 432498951862649856L, Calendar.getInstance().getTime()); ``` # 5. 查询币种对汇率值 ## 5.1 接口描述 接口名:kd.bos.servicehelper.basedata.BaseDataServiceHelper.getExchangeRateByQuoteType(Long originalCurrency, Long targetCurrency, Long exchangeRateType, Date conversionDate, boolean quoteType) 根据原币、目标币、汇率表、折算日期、换算方式,获取当前币种对直接/间接汇率值。 ## 5.2 输入参数 | **字段** | **必填** | **类型** | **示例** | **说明** | | ---------------- | -------- | -------- | -------------- | ---------- | | originalCurrency | 是 | Long | 10L | 原币ID | | targetCurrency | 是 | Long | 11L | 目标币ID | | exchangeRateType | 是 | Long | 1232563627882L | 汇率类型ID | | conversionDate | 是 | Date | 2021-01-01 | 折算日期 | | quoteType | 是 | boolean | true | 换算方式 | ## 5.3 输出参数 返回结果为 **Bigdecimal** 类型的值,比如:0.12385672 ## 5.4 代码示例 ```java Bigdecimal rate = BaseDataServiceHelper.getExchangeRateByQuoteType(6L, 1L, 432498951862649856L,Calendar.getInstance().getTime(), true); ``` # 6. 查询币种对汇率精度 ## 6.1 接口描述 接口名:kd.bos.servicehelper.basedata.ExchangeRateService.getExRatePrecision(Long originalCurrency, Long targetCurrency) 根据原币、目标币获取当前币种对汇率精度。 ## 6.2 输入参数 | **字段** | **必填** | **类型** | **示例** | **说明** | | ---------------- | -------- | -------- | -------- | -------- | | originalCurrency | 是 | Long | 10L | 原币ID | | targetCurrency | 是 | Long | 11L | 目标币ID | ## 6.3 输出参数 返回结果为 **Bigdecimal** 类型的整数值,比如:1 ## 6.4 代码示例 ```java Bigdecimal rate = ExchangeRateService.getExRatePrecision(10L, 11L); ```

汇率接口

# 1. 计算交叉汇率## 1.1 接口描述接口名:kd.bos.i18n.api.IExchangeRateService.getCrossRate(List<Map<String,Object>> exchangeRa...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息