目录
今天也是接到了这个任务,官网有小demo,可以下载下来参考test中代码
官方文档地址:
1.引入依赖
<!--快递100-->
<dependency>
<groupId>com.github.kuaidi100-api</groupId>
<artifactId>sdk</artifactId>
<version>1.0.11</version>
</dependency>
2.定义配置信息
这个要到官网申请 注册-快递100API开放平台|快递接口免费申请
#快递100配置信息
kuaidi100:
key: *******
customer: **********
3.模块结构
具体用到这些类,官方demo里有的我就不展示了
4.Controller
package cn.homed.shop.express100.web;
import cn.homed.common.entity.MsgBean;
import cn.homed.shop.express100.service.Express100Service;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/dim/express100/"