Giter Club home page Giter Club logo

aggregatelogistics's Introduction

Build Status Build Status Build Status

聚合物流(aggregatelogistics)

它是一个聚合各物流公司开放平台的Java工具类库,为解决公司电商项目集成物流而生。

当前已聚合顺丰、中通、申通、圆通、百世、极兔。

提示:多数快递公司都需要企业认证,即营业执照(公司或个体工商户)。所以个人用户难以配置并使用该类库。

功能

  • 运单轨迹查询:

    当前支持顺丰、中通、申通、圆通、百世、极兔;

  • 运费及实效查询:

    当前支持中通、申通、圆通、极兔;

  • 下单:

    当前支持顺丰;

使用

1. 引入

  • Maven

    <dependency>
        <groupId>net.kdks</groupId>
        <artifactId>aggregatelogistics</artifactId>
        <version>0.0.8</version>
    </dependency>
  • Gradle

    compile 'net.kdks:aggregatelogistics:0.0.8'
    

2. 调用

// 配置,每行最后一个参数0表示测试环境,1表示正式环境,不填为正式环境. 可选择性配置自己所需的快递公司
// 所有配置参数需注册该快递公司开放平台,且多数需要企业认证(营业执照)
ExpressConfig config=ExpressConfig.builder()
  // 顺丰配置
  .shunfengConfig("partnerId", "requestId", "checkWord", 1)
  // 申通配置
  .shentongConfig("appkey","secretKey",1)
  // 百世配置
  .baishiConfig("partnerId","secretKey",1)
  // 圆通配置
  .yuantongConfig("appkey", "secretKey", "userId", 1)
  // 中通配置
  .zhongtongConfig("companyId", "secretKey", 1)
  // 极兔配置
  .jituConfig("apiAccount", "privateKey", "uuid", "customerCode", "customerPwd", 1)
  .build();
ExpressHandlers expressHandlers=new ExpressHandlers(config);
// 快递公司编号,具体查看net.kdks.enums.ExpressCompanyCodeEnum
String expressCompanyNo="SF";
// 轨迹查询参数
ExpressParam param=new ExpressParam();
// 单号必传
List<String> expressNo = new ArrayList<>();
expressNo.add("SF1028911111316");
param.setExpressNos(expressNo);
// 手机号,顺丰必填(全11位或后4位)
param.setMobile("0728");
// 调用运单轨迹查询
ExpressResponse<ExpressResult> expressResult=expressHandlers.getExpressInfo(param, "SF");

// 运费及实效查询参数,此处省略赋值,具体查看net.kdks.model.ExpressPriceParam
ExpressPriceParam expressPriceParam = new ExpressPriceParam();
ExpressResponse<ExpressPriceResult> result = expressHandlers.getExpressPrice(expressPriceParam, "STO");

// 下单参数,此处省略赋值,具体查看net.kdks.model.CreateOrderParam
CreateOrderParam createOrderParam=new CreateOrderParam();
// 调用下单
ExpressResponse<OrderResult> orderResult=expressHandlers.createOrder(createOrderParam, "SF");

3. 参数申请(待完善步骤)

提示:多数都需要企业认证,即营业执照(公司或个体工商户)。所以个人用户难以配置并使用该类库。

示例

反馈或建议

致谢

aggregatelogistics's People

Contributors

fuzui avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.