完善视频号小店电子面单打印

This commit is contained in:
老齐 2024-06-19 17:33:53 +08:00
parent de1b4c3e56
commit 1dafa7e3c1
18 changed files with 730 additions and 359 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 80032
File Encoding : 65001
Date: 19/06/2024 16:16:35
Date: 19/06/2024 17:33:05
*/
SET NAMES utf8mb4;
@ -1755,6 +1755,9 @@ CREATE TABLE `oms_wei_order` (
`settle_info` varchar(2550) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算信息json',
`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发货状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
@ -1828,6 +1831,36 @@ CREATE TABLE `oms_wei_refund` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '视频号小店退款' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for oms_wei_waybill_account
-- ----------------------------
DROP TABLE IF EXISTS `oms_wei_waybill_account`;
CREATE TABLE `oms_wei_waybill_account` (
`id` bigint(0) NOT NULL AUTO_INCREMENT,
`shop_id` bigint(0) NOT NULL COMMENT '店铺id',
`seller_shop_id` bigint(0) DEFAULT NULL COMMENT '平台店铺id全局唯一一个店铺分配一个shop_id',
`delivery_id` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '快递公司编码',
`company_type` int(0) DEFAULT NULL COMMENT '快递公司类型1加盟型 2直营型',
`acct_id` bigint(0) DEFAULT NULL COMMENT '电子面单账号id每绑定一个网点分配一个acct_id',
`acct_type` int(0) DEFAULT NULL COMMENT '面单账号类型0普通账号 1共享账号',
`status` int(0) DEFAULT NULL COMMENT '面单账号状态',
`available` int(0) DEFAULT NULL COMMENT '面单余额',
`allocated` int(0) DEFAULT NULL COMMENT '累积已取单',
`cancel` int(0) DEFAULT NULL COMMENT '累计已取消',
`recycled` int(0) DEFAULT NULL COMMENT '累积已回收',
`monthly_card` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '月结账号company_type 为直营型时有效',
`site_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '网点信息JSON',
`sender_province` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省名称(一级地址)',
`sender_city` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '市名称(二级地址)',
`sender_county` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`sender_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 = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '视频号小店电子面单账户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for s_kwai_order
-- ----------------------------

View File

@ -0,0 +1,10 @@
package com.qihang.wei.bo;
import lombok.Data;
@Data
public class WeiWaybillGetBo {
private Long accountId;//电子面单账户id
private String[] ids;
private Long shopId;//店铺Id
}

View File

@ -0,0 +1,206 @@
package com.qihang.wei.controller;
import cn.qihangerp.open.wei.EwaybillApiHelper;
import cn.qihangerp.open.wei.common.ApiResultVo;
import cn.qihangerp.open.wei.vo.ewaybill.AccountVo;
import cn.qihangerp.open.wei.vo.ewaybill.DeliveryVo;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qihang.common.common.AjaxResult;
import com.qihang.common.common.ResultVoEnum;
import com.qihang.common.enums.HttpStatus;
import com.qihang.wei.bo.PullRequest;
import com.qihang.wei.bo.WeiWaybillGetBo;
import com.qihang.wei.domain.OmsWeiWaybillAccount;
import com.qihang.wei.service.OmsWeiWaybillAccountService;
import lombok.AllArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Log
@RequestMapping("/ewaybill")
@RestController
@AllArgsConstructor
public class WayBillController {
private final WeiApiCommon apiCommon;
private final OmsWeiWaybillAccountService waybillAccountService;
@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<OmsWeiWaybillAccount> list = waybillAccountService.list(new LambdaQueryWrapper<OmsWeiWaybillAccount>().eq(OmsWeiWaybillAccount::getShopId, params.getShopId()).eq(OmsWeiWaybillAccount::getIsShow, 1));
return AjaxResult.success(list);
}
@RequestMapping(value = "/pull_waybill_account", method = RequestMethod.POST)
public AjaxResult pull_waybill_account(@RequestBody PullRequest params) throws Exception {
if (params.getShopId() == null || params.getShopId() <= 0) {
// return ApiResul new ApiResult(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
}
Date currDateTime = new Date();
long startTime = System.currentTimeMillis();
var checkResult = apiCommon.checkBefore(params.getShopId());
if (checkResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
}
String accessToken = checkResult.getData().getAccessToken();
String serverUrl = checkResult.getData().getServerUrl();
String appKey = checkResult.getData().getAppKey();
String appSecret = checkResult.getData().getAppSecret();
// ApiResultVo<DeliveryVo> apiResultVo = EwaybillApiHelper.getDeliveryList(appKey, appSecret, accessToken);
ApiResultVo<AccountVo> apiResultVo = EwaybillApiHelper.getAccountList(appKey, appSecret, accessToken);
List<OmsWeiWaybillAccount> list = new ArrayList<>();
if(apiResultVo.getCode()==0){
for (var item : apiResultVo.getList()) {
OmsWeiWaybillAccount vo = new OmsWeiWaybillAccount();
vo.setShopId(params.getShopId());
vo.setSellerShopId(item.getShopId());
vo.setIsShow(1);
vo.setDeliveryId(item.getDeliveryId());
vo.setCompanyType(item.getCompanyType());
vo.setAcctId(item.getAcctId());
vo.setAcctType(item.getAcctType());
vo.setStatus(item.getStatus());
vo.setAvailable(item.getAvailable());
vo.setAllocated(item.getAllocated());
vo.setCancel(item.getCancel());
vo.setRecycled(item.getRecycled());
vo.setMonthlyCard(item.getMonthlyCard());
vo.setSiteInfo(JSONObject.toJSONString(item.getSiteInfo()));
if (item.getSenderAddress()!=null) {
vo.setSenderAddress(item.getSenderAddress().getAddress());
vo.setSenderProvince(item.getSenderAddress().getProvince());
vo.setSenderCity(item.getSenderAddress().getCity());
vo.setSenderCounty(item.getSenderAddress().getCounty());
}
list.add(vo);
waybillAccountService.save(vo);
log.info("========添加wei电子面单账户信息==========");
}
}
return AjaxResult.success(list);
// return AjaxResult.success(apiResultVo.getList());
}
@PostMapping("/get_waybill_code")
@ResponseBody
public AjaxResult getWaybillCode(@RequestBody WeiWaybillGetBo 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();
// 获取电子面单账户信息(包含了发货地址信息)
OmsWeiWaybillAccount account = waybillAccountService.getById(req.getAccountId());
// WaybillCloudPrintApplyNewRequest request = new WaybillCloudPrintApplyNewRequest();
// request.setCp_code(account.getCpCode());
//
// WaybillCloudPrintApplyNewRequestSender sender = new WaybillCloudPrintApplyNewRequestSender();
// sender.setName(account.getName());
// sender.setMobile(account.getMobile());
// WaybillCloudPrintApplyNewRequestSender.AddressDTO addressDTO = new WaybillCloudPrintApplyNewRequestSender.AddressDTO();
// addressDTO.setCity(account.getCity());
// addressDTO.setProvince(account.getProvince());
// addressDTO.setDistrict(account.getArea());
// addressDTO.setTown("");
// addressDTO.setDetail(account.getAddressDetail());
// sender.setAddress(addressDTO);
// request.setSender(sender);
//
// // 组合取号的订单信息trade_order_info_dtos
// List<WaybillCloudPrintApplyNewRequestTradeOrderInfoDto> orderList = new ArrayList<>();
//
// for(String orderId:req.getIds()){
// if(StringUtils.hasText(orderId)){
// OmsTaoOrder omsTaoOrder = orderService.queryDetailByTid(orderId);
// if(omsTaoOrder!=null) {
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto dto = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto();
// dto.setObjectId(omsTaoOrder.getTid());
// dto.setTemplateUrl("http://cloudprint.cainiao.com/template/standard/101");
// dto.setUserId(sellerShopId.intValue());
//
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO orderInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO();
// orderInfoDTO.setOrderChannelsType("TB");
// orderInfoDTO.setTradeOrderList(omsTaoOrder.getTid());
// dto.setOrderInfo(orderInfoDTO);
//
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO packageInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO();
// List<WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO> items = new ArrayList<>();
// for (var orderItem : omsTaoOrder.getItems()) {
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO itemsDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO();
// itemsDTO.setCount(orderItem.getNum());
// itemsDTO.setName(orderItem.getTitle());
// items.add(itemsDTO);
// }
// packageInfoDTO.setItems(items);
// dto.setPackageInfo(packageInfoDTO);
//
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO recipientDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO();
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO addressDTO1 = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO();
// addressDTO1.setCity(omsTaoOrder.getReceiverCity());
// addressDTO1.setTown(omsTaoOrder.getReceiverTown());
// addressDTO1.setProvince(omsTaoOrder.getReceiverState());
// addressDTO1.setDistrict(omsTaoOrder.getReceiverDistrict());
// addressDTO1.setDetail(omsTaoOrder.getReceiverAddress());
// recipientDTO.setAddress(addressDTO1);
// recipientDTO.setName(omsTaoOrder.getReceiverName());
// recipientDTO.setOaid(omsTaoOrder.getOaid());
// recipientDTO.setTid(omsTaoOrder.getTid());
// dto.setRecipient(recipientDTO);
// orderList.add(dto);
// }
// }
// }
//
// request.setTrade_order_info_dtos(orderList);
//
// ApiResultVo<WaybillCloudPrint> apiResultVo = WaybillApiHelper.waybillCloudPrintApplyNew(appKey, appSecret, accessToken, request);
// if(apiResultVo.getCode()==0){
// // 保持数据
// for(var result: apiResultVo.getList()){
// ErpShipWaybill waybill = new ErpShipWaybill();
// waybill.setShopId(req.getShopId());
// waybill.setOrderId(result.getObjectId());
// waybill.setWaybillCode(result.getWaybillCode());
// waybill.setLogisticsCode(result.getCpCode());
// waybill.setPrintData(result.getPrintData());
// waybill.setStatus(1);//1已取号
// erpShipWaybillService.waybillUpdate(waybill);
// log.info("====保存電子面單信息========"+result.getObjectId());
// }
// }else{
// return AjaxResult.error(apiResultVo.getMsg());
// }
return AjaxResult.success();
}
}

View File

@ -1,52 +0,0 @@
package com.qihang.wei.controller;
import cn.qihangerp.open.wei.EwaybillApiHelper;
import cn.qihangerp.open.wei.common.ApiResultVo;
import cn.qihangerp.open.wei.vo.ewaybill.DeliveryVo;
import com.alibaba.fastjson2.JSONObject;
import com.qihang.common.common.AjaxResult;
import com.qihang.common.common.ResultVoEnum;
import com.qihang.common.enums.HttpStatus;
import com.qihang.wei.bo.PullRequest;
import com.qihang.wei.domain.WeiGoods;
import com.qihang.wei.domain.WeiGoodsSku;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RequestMapping("/ewaybill")
@RestController
@AllArgsConstructor
public class eWayBillController {
private final WeiApiCommon apiCommon;
@RequestMapping(value = "/get_deliver_list", method = RequestMethod.POST)
public AjaxResult getDeliverList(@RequestBody PullRequest params) throws Exception {
if (params.getShopId() == null || params.getShopId() <= 0) {
// return ApiResul new ApiResult(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
}
Date currDateTime = new Date();
long startTime = System.currentTimeMillis();
var checkResult = apiCommon.checkBefore(params.getShopId());
if (checkResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
}
String accessToken = checkResult.getData().getAccessToken();
String serverUrl = checkResult.getData().getServerUrl();
String appKey = checkResult.getData().getAppKey();
String appSecret = checkResult.getData().getAppSecret();
ApiResultVo<DeliveryVo> apiResultVo = EwaybillApiHelper.getDeliveryList(appKey, appSecret, accessToken);
return AjaxResult.success(apiResultVo.getList());
}
}

View File

@ -174,6 +174,22 @@ public class OmsWeiOrder implements Serializable {
* 订单审核时间
*/
private Date auditTime;
/**
* erp发货快递公司
*/
private String erpSendCompany;
/**
* erp发货快递单号
*/
private String erpSendCode;
/**
* erp发货状态
*/
private Integer erpSendStatus;
@TableField(exist = false)
private List<OmsWeiOrderItem> items;

View File

@ -0,0 +1,127 @@
package com.qihang.wei.domain;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* 视频号小店电子面单账户信息表
* @TableName oms_wei_waybill_account
*/
@Data
public class OmsWeiWaybillAccount implements Serializable {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 店铺id
*/
private Long shopId;
/**
* 平台店铺id全局唯一一个店铺分配一个shop_id
*/
private String sellerShopId;
/**
* 快递公司编码
*/
private String deliveryId;
/**
* 快递公司类型1加盟型 2直营型
*/
private Integer companyType;
/**
* 电子面单账号id每绑定一个网点分配一个acct_id
*/
private String acctId;
/**
* 面单账号类型0普通账号 1共享账号
*/
private Integer acctType;
/**
* 面单账号状态
*/
private Integer status;
/**
* 面单余额
*/
private Integer available;
/**
* 累积已取单
*/
private Integer allocated;
/**
* 累计已取消
*/
private Integer cancel;
/**
* 累积已回收
*/
private Integer recycled;
/**
* 月结账号company_type 为直营型时有效
*/
private String monthlyCard;
/**
* 网点信息JSON
*/
private String siteInfo;
/**
* 省名称一级地址
*/
private String senderProvince;
/**
* 市名称二级地址
*/
private String senderCity;
/**
*
*/
private String senderCounty;
/**
* 详细地址
*/
private String senderAddress;
/**
* 发货人
*/
private String name;
/**
* 发货手机号
*/
private String mobile;
/**
* 发货固定电话
*/
private String phone;
/**
* 是否前台显示1显示0不显示
*/
private Integer isShow;
private static final long serialVersionUID = 1L;
}

View File

@ -160,6 +160,7 @@ public class WeiOrder implements Serializable {
*/
private String settleInfo;
@TableField(exist = false)
private List<WeiOrderItem> items;

View File

@ -0,0 +1,18 @@
package com.qihang.wei.mapper;
import com.qihang.wei.domain.OmsWeiWaybillAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author TW
* @description 针对表oms_wei_waybill_account(视频号小店电子面单账户信息表)的数据库操作Mapper
* @createDate 2024-06-19 17:08:54
* @Entity com.qihang.wei.domain.OmsWeiWaybillAccount
*/
public interface OmsWeiWaybillAccountMapper extends BaseMapper<OmsWeiWaybillAccount> {
}

View File

@ -0,0 +1,13 @@
package com.qihang.wei.service;
import com.qihang.wei.domain.OmsWeiWaybillAccount;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author TW
* @description 针对表oms_wei_waybill_account(视频号小店电子面单账户信息表)的数据库操作Service
* @createDate 2024-06-19 17:08:54
*/
public interface OmsWeiWaybillAccountService extends IService<OmsWeiWaybillAccount> {
}

View File

@ -44,7 +44,15 @@ public class OmsWeiOrderServiceImpl extends ServiceImpl<OmsWeiOrderMapper, OmsWe
LambdaQueryWrapper<OmsWeiOrder> queryWrapper = new LambdaQueryWrapper<OmsWeiOrder>()
.eq(bo.getShopId()!=null,OmsWeiOrder::getShopId,bo.getShopId())
.eq(StringUtils.hasText(bo.getOrderId()),OmsWeiOrder::getOrderId,bo.getOrderId())
.eq(bo.getStatus()!=null,OmsWeiOrder::getStatus,bo.getStatus())
;
if(bo.getErpSendStatus()!=null){
if(bo.getErpSendStatus()==-1) {
queryWrapper.lt(OmsWeiOrder::getErpSendStatus,3);
}else {
queryWrapper.eq(OmsWeiOrder::getErpSendStatus, bo.getErpSendStatus());
}
}
Page<OmsWeiOrder> page = mapper.selectPage(pageQuery.build(), queryWrapper);
if(page.getRecords()!=null){

View File

@ -0,0 +1,22 @@
package com.qihang.wei.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.wei.domain.OmsWeiWaybillAccount;
import com.qihang.wei.service.OmsWeiWaybillAccountService;
import com.qihang.wei.mapper.OmsWeiWaybillAccountMapper;
import org.springframework.stereotype.Service;
/**
* @author TW
* @description 针对表oms_wei_waybill_account(视频号小店电子面单账户信息表)的数据库操作Service实现
* @createDate 2024-06-19 17:08:54
*/
@Service
public class OmsWeiWaybillAccountServiceImpl extends ServiceImpl<OmsWeiWaybillAccountMapper, OmsWeiWaybillAccount>
implements OmsWeiWaybillAccountService{
}

View File

@ -37,6 +37,9 @@
<result property="settleInfo" column="settle_info" jdbcType="VARCHAR"/>
<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">
@ -50,6 +53,6 @@
house_number,virtual_order_tel_number,tel_number_ext_info,
use_tel_number,hash_code,delivery_product_info,
ship_done_time,ewaybill_order_code,settle_info,
audit_status,audit_time
audit_status,audit_time,erp_send_company,erp_send_code,erp_send_status
</sql>
</mapper>

View File

@ -0,0 +1,42 @@
<?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.wei.mapper.OmsWeiWaybillAccountMapper">
<resultMap id="BaseResultMap" type="com.qihang.wei.domain.OmsWeiWaybillAccount">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
<result property="deliveryId" column="delivery_id" jdbcType="VARCHAR"/>
<result property="companyType" column="company_type" jdbcType="INTEGER"/>
<result property="acctId" column="acct_id" jdbcType="BIGINT"/>
<result property="acctType" column="acct_type" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="available" column="available" jdbcType="INTEGER"/>
<result property="allocated" column="allocated" jdbcType="INTEGER"/>
<result property="cancel" column="cancel" jdbcType="INTEGER"/>
<result property="recycled" column="recycled" jdbcType="INTEGER"/>
<result property="monthlyCard" column="monthly_card" jdbcType="VARCHAR"/>
<result property="siteInfo" column="site_info" jdbcType="VARCHAR"/>
<result property="senderProvince" column="sender_province" jdbcType="VARCHAR"/>
<result property="senderCity" column="sender_city" jdbcType="VARCHAR"/>
<result property="senderCounty" column="sender_county" jdbcType="VARCHAR"/>
<result property="senderAddress" column="sender_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_shop_id,
delivery_id,company_type,acct_id,
acct_type,status,available,
allocated,cancel,recycled,
monthly_card,site_info,sender_province,
sender_city,sender_county,sender_address,
name,mobile,phone,
is_show
</sql>
</mapper>

View File

@ -1,9 +1,54 @@
import request from '@/utils/request'
// 列表
export function getDeliverList(data) {
export function getWaybillAccountList(data) {
return request({
url: '/api/wei-api/ewaybill/get_deliver_list',
url: '/api/wei-api/ewaybill/get_waybill_account_list',
method: 'post',
data: data
})
}
// 更新电子面单账户
export function pullWaybillAccount(data) {
return request({
url: '/api/wei-api/ewaybill/pull_waybill_account',
method: 'post',
data: data
})
}
// 取号
export function getWaybillCode(data) {
return request({
url: '/api/wei-api/ewaybill/get_waybill_code',
method: 'post',
data: data
})
}
// 获取打印的数据
export function getWaybillPrintData(data) {
return request({
url: '/api/wei-api/ewaybill/get_print_data',
method: 'post',
data: data
})
}
// 打印成功
export function pushWaybillPrintSuccess(data) {
return request({
url: '/api/tao-api/ewaybill/push_print_success',
method: 'post',
data: data
})
}
export function pushShipSend(data) {
return request({
url: '/api/tao-api/ewaybill/push_ship_send',
method: 'post',
data: data
})

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="淘宝天猫" name="printTao" >
<el-tab-pane label="淘宝天猫" name="printTao" lazy>
<print-tao></print-tao>
</el-tab-pane>
<el-tab-pane label="京东POP" name="printJd" lazy>
@ -35,7 +35,7 @@ export default {
components:{PrintJd, printWei,printTao,printPdd,printDou},
data() {
return {
activeName: 'printTao'
activeName: 'printWei'
};
},
created() {

View File

@ -1,234 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
<el-form-item label="平台SkuId" prop="skuId">
<el-input
v-model="queryParams.skuId"
placeholder="请输入平台SkuId"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商家sku编码" prop="outerId">
<el-input
v-model="queryParams.outerId"
placeholder="请输入商家sku编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="ERP skuId" prop="erpSkuId">
<el-input
v-model="queryParams.erpSkuId"
placeholder="请输入ERP skuId"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="店铺" prop="shopId">-->
<!-- <el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">-->
<!-- <el-option-->
<!-- v-for="item in shopList"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-download"
size="mini"
@click="handlePull"
>API拉取商品数据</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="goodsList" @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="商品ID" align="center" prop="wareId" />
<el-table-column label="Sku Id" align="center" prop="skuId" />
<el-table-column label="sku名称" align="center" prop="skuName" />
<el-table-column label="图片" align="center" prop="logo" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
</template>
</el-table-column>
<!-- <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="center" prop="outerId" />
<el-table-column label="京东价" align="center" prop="jdPrice" />
<el-table-column label="ERP SKU ID" align="center" prop="erpSkuId" />
<el-table-column label="状态" align="center" prop="status" >
<template slot-scope="scope">
<el-tag size="small" v-if="scope.row.status === 1">销售中</el-tag>
<el-tag size="small" v-if="scope.row.status === 2">已下架</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleLink(scope.row)"
>关联ERP</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改商品管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="ERP商品SkuId" prop="erpSkuId">
<el-input v-model.number="form.erpSkuId" placeholder="请输入ERP商品SkuId" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {listShop} from "@/api/shop/shop";
export default {
name: "ewaybillWei",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
goodsList: [],
shopList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null
},
//
form: {},
supplierList: [],
categoryList: [],
categoryTree: [],
//
rules: {
id: [
{ required: true, message: "不能为空", trigger: "change" }
],
erpSkuId: [
{ required: true, message: "不能为空", trigger: "blur" }
],
}
};
},
created() {
// listShop({platform:3}).then(response => {
// this.shopList = response.rows;
// });
// this.getList();
this.loading = false;
},
methods: {
/** 查询商品管理列表 */
getList() {
this.loading = true;
listGoodsSku(this.queryParams).then(response => {
this.goodsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
erpSkuId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleLink(row) {
this.reset();
const id = row.id || this.ids
getGoodsSku(id).then(response => {
console.log('=====00000000============',response)
this.form = response.data;
this.open = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
linkErpGoodsSkuId(this.form).then(response => {
this.$modal.msgSuccess("关联成功");
this.open = false;
this.getList();
});
}
});
},
}
};
</script>

View File

@ -1,19 +1,29 @@
<template>
<div class="app-container">
<el-form :model="printParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
<el-form-item label="快递公司" prop="deliver">
<el-select v-model="printParams.deliver" placeholder="请选择快递公司" clearable>
<el-form-item label="订单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="店铺" prop="shopId">
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
<el-option
v-for="item in deliverList"
:key="item.delivery_id"
:label="item.delivery_name"
:value="item.delivery_id">
v-for="item in shopList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button @click="getDeliverList"> 获取 </el-button>
</el-form-item>
<el-form-item label="打印机" prop="printer">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
<el-form-item>
<el-select v-model="printParams.printer" placeholder="请选择打印机" clearable>
<el-option
v-for="item in printerList"
@ -22,9 +32,6 @@
:value="item.name">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
</el-form-item>
</el-form>
@ -32,51 +39,95 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
type="primary"
plain
icon="el-icon-download"
icon="el-icon-time"
size="mini"
:disabled="multiple"
@click="handleGetEwaybillCode"
>电子面单取号</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
:disabled="multiple"
icon="el-icon-printer"
size="mini"
@click="handlePrintEwaybill"
>打印电子面单</el-button>
>电子面单打印</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-d-arrow-right"
size="mini"
:disabled="multiple"
@click="handleShipSend"
>电子面单发货</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handlePrintEwaybill"-->
<!-- >打印电子面单</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="goodsList" @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="商品ID" align="center" prop="wareId" />
<el-table-column label="Sku Id" align="center" prop="skuId" />
<el-table-column label="sku名称" align="center" prop="skuName" />
<el-table-column label="图片" align="center" prop="logo" width="100">
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="订单号" align="left" prop="orderId" width="180">
<template slot-scope="scope">
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
<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="550">
<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="SKU编码" align="center" prop="skuCode" />
<el-table-column label="数量" align="center" prop="num" width="60">
<template slot-scope="scope">
<el-tag size="small">x {{scope.row.skuCnt}}</el-tag>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="下单时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<!-- <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="center" prop="outerId" />
<el-table-column label="京东价" align="center" prop="jdPrice" />
<el-table-column label="ERP SKU ID" align="center" prop="erpSkuId" />
<el-table-column label="状态" align="center" prop="status" >
<el-table-column label="收件信息" align="left" prop="userName" >
<template slot-scope="scope">
<el-tag size="small" v-if="scope.row.status === 1">销售中</el-tag>
<el-tag size="small" v-if="scope.row.status === 2">已下架</el-tag>
<span>{{scope.row.userName}} {{scope.row.telNumber}}</span><br />
<span> {{scope.row.provinceName}} {{scope.row.cityName}} {{scope.row.countyName}}
</span>
<p>
{{scope.row.maskPostAddress}}
</p>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="面单号" align="center" prop="erpSendCode" />
<el-table-column label="状态" align="center" prop="erpSendStatus" >
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleLink(scope.row)"
>关联ERP</el-button>
<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>
@ -89,20 +140,30 @@
@pagination="getList"
/>
<!-- 添加或修改商品管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<!-- 取号 -->
<el-dialog title="取号" :visible.sync="getCodeOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="ERP商品SkuId" prop="erpSkuId">
<el-input v-model.number="form.erpSkuId" placeholder="请输入ERP商品SkuId" />
<el-form-item label="电子面单账户" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择电子面单账户" clearable>
<el-option
v-for="item in deliverList"
:key="item.id"
:label="item.deliveryId"
:value="item.id">
<span style="float: left">{{ item.deliveryId }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.senderProvince}}{{item.senderCity}}{{item.senderCounty}}{{item.senderAddress}}:{{item.available}}</span>
</el-option>
</el-select>
<el-button type="success" plain @click="updateWaybillAccount" >更新电子面单账户信息</el-button>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="getCodeOpenForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -110,7 +171,8 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {listShop} from "@/api/shop/shop";
import {getDeliverList} from "@/api/wei/ewaybill";
import {getWaybillAccountList,pullWaybillAccount,getWaybillCode} from "@/api/wei/ewaybill";
import {listOrder} from "@/api/wei/order";
export default {
name: "printWei",
@ -118,8 +180,11 @@ export default {
return {
//
loading: true,
getCodeOpen: false,
//
ids: [],
shopList: [],
orderList: [],
//
single: true,
//
@ -136,7 +201,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
name: null
status: 20,
erpSendStatus: -1,
},
//
printParams: {
@ -153,32 +219,76 @@ export default {
},
created() {
this.openWs()
// listShop({platform:3}).then(response => {
// this.shopList = response.rows;
// });
// this.getList();
this.loading = false;
this.openWs()
listShop({platform: 2}).then(response => {
this.shopList = response.rows;
if (this.shopList && this.shopList.length > 0) {
this.queryParams.shopId = this.shopList[0].id
}
this.getList();
});
},
methods: {
/** getDeliverList获取开通的快递公司 */
getDeliverList(){
getDeliverList({shopId:2}).then(response => {
this.deliverList = response.data;
});
},
/** 查询商品管理列表 */
/** 查询列表 */
getList() {
this.loading = true;
listGoodsSku(this.queryParams).then(response => {
this.goodsList = response.rows;
listOrder(this.queryParams).then(response => {
this.orderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.orderId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
//
handleGetEwaybillCode() {
const ids = this.ids;
if (ids) {
getWaybillAccountList({shopId: this.queryParams.shopId}).then(response => {
this.deliverList = response.data;
this.getCodeOpen = true
});
} else {
this.$modal.msgError("请选择订单")
}
},
//
updateWaybillAccount() {
pullWaybillAccount({shopId: this.queryParams.shopId}).then(response => {
this.deliverList = response.data;
});
},
/** 取号提交按钮 */
getCodeOpenForm() {
this.$refs["form"].validate(valid => {
if (valid) {
const ids = this.ids;
console.log('=========3333========', ids)
if (ids) {
console.log('===请求参数=====', {shopId: this.queryParams.shopId, ids: ids, accountId: this.form.accountId})
getWaybillCode({
shopId: this.queryParams.shopId,
ids: ids,
accountId: this.form.accountId
}).then(response => {
this.$modal.msgSuccess("取号成功")
this.getList()
this.getCodeOpen = false
});
} else {
this.$modal.msgError("请选择订单")
}
}
});
},
//
cancel() {
this.open = false;
this.getCodeOpen = false;
this.reset();
},
//

View File

@ -103,12 +103,15 @@
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="收件人信息" align="center" prop="userName" >
<template slot-scope="scope">
<span>{{scope.row.userName}}</span><br />
<span> {{scope.row.provinceName}} {{scope.row.cityName}} {{scope.row.countyName}}
</span>
<p>
{{scope.row.detailInfo}}
</p>
</template>
</el-table-column>