diff --git a/README.md b/README.md
index f1b6a826..109694ea 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,20 @@
+### 开放计划
++ [ ] 打单--> 备货 --> 发货 --> 物流跟踪
++ [ ] 接入店铺退款
+ + [ ] 淘宝
+ + [ ] 京东
+ + [ ] 拼多多
+ + [ ] 抖店
+ + [ ] 视频号小店
++ [ ] 接入电子面单打印
+ + [x] 淘宝
+ + [x] 视频号小店
+ + [ ] 拼多多
+ + [ ] 抖店
+
## 二、关键流程
### 2.1 关联商品SKU
diff --git a/docs/erp_ship_waybill.sql b/docs/erp_ship_waybill.sql
new file mode 100644
index 00000000..d6a6380a
--- /dev/null
+++ b/docs/erp_ship_waybill.sql
@@ -0,0 +1,68 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : localhost
+ Source Server Type : MySQL
+ Source Server Version : 80200
+ Source Host : localhost:3306
+ Source Schema : qihang-erp
+
+ Target Server Type : MySQL
+ Target Server Version : 80200
+ File Encoding : 65001
+
+ Date: 16/06/2024 18:29:52
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for erp_ship_waybill
+-- ----------------------------
+DROP TABLE IF EXISTS `erp_ship_waybill`;
+CREATE TABLE `erp_ship_waybill` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `order_id` varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单号',
+ `shop_id` bigint NOT NULL COMMENT '店铺id',
+ `shop_type` int NOT NULL COMMENT '店铺类型',
+ `waybill_code` varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '快递单号',
+ `logistics_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '快递公司编码',
+ `print_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '打印数据',
+ `status` int NULL DEFAULT NULL COMMENT '状态(1已取号2已打印3已发货)',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+ `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
+ `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发货电子面单记录表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for oms_tao_waybill_account
+-- ----------------------------
+DROP TABLE IF EXISTS `oms_tao_waybill_account`;
+CREATE TABLE `oms_tao_waybill_account` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `shop_id` bigint NOT NULL COMMENT '店铺id',
+ `seller_id` bigint NULL DEFAULT NULL COMMENT '商家ID',
+ `cp_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物流服务商编码',
+ `cp_type` int NULL DEFAULT NULL COMMENT '1是直营,2是加盟',
+ `quantity` int NULL DEFAULT NULL COMMENT '可用单数',
+ `allocated_quantity` int NULL DEFAULT NULL COMMENT '已用单数',
+ `branch_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网点ID',
+ `branch_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网点名称',
+ `print_quantity` int NULL DEFAULT NULL COMMENT '已经打印的面单总数',
+ `cancel_quantity` int NULL DEFAULT NULL COMMENT '取消的面对总数',
+ `waybill_address_id` bigint NULL DEFAULT NULL COMMENT 'waybill 地址记录ID(非地址库ID)',
+ `province` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省名称(一级地址)',
+ `city` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '市名称(二级地址)',
+ `area` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '区名称(三级地址)',
+ `address_detail` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址',
+ `name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货人',
+ `mobile` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货手机号',
+ `phone` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货固定电话',
+ `is_show` int NULL DEFAULT NULL COMMENT '是否前台显示1显示0不显示',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '淘宝电子面单账户信息表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/open-api/tao-api/libs/tao-api2-1.5.4.jar b/open-api/tao-api/libs/tao-api2-1.5.4.jar
deleted file mode 100644
index d23d3746..00000000
Binary files a/open-api/tao-api/libs/tao-api2-1.5.4.jar and /dev/null differ
diff --git a/open-api/tao-api/libs/tao-api2-1.6.16.jar b/open-api/tao-api/libs/tao-api2-1.6.16.jar
new file mode 100644
index 00000000..f042be2b
Binary files /dev/null and b/open-api/tao-api/libs/tao-api2-1.6.16.jar differ
diff --git a/open-api/tao-api/pom.xml b/open-api/tao-api/pom.xml
index d7609f64..5a45f2da 100644
--- a/open-api/tao-api/pom.xml
+++ b/open-api/tao-api/pom.xml
@@ -26,9 +26,9 @@
cn.qihangerp.open.tao
tao-api2
- 1.5.4
+ 1.6.16
system
- ${project.basedir}/libs/tao-api2-1.5.4.jar
+ ${project.basedir}/libs/tao-api2-1.6.16.jar
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/controller/EwaybillController.java b/open-api/tao-api/src/main/java/com/qihang/tao/controller/EwaybillController.java
new file mode 100644
index 00000000..1c98c729
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/controller/EwaybillController.java
@@ -0,0 +1,246 @@
+package com.qihang.tao.controller;
+
+import cn.qihangerp.open.tao.WaybillAccountApiHelper;
+import cn.qihangerp.open.tao.WaybillApiHelper;
+import cn.qihangerp.open.tao.common.ApiResultVo;
+import cn.qihangerp.open.tao.model.WaybillBranchAccountList;
+import cn.qihangerp.open.tao.model.WaybillCloudPrint;
+import cn.qihangerp.open.tao.request.WaybillCloudPrintApplyNewRequest;
+import cn.qihangerp.open.tao.request.WaybillCloudPrintApplyNewRequestSender;
+import cn.qihangerp.open.tao.request.WaybillCloudPrintApplyNewRequestTradeOrderInfoDto;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.qihang.common.common.AjaxResult;
+import com.qihang.common.common.ResultVoEnum;
+import com.qihang.common.enums.EnumShopType;
+import com.qihang.common.enums.HttpStatus;
+import com.qihang.common.mq.MqMessage;
+import com.qihang.common.mq.MqType;
+import com.qihang.tao.common.BaseController;
+import com.qihang.tao.common.TaoRequest;
+import com.qihang.tao.domain.ErpShipWaybill;
+import com.qihang.tao.domain.OmsTaoOrder;
+import com.qihang.tao.domain.OmsTaoWaybillAccount;
+import com.qihang.tao.domain.bo.TaoOrderPushBo;
+import com.qihang.tao.domain.bo.TaoWaybillGetBo;
+import com.qihang.tao.openApi.ApiCommon;
+import com.qihang.tao.service.ErpShipWaybillService;
+import com.qihang.tao.service.OmsTaoOrderService;
+import com.qihang.tao.service.OmsTaoWaybillAccountService;
+import lombok.AllArgsConstructor;
+import lombok.extern.java.Log;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Log
+@AllArgsConstructor
+@RestController
+@RequestMapping("/ewaybill")
+public class EwaybillController extends BaseController {
+ private final ApiCommon apiCommon;
+ private final OmsTaoWaybillAccountService waybillAccountService;
+ private final OmsTaoOrderService orderService;
+ private final ErpShipWaybillService erpShipWaybillService;
+
+ @RequestMapping(value = "/get_waybill_account_list", method = RequestMethod.POST)
+ public AjaxResult getWaybillAccountList(@RequestBody TaoRequest params) throws Exception {
+ if (params.getShopId() == null || params.getShopId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
+ }
+ List list = waybillAccountService.list(new LambdaQueryWrapper().eq(OmsTaoWaybillAccount::getShopId, params.getShopId()).eq(OmsTaoWaybillAccount::getIsShow, 1));
+ return AjaxResult.success(list);
+ }
+
+ /**
+ * 拉取电子面单账号
+ * @param params
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping(value = "/pull_waybill_account", method = RequestMethod.POST)
+ public AjaxResult pullWaybillAccount(@RequestBody TaoRequest params) throws Exception {
+ if (params.getShopId() == null || params.getShopId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
+ }
+
+ var checkResult = apiCommon.checkBefore(params.getShopId());
+ if (checkResult.getCode() != HttpStatus.SUCCESS) {
+ return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
+ }
+ String accessToken = checkResult.getData().getAccessToken();
+ String appKey = checkResult.getData().getAppKey();
+ String appSecret = checkResult.getData().getAppSecret();
+ Long sellId = checkResult.getData().getSellerShopId();
+
+ ApiResultVo apiResultVo = WaybillAccountApiHelper.pullWaybillBranchAccountList(appKey, appSecret, accessToken);
+ List list = new ArrayList<>();
+ if(apiResultVo.getCode()==0){
+ for (var item : apiResultVo.getList()){
+ for(var acc:item.getBranchAccountCols().getWaybillBranchAccount()){
+ OmsTaoWaybillAccount vo = new OmsTaoWaybillAccount();
+ vo.setShopId(params.getShopId());
+ vo.setSellerId(sellId);
+ vo.setIsShow(1);
+ vo.setCpCode(item.getCpCode());
+ vo.setCpType(item.getCpType());
+ vo.setAllocatedQuantity(acc.getAllocatedQuantity());
+ vo.setBranchCode(acc.getBranchCode());
+ vo.setBranchName(acc.getBranchName());
+ vo.setCancelQuantity(acc.getCancelQuantity());
+ vo.setPrintQuantity(acc.getPrintQuantity());
+ vo.setQuantity(acc.getQuantity());
+ if(acc.getShippAddressCols().getWaybillAddress().size()>0) {
+ vo.setAddressDetail(acc.getShippAddressCols().getWaybillAddress().get(0).getAddressDetail());
+ vo.setArea(acc.getShippAddressCols().getWaybillAddress().get(0).getArea());
+ vo.setCity(acc.getShippAddressCols().getWaybillAddress().get(0).getCity());
+ vo.setProvince(acc.getShippAddressCols().getWaybillAddress().get(0).getProvince());
+ vo.setWaybillAddressId(acc.getShippAddressCols().getWaybillAddress().get(0).getWaybillAddressId().longValue());
+ list.add(vo);
+ }
+
+ waybillAccountService.save(vo);
+ log.info("========添加tao电子面单账户信息==========");
+ }
+ }
+ }
+
+
+ return AjaxResult.success(list);
+ }
+
+ @PostMapping("/get_waybill_code")
+ @ResponseBody
+ public AjaxResult getWaybillCode(@RequestBody TaoWaybillGetBo req) {
+ if (req.getAccountId() == null || req.getAccountId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,请选择电子面单账户");
+ }
+ if (req.getShopId() == null || req.getShopId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
+ }
+ if(req.getIds()==null || req.getIds().length<=0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
+ }
+ var checkResult = apiCommon.checkBefore(req.getShopId());
+ if (checkResult.getCode() != HttpStatus.SUCCESS) {
+ return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
+ }
+ String accessToken = checkResult.getData().getAccessToken();
+ String appKey = checkResult.getData().getAppKey();
+ String appSecret = checkResult.getData().getAppSecret();
+ Long sellerShopId = checkResult.getData().getSellerShopId();
+
+ // 获取电子面单账户信息(包含了发货地址信息)
+ OmsTaoWaybillAccount account = waybillAccountService.getById(req.getAccountId());
+
+ WaybillCloudPrintApplyNewRequest request = new WaybillCloudPrintApplyNewRequest();
+ request.setCp_code(account.getCpCode());
+
+ WaybillCloudPrintApplyNewRequestSender sender = new WaybillCloudPrintApplyNewRequestSender();
+ sender.setName(account.getName());
+ sender.setMobile(account.getMobile());
+ WaybillCloudPrintApplyNewRequestSender.AddressDTO addressDTO = new WaybillCloudPrintApplyNewRequestSender.AddressDTO();
+ addressDTO.setCity(account.getCity());
+ addressDTO.setProvince(account.getProvince());
+ addressDTO.setDistrict(account.getArea());
+ addressDTO.setTown("");
+ addressDTO.setDetail(account.getAddressDetail());
+ sender.setAddress(addressDTO);
+ request.setSender(sender);
+
+ // 组合取号的订单信息trade_order_info_dtos
+ List orderList = new ArrayList<>();
+
+ for(String orderId:req.getIds()){
+ if(StringUtils.hasText(orderId)){
+ OmsTaoOrder omsTaoOrder = orderService.queryDetailByTid(orderId);
+ if(omsTaoOrder!=null) {
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto dto = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto();
+ dto.setObjectId(omsTaoOrder.getTid());
+ dto.setTemplateUrl("http://cloudprint.cainiao.com/template/standard/101");
+ dto.setUserId(sellerShopId.intValue());
+
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO orderInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO();
+ orderInfoDTO.setOrderChannelsType("TB");
+ orderInfoDTO.setTradeOrderList(omsTaoOrder.getTid());
+ dto.setOrderInfo(orderInfoDTO);
+
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO packageInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO();
+ List items = new ArrayList<>();
+ for (var orderItem : omsTaoOrder.getItems()) {
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO itemsDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO();
+ itemsDTO.setCount(orderItem.getNum());
+ itemsDTO.setName(orderItem.getTitle());
+ items.add(itemsDTO);
+ }
+ packageInfoDTO.setItems(items);
+ dto.setPackageInfo(packageInfoDTO);
+
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO recipientDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO();
+ WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO addressDTO1 = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO();
+ addressDTO1.setCity(omsTaoOrder.getReceiverCity());
+ addressDTO1.setTown(omsTaoOrder.getReceiverTown());
+ addressDTO1.setProvince(omsTaoOrder.getReceiverState());
+ addressDTO1.setDistrict(omsTaoOrder.getReceiverDistrict());
+ addressDTO1.setDetail(omsTaoOrder.getReceiverAddress());
+ recipientDTO.setAddress(addressDTO1);
+ recipientDTO.setName(omsTaoOrder.getReceiverName());
+ recipientDTO.setOaid(omsTaoOrder.getOaid());
+ recipientDTO.setTid(omsTaoOrder.getTid());
+ dto.setRecipient(recipientDTO);
+ orderList.add(dto);
+ }
+ }
+ }
+
+ request.setTrade_order_info_dtos(orderList);
+
+ ApiResultVo apiResultVo = WaybillApiHelper.waybillCloudPrintApplyNew(appKey, appSecret, accessToken, request);
+ if(apiResultVo.getCode()==0){
+ // 保持数据
+ for(var result: apiResultVo.getList()){
+ ErpShipWaybill waybill = new ErpShipWaybill();
+ waybill.setShopId(req.getShopId());
+ waybill.setOrderId(result.getObjectId());
+ waybill.setWaybillCode(result.getWaybillCode());
+ waybill.setLogisticsCode(result.getCpCode());
+ waybill.setPrintData(result.getPrintData());
+ erpShipWaybillService.waybillUpdate(waybill);
+ log.info("====保存電子面單信息========"+result.getObjectId());
+ }
+ }else{
+ return AjaxResult.error(apiResultVo.getMsg());
+ }
+
+ return success();
+ }
+
+ @PostMapping("/get_print_data")
+ @ResponseBody
+ public AjaxResult getPrintData(@RequestBody TaoWaybillGetBo req) {
+ if (req.getShopId() == null || req.getShopId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
+ }
+ if (req.getIds() == null || req.getIds().length <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
+ }
+ List listByOrderIds = erpShipWaybillService.getListByOrderIds(req.getShopId(), req.getIds());
+ return AjaxResult.success(listByOrderIds);
+ }
+
+ @PostMapping("/push_print_success")
+ @ResponseBody
+ public AjaxResult pushPrintSuccess(@RequestBody TaoWaybillGetBo req) {
+ if (req.getShopId() == null || req.getShopId() <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
+ }
+ if (req.getIds() == null || req.getIds().length <= 0) {
+ return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
+ }
+ erpShipWaybillService.printSuccess(req.getShopId(), req.getIds());
+ return AjaxResult.success();
+ }
+}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/domain/ErpShipWaybill.java b/open-api/tao-api/src/main/java/com/qihang/tao/domain/ErpShipWaybill.java
new file mode 100644
index 00000000..ea0d7344
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/domain/ErpShipWaybill.java
@@ -0,0 +1,78 @@
+package com.qihang.tao.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+/**
+ * 发货电子面单记录表
+ * @TableName erp_ship_waybill
+ */
+@Data
+public class ErpShipWaybill implements Serializable {
+ /**
+ *
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 订单号
+ */
+ private String orderId;
+
+ /**
+ * 店铺id
+ */
+ private Long shopId;
+
+ /**
+ * 店铺类型
+ */
+ private Integer shopType;
+
+ /**
+ * 快递单号
+ */
+ private String waybillCode;
+
+ /**
+ * 快递公司编码
+ */
+ private String logisticsCode;
+
+ /**
+ * 打印数据
+ */
+ private String printData;
+
+ /**
+ * 状态(1已取号2已打印3已发货)
+ */
+ private Integer status;
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ /**
+ * 创建人
+ */
+ private String createBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+
+ /**
+ * 更新人
+ */
+ private String updateBy;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/domain/OmsTaoWaybillAccount.java b/open-api/tao-api/src/main/java/com/qihang/tao/domain/OmsTaoWaybillAccount.java
new file mode 100644
index 00000000..a688fdf4
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/domain/OmsTaoWaybillAccount.java
@@ -0,0 +1,98 @@
+package com.qihang.tao.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 淘宝电子面单账户信息表
+ * @TableName oms_tao_waybill_account
+ */
+@Data
+public class OmsTaoWaybillAccount implements Serializable {
+ /**
+ *
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ private Long shopId;
+
+ /**
+ * 物流服务商编码
+ */
+ private String cpCode;
+
+ /**
+ * 1是直营,2是加盟
+ */
+ private Integer cpType;
+
+ /**
+ * 商家ID
+ */
+ private Long sellerId;
+
+ /**
+ * 可用单数
+ */
+ private Integer quantity;
+
+ /**
+ * 已用单数
+ */
+ private Integer allocatedQuantity;
+
+ /**
+ * 网点ID
+ */
+ private String branchCode;
+ private String branchName;
+
+ /**
+ * 已经打印的面单总数
+ */
+ private Integer printQuantity;
+
+ /**
+ * 取消的面对总数
+ */
+ private Integer cancelQuantity;
+
+ /**
+ * waybill 地址记录ID(非地址库ID)
+ */
+ private Long waybillAddressId;
+
+ /**
+ * 省名称(一级地址)
+ */
+ private String province;
+
+ /**
+ * 市名称(二级地址)
+ */
+ private String city;
+
+ /**
+ * 区名称(三级地址)
+ */
+ private String area;
+
+ /**
+ * 详细地址
+ */
+ private String addressDetail;
+ private String name;
+ private String mobile;
+ private String phone;
+
+ /**
+ * 是否前台显示1显示0不显示
+ */
+ private Integer isShow;
+
+ private static final long serialVersionUID = 1L;
+
+}
\ No newline at end of file
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoOrderBo.java b/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoOrderBo.java
index 9fb71209..e5d5fbb0 100644
--- a/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoOrderBo.java
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoOrderBo.java
@@ -11,4 +11,5 @@ public class TaoOrderBo implements Serializable {
private Long erpGoodsSkuId;
private Long shopId;
private String status;
+ private Integer erpSendStatus;
}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoWaybillGetBo.java b/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoWaybillGetBo.java
new file mode 100644
index 00000000..9562d19e
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/domain/bo/TaoWaybillGetBo.java
@@ -0,0 +1,10 @@
+package com.qihang.tao.domain.bo;
+
+import lombok.Data;
+
+@Data
+public class TaoWaybillGetBo {
+ private Long accountId;//电子面单账户id
+ private String[] ids;
+ private Long shopId;//店铺Id
+}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/domain/vo/WaybillBranchAccountVo.java b/open-api/tao-api/src/main/java/com/qihang/tao/domain/vo/WaybillBranchAccountVo.java
new file mode 100644
index 00000000..db3433d9
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/domain/vo/WaybillBranchAccountVo.java
@@ -0,0 +1,32 @@
+//package com.qihang.tao.domain.vo;
+//
+//import com.fasterxml.jackson.annotation.JsonProperty;
+//import lombok.Data;
+//
+//@Data
+//public class WaybillBranchAccountVo {
+// private String cpCode;
+// private Integer cpType;
+//
+// private Integer allocatedQuantity;
+//
+// private String branchCode;
+//
+// private String branchName;
+//
+// private Integer cancelQuantity;
+//
+// private Integer printQuantity;
+//
+// private Integer quantity;
+//
+// private String addressDetail;
+//
+// private String area;
+//
+// private String city;
+//
+// private String province;
+//
+// private Integer waybillAddressId;
+//}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/mapper/ErpShipWaybillMapper.java b/open-api/tao-api/src/main/java/com/qihang/tao/mapper/ErpShipWaybillMapper.java
new file mode 100644
index 00000000..15d9495e
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/mapper/ErpShipWaybillMapper.java
@@ -0,0 +1,18 @@
+package com.qihang.tao.mapper;
+
+import com.qihang.tao.domain.ErpShipWaybill;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author qilip
+* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Mapper
+* @createDate 2024-06-16 17:18:22
+* @Entity com.qihang.tao.domain.ErpShipWaybill
+*/
+public interface ErpShipWaybillMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/mapper/OmsTaoWaybillAccountMapper.java b/open-api/tao-api/src/main/java/com/qihang/tao/mapper/OmsTaoWaybillAccountMapper.java
new file mode 100644
index 00000000..8dacafb4
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/mapper/OmsTaoWaybillAccountMapper.java
@@ -0,0 +1,18 @@
+package com.qihang.tao.mapper;
+
+import com.qihang.tao.domain.OmsTaoWaybillAccount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author qilip
+* @description 针对表【oms_tao_waybill_account(淘宝电子面单账户信息表)】的数据库操作Mapper
+* @createDate 2024-06-16 11:56:38
+* @Entity com.qihang.tao.domain.OmsTaoWaybillAccount
+*/
+public interface OmsTaoWaybillAccountMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/openApi/ApiCommon.java b/open-api/tao-api/src/main/java/com/qihang/tao/openApi/ApiCommon.java
index 3a593539..8648797e 100644
--- a/open-api/tao-api/src/main/java/com/qihang/tao/openApi/ApiCommon.java
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/openApi/ApiCommon.java
@@ -50,9 +50,9 @@ public class ApiCommon {
// if(!StringUtils.hasText(platform.getServerUrl())) {
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ApiRequestUrl");
// }
-// if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
-// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
-// }
+ if(shop.getSellerShopId() == null || shop.getSellerShopId() <= 0) {
+ return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerShopId");
+ }
ShopApiParams params = new ShopApiParams();
params.setAppKey(platform.getAppKey());
@@ -60,7 +60,7 @@ public class ApiCommon {
params.setAccessToken(shop.getAccessToken());
params.setRedirectUrl(platform.getRedirectUrl());
params.setServerUrl(platform.getServerUrl());
-
+ params.setSellerShopId(shop.getSellerShopId());
if (!StringUtils.hasText(shop.getAccessToken())) {
return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token已过期,请重新授权", params);
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/ErpShipWaybillService.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/ErpShipWaybillService.java
new file mode 100644
index 00000000..528838a4
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/ErpShipWaybillService.java
@@ -0,0 +1,19 @@
+package com.qihang.tao.service;
+
+import com.qihang.common.common.ResultVo;
+import com.qihang.tao.domain.ErpShipWaybill;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+* @author qilip
+* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service
+* @createDate 2024-06-16 17:18:22
+*/
+public interface ErpShipWaybillService extends IService {
+ ResultVo waybillUpdate(ErpShipWaybill shipWaybill);
+ List getListByOrderIds(Long shopId,String[] orderIds);
+
+ ResultVo printSuccess(Long shopId,String[] orderIds);
+}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoOrderService.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoOrderService.java
index f7982d3b..d599afac 100644
--- a/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoOrderService.java
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoOrderService.java
@@ -25,5 +25,5 @@ public interface OmsTaoOrderService extends IService {
PageResult queryPageList(TaoOrderBo bo, PageQuery pageQuery);
OmsTaoOrder queryDetailById(Long id);
-
+ OmsTaoOrder queryDetailByTid(String tid);
}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoWaybillAccountService.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoWaybillAccountService.java
new file mode 100644
index 00000000..e36f4b0b
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/OmsTaoWaybillAccountService.java
@@ -0,0 +1,13 @@
+package com.qihang.tao.service;
+
+import com.qihang.tao.domain.OmsTaoWaybillAccount;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author qilip
+* @description 针对表【oms_tao_waybill_account(淘宝电子面单账户信息表)】的数据库操作Service
+* @createDate 2024-06-16 11:56:38
+*/
+public interface OmsTaoWaybillAccountService extends IService {
+
+}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/ErpShipWaybillServiceImpl.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/ErpShipWaybillServiceImpl.java
new file mode 100644
index 00000000..a23a2dc0
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/ErpShipWaybillServiceImpl.java
@@ -0,0 +1,123 @@
+package com.qihang.tao.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qihang.common.common.ResultVo;
+import com.qihang.common.enums.EnumShopType;
+import com.qihang.tao.domain.ErpShipWaybill;
+import com.qihang.tao.domain.OmsTaoOrder;
+import com.qihang.tao.mapper.OmsTaoOrderMapper;
+import com.qihang.tao.service.ErpShipWaybillService;
+import com.qihang.tao.mapper.ErpShipWaybillMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+* @author qilip
+* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service实现
+* @createDate 2024-06-16 17:18:22
+*/
+@AllArgsConstructor
+@Service
+public class ErpShipWaybillServiceImpl extends ServiceImpl
+ implements ErpShipWaybillService{
+ private final ErpShipWaybillMapper mapper;
+ private final OmsTaoOrderMapper orderMapper;
+
+ /**
+ * 更新电子面单信息
+ * @param shipWaybill
+ * @return
+ */
+ @Transactional
+ @Override
+ public ResultVo waybillUpdate(ErpShipWaybill shipWaybill) {
+ String orderId= shipWaybill.getOrderId();
+ if(shipWaybill.getId()!=null&&shipWaybill.getId()>0){
+ // 存在,修改
+ shipWaybill.setCreateBy(null);
+ shipWaybill.setCreateTime(null);
+ shipWaybill.setOrderId(null);
+ shipWaybill.setShopId(null);
+ shipWaybill.setShopType(null);
+ mapper.updateById(shipWaybill);
+ }else{
+ // 新增
+ List erpShipWaybills = mapper.selectList(new LambdaQueryWrapper().eq(ErpShipWaybill::getOrderId, orderId));
+ if(erpShipWaybills==null|| erpShipWaybills.size()==0) {
+ shipWaybill.setStatus(1);//已取号
+ shipWaybill.setShopType(EnumShopType.TAO.getIndex());
+ shipWaybill.setCreateTime(new Date());
+ mapper.insert(shipWaybill);
+ }else{
+ ErpShipWaybill update = new ErpShipWaybill();
+ update.setId(erpShipWaybills.get(0).getId());
+ update.setWaybillCode(shipWaybill.getWaybillCode());
+ update.setLogisticsCode(shipWaybill.getLogisticsCode());
+ update.setPrintData(shipWaybill.getPrintData());
+ update.setStatus(1);
+ update.setUpdateTime(new Date());
+ update.setUpdateBy("重新取号");
+ mapper.updateById(update);
+ }
+ }
+ // 更新关联订单erp_send_status状态
+ OmsTaoOrder orderUpdate = new OmsTaoOrder();
+ orderUpdate.setErpSendStatus(shipWaybill.getStatus());
+ orderUpdate.setErpSendCode(shipWaybill.getWaybillCode());
+ orderUpdate.setErpSendCompany(shipWaybill.getLogisticsCode());
+ orderMapper.update(orderUpdate,new LambdaQueryWrapper().eq(OmsTaoOrder::getTid,orderId));
+
+ return ResultVo.success();
+ }
+
+ @Override
+ public List getListByOrderIds(Long shopId, String[] orderIds) {
+ List erpShipWaybills = mapper.selectList(
+ new LambdaQueryWrapper()
+ .eq(ErpShipWaybill::getShopId,shopId)
+ .in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
+ return erpShipWaybills;
+ }
+
+ @Transactional
+ @Override
+ public ResultVo printSuccess(Long shopId, String[] orderIds) {
+ List erpShipWaybills = mapper.selectList(
+ new LambdaQueryWrapper()
+ .eq(ErpShipWaybill::getShopId,shopId)
+ .in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
+ if(erpShipWaybills!=null){
+ for (var w : erpShipWaybills){
+ ErpShipWaybill update = new ErpShipWaybill();
+ update.setId(erpShipWaybills.get(0).getId());
+ update.setStatus(2);
+ update.setUpdateTime(new Date());
+ update.setUpdateBy("打印面单");
+ mapper.updateById(update);
+
+ // 更新关联订单erp_send_status状态
+ OmsTaoOrder orderUpdate = new OmsTaoOrder();
+ orderUpdate.setErpSendStatus(update.getStatus());
+
+ orderMapper.update(orderUpdate,new LambdaQueryWrapper().eq(OmsTaoOrder::getTid,w.getOrderId()));
+
+ //TODO: 打印成功之后 加入备货清单
+
+
+
+
+ }
+ }
+ return ResultVo.success();
+ }
+}
+
+
+
+
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoOrderServiceImpl.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoOrderServiceImpl.java
index 8a8eb1d3..e53538b9 100644
--- a/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoOrderServiceImpl.java
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoOrderServiceImpl.java
@@ -165,6 +165,7 @@ public class OmsTaoOrderServiceImpl extends ServiceImpl taoGoodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
@@ -182,6 +183,15 @@ public class OmsTaoOrderServiceImpl extends ServiceImpl().eq(OmsTaoOrderItem::getTid,omsTaoOrder.getTid())));
return omsTaoOrder;
}
+ @Override
+ public OmsTaoOrder queryDetailByTid(String tid) {
+ List omsTaoOrders = mapper.selectList(new LambdaQueryWrapper().eq(OmsTaoOrder::getTid, tid));
+ if(omsTaoOrders == null) return null;
+
+ OmsTaoOrder omsTaoOrder = omsTaoOrders.get(0);
+ omsTaoOrder.setItems(itemMapper.selectList(new LambdaQueryWrapper().eq(OmsTaoOrderItem::getTid,omsTaoOrder.getTid())));
+ return omsTaoOrder;
+ }
}
diff --git a/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoWaybillAccountServiceImpl.java b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoWaybillAccountServiceImpl.java
new file mode 100644
index 00000000..068007a9
--- /dev/null
+++ b/open-api/tao-api/src/main/java/com/qihang/tao/service/impl/OmsTaoWaybillAccountServiceImpl.java
@@ -0,0 +1,22 @@
+package com.qihang.tao.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qihang.tao.domain.OmsTaoWaybillAccount;
+import com.qihang.tao.service.OmsTaoWaybillAccountService;
+import com.qihang.tao.mapper.OmsTaoWaybillAccountMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author qilip
+* @description 针对表【oms_tao_waybill_account(淘宝电子面单账户信息表)】的数据库操作Service实现
+* @createDate 2024-06-16 11:56:38
+*/
+@Service
+public class OmsTaoWaybillAccountServiceImpl extends ServiceImpl
+ implements OmsTaoWaybillAccountService{
+
+}
+
+
+
+
diff --git a/open-api/tao-api/src/main/resources/mapper/ErpShipWaybillMapper.xml b/open-api/tao-api/src/main/resources/mapper/ErpShipWaybillMapper.xml
new file mode 100644
index 00000000..68098896
--- /dev/null
+++ b/open-api/tao-api/src/main/resources/mapper/ErpShipWaybillMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,order_id,shop_id,
+ shop_type,waybill_code,logistics_code,
+ print_data,status,create_time,
+ create_by,update_time,update_by
+
+
diff --git a/open-api/tao-api/src/main/resources/mapper/OmsTaoWaybillAccountMapper.xml b/open-api/tao-api/src/main/resources/mapper/OmsTaoWaybillAccountMapper.xml
new file mode 100644
index 00000000..f4614119
--- /dev/null
+++ b/open-api/tao-api/src/main/resources/mapper/OmsTaoWaybillAccountMapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,cp_code,cp_type,shop_id,branch_name,
+ seller_id,quantity,allocated_quantity,
+ branch_code,print_quantity,cancel_quantity,
+ waybill_address_id,province,city,`name`,mobile,phone
+ area,address_detail,is_show
+
+
diff --git a/open-api/wei-api/pom.xml b/open-api/wei-api/pom.xml
index 722f1fbb..291ec4d1 100644
--- a/open-api/wei-api/pom.xml
+++ b/open-api/wei-api/pom.xml
@@ -24,58 +24,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
org.springframework.boot
spring-boot-starter-webflux
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
wei-api
wei-api
@@ -84,22 +37,4 @@
${project.basedir}/libs/wei-api-1.6.3.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vue/src/api/tao/ewaybill.js b/vue/src/api/tao/ewaybill.js
new file mode 100644
index 00000000..3ad38515
--- /dev/null
+++ b/vue/src/api/tao/ewaybill.js
@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+// 获取电子面单账户list
+export function getWaybillAccountList(data) {
+ return request({
+ url: '/api/tao-api/ewaybill/get_waybill_account_list',
+ method: 'post',
+ data: data
+ })
+}
+
+
+// 更新电子面单账户
+export function pullWaybillAccount(data) {
+ return request({
+ url: '/api/tao-api/ewaybill/pull_waybill_account',
+ method: 'post',
+ data: data
+ })
+}
+
+// 取号
+export function getWaybillCode(data) {
+ return request({
+ url: '/api/tao-api/ewaybill/get_waybill_code',
+ method: 'post',
+ data: data
+ })
+}
+
+// 获取打印的数据
+export function getWaybillPrintData(data) {
+ return request({
+ url: '/api/tao-api/ewaybill/get_print_data',
+ method: 'post',
+ data: data
+ })
+}
+
+// 打印成功
+export function pushWaybillPrintSuccess(data) {
+ return request({
+ url: '/api/tao-api/ewaybill/push_print_success',
+ method: 'post',
+ data: data
+ })
+}
diff --git a/vue/src/views/shipping/ewaybillPrint/index.vue b/vue/src/views/shipping/ewaybillPrint/index.vue
index dc0e4025..97b0c584 100644
--- a/vue/src/views/shipping/ewaybillPrint/index.vue
+++ b/vue/src/views/shipping/ewaybillPrint/index.vue
@@ -1,28 +1,38 @@
-
-
-
+
+
-
-
-
+
+ 京东POP电子面单打印暂不提供
+
+
+ 拼多多电子面单打印正在开发中
+
+
+ 抖店电子面单打印后续开放
+
+
+
+
+
diff --git a/vue/src/views/shop/tao/order/index.vue b/vue/src/views/shop/tao/order/index.vue
index 3a29a7b7..192bfc72 100644
--- a/vue/src/views/shop/tao/order/index.vue
+++ b/vue/src/views/shop/tao/order/index.vue
@@ -107,9 +107,9 @@
-
+
- {{ parseTime(scope.row.created, '{y}-{m}-{d} {h}:{m}:{s}') }}
+ {{ parseTime(scope.row.created) }}
diff --git a/vue/src/views/shop/wei/ewaybill/index.vue b/vue/src/views/shop/wei/ewaybill/index.vue
index c541fa6d..56a640b1 100644
--- a/vue/src/views/shop/wei/ewaybill/index.vue
+++ b/vue/src/views/shop/wei/ewaybill/index.vue
@@ -113,7 +113,7 @@ import {listShop} from "@/api/shop/shop";
import {getDeliverList} from "@/api/wei/ewaybill";
export default {
- name: "ewaybillWei",
+ name: "printWei",
data() {
return {
// 遮罩层
@@ -241,7 +241,7 @@ export default {
};
// 当发生错误时触发
ws.onerror = function(error) {
- obj.msgError("打印组件连接失败!请安装并启动微信视频号小单打印组件!");
+ obj.msgError("打印组件连接失败!请安装并启动微信视频号小店打印组件!");
console.error('WebSocket error:', error);
// alert('WebSocket error occurred. Check the console for more details.');
};