合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
#### 1\. 下载SDK * [JAVA-SDK下载](https://resource.duobaoyu.com.cn/supply/dby-java-sdk-1.0-RELEASE_2023-08-09-18-12-36.jar "JAVA-SDK下载") * 导入SDK包 #### [](https://duobaoyu.com.cn/documentcenter?onlyFlag=b7338def6ecec696204f75f37fb5d859#2-%E6%B7%BB%E5%8A%A0sdk%E4%BE%9D%E8%B5%96)2\. 添加SDK依赖 ~~~xml <!--网络请求--> <dependency> <groupId>com.dtflys.forest</groupId> <artifactId>forest-core</artifactId> <version>1.5.26</version> </dependency> <!--工具类 --> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-crypto</artifactId> <version>5.7.22</version> </dependency> <!-- json处理 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.83</version> </dependency> <!--bean处理--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.22</version> </dependency> ~~~ #### [](https://duobaoyu.com.cn/documentcenter?onlyFlag=b7338def6ecec696204f75f37fb5d859#3-%E4%BD%BF%E7%94%A8sdk%E5%8F%91%E8%B5%B7%E8%AF%B7%E6%B1%82)3\. 使用SDK发起请求 * 以下单为例 ~~~java DbyClient client = new DbyClient("http://xxxxx/open/api", "your appKey", "your appSecret"); ScmOrderSubmitRequest.SkuInfo sku1 = ScmOrderSubmitRequest.SkuInfo.builder() .skuCode("50180878441").skuNum(1).unitPrice(8000).build(); List<ScmOrderSubmitRequest.SkuInfo> skuInfos = Collections.singletonList(sku1); ScmOrderSubmitRequest request = ScmOrderSubmitRequest.builder() .tradeNo(IdUtil.getSnowflakeNextIdStr()) .consigneeName("张三") .consigneeMobile("15900000000") .consigneeProvinceCode("42") .consigneeCityCode("4201") .consigneeCountyCode("420106") .consigneeTownCode("420106010") .consigneeAddress("安腾国际") .orderRemark("测试下单") .skuInfos(skuInfos).build(); DbyR<ScmOrderSubmitResponse> response = client.execute(request); ~~~ #### [](https://duobaoyu.com.cn/documentcenter?onlyFlag=b7338def6ecec696204f75f37fb5d859#4-%E5%9F%BA%E4%BA%8Espringboot%E7%9A%84api%E6%96%B9%E5%BC%8F%E5%8F%8Asdk%E6%96%B9%E5%BC%8F%E5%AF%B9%E6%8E%A5%E7%A4%BA%E4%BE%8B)4\. 基于SpringBoot的API方式及SDK方式对接示例 * [dby-example示例工程下载](https://resource.duobaoyu.com.cn/supply/dby-example.zip "dby-example示例工程下载")***该工程已不再维护,工程里面SDK包以及API参数请以最新的为准*** * 工程结构 ~~~ dby-example ├── dby-common ├── dby-scm-api-demo -- 基于Forest网络请求框架的API调用示例及消息回调示例 ├── dby-sdk-demo -- 基于SDK的调用示例 ~~~