完善jd电子面单打印
This commit is contained in:
parent
b96d58dbe3
commit
a372ea6cf0
12
README.md
12
README.md
|
|
@ -19,20 +19,20 @@
|
|||
|
||||
<img src="preview.png" />
|
||||
|
||||
### 开放计划
|
||||
+ [ ] 打单--> 备货 --> 发货 --> 物流跟踪
|
||||
### 近期开发计划
|
||||
+ [x] 打单--> 备货 --> 发货 --> 物流跟踪
|
||||
+ [ ] 接入店铺退款
|
||||
+ [ ] 淘宝
|
||||
+ [ ] 京东
|
||||
+ [ ] 拼多多
|
||||
+ [ ] 抖店
|
||||
+ [ ] 视频号小店
|
||||
+ [ ] 接入电子面单打印
|
||||
+ [x] 接入电子面单打印
|
||||
+ [x] 淘宝
|
||||
+ [ ] 京东
|
||||
+ [x] 京东
|
||||
+ [x] 视频号小店
|
||||
+ [ ] 拼多多
|
||||
+ [ ] 抖店
|
||||
+ [x] 拼多多
|
||||
+ [x] 抖店
|
||||
|
||||
## 二、关键流程
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
Target Server Version : 80032
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 18/06/2024 16:00:44
|
||||
Date: 18/06/2024 19:59:12
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
|
@ -551,6 +551,7 @@ CREATE TABLE `erp_ship_order_fee` (
|
|||
DROP TABLE IF EXISTS `erp_ship_stock_up`;
|
||||
CREATE TABLE `erp_ship_stock_up` (
|
||||
`id` bigint(0) NOT NULL AUTO_INCREMENT,
|
||||
`shop_id` bigint(0) DEFAULT NULL COMMENT '店铺id',
|
||||
`sale_order_id` bigint(0) DEFAULT NULL COMMENT 'erp订单id',
|
||||
`sale_order_item_id` bigint(0) DEFAULT NULL COMMENT 'erp订单itemid',
|
||||
`order_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '订单编号',
|
||||
|
|
@ -1041,6 +1042,9 @@ CREATE TABLE `oms_jd_order` (
|
|||
`create_time` datetime(0) DEFAULT NULL,
|
||||
`audit_status` int(0) DEFAULT NULL COMMENT '订单审核状态(0待审核1已审核)',
|
||||
`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发货状态(1已取号2已打印3已发货10手动发货)',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '京东订单表' ROW_FORMAT = Dynamic;
|
||||
|
||||
|
|
@ -1077,6 +1081,39 @@ CREATE TABLE `oms_jd_order_item` (
|
|||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '京东订单明细表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oms_jd_waybill_account
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `oms_jd_waybill_account`;
|
||||
CREATE TABLE `oms_jd_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',
|
||||
`provider_id` int(0) DEFAULT NULL COMMENT '承运商id',
|
||||
`provider_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '承运商编码',
|
||||
`provider_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '承运商名称',
|
||||
`provider_type` int(0) DEFAULT NULL COMMENT '承运商类型,1-快递公司 2-物流公司 3-安装公司 4-生鲜冷链公司',
|
||||
`amount` int(0) DEFAULT NULL COMMENT '可用单数',
|
||||
`support_cod` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否支持货到付款',
|
||||
`branch_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '网点ID',
|
||||
`branch_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '网点名称',
|
||||
`settlement_code` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '财务结算编码',
|
||||
`province_id` int(0) DEFAULT NULL,
|
||||
`province_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省名称(一级地址)',
|
||||
`city_id` int(0) DEFAULT NULL,
|
||||
`city_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '市名称(二级地址)',
|
||||
`country_id` int(0) DEFAULT NULL COMMENT '区名称(三级地址)',
|
||||
`country_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`countryside_id` int(0) DEFAULT NULL,
|
||||
`countryside_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区名称(三级地址)',
|
||||
`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 = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '京东电子面单账户信息表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oms_pdd_goods
|
||||
-- ----------------------------
|
||||
|
|
|
|||
|
|
@ -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 ErpShipWaybill implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
|||
<artifactId>jd-api</artifactId>
|
||||
<version>1.5.4</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/jd-api-1.5.4.jar</systemPath>
|
||||
<systemPath>${project.basedir}/libs/jd-api-1.6.17.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,328 @@
|
|||
package com.qihang.jd.controller;
|
||||
|
||||
|
||||
import cn.qihangerp.open.jd.WaybillAccountApiHelper;
|
||||
import cn.qihangerp.open.jd.WaybillApiHelper;
|
||||
import cn.qihangerp.open.jd.common.ApiResultVo;
|
||||
import cn.qihangerp.open.jd.jdl.CloudPrintApiHelper;
|
||||
import cn.qihangerp.open.jd.jdl.CloudPrintData;
|
||||
import cn.qihangerp.open.jd.jdl.PullCloudPrintRequestDto;
|
||||
import cn.qihangerp.open.jd.jdl.WayBillInfo;
|
||||
import cn.qihangerp.open.jd.model.WaybillAccount;
|
||||
import cn.qihangerp.open.jd.model.WaybillCodeResponse;
|
||||
import cn.qihangerp.open.jd.request.WaybillAddress;
|
||||
import cn.qihangerp.open.jd.request.WaybillReceiveRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.enums.HttpStatus;
|
||||
import com.qihang.jd.domain.ErpShipWaybill;
|
||||
import com.qihang.jd.domain.OmsJdOrder;
|
||||
import com.qihang.jd.domain.OmsJdWaybillAccount;
|
||||
import com.qihang.jd.domain.bo.JdWaybillGetBo;
|
||||
import com.qihang.jd.openApi.ApiCommon;
|
||||
import com.qihang.jd.openApi.PullRequest;
|
||||
import com.qihang.jd.service.ErpShipWaybillService;
|
||||
import com.qihang.jd.service.OmsJdOrderService;
|
||||
import com.qihang.jd.service.OmsJdWaybillAccountService;
|
||||
import com.qihang.security.common.BaseController;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Log
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ewaybill")
|
||||
public class WaybillController extends BaseController {
|
||||
private final ApiCommon apiCommon;
|
||||
private final OmsJdWaybillAccountService waybillAccountService;
|
||||
private final OmsJdOrderService orderService;
|
||||
private final ErpShipWaybillService erpShipWaybillService;
|
||||
private final KafkaTemplate<String,Object> kafkaTemplate;
|
||||
|
||||
@RequestMapping(value = "/get_waybill_account_list", method = RequestMethod.POST)
|
||||
public AjaxResult getWaybillAccountList(@RequestBody PullRequest params) throws Exception {
|
||||
if (params.getShopId() == null || params.getShopId() <= 0) {
|
||||
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||
}
|
||||
List<OmsJdWaybillAccount> list = waybillAccountService.list(new LambdaQueryWrapper<OmsJdWaybillAccount>().eq(OmsJdWaybillAccount::getShopId, params.getShopId()).eq(OmsJdWaybillAccount::getIsShow, 1));
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取电子面单账号
|
||||
* @param params
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/pull_waybill_account", method = RequestMethod.POST)
|
||||
public AjaxResult pullWaybillAccount(@RequestBody PullRequest 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<WaybillAccount> apiResultVo = WaybillAccountApiHelper.getWaybillAccount(appKey, appSecret, accessToken, sellId.toString());
|
||||
|
||||
List<OmsJdWaybillAccount> list = new ArrayList<>();
|
||||
if(apiResultVo.getCode()==0){
|
||||
for (var item : apiResultVo.getList()) {
|
||||
|
||||
OmsJdWaybillAccount vo = new OmsJdWaybillAccount();
|
||||
vo.setShopId(params.getShopId());
|
||||
vo.setSellerId(sellId);
|
||||
vo.setIsShow(1);
|
||||
|
||||
vo.setProviderId(item.getProviderId());
|
||||
vo.setProviderType(item.getProviderType());
|
||||
vo.setProviderName(item.getProviderName());
|
||||
vo.setProviderCode(item.getProviderCode());
|
||||
vo.setBranchCode(item.getBranchCode());
|
||||
vo.setBranchName(item.getBranchName());
|
||||
vo.setAmount(item.getAmount());
|
||||
// vo.setSupportCod();
|
||||
vo.setSettlementCode(item.getSettlementCode());
|
||||
if (item.getAddress()!=null) {
|
||||
vo.setProvinceId(item.getAddress().getProvinceId());
|
||||
vo.setProvinceName(item.getAddress().getProvinceName());
|
||||
vo.setCityId(item.getAddress().getCityId());
|
||||
vo.setCityName(item.getAddress().getCityName());
|
||||
vo.setCountryId(item.getAddress().getCountryId());
|
||||
vo.setCountryName(item.getAddress().getCountryName());
|
||||
vo.setCountrysideId(item.getAddress().getCountrysideId());
|
||||
vo.setCountrysideName(item.getAddress().getCountrysideName());
|
||||
vo.setAddress(item.getAddress().getAddress());
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
waybillAccountService.save(vo);
|
||||
log.info("========添加jd电子面单账户信息==========");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/get_waybill_code")
|
||||
@ResponseBody
|
||||
public AjaxResult getWaybillCode(@RequestBody JdWaybillGetBo 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();
|
||||
|
||||
// 获取电子面单账户信息(包含了发货地址信息)
|
||||
OmsJdWaybillAccount account = waybillAccountService.getById(req.getAccountId());
|
||||
|
||||
for(String orderId:req.getIds()){
|
||||
if(StringUtils.hasText(orderId)){
|
||||
List<OmsJdOrder> list = orderService.list(new LambdaQueryWrapper<OmsJdOrder>().eq(OmsJdOrder::getOrderId, orderId));
|
||||
|
||||
if(list!=null && list.size()>0) {
|
||||
OmsJdOrder omsTaoOrder = list.get(0);
|
||||
WaybillReceiveRequest request = new WaybillReceiveRequest();
|
||||
request.setWaybillType(1);
|
||||
request.setWaybillCount(1);
|
||||
request.setProviderCode(account.getProviderCode());
|
||||
request.setProviderId(account.getProviderId());
|
||||
request.setSettlementCode(account.getSettlementCode());
|
||||
request.setSalePlatform("0010001");
|
||||
request.setPlatformOrderNo(omsTaoOrder.getOrderId());
|
||||
request.setVendorCode(sellerShopId.toString());
|
||||
request.setVendorName("xxxxxx");
|
||||
request.setVendorOrderCode(omsTaoOrder.getOrderId());
|
||||
request.setWeight(BigDecimal.ZERO);
|
||||
request.setVolume(BigDecimal.ZERO);
|
||||
request.setPayType(0);
|
||||
request.setGoodsMoney(BigDecimal.ZERO);
|
||||
request.setShouldPayMoney(BigDecimal.ZERO);
|
||||
request.setNeedGuarantee(false);
|
||||
request.setGuaranteeMoney(BigDecimal.ZERO);
|
||||
request.setReceiveTimeType(0);
|
||||
|
||||
WaybillAddress fromAddress = new WaybillAddress();
|
||||
fromAddress.setProvinceId(account.getProvinceId());
|
||||
fromAddress.setProvinceName(account.getProvinceName());
|
||||
fromAddress.setCityId(account.getCityId());
|
||||
fromAddress.setCityName(account.getCityName());
|
||||
fromAddress.setCountryId(account.getCountryId());
|
||||
fromAddress.setCountryName(account.getCountryName());
|
||||
fromAddress.setCountrysideId(account.getCountrysideId());
|
||||
fromAddress.setCountrysideName(account.getCountrysideName());
|
||||
fromAddress.setAddress(account.getAddress());
|
||||
fromAddress.setContact(account.getName());
|
||||
fromAddress.setMobile(account.getMobile());
|
||||
fromAddress.setPhone(account.getPhone());
|
||||
request.setFromAddress(fromAddress);
|
||||
|
||||
WaybillAddress toAddress = new WaybillAddress();
|
||||
toAddress.setProvinceId(StringUtils.hasText(omsTaoOrder.getProvinceId())?Integer.parseInt(omsTaoOrder.getProvinceId()):0);
|
||||
toAddress.setProvinceName(omsTaoOrder.getProvince());
|
||||
toAddress.setCityId(StringUtils.hasText(omsTaoOrder.getCityId())?Integer.parseInt(omsTaoOrder.getCityId()):0);
|
||||
toAddress.setCityName(omsTaoOrder.getCity());
|
||||
toAddress.setCountryId(StringUtils.hasText(omsTaoOrder.getCountyId())?Integer.parseInt(omsTaoOrder.getCounty()):0);
|
||||
toAddress.setCountryName(omsTaoOrder.getCounty());
|
||||
toAddress.setCountrysideId(StringUtils.hasText(omsTaoOrder.getTownId())?Integer.parseInt(omsTaoOrder.getTownId()):0);
|
||||
toAddress.setCountrysideName(omsTaoOrder.getTown());
|
||||
toAddress.setAddress(omsTaoOrder.getFullAddress());
|
||||
toAddress.setContact(omsTaoOrder.getFullname());
|
||||
toAddress.setMobile(omsTaoOrder.getMobile());
|
||||
toAddress.setPhone(omsTaoOrder.getTelephone());
|
||||
request.setToAddress(toAddress);
|
||||
|
||||
ApiResultVo<WaybillCodeResponse> apiResultVo = WaybillApiHelper.getWaybillCode(appKey, appSecret, accessToken, request);
|
||||
if(apiResultVo.getCode()==0){
|
||||
// 保持数据
|
||||
|
||||
ErpShipWaybill waybill = new ErpShipWaybill();
|
||||
waybill.setShopId(req.getShopId());
|
||||
waybill.setOrderId(apiResultVo.getData().getPlatformOrderNo());
|
||||
if(apiResultVo.getData().getWaybillCodeList()!=null&&apiResultVo.getData().getWaybillCodeList().size()>0) {
|
||||
waybill.setWaybillCode(apiResultVo.getData().getWaybillCodeList().get(0));
|
||||
}
|
||||
waybill.setLogisticsCode(account.getProviderCode());
|
||||
// waybill.setPrintData(result.getPrintData());
|
||||
waybill.setStatus(1);//1已取号
|
||||
erpShipWaybillService.waybillUpdate(waybill);
|
||||
log.info("====保存電子面單信息jd========"+apiResultVo.getData().getPlatformOrderNo());
|
||||
|
||||
}else{
|
||||
return AjaxResult.error(apiResultVo.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
@PostMapping("/get_print_data")
|
||||
@ResponseBody
|
||||
public AjaxResult getPrintData(@RequestBody JdWaybillGetBo 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() != 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();
|
||||
|
||||
List<ErpShipWaybill> list = erpShipWaybillService.getListByOrderIds(req.getShopId(), req.getIds());
|
||||
List<PullCloudPrintRequestDto> dtos = new ArrayList<>();
|
||||
if(list!=null && list.size()>0) {
|
||||
for (var ship:list) {
|
||||
if(!StringUtils.hasText(ship.getPrintData())) {
|
||||
PullCloudPrintRequestDto dto = new PullCloudPrintRequestDto();
|
||||
dto.setCpCode(ship.getLogisticsCode());
|
||||
dto.setObjectId(ship.getOrderId());
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("eCustomerCode", sellerShopId.toString());
|
||||
dto.setParameters(map);
|
||||
List<WayBillInfo> wayBillInfos = new ArrayList<>();
|
||||
WayBillInfo w = new WayBillInfo();
|
||||
w.setPopFlag(1);
|
||||
w.setOrderNo(ship.getOrderId());
|
||||
w.setWayBillCode(ship.getWaybillCode());
|
||||
wayBillInfos.add(w);
|
||||
dto.setWayBillInfos(wayBillInfos);
|
||||
dtos.add(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiResultVo<CloudPrintData> apiResultVo = CloudPrintApiHelper.pullCloudPrintData(appKey, appSecret, accessToken, dtos);
|
||||
if(apiResultVo.getCode()==0){
|
||||
// 更新数据
|
||||
for (var item:apiResultVo.getList()) {
|
||||
ErpShipWaybill waybillNew = new ErpShipWaybill();
|
||||
waybillNew.setPrintData(item.getPerPrintData());
|
||||
waybillNew.setUpdateBy("获取打印数据");
|
||||
waybillNew.setUpdateTime(new Date());
|
||||
erpShipWaybillService.update(waybillNew,new LambdaQueryWrapper<ErpShipWaybill>().eq(ErpShipWaybill::getWaybillCode,item.getWayBillNo()));
|
||||
log.info("====保存電子面單打印信息jd========"+item.getWayBillNo());
|
||||
ErpShipWaybill list1 = list.stream().filter(x -> x.getWaybillCode().equals(item.getWayBillNo())).findFirst().get();
|
||||
if(list1!=null){
|
||||
list1.setPrintData(item.getPerPrintData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
return AjaxResult.error(apiResultVo.getMsg());
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/push_print_success")
|
||||
@ResponseBody
|
||||
public AjaxResult pushPrintSuccess(@RequestBody JdWaybillGetBo 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发货
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/push_ship_send")
|
||||
@ResponseBody
|
||||
public AjaxResult pushShipSend(@RequestBody JdWaybillGetBo 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.pushShipSend(req.getShopId(), req.getIds());
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 发货电子面单记录表
|
||||
* @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;
|
||||
}
|
||||
|
|
@ -262,6 +262,20 @@ public class OmsJdOrder implements Serializable {
|
|||
* 订单审核时间
|
||||
*/
|
||||
private Date auditTime;
|
||||
/**
|
||||
* erp发货快递公司
|
||||
*/
|
||||
private String erpSendCompany;
|
||||
|
||||
/**
|
||||
* erp发货快递单号
|
||||
*/
|
||||
private String erpSendCode;
|
||||
|
||||
/**
|
||||
* erp发货状态
|
||||
*/
|
||||
private Integer erpSendStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<OmsJdOrderItem> itemList;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
package com.qihang.jd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 京东电子面单账户信息表
|
||||
* @TableName oms_jd_waybill_account
|
||||
*/
|
||||
@Data
|
||||
public class OmsJdWaybillAccount implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
private Long sellerId;
|
||||
|
||||
/**
|
||||
* 承运商id
|
||||
*/
|
||||
private Integer providerId;
|
||||
|
||||
/**
|
||||
* 承运商编码
|
||||
*/
|
||||
private String providerCode;
|
||||
|
||||
/**
|
||||
* 承运商名称
|
||||
*/
|
||||
private String providerName;
|
||||
|
||||
/**
|
||||
* 承运商类型,1-快递公司 2-物流公司 3-安装公司 4-生鲜冷链公司
|
||||
*/
|
||||
private Integer providerType;
|
||||
|
||||
/**
|
||||
* 可用单数
|
||||
*/
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 是否支持货到付款
|
||||
*/
|
||||
private String supportCod;
|
||||
|
||||
/**
|
||||
* 网点ID
|
||||
*/
|
||||
private String branchCode;
|
||||
|
||||
/**
|
||||
* 网点名称
|
||||
*/
|
||||
private String branchName;
|
||||
|
||||
/**
|
||||
* 财务结算编码
|
||||
*/
|
||||
private String settlementCode;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer provinceId;
|
||||
|
||||
/**
|
||||
* 省名称(一级地址)
|
||||
*/
|
||||
private String provinceName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer cityId;
|
||||
|
||||
/**
|
||||
* 市名称(二级地址)
|
||||
*/
|
||||
private String cityName;
|
||||
|
||||
/**
|
||||
* 区名称(三级地址)
|
||||
*/
|
||||
private Integer countryId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String countryName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer countrysideId;
|
||||
|
||||
/**
|
||||
* 区名称(三级地址)
|
||||
*/
|
||||
private String countrysideName;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 发货人
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 发货手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 发货固定电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 是否前台显示1显示0不显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -9,4 +9,5 @@ public class JdOrderBo implements Serializable {
|
|||
private String orderId;
|
||||
private Integer shopId;
|
||||
private String orderState;
|
||||
private Integer erpSendStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.qihang.jd.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JdWaybillGetBo {
|
||||
private Long accountId;//电子面单账户id
|
||||
private String[] ids;
|
||||
private Long shopId;//店铺Id
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.jd.mapper;
|
||||
|
||||
import com.qihang.jd.domain.ErpShipWaybill;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-18 18:48:08
|
||||
* @Entity com.qihang.jd.domain.ErpShipWaybill
|
||||
*/
|
||||
public interface ErpShipWaybillMapper extends BaseMapper<ErpShipWaybill> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.jd.mapper;
|
||||
|
||||
import com.qihang.jd.domain.OmsJdWaybillAccount;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_jd_waybill_account(京东电子面单账户信息表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-18 18:25:19
|
||||
* @Entity com.qihang.jd.domain.OmsJdWaybillAccount
|
||||
*/
|
||||
public interface OmsJdWaybillAccountMapper extends BaseMapper<OmsJdWaybillAccount> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -49,9 +49,9 @@ public class ApiCommon {
|
|||
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
||||
// }
|
||||
|
||||
// if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
||||
// return com.qihang.tao.common.ApiResult.build(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());
|
||||
|
|
@ -64,32 +64,6 @@ public class ApiCommon {
|
|||
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED1, "Token已过期,请重新授权", params);
|
||||
}
|
||||
|
||||
/****************先查询卖家对不对***************/
|
||||
// TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
// UserSellerGetRequest reqSeller = new UserSellerGetRequest();
|
||||
// reqSeller.setFields("nick,user_id");
|
||||
// UserSellerGetResponse rsp = client.execute(reqSeller, sessionKey);
|
||||
// if(StringUtils.hasText(rsp.getErrorCode())){
|
||||
// if(rsp.getErrorCode().equals("27")){
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token已过期,请重新授权",params);
|
||||
// }
|
||||
// else if(rsp.getErrorCode().equals("11")){
|
||||
// if(rsp.getSubCode().equals("isv.permission-api-package-limit"))
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请检查淘宝用户API:taobao.user.seller.get是否具有访问权限",params);
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), rsp.getSubCode(),params);
|
||||
// }
|
||||
// else if(rsp.getErrorCode().equals("25")){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "无效签名!请检查SessionKey、appKey、appSecret是否匹配",params);
|
||||
// } else
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误!"+(StringUtils.hasText(rsp.getSubMsg()) ? rsp.getSubMsg(): rsp.getMsg()));
|
||||
// }
|
||||
// if(rsp.getUser() == null || rsp.getUser().getUserId() == null){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误!请设置店铺SellerUserId值!",params);
|
||||
// }
|
||||
// else if (shop.getSellerUserId().longValue() != rsp.getUser().getUserId().longValue()) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "当前用户是:" + rsp.getUser().getNick() + ",请重新授权",params);
|
||||
// }
|
||||
return ResultVo.success(HttpStatus.SUCCESS, params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.qihang.jd.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qihang.common.common.ResultVo;
|
||||
import com.qihang.jd.domain.ErpShipWaybill;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qilip
|
||||
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service
|
||||
* @createDate 2024-06-16 17:18:22
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.qihang.jd.service;
|
||||
|
||||
import com.qihang.jd.domain.OmsJdWaybillAccount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_jd_waybill_account(京东电子面单账户信息表)】的数据库操作Service
|
||||
* @createDate 2024-06-18 18:25:19
|
||||
*/
|
||||
public interface OmsJdWaybillAccountService extends IService<OmsJdWaybillAccount> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.qihang.jd.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.jd.domain.ErpShipWaybill;
|
||||
import com.qihang.jd.domain.OmsJdOrder;
|
||||
import com.qihang.jd.mapper.ErpShipWaybillMapper;
|
||||
import com.qihang.jd.mapper.OmsJdOrderMapper;
|
||||
import com.qihang.jd.service.ErpShipWaybillService;
|
||||
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 qilip
|
||||
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-16 17:18:22
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class ErpShipWaybillServiceImpl extends ServiceImpl<ErpShipWaybillMapper, ErpShipWaybill>
|
||||
implements ErpShipWaybillService{
|
||||
private final ErpShipWaybillMapper mapper;
|
||||
private final OmsJdOrderMapper 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状态
|
||||
OmsJdOrder orderUpdate = new OmsJdOrder();
|
||||
orderUpdate.setErpSendStatus(shipWaybill.getStatus());
|
||||
orderUpdate.setErpSendCode(shipWaybill.getWaybillCode());
|
||||
orderUpdate.setErpSendCompany(shipWaybill.getLogisticsCode());
|
||||
orderMapper.update(orderUpdate,new LambdaQueryWrapper<OmsJdOrder>().eq(OmsJdOrder::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状态
|
||||
OmsJdOrder orderUpdate = new OmsJdOrder();
|
||||
orderUpdate.setErpSendStatus(update.getStatus());
|
||||
|
||||
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsJdOrder>().eq(OmsJdOrder::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状态
|
||||
OmsJdOrder orderUpdate = new OmsJdOrder();
|
||||
orderUpdate.setErpSendStatus(update.getStatus());
|
||||
|
||||
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsJdOrder>().eq(OmsJdOrder::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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -43,6 +43,13 @@ public class OmsJdOrderServiceImpl extends ServiceImpl<OmsJdOrderMapper, OmsJdOr
|
|||
.eq(StringUtils.hasText(bo.getOrderId()),OmsJdOrder::getOrderId,bo.getOrderId())
|
||||
.eq(StringUtils.hasText(bo.getOrderState()),OmsJdOrder::getOrderState,bo.getOrderState())
|
||||
;
|
||||
if(bo.getErpSendStatus()!=null){
|
||||
if(bo.getErpSendStatus()==-1) {
|
||||
queryWrapper.lt(OmsJdOrder::getErpSendStatus,3);
|
||||
}else {
|
||||
queryWrapper.eq(OmsJdOrder::getErpSendStatus, bo.getErpSendStatus());
|
||||
}
|
||||
}
|
||||
|
||||
Page<OmsJdOrder> page = mapper.selectPage(pageQuery.build(), queryWrapper);
|
||||
if(page.getRecords()!=null){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.qihang.jd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.jd.domain.OmsJdWaybillAccount;
|
||||
import com.qihang.jd.service.OmsJdWaybillAccountService;
|
||||
import com.qihang.jd.mapper.OmsJdWaybillAccountMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_jd_waybill_account(京东电子面单账户信息表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-18 18:25:19
|
||||
*/
|
||||
@Service
|
||||
public class OmsJdWaybillAccountServiceImpl extends ServiceImpl<OmsJdWaybillAccountMapper, OmsJdWaybillAccount>
|
||||
implements OmsJdWaybillAccountService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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.jd.mapper.ErpShipWaybillMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.jd.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>
|
||||
|
|
@ -55,6 +55,9 @@
|
|||
<result property="createTime" column="create_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">
|
||||
|
|
@ -66,7 +69,8 @@
|
|||
invoice_code,order_remark,order_start_time,
|
||||
order_end_time,fullname,telephone,
|
||||
mobile,full_address,province,
|
||||
city,county,town,
|
||||
city,county,town,erp_send_company,
|
||||
erp_send_code,erp_send_status,create_time,
|
||||
province_id,city_id,county_id,
|
||||
town_id,vender_remark,balance_used,
|
||||
pin,return_order,payment_confirm_time,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
<?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.jd.mapper.OmsJdWaybillAccountMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.jd.domain.OmsJdWaybillAccount">
|
||||
<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="providerId" column="provider_id" jdbcType="INTEGER"/>
|
||||
<result property="providerCode" column="provider_code" jdbcType="VARCHAR"/>
|
||||
<result property="providerName" column="provider_name" jdbcType="VARCHAR"/>
|
||||
<result property="providerType" column="provider_type" jdbcType="INTEGER"/>
|
||||
<result property="amount" column="amount" jdbcType="INTEGER"/>
|
||||
<result property="supportCod" column="support_cod" jdbcType="VARCHAR"/>
|
||||
<result property="branchCode" column="branch_code" jdbcType="VARCHAR"/>
|
||||
<result property="branchName" column="branch_name" jdbcType="VARCHAR"/>
|
||||
<result property="settlementCode" column="settlement_code" jdbcType="VARCHAR"/>
|
||||
<result property="provinceId" column="province_id" jdbcType="INTEGER"/>
|
||||
<result property="provinceName" column="province_name" jdbcType="VARCHAR"/>
|
||||
<result property="cityId" column="city_id" jdbcType="INTEGER"/>
|
||||
<result property="cityName" column="city_name" jdbcType="VARCHAR"/>
|
||||
<result property="countryId" column="country_id" jdbcType="INTEGER"/>
|
||||
<result property="countryName" column="country_name" jdbcType="VARCHAR"/>
|
||||
<result property="countrysideId" column="countryside_id" jdbcType="INTEGER"/>
|
||||
<result property="countrysideName" column="countryside_name" jdbcType="VARCHAR"/>
|
||||
<result property="address" column="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,
|
||||
provider_id,provider_code,provider_name,
|
||||
provider_type,amount,support_cod,
|
||||
branch_code,branch_name,settlement_code,
|
||||
province_id,province_name,city_id,
|
||||
city_name,country_id,country_name,
|
||||
countryside_id,countryside_name,address,
|
||||
name,mobile,phone,
|
||||
is_show
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -165,8 +165,14 @@ public class OmsTaoOrderServiceImpl extends ServiceImpl<OmsTaoOrderMapper, OmsTa
|
|||
.eq(bo.getShopId()!=null,OmsTaoOrder::getShopId,bo.getShopId())
|
||||
.eq(StringUtils.hasText(bo.getTid()),OmsTaoOrder::getTid,bo.getTid())
|
||||
.eq(StringUtils.hasText(bo.getStatus()),OmsTaoOrder::getStatus,bo.getStatus())
|
||||
.eq(bo.getErpSendStatus()!=null,OmsTaoOrder::getErpSendStatus,bo.getErpSendStatus())
|
||||
;
|
||||
if(bo.getErpSendStatus()!=null){
|
||||
if(bo.getErpSendStatus()==-1) {
|
||||
queryWrapper.lt(OmsTaoOrder::getErpSendStatus,3);
|
||||
}else {
|
||||
queryWrapper.eq(OmsTaoOrder::getErpSendStatus, bo.getErpSendStatus());
|
||||
}
|
||||
}
|
||||
|
||||
Page<OmsTaoOrder> taoGoodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
|
||||
if(taoGoodsPage.getRecords()!=null){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
import request from '@/utils/request'
|
||||
// 获取电子面单账户list
|
||||
export function getWaybillAccountList(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/get_waybill_account_list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 更新电子面单账户
|
||||
export function pullWaybillAccount(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/pull_waybill_account',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 取号
|
||||
export function getWaybillCode(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/get_waybill_code',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取打印的数据
|
||||
export function getWaybillPrintData(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/get_print_data',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 打印成功
|
||||
export function pushWaybillPrintSuccess(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/push_print_success',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function pushShipSend(data) {
|
||||
return request({
|
||||
url: '/api/jd-api/ewaybill/push_ship_send',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -79,68 +79,52 @@
|
|||
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||
<el-table-column label="订单号" align="left" prop="tid" width="180">
|
||||
<el-table-column label="订单号" align="left" prop="orderId" >
|
||||
<template slot-scope="scope">
|
||||
<p>{{scope.row.tid}}</p>
|
||||
<el-tag effect="plain">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
|
||||
<p>{{scope.row.orderId}}</p>
|
||||
<el-tag size="small">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品" width="550">
|
||||
<el-table-column label="商品" width="350">
|
||||
<template slot-scope="scope">
|
||||
<el-table :data="scope.row.items" :show-header="false">
|
||||
<el-table-column label="商品" align="center" prop="title" />
|
||||
<el-table-column label="规格" align="center" prop="skuPropertiesName" />
|
||||
<el-table-column label="数量" align="center" prop="num" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small">x {{scope.row.num}}</el-tag>
|
||||
<el-row v-for="item in scope.row.itemList" :key="item.id" :gutter="20">
|
||||
|
||||
<div style="float: left;display: flex;align-items: center;" >
|
||||
<!-- <el-image style="width: 70px; height: 70px;" :src="item.picPath"></el-image>-->
|
||||
<div style="margin-left:10px">
|
||||
<p>{{item.skuName}}</p>
|
||||
<p>{{item.outerSkuId}}
|
||||
<el-tag size="small">x {{item.itemTotal}}</el-tag>
|
||||
</p>
|
||||
<p v-if="scope.row.refundStatus === 0">
|
||||
<el-button type="text" size="mini" round @click="handleRefund(scope.row,item)">售后</el-button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <el-row v-for="item in scope.row.items" :key="item.id" :gutter="20">-->
|
||||
|
||||
<!-- <div style="float: left;display: flex;align-items: center;" >-->
|
||||
|
||||
<!-- <div style="margin-left:10px">-->
|
||||
<!-- <p>{{item.title}}</p>-->
|
||||
<!-- <p>{{item.skuPropertiesName}} -->
|
||||
<!-- <el-tag size="small">x {{item.num}}</el-tag>-->
|
||||
<!-- </p>-->
|
||||
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-row>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下单时间" align="center" prop="orderCreateTime" width="180">
|
||||
<el-table-column label="下单时间" align="center" prop="orderStartTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.created) }}</span>
|
||||
<span>{{ parseTime(scope.row.orderStartTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="buyerMessage" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.buyerMessage">买家留言:{{ scope.row.buyerMessage }}</span>
|
||||
<span v-if="scope.row.sellerMemo">卖家备注:{{ scope.row.sellerMemo }}</span>
|
||||
<span v-if="scope.row.orderRemark">买家备注:{{ scope.row.orderRemark }}</span>
|
||||
<span v-if="scope.row.venderRemark">商家备注:{{ scope.row.venderRemark }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="买家留言" align="center" prop="buyerMessage" />-->
|
||||
<!-- <el-table-column label="卖家备注" align="center" prop="sellerMemo" />-->
|
||||
|
||||
<!-- <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">
|
||||
<div>
|
||||
{{scope.row.receiverName}} {{scope.row.receiverMobile}}
|
||||
{{scope.row.fullname}} {{scope.row.mobile}}
|
||||
</div>
|
||||
<div>
|
||||
{{scope.row.receiverState}} {{scope.row.receiverCity}} {{scope.row.receiverDistrict}} {{scope.row.receiverTown}}
|
||||
{{scope.row.province}} {{scope.row.city}} {{scope.row.county}} {{scope.row.town}}
|
||||
</div>
|
||||
<div>
|
||||
{{scope.row.receiverAddress}}
|
||||
{{scope.row.fullAddress}}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -171,10 +155,10 @@
|
|||
<el-option
|
||||
v-for="item in deliverList"
|
||||
:key="item.id"
|
||||
:label="item.cpCode"
|
||||
:label="item.providerName"
|
||||
: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.providerName }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.branchName}}:{{item.amount}}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="success" plain @click="updateWaybillAccount" >更新电子面单账户信息</el-button>
|
||||
|
|
@ -193,14 +177,14 @@
|
|||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
import {listShop} from "@/api/shop/shop";
|
||||
import {listOrder} from "@/api/tao/order";
|
||||
import {listOrder} from "@/api/jd/order";
|
||||
import {
|
||||
getWaybillAccountList,
|
||||
pullWaybillAccount,
|
||||
getWaybillCode,
|
||||
getWaybillPrintData,
|
||||
pushWaybillPrintSuccess, pushShipSend
|
||||
} from "@/api/tao/ewaybill";
|
||||
} from "@/api/jd/ewaybill";
|
||||
|
||||
export default {
|
||||
name: "printJd",
|
||||
|
|
@ -227,8 +211,8 @@ export default {
|
|||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: 'WAIT_SELLER_SEND_GOODS',
|
||||
erpSendStatus:null,
|
||||
orderState: 'WAIT_SELLER_STOCK_OUT',
|
||||
erpSendStatus:-1,
|
||||
shopId: null
|
||||
},
|
||||
// 打印参数
|
||||
|
|
@ -249,7 +233,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.openWs()
|
||||
listShop({platform: 4}).then(response => {
|
||||
listShop({platform: 3}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
@ -292,12 +276,12 @@ export default {
|
|||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.tid)
|
||||
this.ids = selection.map(item => item.orderId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
openWs() {
|
||||
const ws = new WebSocket('ws://127.0.0.1:13528');
|
||||
const ws = new WebSocket('ws://127.0.0.1:9113');
|
||||
ws.onopen = () => {
|
||||
console.log('与打印组件建立连接成功: ');
|
||||
// 或打印机
|
||||
|
|
@ -318,7 +302,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.');
|
||||
};
|
||||
|
|
@ -375,14 +359,13 @@ export default {
|
|||
// }
|
||||
if (!this.printParams.printer) {
|
||||
this.$modal.msgError('请选择打印机!');
|
||||
return pushWaybillPrintSuccess({shopId: this.queryParams.shopId, ids: this.ids})
|
||||
return
|
||||
}
|
||||
const ids = this.ids;
|
||||
getWaybillPrintData({shopId: this.queryParams.shopId, ids: ids}).then(response => {
|
||||
console.log("======打印======", response.data)
|
||||
if (response.data) {
|
||||
const ws = new WebSocket('ws://127.0.0.1:13528');
|
||||
const ws = new WebSocket('ws://127.0.0.1:9113');
|
||||
ws.onopen = () => {
|
||||
let printData = []
|
||||
response.data.forEach(x => printData.push(JSON.parse(x.printData)))
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: 'WAIT_SELLER_SEND_GOODS',
|
||||
erpSendStatus:null,
|
||||
erpSendStatus:-1,//-1代表未发货的
|
||||
shopId: null
|
||||
},
|
||||
// 打印参数
|
||||
|
|
|
|||
Loading…
Reference in New Issue