From 6da59e82e50d6cf6a0bba8dc45ef8531fbef73c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Mon, 12 Aug 2024 20:40:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E9=9D=A2=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../delivery/AppDeliverExpressController.java | 12 +++++++- .../vo/express/ElectronicFaceSheet.java | 12 ++++++++ .../vo/express/ElectronicFaceSheetParam.java | 30 +++++++++++++++++++ .../app/delivery/vo/express/RecManVo.java | 12 ++++++++ .../app/delivery/vo/express/SendManVo.java | 12 ++++++++ .../delivery/DeliveryExpressService.java | 2 ++ .../delivery/DeliveryExpressServiceImpl.java | 21 +++++++++++++ 7 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheet.java create mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheetParam.java create mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/RecManVo.java create mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/SendManVo.java diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverExpressController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverExpressController.java index 540f5b6..fc88fe5 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverExpressController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverExpressController.java @@ -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 realTimeExpressDeliveryQuery(){ String deliveryQuery = deliveryExpressService.deliveryQuery(); return success(deliveryQuery); } + @PostMapping("/electronicFaceSheet") + @Operation(summary = "电子面单下单") + public CommonResult electronicFaceSheetOrder(){ + String sheetOrder = deliveryExpressService.doElectronicFaceSheetOrder(); + return success(sheetOrder); + } + } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheet.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheet.java new file mode 100644 index 0000000..4391be5 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheet.java @@ -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;// 由其他字段拼接 +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheetParam.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheetParam.java new file mode 100644 index 0000000..622e304 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/ElectronicFaceSheetParam.java @@ -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 = 1、count 需要大于1,如count = 2 则一个主单 一个子单,count = 3则一个主单 二个子单;返回的子单号码见返回结果的childNum字段 + private Double weight;//物品总重量KG,例:1.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信息获取 +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/RecManVo.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/RecManVo.java new file mode 100644 index 0000000..0cc1011 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/RecManVo.java @@ -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; +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/SendManVo.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/SendManVo.java new file mode 100644 index 0000000..521b25f --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/express/SendManVo.java @@ -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; +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java index f8722fc..910f392 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java @@ -82,4 +82,6 @@ public interface DeliveryExpressService { String deliveryQuery(); + String doElectronicFaceSheetOrder(); + } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressServiceImpl.java index b768357..2e4775d 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressServiceImpl.java @@ -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(); + } + }