电子面单接口对接

This commit is contained in:
慕下 2024-08-12 20:40:24 +08:00
parent 1f8464fd76
commit 6da59e82e5
7 changed files with 100 additions and 1 deletions

View File

@ -14,12 +14,15 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -40,11 +43,18 @@ public class AppDeliverExpressController {
return success(DeliveryExpressConvert.INSTANCE.convertList03(list));
}
@GetMapping("/realTimeExpressDeliveryQuery")
@PostMapping("/realTimeExpressDeliveryQuery")
@Operation(summary = "实时物流查询")
public CommonResult<String> realTimeExpressDeliveryQuery(){
String deliveryQuery = deliveryExpressService.deliveryQuery();
return success(deliveryQuery);
}
@PostMapping("/electronicFaceSheet")
@Operation(summary = "电子面单下单")
public CommonResult<String> electronicFaceSheetOrder(){
String sheetOrder = deliveryExpressService.doElectronicFaceSheetOrder();
return success(sheetOrder);
}
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express;
import lombok.Data;
@Data
public class ElectronicFaceSheet {
private String method;//业务类型默认order
private String key;//授权码请到快递100页面申请企业版接口获取
private String sign;//32位大写签名用于验证身份按MD5 (param +t+key+ secret)的顺序进行MD5加密不需要加上+secret在企业管理后台获取
private String t;//时间戳如1576123932000
private ElectronicFaceSheetParam param;// 由其他字段拼接
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express;
import lombok.Data;
@Data
public class ElectronicFaceSheetParam {
private String printType;//打印类型NON只下单不打印默认 IMAGE:生成图片短链HTML:生成html短链 CLOUD:使用快递100云打印机打印使用CLOUD时siid必填
private String partnerId;// 电子面单客户账户或月结账号需贵司向当地快递公司网点申请参考电子面单申请指南 是否必填该属性请查看参数字典
private String partnerKey;//电子面单密码需贵司向当地快递公司网点申请 是否必填该属性请查看参数字典
private String partnerSecret;//电子面单密钥需贵司向当地快递公司网点申请 是否必填该属性请查看参数字典
private String partnerName;// 电子面单客户账户名称需贵司向当地快递公司网点申请 是否必填该属性请查看参数字典
private String net;//收件网点名称,由快递公司当地网点分配 若使用淘宝授权填入taobao使用菜鸟授权填入cainiao), 使用京东授权填入jdalpha),使用拼多多授权填入(pinduoduoWx)使用抖音授权填入(douyin)使用快手授权填入(kuaishou),使用唯品会授权填入weipinhui,使用视频号授权填入wechatChannels,使用小红书授权填入(xiaohongshu) 是否必填该属性请查看参数字典 若通过第三方授权方式获取单号partnerId,partnerKey参数为必填,参数值可通过第三方授权接口获取)
private String code;//电子面单承载编号需贵司向当地快递公司网点申请 是否必填该属性请查看参数字典
private String checkMan;//电子面单承载快递员名需贵司向当地快递公司网点申请 是否必填该属性请查看参数字典
private String tbNet;// 在使用菜鸟/淘宝/拼多多授权电子面单时若月结账号下存在多个网点则tbNet="网点名称,网点编号" 注意此处为英文逗号
private String kuaidicom;//快递公司的编码一律用小写字母请查看参数字典
private RecManVo recMan;//收件人信息
private SendManVo sendMan;//寄件人信息
private String cargo;//物品名称,文件
private Integer count;//包裹总数量该属性与子单有关如果需要子单指同一个订单打印出多张电子面单即同一个订单返回多个面单号needChild = 1count 需要大于1如count = 2 则一个主单 一个子单count = 3则一个主单 二个子单返回的子单号码见返回结果的childNum字段
private Double weight;//物品总重量KG1.5单位kg极兔速递必填其他快递公司非必填
private String payType;//支付方式 SHIPPER寄方付默认 CONSIGNEE到付 MONTHLY月结 THIRDPARTY第三方支付 详细请查看参数字典
private String expType;//产品类型 如标准快递默认 顺丰标快陆运 EMS经济 详细请请查看参数字典
private String remark;//备注
private String siid;//打印设备通过打印机输出的设备码进行获取printType为CLOUD时必填
private String direction;//打印方向 0正方向默认 1反方向只有printType为CLOUD时该参数生效
private String tempId;//主单模板通过管理后台的快递公司模板V2信息获取
private String childTempId;//子单模板部分快递公司需指定通过管理后台的快递公司模板V2信息获取
private String backTempId;//回单模板部分快递公司需指定通过管理后台的快递公司模板V2信息获取
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express;
import lombok.Data;
@Data
public class RecManVo {
private String name;
private String mobile;
private String tel;
private String printAddr;
private String company;
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express;
import lombok.Data;
@Data
public class SendManVo {
private String name;
private String mobile;
private String tel;
private String printAddr;
private String company;
}

View File

@ -82,4 +82,6 @@ public interface DeliveryExpressService {
String deliveryQuery();
String doElectronicFaceSheetOrder();
}

View File

@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.Delive
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressPageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressUpdateReqVO;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express.ElectronicFaceSheet;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.express.ElectronicFaceSheetParam;
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressMapper;
@ -170,4 +172,23 @@ public class DeliveryExpressServiceImpl implements DeliveryExpressService {
return postSec.body();
}
@Override
public String doElectronicFaceSheetOrder() {
//快递100 电子面单下单api接口地址
String url = "https://api.kuaidi100.com/label/order";
ElectronicFaceSheet faceSheet = new ElectronicFaceSheet();
faceSheet.setKey("");
faceSheet.setMethod("order");
faceSheet.setSign("");
ElectronicFaceSheetParam sheetParam = new ElectronicFaceSheetParam();
sheetParam.setPrintType("NON");
sheetParam.setPartnerId("");
faceSheet.setParam(sheetParam);
HttpResponse postSec = HttpUtil.createPost(url)
.header("Content-Type","application/x-www-form-urlencoded")
.body(faceSheet.toString())
.execute();
return postSec.body();
}
}