完善dou电子面单打印

This commit is contained in:
老齐 2024-06-19 16:17:03 +08:00
parent ff07e0a745
commit de1b4c3e56
42 changed files with 903 additions and 184 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 80032
File Encoding : 65001
Date: 18/06/2024 19:59:12
Date: 19/06/2024 16:16:35
*/
SET NAMES utf8mb4;
@ -383,7 +383,7 @@ CREATE TABLE `erp_sale_order` (
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `order_sn_index`(`order_num`) USING BTREE,
INDEX `shopid_index`(`shop_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1801809140794216449 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1801809140794216450 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for erp_sale_order_item
@ -570,7 +570,7 @@ CREATE TABLE `erp_ship_stock_up` (
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`update_by` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '备货表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '备货表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for erp_ship_waybill
@ -590,7 +590,7 @@ CREATE TABLE `erp_ship_waybill` (
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1802644906957025282 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发货电子面单记录表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发货电子面单记录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for oms_dou_goods
@ -741,6 +741,9 @@ CREATE TABLE `oms_dou_order` (
`last_pull_time` datetime(0) DEFAULT NULL COMMENT '最后一次拉取时间',
`audit_status` int(0) NOT NULL DEFAULT 0 COMMENT '0待确认1已确认2已拦截-9未拉取',
`audit_time` datetime(0) DEFAULT NULL COMMENT '审核时间',
`erp_send_company` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'erp发货快递公司',
`erp_send_code` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'erp发货快递单号',
`erp_send_status` int(0) DEFAULT 0 COMMENT 'erp发货状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '抖店订单表' ROW_FORMAT = Dynamic;
@ -862,6 +865,34 @@ CREATE TABLE `oms_dou_refund` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1800783607092436994 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '抖店退款表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for oms_dou_waybill_account
-- ----------------------------
DROP TABLE IF EXISTS `oms_dou_waybill_account`;
CREATE TABLE `oms_dou_waybill_account` (
`id` bigint(0) NOT NULL AUTO_INCREMENT,
`shop_id` bigint(0) NOT NULL COMMENT '店铺id',
`seller_id` bigint(0) DEFAULT NULL COMMENT '商家ID',
`company` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '快递公司编码',
`company_type` int(0) DEFAULT NULL COMMENT '物流服务商业务类型 1直营 2加盟 3落地配 4直营带网点',
`amount` int(0) DEFAULT NULL COMMENT '电子面单余额数量,-1表示没有额度限制',
`allocated_quantity` int(0) DEFAULT NULL COMMENT '已取单号数量,若业务本身无值,则传-1前端可展示为“-”',
`cancelled_quantity` int(0) DEFAULT NULL COMMENT '已取消单号数量,若业务本身无值,则传-1前端可展示为“-”',
`recycled_quantity` int(0) DEFAULT NULL COMMENT '已回收单号数量,若业务本身无值,则传-1前端可展示为“-”',
`netsite_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '网点Code',
`netsite_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '网点名称',
`province_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省名称(一级地址)',
`city_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '市名称(二级地址)',
`district_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`street_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区名称(三级地址)',
`detail_address` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '详细地址',
`name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发货人',
`mobile` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发货手机号',
`phone` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发货固定电话',
`is_show` int(0) DEFAULT NULL COMMENT '是否前台显示1显示0不显示',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '抖店电子面单账户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for oms_jd_after_sale
-- ----------------------------

View File

@ -2,6 +2,9 @@ package com.qihang.oms.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.oms.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -29,9 +29,9 @@
<dependency>
<groupId>doudian</groupId>
<artifactId>dou-api</artifactId>
<version>0.3</version>
<version>0.6.18</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/dou-api-0.3.jar</systemPath>
<systemPath>${project.basedir}/libs/dou-api-0.6.18.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/net.logstash.logback/logstash-logback-encoder -->
<dependency>

View File

@ -1,51 +1,50 @@
package com.qihang.pdd.controller;
package com.qihang.dou.controller;
import cn.qihangerp.open.pdd.WaybillAccountApiHelper;
import cn.qihangerp.open.pdd.WaybillApiHelper;
import cn.qihangerp.open.pdd.common.ApiResultVo;
import cn.qihangerp.open.pdd.model.WaybillAccount;
import cn.qihangerp.open.pdd.model.WaybillCodeModule;
import cn.qihangerp.open.pdd.request.*;
import cn.qihangerp.open.dou.DouTokenApiHelper;
import cn.qihangerp.open.dou.WaybillAccountApiHelper;
import cn.qihangerp.open.dou.WaybillApiHelper;
import cn.qihangerp.open.dou.common.ApiResultVo;
import cn.qihangerp.open.dou.model.Token;
import cn.qihangerp.open.dou.model.WaybillAccount;
import cn.qihangerp.open.dou.model.WaybillCode;
import cn.qihangerp.open.dou.model.WaybillPrintData;
import cn.qihangerp.open.dou.request.*;
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.HttpStatus;
import com.qihang.pdd.domain.ErpShipWaybill;
import com.qihang.pdd.domain.OmsPddOrder;
import com.qihang.pdd.domain.OmsPddWaybillAccount;
import com.qihang.pdd.domain.bo.PddWaybillGetBo;
import com.qihang.pdd.openapi.ApiCommon;
import com.qihang.pdd.openapi.PullRequest;
import com.qihang.pdd.service.ErpShipWaybillService;
import com.qihang.pdd.service.OmsPddOrderService;
import com.qihang.pdd.service.OmsPddWaybillAccountService;
import com.qihang.dou.domain.ErpShipWaybill;
import com.qihang.dou.domain.OmsDouOrder;
import com.qihang.dou.domain.OmsDouWaybillAccount;
import com.qihang.dou.domain.bo.DouRequest;
import com.qihang.dou.domain.bo.DouWaybillGetBo;
import com.qihang.dou.service.ErpShipWaybillService;
import com.qihang.dou.service.OmsDouOrderService;
import com.qihang.dou.service.OmsDouWaybillAccountService;
import com.qihang.security.common.BaseController;
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.List;
import java.util.*;
@Log
@AllArgsConstructor
@RestController
@RequestMapping("/ewaybill")
public class EwaybillController extends BaseController {
private final ApiCommon apiCommon;
private final OmsPddWaybillAccountService waybillAccountService;
private final OmsPddOrderService orderService;
private final DouApiHelper apiCommon;
private final OmsDouWaybillAccountService waybillAccountService;
private final OmsDouOrderService orderService;
private final ErpShipWaybillService erpShipWaybillService;
@GetMapping(value = "/get_waybill_account_list")
public AjaxResult getWaybillAccountList(@RequestParam Long shopId) throws Exception {
// if (params.getShopId() == null || params.getShopId() <= 0) {
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
// }
List<OmsPddWaybillAccount> list = waybillAccountService.list(
new LambdaQueryWrapper<OmsPddWaybillAccount>().eq(OmsPddWaybillAccount::getShopId, shopId)
.eq(OmsPddWaybillAccount::getIsShow, 1));
List<OmsDouWaybillAccount> list = waybillAccountService.list(
new LambdaQueryWrapper<OmsDouWaybillAccount>().eq(OmsDouWaybillAccount::getShopId, shopId)
.eq(OmsDouWaybillAccount::getIsShow, 1));
return AjaxResult.success(list);
}
@ -56,59 +55,61 @@ public class EwaybillController extends BaseController {
* @throws Exception
*/
@RequestMapping(value = "/pull_waybill_account", method = RequestMethod.POST)
public AjaxResult pullWaybillAccount(@RequestBody PullRequest params) throws Exception {
public AjaxResult pullWaybillAccount(@RequestBody DouRequest 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) {
if (checkResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
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<Token> token = DouTokenApiHelper.getToken(appKey, appSecret,checkResult.getData().getSellerShopId());
if(token.getCode()==0) {
accessToken = token.getData().getAccessToken();
}else{
return AjaxResult.error(token.getMsg());
}
ApiResultVo<WaybillAccount> apiResultVo = WaybillAccountApiHelper.listWaybillAccount(appKey, appSecret, accessToken);
List<OmsDouWaybillAccount> list = new ArrayList<>();
if(apiResultVo.getCode()==0) {
for (var item : apiResultVo.getList()) {
ApiResultVo<WaybillAccount> apiResultVo = WaybillAccountApiHelper.pullWaybillBranchAccountList(appKey, appSecret, accessToken);
List<OmsPddWaybillAccount> list = new ArrayList<>();
if(apiResultVo.getCode()==0){
for (var item : apiResultVo.getList()){
for(var acc:item.getBranchAccountCols()){
OmsPddWaybillAccount vo = new OmsPddWaybillAccount();
vo.setShopId(params.getShopId());
vo.setSellerId(sellId);
vo.setIsShow(1);
vo.setCpCode(item.getWpCode());
vo.setCpType(item.getWpType());
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().size()>0) {
vo.setAddressDetail(acc.getShippAddressCols().get(0).getDetail());
vo.setArea(acc.getShippAddressCols().get(0).getDistrict());
vo.setCity(acc.getShippAddressCols().get(0).getCity());
vo.setProvince(acc.getShippAddressCols().get(0).getProvince());
// vo.setWaybillAddressId(acc.getShippAddressCols().get(0).getWaybillAddressId().longValue());
list.add(vo);
}
waybillAccountService.save(vo);
log.info("========添加pdd电子面单账户信息==========");
OmsDouWaybillAccount vo = new OmsDouWaybillAccount();
vo.setShopId(params.getShopId());
vo.setSellerId(sellId);
vo.setIsShow(1);
vo.setCompany(item.getCompany());
vo.setCompanyType(item.getCompanyType());
vo.setAmount(Integer.parseInt(item.getAmount()));
vo.setAllocatedQuantity(item.getAllocatedQuantity());
vo.setCancelledQuantity(item.getCancelledQuantity());
vo.setRecycledQuantity(item.getRecycledQuantity());
vo.setNetsiteCode(item.getNetsiteCode());
vo.setNetsiteName(item.getNetsiteName());
if (item.getSenderAddress() != null && item.getSenderAddress().size() > 0) {
vo.setProvinceName(item.getSenderAddress().get(0).getProvinceName());
vo.setDistrictName(item.getSenderAddress().get(0).getDistrictName());
vo.setCityName(item.getSenderAddress().get(0).getCityName());
vo.setStreetName(item.getSenderAddress().get(0).getStreetName());
vo.setDetailAddress(item.getSenderAddress().get(0).getDetailAddress());
}
list.add(vo);
waybillAccountService.save(vo);
log.info("========添加dou电子面单账户信息==========");
}
}
return AjaxResult.success(list);
}
@PostMapping("/get_waybill_code")
@ResponseBody
public AjaxResult getWaybillCode(@RequestBody PddWaybillGetBo req) {
public AjaxResult getWaybillCode(@RequestBody DouWaybillGetBo req) {
if (req.getAccountId() == null || req.getAccountId() <= 0) {
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,请选择电子面单账户");
}
@ -119,7 +120,7 @@ public class EwaybillController extends BaseController {
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
}
var checkResult = apiCommon.checkBefore(req.getShopId());
if (checkResult.getCode() != HttpStatus.SUCCESS) {
if (checkResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
}
String accessToken = checkResult.getData().getAccessToken();
@ -127,85 +128,99 @@ public class EwaybillController extends BaseController {
String appSecret = checkResult.getData().getAppSecret();
Long sellerShopId = checkResult.getData().getSellerShopId();
ApiResultVo<Token> token = DouTokenApiHelper.getToken(appKey, appSecret,checkResult.getData().getSellerShopId());
if(token.getCode()==0) {
accessToken = token.getData().getAccessToken();
}else{
return AjaxResult.error(token.getMsg());
}
// 获取电子面单账户信息(包含了发货地址信息)
OmsPddWaybillAccount account = waybillAccountService.getById(req.getAccountId());
OmsDouWaybillAccount waybillAccount = waybillAccountService.getById(req.getAccountId());
WaybillCloudPrintApplyNewRequest request = new WaybillCloudPrintApplyNewRequest();
request.setWp_code(account.getCpCode());
request.setNeed_encrypt(true);
WaybillCodeRequest request = new WaybillCodeRequest();
request.setLogistics_code(waybillAccount.getCompany());
request.setOrder_channel("1");
WaybillCloudPrintApplyNewRequestContact sender = new WaybillCloudPrintApplyNewRequestContact();
sender.setName(account.getName());
sender.setMobile(account.getMobile());
WaybillCloudPrintApplyNewRequestContactAddress addressDTO = new WaybillCloudPrintApplyNewRequestContactAddress();
addressDTO.setCity(account.getCity());
addressDTO.setProvince(account.getProvince());
addressDTO.setDistrict(account.getArea());
addressDTO.setTown("");
addressDTO.setDetail(account.getAddressDetail());
sender.setAddress(addressDTO);
request.setSender(sender);
WaybillAddressInfo sender = new WaybillAddressInfo();
WaybillAddress address = new WaybillAddress();
address.setCountry_code("CHN");
address.setProvince_name(waybillAccount.getProvinceName());
address.setCity_name(waybillAccount.getCityName());
address.setDistrict_name(waybillAccount.getDistrictName());
address.setStreet_name(waybillAccount.getStreetName());
address.setDetail_address(waybillAccount.getDetailAddress());
sender.setAddress(address);
// 组合取号的订单信息trade_order_info_dtos
List<WaybillCloudPrintApplyNewRequestTradeOrderInfoDto> orderList = new ArrayList<>();
WaybillContact contact = new WaybillContact();
contact.setName(waybillAccount.getName());
contact.setMobile(waybillAccount.getMobile());
for(String orderSn:req.getIds()){
if(StringUtils.hasText(orderSn)){
OmsPddOrder order = orderService.queryDetailByOrderSn(orderSn);
sender.setContact(contact);
request.setSender_info(sender);
// 开始组装订单
List<WaybillOrderInfo> orderInfos=new ArrayList<>();
for(String orderId:req.getIds()){
if(StringUtils.hasText(orderId)){
OmsDouOrder order = orderService.queryDetailByOrderId(orderId);
if(order!=null) {
WaybillCloudPrintApplyNewRequestTradeOrderInfoDto dto = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto();
dto.setObject_id(order.getOrderSn());
dto.setTemplate_url("https://file-link.pinduoduo.com/yunda_std");
dto.setUser_id(sellerShopId);
OrderInfo orderInfo = new OrderInfo();
orderInfo.setOrder_channels_type("PDD");
orderInfo.setTrade_order_list(new String[] {order.getOrderSn()});
dto.setOrder_info(orderInfo);
WaybillOrderInfo orderInfo = new WaybillOrderInfo();
orderInfo.setOrder_id(order.getOrderId());
WaybillAddressInfo receiver = new WaybillAddressInfo();
WaybillAddress address1 = new WaybillAddress();
address1.setCountry_code("CHN");
address1.setProvince_name(order.getProvinceName());
address1.setCity_name(order.getCityName());
address1.setDistrict_name(order.getTownName());
address1.setStreet_name(order.getStreetName());
address1.setDetail_address(order.getMaskPostAddress());
receiver.setAddress(address1);
PackageInfo packageInfo = new PackageInfo();
List<PackageInfoItem> items = new ArrayList<>();
for (var orderItem : order.getItemList()) {
PackageInfoItem item = new PackageInfoItem();
item.setName(orderItem.getGoodsName());
item.setCount(orderItem.getGoodsCount());
items.add(item);
WaybillContact contact1 = new WaybillContact();
contact1.setName(order.getMaskPostReceiver());
contact1.setMobile("-");
receiver.setContact(contact1);
orderInfo.setReceiver_info(receiver);
//
List<WaybillOrderItem> items=new ArrayList<>();
if(order.getItems()!=null&&order.getItems().size()>0) {
for (var it: order.getItems()) {
WaybillOrderItem item = new WaybillOrderItem();
item.setItem_count(it.getItemNum());
item.setItem_name(it.getProductName());
item.setItem_specs(it.getSpec());
items.add(item);
}
orderInfo.setItems(items);
}
packageInfo.setItems(items);
dto.setPackage_info(packageInfo);
WaybillCloudPrintApplyNewRequestContact recipient = new WaybillCloudPrintApplyNewRequestContact();
recipient.setName("启航");
recipient.setMobile("15818590112");
WaybillCloudPrintApplyNewRequestContactAddress recipientAddress = new WaybillCloudPrintApplyNewRequestContactAddress();
recipientAddress.setProvince(order.getProvince());
recipientAddress.setCity(order.getCity());
recipientAddress.setDistrict(order.getTown());
recipientAddress.setDetail(order.getAddress());
recipient.setAddress(recipientAddress);
dto.setRecipient(recipient);
orderList.add(dto);
orderInfos.add(orderInfo);
}
}
}
request.setTrade_order_info_dtos(orderList);
request.setOrder_infos(orderInfos);
ApiResultVo<WaybillCode> apiResultVo = WaybillApiHelper.getWaybillCode(appKey, appSecret, token.getData().getAccessToken(), request);
ApiResultVo<WaybillCodeModule> apiResultVo = WaybillApiHelper.getWaybillCode(appKey, appSecret, accessToken, request);
if(apiResultVo.getCode()==0){
// 保持数据
for(var result: apiResultVo.getList()){
ErpShipWaybill waybill = new ErpShipWaybill();
waybill.setShopId(req.getShopId());
waybill.setOrderId(result.getObject_id());
waybill.setWaybillCode(result.getWaybill_code());
waybill.setLogisticsCode(account.getCpCode());
waybill.setPrintData(result.getPrint_data());
waybill.setOrderId(result.getOrderId());
waybill.setWaybillCode(result.getTrackNo());
waybill.setLogisticsCode(result.getCompany());
// waybill.setPrintData(result.getPrint_data());
erpShipWaybillService.waybillUpdate(waybill);
log.info("====保存電子面單信息========"+result.getObject_id());
log.info("====保存電子面單信息========"+result.getOrderId());
}
}else{
return AjaxResult.error(apiResultVo.getMsg());
@ -214,22 +229,69 @@ public class EwaybillController extends BaseController {
return success();
}
@PostMapping("/get_print_data")
@ResponseBody
public AjaxResult getPrintData(@RequestBody PddWaybillGetBo 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<ErpShipWaybill> listByOrderIds = erpShipWaybillService.getListByOrderIds(req.getShopId(), req.getIds());
return AjaxResult.success(listByOrderIds);
@PostMapping("/get_print_data")
@ResponseBody
public AjaxResult getPrintData(@RequestBody DouWaybillGetBo 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, "参数错误,没有选择订单");
}
var checkResult = apiCommon.checkBefore(req.getShopId());
if (checkResult.getCode() != 0) {
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();
ApiResultVo<Token> token = DouTokenApiHelper.getToken(appKey, appSecret,checkResult.getData().getSellerShopId());
if(token.getCode()==0) {
accessToken = token.getData().getAccessToken();
}else{
return AjaxResult.error(token.getMsg());
}
List<ErpShipWaybill> list = erpShipWaybillService.getListByOrderIds(req.getShopId(), req.getIds());
WaybillApplyRequest request = new WaybillApplyRequest();
List<WaybillApply> waybillApplyList = new ArrayList<>();
if(list!=null && list.size()>0) {
for (var ship:list) {
if(!StringUtils.hasText(ship.getPrintData())) {
WaybillApply dto = new WaybillApply();
dto.setLogistics_code(ship.getLogisticsCode());
dto.setTrack_no(ship.getWaybillCode());
waybillApplyList.add(dto);
}
}
}
request.setWaybill_applies(waybillApplyList);
ApiResultVo<WaybillPrintData> apiResultVo = WaybillApiHelper.pullWaybillPrintData(appKey, appSecret, accessToken, request);
if(apiResultVo.getCode()==0){
// 更新数据
for (var item:apiResultVo.getList()) {
ErpShipWaybill waybillNew = new ErpShipWaybill();
waybillNew.setPrintData(item.getPrintData());
waybillNew.setUpdateBy("获取打印数据");
waybillNew.setUpdateTime(new Date());
erpShipWaybillService.update(waybillNew,new LambdaQueryWrapper<ErpShipWaybill>().eq(ErpShipWaybill::getWaybillCode,item.getTrackNo()));
log.info("====保存電子面單打印信息jd========"+item.getOrderId());
ErpShipWaybill list1 = list.stream().filter(x -> x.getWaybillCode().equals(item.getTrackNo())).findFirst().get();
if(list1!=null){
list1.setPrintData(item.getPrintData());
}
}
}else{
return AjaxResult.error(apiResultVo.getMsg());
}
return AjaxResult.success(list);
}
@PostMapping("/push_print_success")
@ResponseBody
public AjaxResult pushPrintSuccess(@RequestBody PddWaybillGetBo req) {
public AjaxResult pushPrintSuccess(@RequestBody DouWaybillGetBo req) {
if (req.getShopId() == null || req.getShopId() <= 0) {
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
}
@ -247,7 +309,7 @@ public class EwaybillController extends BaseController {
*/
@PostMapping("/push_ship_send")
@ResponseBody
public AjaxResult pushShipSend(@RequestBody PddWaybillGetBo req) {
public AjaxResult pushShipSend(@RequestBody DouWaybillGetBo req) {
if (req.getShopId() == null || req.getShopId() <= 0) {
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
}

View File

@ -116,7 +116,7 @@ public class OrderApiController {
}
//获取
ApiResultVo<Order> resultVo = DouOrderApiHelper.pullOrderList(startTimestamp, endTimestamp, 1, 20, appKey, appSecret, accessToken);
ApiResultVo<Order> resultVo = DouOrderApiHelper.pullOrderList(startTimestamp, endTimestamp, 0, 20, appKey, appSecret, accessToken);
if(resultVo.getCode() !=0 ){
SShopPullLogs logs = new SShopPullLogs();
@ -215,7 +215,7 @@ public class OrderApiController {
logs.setDuration(System.currentTimeMillis() - currTimeMillis);
pullLogsService.save(logs);
String msg = "成功{startTime:"+startTime.format(df)+",endTime:"+endTime.format(df)+"}总共找到:" + resultVo.getTotalRecords() + "条订单,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "";
String msg = "成功{startTime:"+startTimeStr+",endTime:"+endTimeStr+"}总共找到:" + resultVo.getTotalRecords() + "条订单,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "";
log.info("/**************主动更新DOU订单END" + msg + "****************/");
return AjaxResult.success(msg);
}

View File

@ -0,0 +1,78 @@
package com.qihang.dou.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;
}

View File

@ -16,7 +16,7 @@ public class OmsDouOrder implements Serializable {
/**
*
*/
private Long id;
private String id;
/**
* 店铺父订单号抖店平台生成平台下唯一
@ -407,7 +407,20 @@ public class OmsDouOrder implements Serializable {
private Date lastPullTime;
private Integer auditStatus;
private Date auditTime;
/**
* erp发货快递公司
*/
private String erpSendCompany;
/**
* erp发货快递单号
*/
private String erpSendCode;
/**
* erp发货状态
*/
private Integer erpSendStatus;
@TableField(exist = false)
private List<OmsDouOrderItem> items;
private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,117 @@
package com.qihang.dou.domain;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* 抖店电子面单账户信息表
* @TableName oms_dou_waybill_account
*/
@Data
public class OmsDouWaybillAccount implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 店铺id
*/
private Long shopId;
/**
* 商家ID
*/
private Long sellerId;
/**
* 快递公司编码
*/
private String company;
/**
* 物流服务商业务类型 1直营 2加盟 3落地配 4直营带网点
*/
private Integer companyType;
/**
* 电子面单余额数量-1表示没有额度限制
*/
private Integer amount;
/**
* 已取单号数量若业务本身无值则传-1前端可展示为-
*/
private Integer allocatedQuantity;
/**
* 已取消单号数量若业务本身无值则传-1前端可展示为-
*/
private Integer cancelledQuantity;
/**
* 已回收单号数量若业务本身无值则传-1前端可展示为-
*/
private Integer recycledQuantity;
/**
* 网点Code
*/
private String netsiteCode;
/**
* 网点名称
*/
private String netsiteName;
/**
* 省名称一级地址
*/
private String provinceName;
/**
* 市名称二级地址
*/
private String cityName;
/**
*
*/
private String districtName;
/**
* 区名称三级地址
*/
private String streetName;
/**
* 详细地址
*/
private String detailAddress;
/**
* 发货人
*/
private String name;
/**
* 发货手机号
*/
private String mobile;
/**
* 发货固定电话
*/
private String phone;
/**
* 是否前台显示1显示0不显示
*/
private Integer isShow;
private static final long serialVersionUID = 1L;
}

View File

@ -2,6 +2,9 @@ package com.qihang.dou.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.dou.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -3,6 +3,9 @@ package com.qihang.dou.domain;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -14,6 +17,7 @@ public class SShopPullLasttime implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -10,7 +10,8 @@ public class DouOrderBo implements Serializable {
private Long skuId;
private Long erpGoodsSkuId;
private Integer shopId;
private String orderStatus;
private Integer orderStatus;
private Integer erpSendStatus;
private String startTime;
private String endTime;
}

View File

@ -1,9 +1,9 @@
package com.qihang.pdd.domain.bo;
package com.qihang.dou.domain.bo;
import lombok.Data;
@Data
public class PddWaybillGetBo {
public class DouWaybillGetBo {
private Long accountId;//电子面单账户id
private String[] ids;
private Long shopId;//店铺Id

View File

@ -0,0 +1,18 @@
package com.qihang.dou.mapper;
import com.qihang.dou.domain.ErpShipWaybill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author TW
* @description 针对表erp_ship_waybill(发货电子面单记录表)的数据库操作Mapper
* @createDate 2024-06-19 15:53:49
* @Entity com.qihang.dou.domain.ErpShipWaybill
*/
public interface ErpShipWaybillMapper extends BaseMapper<ErpShipWaybill> {
}

View File

@ -0,0 +1,18 @@
package com.qihang.dou.mapper;
import com.qihang.dou.domain.OmsDouWaybillAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author TW
* @description 针对表oms_dou_waybill_account(抖店电子面单账户信息表)的数据库操作Mapper
* @createDate 2024-06-19 14:35:56
* @Entity com.qihang.dou.domain.OmsDouWaybillAccount
*/
public interface OmsDouWaybillAccountMapper extends BaseMapper<OmsDouWaybillAccount> {
}

View File

@ -0,0 +1,20 @@
package com.qihang.dou.service;
import com.qihang.common.common.ResultVo;
import com.qihang.dou.domain.ErpShipWaybill;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author TW
* @description 针对表erp_ship_waybill(发货电子面单记录表)的数据库操作Service
* @createDate 2024-06-19 15:53:49
*/
public interface ErpShipWaybillService extends IService<ErpShipWaybill> {
ResultVo<Integer> waybillUpdate(ErpShipWaybill shipWaybill);
List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds);
ResultVo<Integer> printSuccess(Long shopId,String[] orderIds);
ResultVo<Integer> pushShipSend(Long shopId,String[] orderIds);
}

View File

@ -16,6 +16,7 @@ public interface OmsDouOrderService extends IService<OmsDouOrder> {
PageResult<OmsDouOrder> queryPageList(DouOrderBo bo, PageQuery pageQuery);
OmsDouOrder queryDetailById(Long id);
OmsDouOrder queryDetailByOrderId(String orderId);
/**
* 保存店铺订单
* @param shopId

View File

@ -0,0 +1,13 @@
package com.qihang.dou.service;
import com.qihang.dou.domain.OmsDouWaybillAccount;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author TW
* @description 针对表oms_dou_waybill_account(抖店电子面单账户信息表)的数据库操作Service
* @createDate 2024-06-19 14:35:56
*/
public interface OmsDouWaybillAccountService extends IService<OmsDouWaybillAccount> {
}

View File

@ -0,0 +1,161 @@
package com.qihang.dou.service.impl;
import com.alibaba.fastjson2.JSONObject;
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.common.mq.MqMessage;
import com.qihang.common.mq.MqType;
import com.qihang.dou.domain.ErpShipWaybill;
import com.qihang.dou.domain.OmsDouOrder;
import com.qihang.dou.mapper.OmsDouOrderMapper;
import com.qihang.dou.service.ErpShipWaybillService;
import com.qihang.dou.mapper.ErpShipWaybillMapper;
import lombok.AllArgsConstructor;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author TW
* @description 针对表erp_ship_waybill(发货电子面单记录表)的数据库操作Service实现
* @createDate 2024-06-19 15:53:49
*/
@AllArgsConstructor
@Service
public class ErpShipWaybillServiceImpl extends ServiceImpl<ErpShipWaybillMapper, ErpShipWaybill>
implements ErpShipWaybillService{
private final ErpShipWaybillMapper mapper;
private final OmsDouOrderMapper orderMapper;
private final KafkaTemplate<String,Object> kafkaTemplate;
/**
* 更新电子面单信息
* @param shipWaybill
* @return
*/
@Transactional
@Override
public ResultVo<Integer> 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<ErpShipWaybill> erpShipWaybills = mapper.selectList(new LambdaQueryWrapper<ErpShipWaybill>().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状态
OmsDouOrder orderUpdate = new OmsDouOrder();
orderUpdate.setErpSendStatus(shipWaybill.getStatus());
orderUpdate.setErpSendCode(shipWaybill.getWaybillCode());
orderUpdate.setErpSendCompany(shipWaybill.getLogisticsCode());
orderMapper.update(orderUpdate,new LambdaQueryWrapper<OmsDouOrder>().eq(OmsDouOrder::getOrderId,orderId));
return ResultVo.success();
}
@Override
public List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds) {
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
new LambdaQueryWrapper<ErpShipWaybill>()
.eq(ErpShipWaybill::getShopId,shopId)
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
return erpShipWaybills;
}
@Transactional
@Override
public ResultVo<Integer> printSuccess(Long shopId, String[] orderIds) {
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
new LambdaQueryWrapper<ErpShipWaybill>()
.eq(ErpShipWaybill::getShopId,shopId)
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
if(erpShipWaybills!=null){
for (var w : erpShipWaybills){
if(w.getStatus()==1) {
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状态
OmsDouOrder orderUpdate = new OmsDouOrder();
orderUpdate.setErpSendStatus(update.getStatus());
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsDouOrder>().eq(OmsDouOrder::getOrderId, w.getOrderId()));
//TODO: 打印成功之后 加入备货清单 采用kafka推送消息处理
// 打印完成通知备货
kafkaTemplate.send(MqType.SHIP_STOCK_UP_MQ, JSONObject.toJSONString(MqMessage.build(w.getShopId(), w.getOrderId())));
}
}
}
return ResultVo.success();
}
@Transactional
@Override
public ResultVo<Integer> pushShipSend(Long shopId, String[] orderIds) {
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
new LambdaQueryWrapper<ErpShipWaybill>()
.eq(ErpShipWaybill::getShopId,shopId)
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
if(erpShipWaybills!=null){
for (var w : erpShipWaybills){
if(w.getStatus() > 0 && w.getStatus()<3) {
ErpShipWaybill update = new ErpShipWaybill();
update.setId(erpShipWaybills.get(0).getId());
update.setStatus(3);// 已发货
update.setUpdateTime(new Date());
update.setUpdateBy("电子面单发货");
mapper.updateById(update);
// 更新关联订单erp_send_status状态
OmsDouOrder orderUpdate = new OmsDouOrder();
orderUpdate.setErpSendStatus(update.getStatus());
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsDouOrder>().eq(OmsDouOrder::getOrderId, w.getOrderId()));
// 更新erp_sale_order发货状态(controller层采用kafka推送消息处理)
// 发货完成通知发货出库
kafkaTemplate.send(MqType.SHIP_SEND_MQ, JSONObject.toJSONString(MqMessage.build(w.getShopId(),w.getOrderId(),w.getLogisticsCode(),w.getWaybillCode())));
}
}
}
return ResultVo.success();
}
}

View File

@ -65,10 +65,18 @@ public class OmsDouOrderServiceImpl extends ServiceImpl<OmsDouOrderMapper, OmsDo
LambdaQueryWrapper<OmsDouOrder> queryWrapper = new LambdaQueryWrapper<OmsDouOrder>()
.eq(bo.getShopId()!=null,OmsDouOrder::getShopId,bo.getShopId())
.eq(StringUtils.hasText(bo.getOrderId()),OmsDouOrder::getOrderId,bo.getOrderId())
.eq(StringUtils.hasText(bo.getOrderStatus()),OmsDouOrder::getOrderStatus,bo.getOrderStatus())
.eq(bo.getOrderStatus()!=null,OmsDouOrder::getOrderStatus,bo.getOrderStatus())
.ge(StringUtils.hasText(bo.getStartTime()),OmsDouOrder::getCreateTime, startTimeStamp)
.le(StringUtils.hasText(bo.getEndTime()),OmsDouOrder::getCreateTime,endTimeStamp)
;
if(bo.getErpSendStatus()!=null){
if(bo.getErpSendStatus()==-1) {
queryWrapper.lt(OmsDouOrder::getErpSendStatus,3);
}else {
queryWrapper.eq(OmsDouOrder::getErpSendStatus, bo.getErpSendStatus());
}
}
pageQuery.setOrderByColumn("create_time");
pageQuery.setIsAsc("desc");
Page<OmsDouOrder> taoGoodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
@ -82,7 +90,20 @@ public class OmsDouOrderServiceImpl extends ServiceImpl<OmsDouOrderMapper, OmsDo
@Override
public OmsDouOrder queryDetailById(Long id) {
return mapper.selectById(id);
var order = mapper.selectById(id);
if(order!=null){
order.setItems(itemMapper.selectList(new LambdaQueryWrapper<OmsDouOrderItem>().eq(OmsDouOrderItem::getParentOrderId,order.getOrderId())));
}
return order;
}
@Override
public OmsDouOrder queryDetailByOrderId(String orderId) {
var orders = mapper.selectList(new LambdaQueryWrapper<OmsDouOrder>().eq(OmsDouOrder::getOrderId,orderId));
if(orders!=null&&orders.size()>0){
orders.get(0).setItems(itemMapper.selectList(new LambdaQueryWrapper<OmsDouOrderItem>().eq(OmsDouOrderItem::getParentOrderId,orders.get(0).getOrderId())));
return orders.get(0);
}else return null;
}
@Transactional

View File

@ -0,0 +1,22 @@
package com.qihang.dou.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.dou.domain.OmsDouWaybillAccount;
import com.qihang.dou.service.OmsDouWaybillAccountService;
import com.qihang.dou.mapper.OmsDouWaybillAccountMapper;
import org.springframework.stereotype.Service;
/**
* @author TW
* @description 针对表oms_dou_waybill_account(抖店电子面单账户信息表)的数据库操作Service实现
* @createDate 2024-06-19 14:35:56
*/
@Service
public class OmsDouWaybillAccountServiceImpl extends ServiceImpl<OmsDouWaybillAccountMapper, OmsDouWaybillAccount>
implements OmsDouWaybillAccountService{
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qihang.dou.mapper.ErpShipWaybillMapper">
<resultMap id="BaseResultMap" type="com.qihang.dou.domain.ErpShipWaybill">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="shopType" column="shop_type" jdbcType="INTEGER"/>
<result property="waybillCode" column="waybill_code" jdbcType="VARCHAR"/>
<result property="logisticsCode" column="logistics_code" jdbcType="VARCHAR"/>
<result property="printData" column="print_data" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,order_id,shop_id,
shop_type,waybill_code,logistics_code,
print_data,status,create_time,
create_by,update_time,update_by
</sql>
</mapper>

View File

@ -86,6 +86,9 @@
<result property="lastPullTime" column="last_pull_time" jdbcType="TIMESTAMP"/>
<result property="auditStatus" column="audit_status" jdbcType="INTEGER"/>
<result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
<result property="erpSendCompany" column="erp_send_company" jdbcType="VARCHAR"/>
<result property="erpSendCode" column="erp_send_code" jdbcType="VARCHAR"/>
<result property="erpSendStatus" column="erp_send_status" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
@ -115,6 +118,6 @@
ship_time,shop_cost_amount,platform_cost_amount,
shop_id,shop_name,total_promotion_amount,
user_tag_ui,s_shop_id,pull_time,
last_pull_time,audit_status,audit_time
last_pull_time,audit_status,audit_time,erp_send_company,erp_send_code,erp_send_status
</sql>
</mapper>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qihang.dou.mapper.OmsDouWaybillAccountMapper">
<resultMap id="BaseResultMap" type="com.qihang.dou.domain.OmsDouWaybillAccount">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="sellerId" column="seller_id" jdbcType="BIGINT"/>
<result property="company" column="company" jdbcType="VARCHAR"/>
<result property="companyType" column="company_type" jdbcType="INTEGER"/>
<result property="amount" column="amount" jdbcType="INTEGER"/>
<result property="allocatedQuantity" column="allocated_quantity" jdbcType="INTEGER"/>
<result property="cancelledQuantity" column="cancelled_quantity" jdbcType="INTEGER"/>
<result property="recycledQuantity" column="recycled_quantity" jdbcType="INTEGER"/>
<result property="netsiteCode" column="netsite_code" jdbcType="VARCHAR"/>
<result property="netsiteName" column="netsite_name" jdbcType="VARCHAR"/>
<result property="provinceName" column="province_name" jdbcType="VARCHAR"/>
<result property="cityName" column="city_name" jdbcType="VARCHAR"/>
<result property="districtName" column="district_name" jdbcType="VARCHAR"/>
<result property="streetName" column="street_name" jdbcType="VARCHAR"/>
<result property="detailAddress" column="detail_address" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="isShow" column="is_show" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,shop_id,seller_id,
company,company_type,amount,
allocated_quantity,cancelled_quantity,recycled_quantity,
netsite_code,netsite_name,province_name,
city_name,district_name,street_name,
detail_address,name,mobile,
phone,is_show
</sql>
</mapper>

View File

@ -2,6 +2,9 @@ package com.qihang.jd.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.jd.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -1,5 +1,7 @@
package com.qihang.jd.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
@ -15,6 +17,7 @@ public class SysShopPullLasttime implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**

View File

@ -12,6 +12,7 @@ public class SysPlatform implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -12,6 +12,7 @@ public class SysShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.pdd.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.pdd.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -1,5 +1,7 @@
package com.qihang.pdd.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
@ -15,6 +17,7 @@ public class SysShopPullLasttime implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ 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;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**

View File

@ -2,6 +2,9 @@ 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;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -1,5 +1,7 @@
package com.qihang.tao.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
@ -15,6 +17,7 @@ public class SysShopPullLasttime implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.wei.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShop implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**

View File

@ -2,6 +2,9 @@ package com.qihang.wei.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -13,6 +16,7 @@ public class SShopPlatform implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -1,6 +1,9 @@
package com.qihang.wei.domain;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
@ -12,6 +15,7 @@ public class SShopSetting implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**

View File

@ -2,7 +2,7 @@ import request from '@/utils/request'
// 获取电子面单账户list
export function getWaybillAccountList(query) {
return request({
url: '/api/pdd-api/ewaybill/get_waybill_account_list',
url: '/api/dou-api/ewaybill/get_waybill_account_list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function getWaybillAccountList(query) {
// 更新电子面单账户
export function pullWaybillAccount(data) {
return request({
url: '/api/pdd-api/ewaybill/pull_waybill_account',
url: '/api/dou-api/ewaybill/pull_waybill_account',
method: 'post',
data: data
})
@ -21,7 +21,7 @@ export function pullWaybillAccount(data) {
// 取号
export function getWaybillCode(data) {
return request({
url: '/api/pdd-api/ewaybill/get_waybill_code',
url: '/api/dou-api/ewaybill/get_waybill_code',
method: 'post',
data: data
})
@ -30,7 +30,7 @@ export function getWaybillCode(data) {
// 获取打印的数据
export function getWaybillPrintData(data) {
return request({
url: '/api/pdd-api/ewaybill/get_print_data',
url: '/api/dou-api/ewaybill/get_print_data',
method: 'post',
data: data
})
@ -46,7 +46,7 @@ export function pushWaybillPrintSuccess(data) {
}
export function pushShipSend(data) {
return request({
url: '/api/pdd-api/ewaybill/push_ship_send',
url: '/api/dou-api/ewaybill/push_ship_send',
method: 'post',
data: data
})

View File

@ -4,7 +4,7 @@
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="订单号" prop="orderId">
<el-input
v-model="queryParams.orderSn"
v-model="queryParams.orderId"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
@ -50,7 +50,7 @@
size="mini"
:disabled="multiple"
@click="handleGetEwaybillCode"
>取号</el-button>
>电子面单取号</el-button>
</el-col>
<el-col :span="1.5">
@ -62,7 +62,7 @@
icon="el-icon-printer"
size="mini"
@click="handlePrintEwaybill"
>打印电子面单</el-button>
>电子面单打印</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -72,7 +72,7 @@
size="mini"
:disabled="multiple"
@click="handleShipSend"
>发货</el-button>
>电子面单发货</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -82,18 +82,18 @@
<!-- <el-table-column label="ID" align="center" prop="id" />-->
<el-table-column label="订单号" align="center" prop="orderId" >
<template slot-scope="scope">
<p>{{scope.row.orderSn}}</p>
<p>{{scope.row.orderId}}</p>
<el-tag effect="plain">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
</template>
</el-table-column>
<el-table-column label="商品" width="450">
<template slot-scope="scope">
<el-table :data="scope.row.itemList" :show-header="false">
<el-table-column label="商品" align="center" prop="outerId" />
<el-table-column label="规格" align="center" prop="goodsSpec" />
<el-table-column label="数量" align="center" prop="goodsCount" width="60">
<el-table :data="scope.row.items" :show-header="false">
<el-table-column label="商品" align="center" prop="productName" />
<el-table-column label="SKU编码" align="center" prop="code" />
<el-table-column label="数量" align="center" prop="itemNum" width="60">
<template slot-scope="scope">
<el-tag size="small">x {{scope.row.goodsCount}}</el-tag>
<el-tag size="small">x {{scope.row.itemNum}}</el-tag>
</template>
</el-table-column>
</el-table>
@ -112,34 +112,41 @@
<!-- </el-row>-->
</template>
</el-table-column>
<el-table-column label="下单时间" align="center" prop="orderCreateTime" width="180">
<el-table-column label="下单时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="buyerMemo" >
<template slot-scope="scope">
<span v-if="scope.row.buyerMemo">买家备注:{{ scope.row.buyerWords }}</span>
<span v-if="scope.row.remark">卖家备注:{{ scope.row.sellerWords }}</span>
</template>
</el-table-column>
<el-table-column label="买家留言" align="center" prop="buyerMemo" />
<el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="店铺" align="center" prop="categoryId" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag size="small">{{categoryList.find(x=>x.id === scope.row.categoryId).name}}</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="收件信息" align="left" prop="receiverState" >
<template slot-scope="scope">
<p>
{{scope.row.receiverNameMask}}&nbsp;{{scope.row.receiverPhoneMask}}
{{scope.row.maskPostReceiver}}&nbsp;{{scope.row.maskPostTel}}
</p>
<p>
{{scope.row.province}} &nbsp;{{scope.row.city}}&nbsp;{{scope.row.town}}&nbsp;
{{scope.row.provinceName}} &nbsp;{{scope.row.cityName}}&nbsp;{{scope.row.townName}} {{scope.row.streetName}}&nbsp;
</p>
<p>
{{scope.row.receiverAddressMask}}
{{scope.row.maskPostAddress}}
</p>
</template>
</el-table-column>
<el-table-column label="面单号" align="center" prop="erpSendCode" />
<el-table-column label="状态" align="center" prop="erpSendStatus" >
<template slot-scope="scope">
<el-tag size="small" v-if="scope.row.erpSendStatus==0">未取号</el-tag>
<el-tag size="small" v-if="scope.row.erpSendStatus==1">已取号</el-tag>
<el-tag size="small" v-if="scope.row.erpSendStatus==2">已打印</el-tag>
<el-tag size="small" v-if="scope.row.erpSendStatus==3">已发货</el-tag>
<el-tag size="small" v-if="scope.row.erpSendStatus==10">手动发货</el-tag>
</template>
</el-table-column>
</el-table>
<pagination
@ -157,10 +164,10 @@
<el-option
v-for="item in deliverList"
:key="item.id"
:label="item.cpCode"
:label="item.company"
:value="item.id">
<span style="float: left">{{ item.cpCode }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.branchName}}:{{item.quantity}}</span>
<span style="float: left">{{ item.company }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.netsiteName}}:{{item.amount}}</span>
</el-option>
</el-select>
<el-button type="success" plain @click="updateWaybillAccount" >更新电子面单账户信息</el-button>
@ -179,14 +186,14 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {listShop} from "@/api/shop/shop";
import {listOrder} from "@/api/pdd/order";
import {listOrder} from "@/api/dou/order";
import {
getWaybillAccountList,
pullWaybillAccount,
getWaybillCode,
getWaybillPrintData,
pushWaybillPrintSuccess
} from "@/api/pdd/ewaybill";
} from "@/api/dou/ewaybill";
export default {
name: "printDou",
@ -213,9 +220,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
orderStatus: 1,
refundStatus: 1,
erpSendStatus:0,
orderStatus: 2,
erpSendStatus:-1,
shopId: null
},
//
@ -236,7 +242,7 @@ export default {
},
created() {
this.openWs()
listShop({platform: 5}).then(response => {
listShop({platform: 6}).then(response => {
this.shopList = response.rows;
if (this.shopList && this.shopList.length > 0) {
this.queryParams.shopId = this.shopList[0].id
@ -279,7 +285,7 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.orderSn)
this.ids = selection.map(item => item.orderId)
this.single = selection.length !== 1
this.multiple = !selection.length
},