完善dou订单拉取

This commit is contained in:
老齐 2024-06-14 14:55:52 +08:00
parent 220bfc71b6
commit 1dfbb7fe90
29 changed files with 1970 additions and 1585 deletions

View File

@ -140,7 +140,29 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
{
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
/**
* 时间字符串转时间戳
* @param format
* @param time 时间字符串
*
* @return
*/
public static final long dateTimeStrToTimeStamp(String format, final String time)
{
try
{
if(format==null||format.equals("")){
format = YYYY_MM_DD_HH_MM_SS;
}
Date date = new SimpleDateFormat(format).parse(time);
return date.getTime();
}
catch (ParseException e)
{
e.printStackTrace();
return 0;
}
}
/**
* 计算时间差
*

View File

@ -33,6 +33,12 @@
<scope>system</scope>
<systemPath>${project.basedir}/libs/dou-api-0.3.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/net.logstash.logback/logstash-logback-encoder -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>7.4</version>
</dependency>
</dependencies>

View File

@ -12,8 +12,9 @@ import com.qihang.dou.service.OmsDouGoodsService;
import com.qihang.dou.service.OmsDouGoodsSkuService;
import com.qihang.security.common.BaseController;
import lombok.AllArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.web.bind.annotation.*;
@Log
@RequestMapping("/goods")
@RestController
@AllArgsConstructor
@ -23,7 +24,7 @@ public class DouGoodsController extends BaseController {
@RequestMapping(value = "/list", method = RequestMethod.GET)
public TableDataInfo goodsList(OmsDouGoods bo, PageQuery pageQuery) {
PageResult<OmsDouGoods> result = goodsService.queryPageList(bo, pageQuery);
log.info("访问商品接口");
return getDataTable(result);
}

View File

@ -0,0 +1,263 @@
package com.qihang.dou.controller;
import cn.qihangerp.open.dou.DouOrderApiHelper;
import cn.qihangerp.open.dou.DouTokenApiHelper;
import cn.qihangerp.open.dou.common.ApiResultVo;
import cn.qihangerp.open.dou.model.Token;
import cn.qihangerp.open.dou.model.order.Order;
import com.alibaba.fastjson2.JSONObject;
import com.qihang.common.common.AjaxResult;
import com.qihang.common.common.ResultVo;
import com.qihang.common.common.ResultVoEnum;
import com.qihang.common.enums.EnumShopType;
import com.qihang.common.enums.HttpStatus;
import com.qihang.common.mq.MqMessage;
import com.qihang.common.mq.MqType;
import com.qihang.common.mq.MqUtils;
import com.qihang.dou.domain.OmsDouOrder;
import com.qihang.dou.domain.OmsDouOrderItem;
import com.qihang.dou.domain.SShopPullLasttime;
import com.qihang.dou.domain.SShopPullLogs;
import com.qihang.dou.domain.bo.DouRequest;
import com.qihang.dou.service.OmsDouOrderService;
import com.qihang.dou.service.SShopPullLasttimeService;
import com.qihang.dou.service.SShopPullLogsService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 淘系订单更新
*/
@AllArgsConstructor
@RestController
@RequestMapping("/order")
public class OrderApiController {
private static Logger log = LoggerFactory.getLogger(OrderApiController.class);
private final OmsDouOrderService orderService;
private final DouApiHelper douApiHelper;
// private final MqUtils mqUtils;
private final SShopPullLogsService pullLogsService;
private final SShopPullLasttimeService pullLasttimeService;
/**
* 增量更新订单
* @param req
* @
* @throws
*/
@PostMapping("/pull_order")
@ResponseBody
public AjaxResult pullOrder(@RequestBody DouRequest req) throws Exception {
log.info("/**************增量拉取dou订单****************/");
if (req.getShopId() == null || req.getShopId() <= 0) {
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
}
Date currDateTime = new Date();
Long currTimeMillis = System.currentTimeMillis();
var checkResult = douApiHelper.checkBefore(req.getShopId());
if (checkResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(),checkResult.getData());
}
String appKey = checkResult.getData().getAppKey();
String appSecret = checkResult.getData().getAppSecret();
Long douShopId = checkResult.getData().getSellerShopId();
String accessToken = checkResult.getData().getAccessToken();
// 获取最后更新时间
LocalDateTime startTime = null;
LocalDateTime endTime = null;
SShopPullLasttime lasttime = pullLasttimeService.getLasttimeByShop(req.getShopId(), "ORDER");
if(lasttime == null){
endTime = LocalDateTime.now();
startTime = endTime.minusDays(1);
}else {
startTime = lasttime.getLasttime().minusHours(1);//取上次结束一个小时前
Duration duration = Duration.between(startTime, LocalDateTime.now());
long hours = duration.toHours();
if (hours > 24) {
// 大于24小时只取24小时
endTime = startTime.plusHours(24);
} else {
endTime = LocalDateTime.now();
}
// endTime = startTime.plusDays(1);//取24小时
// if(endTime.isAfter(LocalDateTime.now())){
// endTime = LocalDateTime.now();
// }
}
String startTimeStr = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
String endTimeStr = endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Long startTimestamp = startTime.toEpochSecond(ZoneOffset.ofHours(8));
Long endTimestamp = endTime.toEpochSecond(ZoneOffset.ofHours(8));
String pullParams = "{startTime:"+startTimeStr+",endTime:"+endTimeStr+"}";
ApiResultVo<Token> token = DouTokenApiHelper.getToken(appKey, appSecret,checkResult.getData().getSellerShopId());
if(token.getCode()==0) {
accessToken = token.getData().getAccessToken();
}else{
return AjaxResult.error(token.getMsg());
}
//获取
ApiResultVo<Order> resultVo = DouOrderApiHelper.pullOrderList(startTimestamp, endTimestamp, 1, 20, appKey, appSecret, accessToken);
if(resultVo.getCode() !=0 ){
SShopPullLogs logs = new SShopPullLogs();
logs.setShopId(req.getShopId());
logs.setShopType(EnumShopType.DOU.getIndex());
logs.setPullType("ORDER");
logs.setPullWay("主动拉取订单");
logs.setPullParams(pullParams);
logs.setPullResult(resultVo.getMsg());
logs.setPullTime(currDateTime);
logs.setDuration(System.currentTimeMillis() - currTimeMillis);
pullLogsService.save(logs);
return AjaxResult.error("接口拉取错误:"+resultVo.getMsg());
}
int insertSuccess = 0;//新增成功的订单
int totalError = 0;
int hasExistOrder = 0;//已存在的订单数
//循环插入订单数据到数据库
for (var gitem : resultVo.getList()) {
OmsDouOrder douOrder = new OmsDouOrder();
BeanUtils.copyProperties(gitem, douOrder);
douOrder.setOrderPhaseList(JSONObject.toJSONString(gitem.getOrderPhaseList()));
douOrder.setEncryptPostAddress(gitem.getPostAddr().getEncryptDetail());
douOrder.setProvinceName(gitem.getPostAddr().getProvince().getName());
douOrder.setProvinceId(gitem.getPostAddr().getProvince().getId());
douOrder.setCityName(gitem.getPostAddr().getCity().getName());
douOrder.setCityId(gitem.getPostAddr().getCity().getId());
douOrder.setTownName(gitem.getPostAddr().getTown().getName());
douOrder.setTownId(gitem.getPostAddr().getTown().getId());
douOrder.setStreetName(gitem.getPostAddr().getStreet().getName());
douOrder.setStreetId(gitem.getPostAddr().getStreet().getId());
douOrder.setMaskPostAddress(gitem.getMaskPostAddr().getDetail());
douOrder.setLogisticsInfo(JSONObject.toJSONString(gitem.getLogisticsInfo()));
List<OmsDouOrderItem> items = new ArrayList<>();
if (gitem.getSkuOrderList() != null) {
for (var i : gitem.getSkuOrderList()) {
OmsDouOrderItem item = new OmsDouOrderItem();
BeanUtils.copyProperties(i, item);
item.setAfterSaleStatus(i.getAfterSaleInfo().getAfterSaleStatus());
item.setAfterSaleType(i.getAfterSaleInfo().getAfterSaleType());
item.setRefundStatus(i.getAfterSaleInfo().getRefundStatus());
item.setSpec(JSONObject.toJSONString(i.getSpec()));
items.add(item);
}
douOrder.setItems(items);
}
//插入订单数据
var result = orderService.saveOrder(req.getShopId(), douOrder);
if (result.getCode() == ResultVoEnum.DataExist.getIndex()) {
//已经存在
log.info("/**************主动更新dou订单开始更新数据库" + douOrder.getOrderId() + "存在、更新************开始通知****/");
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.DOU, MqType.ORDER_MESSAGE,douOrder.getOrderId()));
hasExistOrder++;
} else if (result.getCode() == ResultVoEnum.SUCCESS.getIndex()) {
log.info("/**************主动更新dou订单开始更新数据库" + douOrder.getOrderId() + "不存在、新增************开始通知****/");
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.DOU,MqType.ORDER_MESSAGE,douOrder.getOrderId()));
insertSuccess++;
} else {
log.info("/**************主动更新dou订单开始更新数据库" + douOrder.getOrderId() + "报错****************/");
totalError++;
}
}
if(lasttime == null){
// 新增
SShopPullLasttime insertLasttime = new SShopPullLasttime();
insertLasttime.setShopId(req.getShopId());
insertLasttime.setCreateTime(new Date());
insertLasttime.setLasttime(endTime);
insertLasttime.setPullType("ORDER");
pullLasttimeService.save(insertLasttime);
}else {
// 修改
SShopPullLasttime updateLasttime = new SShopPullLasttime();
updateLasttime.setId(lasttime.getId());
updateLasttime.setUpdateTime(new Date());
updateLasttime.setLasttime(endTime);
pullLasttimeService.updateById(updateLasttime);
}
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
SShopPullLogs logs = new SShopPullLogs();
logs.setShopType(EnumShopType.DOU.getIndex());
logs.setShopId(req.getShopId());
logs.setPullType("ORDER");
logs.setPullWay("主动拉取订单");
logs.setPullParams(pullParams);
logs.setPullResult("{insert:"+insertSuccess+",update:"+hasExistOrder+",fail:"+totalError+"}");
logs.setPullTime(currDateTime);
logs.setDuration(System.currentTimeMillis() - currTimeMillis);
pullLogsService.save(logs);
String msg = "成功{startTime:"+startTime.format(df)+",endTime:"+endTime.format(df)+"}总共找到:" + resultVo.getTotalRecords() + "条订单,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "";
log.info("/**************主动更新DOU订单END" + msg + "****************/");
return AjaxResult.success(msg);
}
/**
* 更新单个订单
*
* @param
* @return
* @throws
*/
// @RequestMapping("/pull_order_detail")
// @ResponseBody
// public AjaxResult getOrderPullDetail(@RequestBody PullRequest req) {
// log.info("/**************主动更新dou订单by number****************/");
// if (req.getShopId() == null || req.getShopId() <= 0) {
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误没有店铺Id");
// }
// if (!StringUtils.hasText(req.getOrderId())) {
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误缺少orderId");
// }
//
// var checkResult = apiCommon.checkBefore(req.getShopId());
// if (checkResult.getCode() != HttpStatus.SUCCESS) {
// return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
// }
//
// String appKey = checkResult.getData().getAppKey();
// String appSecret = checkResult.getData().getAppSecret();
// Long douShopId = checkResult.getData().getSellerId();
//
// ResultVo<DouOrder> resultVo = OrderApiHelper.pullOrderDetail( appKey, appSecret, douShopId,req.getOrderId());
// if (resultVo.getCode() == ResultVoEnum.SUCCESS.getIndex() && resultVo.getData()!=null) {
// var result = orderService.saveOrder(req.getShopId(), resultVo.getData());
// if (result.getCode() == ResultVoEnum.DataExist.getIndex()) {
// //已经存在
// log.info("/**************主动更新dou订单开始更新数据库" + resultVo.getData().getId() + "存在、更新****************/");
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.DOU, MqType.ORDER_MESSAGE,resultVo.getData().getOrderId()));
// } else if (result.getCode() == ResultVoEnum.SUCCESS.getIndex()) {
// log.info("/**************主动更新dou订单开始更新数据库" + resultVo.getData().getId() + "不存在、新增****************/");
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.DOU,MqType.ORDER_MESSAGE,resultVo.getData().getOrderId()));
// }
// return AjaxResult.success();
// } else {
// return AjaxResult.error(resultVo.getCode(), resultVo.getMsg());
// }
// }
}

View File

@ -0,0 +1,58 @@
package com.qihang.dou.controller;
import com.alibaba.fastjson2.JSONObject;
import com.qihang.common.common.AjaxResult;
import com.qihang.common.common.PageQuery;
import com.qihang.common.common.PageResult;
import com.qihang.common.common.TableDataInfo;
import com.qihang.common.enums.EnumShopType;
import com.qihang.common.mq.MqMessage;
import com.qihang.common.mq.MqType;
import com.qihang.common.mq.MqUtils;
import com.qihang.dou.domain.OmsDouOrder;
import com.qihang.dou.domain.bo.DouOrderBo;
import com.qihang.dou.domain.bo.DouOrderPushBo;
import com.qihang.dou.service.OmsDouOrderService;
import com.qihang.security.common.BaseController;
import lombok.AllArgsConstructor;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*;
@AllArgsConstructor
@RestController
@RequestMapping("/order")
public class OrderContoller extends BaseController {
private final OmsDouOrderService orderService;
private final KafkaTemplate<String,Object> kafkaTemplate;
// private final MqUtils mqUtils;
@RequestMapping(value = "/list", method = RequestMethod.GET)
public TableDataInfo goodsList(DouOrderBo bo, PageQuery pageQuery) {
PageResult<OmsDouOrder> result = orderService.queryPageList(bo, pageQuery);
return getDataTable(result);
}
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(orderService.queryDetailById(id));
}
/**
* 手动推送到系统
* @param bo
* @return
*/
@PostMapping("/push_oms")
@ResponseBody
public AjaxResult pushOms(@RequestBody DouOrderPushBo bo) {
// TODO:需要优化消息格式
if(bo!=null && bo.getIds()!=null) {
for(String id: bo.getIds()) {
kafkaTemplate.send(MqType.ORDER_MQ, JSONObject.toJSONString(MqMessage.build(EnumShopType.PDD, MqType.ORDER_MESSAGE,id)));
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.PDD, MqType.ORDER_MESSAGE, id));
}
}
return success();
}
}

View File

@ -0,0 +1,424 @@
package com.qihang.dou.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
/**
* 抖店订单表
* @TableName oms_dou_order
*/
@Data
public class OmsDouOrder implements Serializable {
/**
*
*/
private Long id;
/**
* 店铺父订单号抖店平台生成平台下唯一
*/
private String orderId;
/**
* 订单层级主订单是2级
*/
private Integer orderLevel;
/**
* 定金预售阶段单json
*/
private String orderPhaseList;
/**
* 订单状态1 待确认/待支付订单创建完毕105 已支付 2 备货中 101 部分发货 3 已发货全部发货4 已取消5 已完成已收货
*/
private Integer orderStatus;
/**
* 订单状态描述
*/
private String orderStatusDesc;
/**
*
订单的一些c端标签json
*/
private String orderTag;
/**
* 订单类型 0普通订单 2虚拟商品订单 4电子券poi核销 5三方核销
*/
private Integer orderType;
/**
* 订单类型描述
*/
private String orderTypeDesc;
/**
* 具体某个小程序的ID
*/
private Integer appId;
/**
* 抖音小程序ID
*/
private String openId;
/**
* 小时达订单的接单状态 0-未接单1-已接单2-超时取消或商家取消
*/
private Integer acceptOrderStatus;
/**
* 预约发货时间
*/
private Integer appointmentShipTime;
/**
* 作者达人承担金额单位订单参与活动和优惠中作者达人承担部分的总金额
*/
private Integer authorCostAmount;
/**
* 达人抖音号样品订单场景下才会返回的申样达人信息
*/
private String awemeId;
/**
* 下单端 0站外 1火山 2抖音 3头条 4西瓜 5微信 6值点app 7头条lite 8懂车帝 9皮皮虾 11抖音极速版 12TikTok 13musically 14穿山甲 15火山极速版 16服务市场 26番茄小说 27UG教育营销电商平台 28Jumanji 29电商SDK
*/
private Integer bType;
/**
* 下单端描述
*/
private String bTypeDesc;
/**
* 下单场景 0未知 1app内-原生 2app内-小程序 3H5 13电商SDK-头条 35电商SDK-头条lite
*/
private Integer subBType;
/**
* 下单场景描述
*/
private String subBTypeDesc;
/**
* 业务来源 1 -鲁班 2 -小店 3 -好好学习 4 -ev 5 -虚拟 6 -建站 7 -核销 8 -玉石 9 -ez 10 -ep 11 -虚拟卡券 12 -服务市场 13 - EP 视频课 14 - EP 直播课 21 -跨境BBC 22 -跨境BC 23 -跨境CC|UPU 24 -手机充值 25 -拍卖保证金 26 -懂车帝抵扣券 27 -懂车帝返现券 28 -离岛免税 29 -海南会员购 30 -抽奖 31 -清北-企业代付 32 -+ 33 -联盟寄样 49 -刀剑 53 -通信卡 66 -加油包 76 -大闸蟹 99 -保险 102-小店海外 108-上门取件收款
*/
private Integer biz;
/**
* 业务来源描述
*/
private String bizDesc;
/**
* 买家留言
*/
private String buyerWords;
/**
* 商家备注
*/
private String sellerWords;
/**
* 插旗信息0- 1- 2- 3-绿 4- 5-
*/
private Integer sellerRemarkStars;
/**
* 取消原因
*/
private String cancelReason;
/**
* 支付渠道的流水号
*/
private String channelPaymentNo;
/**
* 下单时间时间戳
*/
private Integer createTime;
/**
* 支付时间时间戳
*/
private Integer payTime;
/**
* 订单更新时间时间戳
*/
private Integer updateTime;
/**
* 订单完成时间时间戳
*/
private Integer finishTime;
/**
* 订单过期时间时间戳
*/
private Integer orderExpireTime;
/**
* 用户唯一id
*/
private String doudianOpenId;
/**
* 收件人姓名
*/
private String encryptPostReceiver;
/**
* 收件人电话
*/
private String encryptPostTel;
/**
* 收件地址
*/
private String encryptPostAddress;
/**
* 预计发货时间时间戳
*/
private Integer expShipTime;
/**
* 物流信息JSON
*/
private String logisticsInfo;
/**
* 主流程状态1 待确认/待支付订单创建完毕103 部分支付105 已支付2 备货中101 部分发货3 已发货全部发货4 已取消5 已完成已收货21 发货前退款完结22 发货后退款完结39 收货后退款完结
*/
private Integer mainStatus;
/**
* 主流程状态描述
*/
private String mainStatusDesc;
/**
* 收件人姓名脱敏后
*/
private String maskPostReceiver;
/**
* 收件人电话脱敏后
*/
private String maskPostTel;
/**
* 收件人地址脱敏后
*/
private String maskPostAddress;
/**
*
*/
private String provinceName;
/**
*
*/
private String provinceId;
/**
*
*/
private String cityName;
/**
*
*/
private String cityId;
/**
*
*/
private String townName;
/**
*
*/
private String townId;
/**
*
*/
private String streetName;
/**
*
*/
private String streetId;
/**
* 标识收件人地址的id可用于合单
*/
private String openAddressId;
/**
* 改价金额变化量单位
*/
private Integer modifyAmount;
/**
* 改价运费金额变化量单位
*/
private Integer modifyPostAmount;
/**
* 仅平台承担金额单位订单参与活动和优惠中平台承担部分的总金额
*/
private Integer onlyPlatformCostAmount;
/**
* 订单金额单位
*/
private Integer orderAmount;
/**
* 支付金额单位
*/
private Integer payAmount;
/**
* 7=无需支付0元单8=DOU分期信用支付9=新卡支付12=先用后付16=收银台支付
*/
private Integer payType;
/**
* 快递费单位
*/
private Integer postAmount;
/**
* 运费险金额单位
*/
private Integer postInsuranceAmount;
/**
* 运费原价单位post_origin_amount = post_amount + post_promotion_amount
*/
private Integer postOriginAmount;
/**
* 运费优惠金额单位
*/
private Integer postPromotionAmount;
/**
* 订单优惠总金额单位 = 店铺优惠金额 + 平台优惠金额 + 达人优惠金额
*/
private Integer promotionAmount;
/**
* 支付优惠金额单位支付渠道上的优惠金额
*/
private Integer promotionPayAmount;
/**
* 平台优惠金额单位属于平台的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionPlatformAmount;
/**
* 红包优惠金额单位
*/
private Integer promotionRedpackAmount;
/**
* 平台红包优惠金额单位属于平台的红包的优惠金额
*/
private Integer promotionRedpackPlatformAmount;
/**
* 达人红包优惠金额单位属于达人的红包的优惠金额
*/
private Integer promotionRedpackTalentAmount;
/**
* 店铺优惠金额单位属于店铺的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionShopAmount;
/**
* 达人优惠金额单位属于达人的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionTalentAmount;
/**
* 发货时间时间戳
*/
private Integer shipTime;
/**
* 商家承担金额单位订单参与活动和优惠中商家承担部分的总金额
*/
private Integer shopCostAmount;
/**
* 平台承担金额单位订单参与活动和优惠中平台+作者达人承担部分的总金额,包含作者达人承担金额platform_cost_amount = only_platform_cost_amount + author_cost_amount
*/
private Integer platformCostAmount;
/**
* 店铺id抖店平台生成平台下唯一
*/
private Long shopId;
/**
* 商户名称
*/
private String shopName;
/**
* 总优惠金额单位total_promotion_amount = promotion_amount + post_promotion_amount
*/
private Integer totalPromotionAmount;
/**
* 用户特征标签JSON
*/
private String userTagUi;
/**
* 系统店铺id
*/
private Integer sShopId;
/**
* 第一次拉取时间
*/
private Date pullTime;
/**
* 最后一次拉取时间
*/
private Date lastPullTime;
/**
* 0待确认1已确认2已拦截-9未拉取
*/
private Integer auditStatus;
/**
* 审核时间
*/
private Date auditTime;
@TableField(exist = false)
private List<OmsDouOrderItem> items;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,283 @@
package com.qihang.dou.domain;
import java.io.Serializable;
import lombok.Data;
/**
* 抖店订单明细表
* @TableName oms_dou_order_item
*/
@Data
public class OmsDouOrderItem implements Serializable {
/**
*
*/
private Long id;
/**
* 店铺子订单号抖店平台生成平台下唯一注意一笔订单下有一个子订单和父订单单号相同
*/
private String orderId;
/**
* 店铺父订单号抖店平台生成平台下唯一
*/
private String parentOrderId;
/**
* 订单层级
*/
private Integer orderLevel;
/**
* 广告来源video-短视频 live-直播
*/
private String adEnvType;
/**
* 售后状态6-售后申请27-拒绝售后申请12-售后成功7-售后退货中11-售后已发货29-售后退货拒绝13-换货返回换货售后换货商家发货补寄返回补寄待用户收货 14-换货返回换货售后换货用户收货补寄返回补寄用户已收货 28-售后失败51-订单取消成功53-逆向交易已完成
*/
private Integer afterSaleStatus;
/**
* 售后类型 0-退货退款;1-已发货仅退款;2-未发货仅退款;3-换货;4-系统取消;5-用户取消;6-价保;7-补寄;
*/
private Integer afterSaleType;
/**
* 退款状态:1-待退款3-退款成功 4-退款失败当买家发起售后后又主动取消售后此时after_sale_status=28并且refund_status=1的状态不变不会流转至4状态
*/
private Integer refundStatus;
/**
* 作者达人承担金额单位订单参与活动和优惠中作者达人承担部分的总金额
*/
private Integer authorCostAmount;
/**
* 直播主播id达人;仅直播间和橱窗产生的订单会有值返回;
*/
private Integer authorId;
/**
* 直播主播名称;仅直播间和橱窗产生的订单会有值返回
*/
private String authorName;
/**
* C端流量来源 0-unknown 2-精选联盟 8-小店自卖
*/
private Integer cBiz;
/**
* C端流量来源业务类型描述
*/
private String cBizDesc;
/**
*
取消原因
*/
private String cancelReason;
/**
* 支付渠道的流水号
*/
private String channelPaymentNo;
/**
* 商家后台商品编码
*/
private String code;
/**
* 用户确认收货时间
*/
private Integer confirmReceiptTime;
/**
* 订单完成时间时间戳
*/
private Integer finishTime;
/**
*
商品原价单位
*/
private Integer goodsPrice;
/**
* 商品类型 0-实体 1-虚拟
*/
private Integer goodsType;
/**
*
是否评价 :1-已评价0-未评价2 -追评
*/
private Integer isComment;
/**
* 订单商品数量
*/
private Integer itemNum;
/**
* 物流收货时间
*/
private Integer logisticsReceiptTime;
/**
*
改价金额变化量单位
*/
private Integer modifyAmount;
/**
* 改价运费金额变化量单位
*/
private Integer modifyPostAmount;
/**
* 仅平台承担金额单位订单参与活动和优惠中平台承担部分的总金额
*/
private Integer onlyPlatformCostAmount;
/**
* 订单金额单位
*/
private Integer orderAmount;
/**
* 支付金额单位
*/
private Integer payAmount;
/**
* 运费险金额单位
*/
private Integer postInsuranceAmount;
/**
* 订单优惠总金额单位 = 店铺优惠金额 + 平台优惠金额 + 达人优惠金额
*/
private Integer promotionAmount;
/**
* 店铺优惠金额单位属于店铺的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionShopAmount;
/**
* 平台优惠金额单位属于平台的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionPlatformAmount;
/**
* 商家承担金额单位订单参与活动和优惠中商家承担部分的总金额
*/
private Integer shopCostAmount;
/**
* 平台承担金额单位订单参与活动和优惠中平台+作者达人承担部分的总金额,包含作者达人承担金额platform_cost_amount = only_platform_cost_amount + author_cost_amount
*/
private Integer platformCostAmount;
/**
* 达人优惠金额单位属于达人的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionTalentAmount;
/**
* 支付优惠金额单位支付渠道上的优惠金额
*/
private Integer promotionPayAmount;
/**
* 商品现价单位
*/
private Integer originAmount;
/**
* 商品外部编码
*/
private String outProductId;
/**
* 外部Skuid
*/
private String outSkuId;
/**
* 商品ID
*/
private Long productId;
/**
* 商品skuId
*/
private Long skuId;
/**
* 商品名称
*/
private String productName;
/**
* 商品图片
*/
private String productPic;
/**
* 平台优惠金额单位属于平台的优惠活动优惠券红包的总优惠金额
*/
private Integer promotionRedpackAmount;
/**
* 平台红包优惠金额单位属于平台的红包的优惠金额
*/
private Integer promotionRedpackPlatformAmount;
/**
* 达人红包优惠金额单位属于达人的红包的优惠金额
*/
private Integer promotionRedpackTalentAmount;
/**
* 直播间id有值则代表订单来自直播间
*/
private Integer roomId;
/**
*
发货时间
*/
private Integer shipTime;
/**
* 规格信息JSON
*/
private String spec;
/**
* 下单来源描述废弃
*/
private String themeTypeDesc;
/**
* 订单更新时间时间戳
*/
private Integer updateTime;
/**
* 下单时间时间戳
*/
private Integer createTime;
/**
* 视频id有值则代表订单来自短视频video_id
*/
private String videoId;
private static final long serialVersionUID = 1L;
}

View File

@ -1,6 +1,7 @@
package com.qihang.dou.domain;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
@ -18,7 +19,7 @@ public class SShopPullLasttime implements Serializable {
/**
* 店铺id
*/
private Integer shopId;
private Long shopId;
/**
* 类型ORDER:订单REFUND:退款
@ -28,7 +29,7 @@ public class SShopPullLasttime implements Serializable {
/**
* 最后更新时间
*/
private Date lasttime;
private LocalDateTime lasttime;
/**
* 创建时间

View File

@ -18,7 +18,7 @@ public class SShopPullLogs implements Serializable {
/**
* 店铺id
*/
private Integer shopId;
private Long shopId;
/**
* 平台id

View File

@ -0,0 +1,16 @@
package com.qihang.dou.domain.bo;
import lombok.Data;
import java.io.Serializable;
@Data
public class DouOrderBo implements Serializable {
private String orderId;
private Long skuId;
private Long erpGoodsSkuId;
private Integer shopId;
private String orderStatus;
private String startTime;
private String endTime;
}

View File

@ -0,0 +1,8 @@
package com.qihang.dou.domain.bo;
import lombok.Data;
@Data
public class DouOrderPushBo {
private String[] ids;
}

View File

@ -0,0 +1,18 @@
package com.qihang.dou.mapper;
import com.qihang.dou.domain.OmsDouOrderItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author TW
* @description 针对表oms_dou_order_item(抖店订单明细表)的数据库操作Mapper
* @createDate 2024-06-14 11:20:51
* @Entity com.qihang.dou.domain.OmsDouOrderItem
*/
public interface OmsDouOrderItemMapper extends BaseMapper<OmsDouOrderItem> {
}

View File

@ -0,0 +1,18 @@
package com.qihang.dou.mapper;
import com.qihang.dou.domain.OmsDouOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author TW
* @description 针对表oms_dou_order(抖店订单表)的数据库操作Mapper
* @createDate 2024-06-14 11:20:51
* @Entity com.qihang.dou.domain.OmsDouOrder
*/
public interface OmsDouOrderMapper extends BaseMapper<OmsDouOrder> {
}

View File

@ -0,0 +1,13 @@
package com.qihang.dou.service;
import com.qihang.dou.domain.OmsDouOrderItem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author TW
* @description 针对表oms_dou_order_item(抖店订单明细表)的数据库操作Service
* @createDate 2024-06-14 11:20:51
*/
public interface OmsDouOrderItemService extends IService<OmsDouOrderItem> {
}

View File

@ -0,0 +1,26 @@
package com.qihang.dou.service;
import com.qihang.common.common.PageQuery;
import com.qihang.common.common.PageResult;
import com.qihang.common.common.ResultVo;
import com.qihang.dou.domain.OmsDouOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qihang.dou.domain.bo.DouOrderBo;
/**
* @author TW
* @description 针对表oms_dou_order(抖店订单表)的数据库操作Service
* @createDate 2024-06-14 11:20:51
*/
public interface OmsDouOrderService extends IService<OmsDouOrder> {
PageResult<OmsDouOrder> queryPageList(DouOrderBo bo, PageQuery pageQuery);
OmsDouOrder queryDetailById(Long id);
/**
* 保存店铺订单
* @param shopId
* @param order
* @return
*/
ResultVo<Integer> saveOrder(Long shopId, OmsDouOrder order);
}

View File

@ -9,5 +9,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @createDate 2024-06-11 14:40:36
*/
public interface SShopPullLasttimeService extends IService<SShopPullLasttime> {
SShopPullLasttime getLasttimeByShop(Long shopId,String pullType);
}

View File

@ -0,0 +1,22 @@
package com.qihang.dou.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.dou.domain.OmsDouOrderItem;
import com.qihang.dou.service.OmsDouOrderItemService;
import com.qihang.dou.mapper.OmsDouOrderItemMapper;
import org.springframework.stereotype.Service;
/**
* @author TW
* @description 针对表oms_dou_order_item(抖店订单明细表)的数据库操作Service实现
* @createDate 2024-06-14 11:20:51
*/
@Service
public class OmsDouOrderItemServiceImpl extends ServiceImpl<OmsDouOrderItemMapper, OmsDouOrderItem>
implements OmsDouOrderItemService{
}

View File

@ -0,0 +1,156 @@
package com.qihang.dou.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.common.common.PageQuery;
import com.qihang.common.common.PageResult;
import com.qihang.common.common.ResultVo;
import com.qihang.common.common.ResultVoEnum;
import com.qihang.common.utils.DateUtils;
import com.qihang.dou.domain.OmsDouOrder;
import com.qihang.dou.domain.OmsDouOrderItem;
import com.qihang.dou.domain.bo.DouOrderBo;
import com.qihang.dou.mapper.OmsDouOrderItemMapper;
import com.qihang.dou.service.OmsDouOrderService;
import com.qihang.dou.mapper.OmsDouOrderMapper;
import lombok.AllArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author TW
* @description 针对表oms_dou_order(抖店订单表)的数据库操作Service实现
* @createDate 2024-06-14 11:20:51
*/
@Log
@AllArgsConstructor
@Service
public class OmsDouOrderServiceImpl extends ServiceImpl<OmsDouOrderMapper, OmsDouOrder>
implements OmsDouOrderService{
private final OmsDouOrderMapper mapper;
private final OmsDouOrderItemMapper itemMapper;
private final String DATE_PATTERN =
"^(?:(?:(?:\\d{4}-(?:0?[1-9]|1[0-2])-(?:0?[1-9]|1\\d|2[0-8]))|(?:(?:(?:\\d{2}(?:0[48]|[2468][048]|[13579][26])|(?:(?:0[48]|[2468][048]|[13579][26])00))-0?2-29))$)|(?:(?:(?:\\d{4}-(?:0?[13578]|1[02]))-(?:0?[1-9]|[12]\\d|30))$)|(?:(?:(?:\\d{4}-0?[13-9]|1[0-2])-(?:0?[1-9]|[1-2]\\d|30))$)|(?:(?:(?:\\d{2}(?:0[48]|[13579][26]|[2468][048])|(?:(?:0[48]|[13579][26]|[2468][048])00))-0?2-29))$)$";
private final Pattern DATE_FORMAT = Pattern.compile(DATE_PATTERN);
@Override
public PageResult<OmsDouOrder> queryPageList(DouOrderBo bo, PageQuery pageQuery) {
long startTimeStamp = 0;
long endTimeStamp = 0;
if(org.springframework.util.StringUtils.hasText(bo.getStartTime())){
Matcher matcher = DATE_FORMAT.matcher(bo.getStartTime());
boolean b = matcher.find();
if(b){
bo.setStartTime(bo.getStartTime()+" 00:00:00");
startTimeStamp = DateUtils.dateTimeStrToTimeStamp(null,bo.getStartTime());
}
}
if(org.springframework.util.StringUtils.hasText(bo.getEndTime())){
Matcher matcher = DATE_FORMAT.matcher(bo.getEndTime());
boolean b = matcher.find();
if(b){
bo.setEndTime(bo.getEndTime()+" 23:59:59");
endTimeStamp = DateUtils.dateTimeStrToTimeStamp(null,bo.getEndTime());
}
}
LambdaQueryWrapper<OmsDouOrder> queryWrapper = new LambdaQueryWrapper<OmsDouOrder>()
.eq(bo.getShopId()!=null,OmsDouOrder::getShopId,bo.getShopId())
.eq(StringUtils.hasText(bo.getOrderId()),OmsDouOrder::getOrderId,bo.getOrderId())
.eq(StringUtils.hasText(bo.getOrderStatus()),OmsDouOrder::getOrderStatus,bo.getOrderStatus())
.ge(StringUtils.hasText(bo.getStartTime()),OmsDouOrder::getCreateTime, startTimeStamp)
.le(StringUtils.hasText(bo.getEndTime()),OmsDouOrder::getCreateTime,endTimeStamp)
;
pageQuery.setOrderByColumn("create_time");
pageQuery.setIsAsc("desc");
Page<OmsDouOrder> taoGoodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
if(taoGoodsPage.getRecords()!=null){
for (var order:taoGoodsPage.getRecords()) {
order.setItems(itemMapper.selectList(new LambdaQueryWrapper<OmsDouOrderItem>().eq(OmsDouOrderItem::getParentOrderId,order.getOrderId())));
}
}
return PageResult.build(taoGoodsPage);
}
@Override
public OmsDouOrder queryDetailById(Long id) {
return mapper.selectById(id);
}
@Transactional
@Override
public ResultVo<Integer> saveOrder(Long shopId, OmsDouOrder order) {
if(order == null ) return ResultVo.error(ResultVoEnum.SystemException);
try {
List<OmsDouOrder> taoOrders = mapper.selectList(new LambdaQueryWrapper<OmsDouOrder>().eq(OmsDouOrder::getOrderId, order.getOrderId()));
if (taoOrders != null && taoOrders.size() > 0) {
// 存在修改
OmsDouOrder update = new OmsDouOrder();
update.setId(taoOrders.get(0).getId());
update.setOrderStatus(order.getOrderStatus());
update.setOrderStatusDesc(order.getOrderStatusDesc());
update.setBuyerWords(order.getBuyerWords());
update.setSellerWords(order.getSellerWords());
update.setSellerRemarkStars(order.getSellerRemarkStars());
update.setCancelReason(order.getCancelReason());
update.setChannelPaymentNo(order.getChannelPaymentNo());
update.setPayTime(order.getPayTime());
update.setUpdateTime(order.getUpdateTime());
update.setFinishTime(order.getFinishTime());
update.setOrderExpireTime(order.getOrderExpireTime());
update.setLogisticsInfo(order.getLogisticsInfo());
update.setMainStatus(order.getMainStatus());
update.setMainStatusDesc(order.getMainStatusDesc());
update.setMaskPostReceiver(order.getMaskPostReceiver());
update.setMaskPostTel(order.getMaskPostTel());
update.setMaskPostAddress(order.getMaskPostAddress());
update.setPayAmount(order.getPayAmount());
update.setPayType(order.getPayType());
update.setShipTime(order.getShipTime());
update.setTotalPromotionAmount(order.getTotalPromotionAmount());
update.setModifyAmount(order.getModifyAmount());
update.setModifyPostAmount(order.getModifyPostAmount());
update.setLastPullTime(new Date());
mapper.updateById(update);
// 删除item
itemMapper.delete(new LambdaQueryWrapper<OmsDouOrderItem>().eq(OmsDouOrderItem::getParentOrderId,order.getOrderId()));
for (var item : order.getItems()) {
// 新增
itemMapper.insert(item);
}
return ResultVo.error(ResultVoEnum.DataExist, "订单已经存在,更新成功");
} else {
// 不存在新增
order.setShopId(shopId);
order.setAuditStatus(0);
order.setPullTime(new Date());
mapper.insert(order);
// 添加item
for (var item : order.getItems()) {
itemMapper.insert(item);
}
return ResultVo.success();
}
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace();
log.info("保存订单数据错误:"+e.getMessage());
return ResultVo.error(ResultVoEnum.SystemException, "系统异常:" + e.getMessage());
}
}
}

View File

@ -1,20 +1,31 @@
package com.qihang.dou.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.dou.domain.SShopPullLasttime;
import com.qihang.dou.service.SShopPullLasttimeService;
import com.qihang.dou.mapper.SShopPullLasttimeMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author TW
* @description 针对表s_shop_pull_lasttime(店铺更新最后时间记录)的数据库操作Service实现
* @createDate 2024-06-11 14:40:36
*/
@AllArgsConstructor
@Service
public class SShopPullLasttimeServiceImpl extends ServiceImpl<SShopPullLasttimeMapper, SShopPullLasttime>
implements SShopPullLasttimeService{
private final SShopPullLasttimeMapper mapper;
@Override
public SShopPullLasttime getLasttimeByShop(Long shopId, String pullType) {
List<SShopPullLasttime> sysShopPullLasttimes = mapper.selectList(new LambdaQueryWrapper<SShopPullLasttime>().eq(SShopPullLasttime::getShopId, shopId).eq(SShopPullLasttime::getPullType, pullType));
if(sysShopPullLasttimes != null && !sysShopPullLasttimes.isEmpty()) return sysShopPullLasttimes.get(0);
else return null;
}
}

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="30 seconds">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="./logs" />
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<!-- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %boldMagenta(%-5level %logger{50}) : %msg%n</pattern>-->
<pattern>%d{yyyy-MM-dd HH:mm:ss:SS} %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{50}) - %cyan(%msg%n)</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>3</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!--logstash配置-->
<!-- <appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
<!-- <destination>127.0.0.1:4560</destination>-->
<!-- &lt;!&ndash; 日志输出编码 &ndash;&gt;-->
<!-- <encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">-->
<!-- <providers>-->
<!-- <timestamp>-->
<!-- <timeZone>UTC</timeZone>-->
<!-- </timestamp>-->
<!-- <pattern>-->
<!-- <pattern>-->
<!-- {-->
<!-- "logLevel": "%level",-->
<!-- "serviceName": "${springAppName:-}",-->
<!-- "pid": "${PID:-}",-->
<!-- "thread": "%thread",-->
<!-- "class": "%logger{40}",-->
<!-- "rest": "%msg"-->
<!-- }-->
<!-- </pattern>-->
<!-- </pattern>-->
<!-- </providers>-->
<!-- </encoder>-->
<!-- &lt;!&ndash;<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>&ndash;&gt;-->
<!-- </appender>-->
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<!-- <appender-ref ref="LOGSTASH"/>-->
</root>
</configuration>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qihang.dou.mapper.OmsDouOrderItemMapper">
<resultMap id="BaseResultMap" type="com.qihang.dou.domain.OmsDouOrderItem">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="parentOrderId" column="parent_order_id" jdbcType="VARCHAR"/>
<result property="orderLevel" column="order_level" jdbcType="INTEGER"/>
<result property="adEnvType" column="ad_env_type" jdbcType="VARCHAR"/>
<result property="afterSaleStatus" column="after_sale_status" jdbcType="INTEGER"/>
<result property="afterSaleType" column="after_sale_type" jdbcType="INTEGER"/>
<result property="refundStatus" column="refund_status" jdbcType="INTEGER"/>
<result property="authorCostAmount" column="author_cost_amount" jdbcType="INTEGER"/>
<result property="authorId" column="author_id" jdbcType="INTEGER"/>
<result property="authorName" column="author_name" jdbcType="VARCHAR"/>
<result property="cBiz" column="c_biz" jdbcType="INTEGER"/>
<result property="cBizDesc" column="c_biz_desc" jdbcType="VARCHAR"/>
<result property="cancelReason" column="cancel_reason" jdbcType="VARCHAR"/>
<result property="channelPaymentNo" column="channel_payment_no" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="confirmReceiptTime" column="confirm_receipt_time" jdbcType="INTEGER"/>
<result property="finishTime" column="finish_time" jdbcType="INTEGER"/>
<result property="goodsPrice" column="goods_price" jdbcType="INTEGER"/>
<result property="goodsType" column="goods_type" jdbcType="INTEGER"/>
<result property="isComment" column="is_comment" jdbcType="INTEGER"/>
<result property="itemNum" column="item_num" jdbcType="INTEGER"/>
<result property="logisticsReceiptTime" column="logistics_receipt_time" jdbcType="INTEGER"/>
<result property="modifyAmount" column="modify_amount" jdbcType="INTEGER"/>
<result property="modifyPostAmount" column="modify_post_amount" jdbcType="INTEGER"/>
<result property="onlyPlatformCostAmount" column="only_platform_cost_amount" jdbcType="INTEGER"/>
<result property="orderAmount" column="order_amount" jdbcType="INTEGER"/>
<result property="payAmount" column="pay_amount" jdbcType="INTEGER"/>
<result property="postInsuranceAmount" column="post_insurance_amount" jdbcType="INTEGER"/>
<result property="promotionAmount" column="promotion_amount" jdbcType="INTEGER"/>
<result property="promotionShopAmount" column="promotion_shop_amount" jdbcType="INTEGER"/>
<result property="promotionPlatformAmount" column="promotion_platform_amount" jdbcType="INTEGER"/>
<result property="shopCostAmount" column="shop_cost_amount" jdbcType="INTEGER"/>
<result property="platformCostAmount" column="platform_cost_amount" jdbcType="INTEGER"/>
<result property="promotionTalentAmount" column="promotion_talent_amount" jdbcType="INTEGER"/>
<result property="promotionPayAmount" column="promotion_pay_amount" jdbcType="INTEGER"/>
<result property="originAmount" column="origin_amount" jdbcType="INTEGER"/>
<result property="outProductId" column="out_product_id" jdbcType="VARCHAR"/>
<result property="outSkuId" column="out_sku_id" jdbcType="VARCHAR"/>
<result property="productId" column="product_id" jdbcType="BIGINT"/>
<result property="skuId" column="sku_id" jdbcType="BIGINT"/>
<result property="productName" column="product_name" jdbcType="VARCHAR"/>
<result property="productPic" column="product_pic" jdbcType="VARCHAR"/>
<result property="promotionRedpackAmount" column="promotion_redpack_amount" jdbcType="INTEGER"/>
<result property="promotionRedpackPlatformAmount" column="promotion_redpack_platform_amount" jdbcType="INTEGER"/>
<result property="promotionRedpackTalentAmount" column="promotion_redpack_talent_amount" jdbcType="INTEGER"/>
<result property="roomId" column="room_id" jdbcType="INTEGER"/>
<result property="shipTime" column="ship_time" jdbcType="INTEGER"/>
<result property="spec" column="spec" jdbcType="VARCHAR"/>
<result property="themeTypeDesc" column="theme_type_desc" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="INTEGER"/>
<result property="videoId" column="video_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,order_id,parent_order_id,
order_level,ad_env_type,after_sale_status,
after_sale_type,refund_status,author_cost_amount,
author_id,author_name,c_biz,
c_biz_desc,cancel_reason,channel_payment_no,
code,confirm_receipt_time,finish_time,
goods_price,goods_type,is_comment,
item_num,logistics_receipt_time,modify_amount,
modify_post_amount,only_platform_cost_amount,order_amount,
pay_amount,post_insurance_amount,promotion_amount,
promotion_shop_amount,promotion_platform_amount,shop_cost_amount,
platform_cost_amount,promotion_talent_amount,promotion_pay_amount,
origin_amount,out_product_id,out_sku_id,
product_id,sku_id,product_name,
product_pic,promotion_redpack_amount,promotion_redpack_platform_amount,
promotion_redpack_talent_amount,room_id,ship_time,
spec,theme_type_desc,update_time,
create_time,video_id
</sql>
</mapper>

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qihang.dou.mapper.OmsDouOrderMapper">
<resultMap id="BaseResultMap" type="com.qihang.dou.domain.OmsDouOrder">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="orderLevel" column="order_level" jdbcType="INTEGER"/>
<result property="orderPhaseList" column="order_phase_list" jdbcType="VARCHAR"/>
<result property="orderStatus" column="order_status" jdbcType="INTEGER"/>
<result property="orderStatusDesc" column="order_status_desc" jdbcType="VARCHAR"/>
<result property="orderTag" column="order_tag" jdbcType="VARCHAR"/>
<result property="orderType" column="order_type" jdbcType="INTEGER"/>
<result property="orderTypeDesc" column="order_type_desc" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="INTEGER"/>
<result property="openId" column="open_id" jdbcType="VARCHAR"/>
<result property="acceptOrderStatus" column="accept_order_status" jdbcType="INTEGER"/>
<result property="appointmentShipTime" column="appointment_ship_time" jdbcType="INTEGER"/>
<result property="authorCostAmount" column="author_cost_amount" jdbcType="INTEGER"/>
<result property="awemeId" column="aweme_id" jdbcType="VARCHAR"/>
<result property="bType" column="b_type" jdbcType="INTEGER"/>
<result property="bTypeDesc" column="b_type_desc" jdbcType="VARCHAR"/>
<result property="subBType" column="sub_b_type" jdbcType="INTEGER"/>
<result property="subBTypeDesc" column="sub_b_type_desc" jdbcType="VARCHAR"/>
<result property="biz" column="biz" jdbcType="INTEGER"/>
<result property="bizDesc" column="biz_desc" jdbcType="VARCHAR"/>
<result property="buyerWords" column="buyer_words" jdbcType="VARCHAR"/>
<result property="sellerWords" column="seller_words" jdbcType="VARCHAR"/>
<result property="sellerRemarkStars" column="seller_remark_stars" jdbcType="INTEGER"/>
<result property="cancelReason" column="cancel_reason" jdbcType="VARCHAR"/>
<result property="channelPaymentNo" column="channel_payment_no" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="INTEGER"/>
<result property="payTime" column="pay_time" jdbcType="INTEGER"/>
<result property="updateTime" column="update_time" jdbcType="INTEGER"/>
<result property="finishTime" column="finish_time" jdbcType="INTEGER"/>
<result property="orderExpireTime" column="order_expire_time" jdbcType="INTEGER"/>
<result property="doudianOpenId" column="doudian_open_id" jdbcType="VARCHAR"/>
<result property="encryptPostReceiver" column="encrypt_post_receiver" jdbcType="VARCHAR"/>
<result property="encryptPostTel" column="encrypt_post_tel" jdbcType="VARCHAR"/>
<result property="encryptPostAddress" column="encrypt_post_address" jdbcType="VARCHAR"/>
<result property="expShipTime" column="exp_ship_time" jdbcType="INTEGER"/>
<result property="logisticsInfo" column="logistics_info" jdbcType="VARCHAR"/>
<result property="mainStatus" column="main_status" jdbcType="INTEGER"/>
<result property="mainStatusDesc" column="main_status_desc" jdbcType="VARCHAR"/>
<result property="maskPostReceiver" column="mask_post_receiver" jdbcType="VARCHAR"/>
<result property="maskPostTel" column="mask_post_tel" jdbcType="VARCHAR"/>
<result property="maskPostAddress" column="mask_post_address" jdbcType="VARCHAR"/>
<result property="provinceName" column="province_name" jdbcType="VARCHAR"/>
<result property="provinceId" column="province_id" jdbcType="INTEGER"/>
<result property="cityName" column="city_name" jdbcType="VARCHAR"/>
<result property="cityId" column="city_id" jdbcType="INTEGER"/>
<result property="townName" column="town_name" jdbcType="VARCHAR"/>
<result property="townId" column="town_id" jdbcType="INTEGER"/>
<result property="streetName" column="street_name" jdbcType="VARCHAR"/>
<result property="streetId" column="street_id" jdbcType="INTEGER"/>
<result property="openAddressId" column="open_address_id" jdbcType="VARCHAR"/>
<result property="modifyAmount" column="modify_amount" jdbcType="INTEGER"/>
<result property="modifyPostAmount" column="modify_post_amount" jdbcType="INTEGER"/>
<result property="onlyPlatformCostAmount" column="only_platform_cost_amount" jdbcType="INTEGER"/>
<result property="orderAmount" column="order_amount" jdbcType="INTEGER"/>
<result property="payAmount" column="pay_amount" jdbcType="INTEGER"/>
<result property="payType" column="pay_type" jdbcType="INTEGER"/>
<result property="postAmount" column="post_amount" jdbcType="INTEGER"/>
<result property="postInsuranceAmount" column="post_insurance_amount" jdbcType="INTEGER"/>
<result property="postOriginAmount" column="post_origin_amount" jdbcType="INTEGER"/>
<result property="postPromotionAmount" column="post_promotion_amount" jdbcType="INTEGER"/>
<result property="promotionAmount" column="promotion_amount" jdbcType="INTEGER"/>
<result property="promotionPayAmount" column="promotion_pay_amount" jdbcType="INTEGER"/>
<result property="promotionPlatformAmount" column="promotion_platform_amount" jdbcType="INTEGER"/>
<result property="promotionRedpackAmount" column="promotion_redpack_amount" jdbcType="INTEGER"/>
<result property="promotionRedpackPlatformAmount" column="promotion_redpack_platform_amount" jdbcType="INTEGER"/>
<result property="promotionRedpackTalentAmount" column="promotion_redpack_talent_amount" jdbcType="INTEGER"/>
<result property="promotionShopAmount" column="promotion_shop_amount" jdbcType="INTEGER"/>
<result property="promotionTalentAmount" column="promotion_talent_amount" jdbcType="INTEGER"/>
<result property="shipTime" column="ship_time" jdbcType="INTEGER"/>
<result property="shopCostAmount" column="shop_cost_amount" jdbcType="INTEGER"/>
<result property="platformCostAmount" column="platform_cost_amount" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="shopName" column="shop_name" jdbcType="VARCHAR"/>
<result property="totalPromotionAmount" column="total_promotion_amount" jdbcType="INTEGER"/>
<result property="userTagUi" column="user_tag_ui" jdbcType="VARCHAR"/>
<result property="sShopId" column="s_shop_id" jdbcType="INTEGER"/>
<result property="pullTime" column="pull_time" jdbcType="TIMESTAMP"/>
<result property="lastPullTime" column="last_pull_time" jdbcType="TIMESTAMP"/>
<result property="auditStatus" column="audit_status" jdbcType="INTEGER"/>
<result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,order_id,order_level,
order_phase_list,order_status,order_status_desc,
order_tag,order_type,order_type_desc,
app_id,open_id,accept_order_status,
appointment_ship_time,author_cost_amount,aweme_id,
b_type,b_type_desc,sub_b_type,
sub_b_type_desc,biz,biz_desc,
buyer_words,seller_words,seller_remark_stars,
cancel_reason,channel_payment_no,create_time,
pay_time,update_time,finish_time,
order_expire_time,doudian_open_id,encrypt_post_receiver,
encrypt_post_tel,encrypt_post_address,exp_ship_time,
logistics_info,main_status,main_status_desc,
mask_post_receiver,mask_post_tel,mask_post_address,
province_name,province_id,city_name,
city_id,town_name,town_id,
street_name,street_id,open_address_id,
modify_amount,modify_post_amount,only_platform_cost_amount,
order_amount,pay_amount,pay_type,
post_amount,post_insurance_amount,post_origin_amount,
post_promotion_amount,promotion_amount,promotion_pay_amount,
promotion_platform_amount,promotion_redpack_amount,promotion_redpack_platform_amount,
promotion_redpack_talent_amount,promotion_shop_amount,promotion_talent_amount,
ship_time,shop_cost_amount,platform_cost_amount,
shop_id,shop_name,total_promotion_amount,
user_tag_ui,s_shop_id,pull_time,
last_pull_time,audit_status,audit_time
</sql>
</mapper>

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询抖店订单列表
export function listOrder(query) {
return request({
url: '/dou/order/list',
url: '/dou-api/order/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listOrder(query) {
// 查询抖店订单详细
export function getOrder(id) {
return request({
url: '/dou/order/' + id,
url: '/dou-api/order/' + id,
method: 'get'
})
}
@ -26,28 +26,20 @@ export function addOrder(data) {
})
}
// 修改抖店订单
export function confirmOrder(data) {
// 接口拉取订单
export function pullOrder(data) {
return request({
url: '/dou/order/confirm',
url: '/dou-api/order/pull_order',
method: 'post',
data: data
})
}
// 删除抖店订单
export function delOrder(id) {
export function pushOms(data) {
return request({
url: '/dou/order/' + id,
method: 'delete'
})
}
// 接口拉取淘宝订单
export function pullOrder(query) {
return request({
url: '/douapi/order/pull_order',
method: 'get',
params: query
url: '/dou-api/order/push_oms',
method: 'post',
data: data
})
}

View File

@ -1,226 +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">
<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: "GoodsDou",
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>

File diff suppressed because it is too large Load Diff

View File

@ -1,226 +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">
<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: "GoodsPdd",
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:4}).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

@ -22,7 +22,7 @@
<script>
import OrderTao from "@/views/shop/tao/order/index";
import OrderJd from "@/views/shop/jd/order/index";
import OrderDou from "@/views/dou/order/index";
import OrderDou from "@/views/shop/dou/order/index";
import OrderPdd from "@/views/shop/pdd/order/index";
export default {
name: "Order",

View File

@ -0,0 +1,336 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="订单号" prop="orderId">
<el-input
v-model="queryParams.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 shopList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="下单时间" prop="orderTime">
<el-date-picker clearable
v-model="orderTime" value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择状态" clearable @change="handleQuery">
<el-option label="待支付" value="1" ></el-option>
<el-option label="已支付" value="105"></el-option>
<el-option label="备货中" value="2"> </el-option>
<el-option label="部分发货" value="101"> </el-option>
<el-option label="已发货" value="3"> </el-option>
<el-option label="已取消" value="4"> </el-option>
<el-option label="已完成" value="5"> </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
:loading="pullLoading"
type="success"
plain
icon="el-icon-download"
size="mini"
@click="handlePull"
>API拉取订单</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-refresh"
size="mini"
:disabled="multiple"
@click="handlePushOms"
>手动将选中订单推送到OMS</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="订单号" align="center" prop="orderId" />
<el-table-column label="店铺" align="center" prop="shopId" >
<template slot-scope="scope">
<span>{{ shopList.find(x=>x.id === scope.row.shopId).name }}</span>
</template>
</el-table-column>
<el-table-column label="商品" width="350">
<template slot-scope="scope">
<el-row v-for="item in scope.row.items" :key="item.id" :gutter="20">
<div style="float: left;display: flex;align-items: center;" >
<el-image style="width: 70px; height: 70px;" :src="item.productPic"></el-image>
<div style="margin-left:10px">
<p>{{item.productName}}
</p>
<p>SKU编码{{item.code}}</p>
<p>数量<el-tag size="small">x {{item.itemNum}}</el-tag></p>
</div>
</div>
</el-row>
</template>
</el-table-column>
<el-table-column label="实付总金额" align="center" prop="payAmount" >
<template slot-scope="scope">
<span>{{ amountFormatter(null,null,scope.row.payAmount/100,0) }}</span>
</template>
</el-table-column>
<el-table-column label="订单创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="买家留言" align="center" prop="buyerWords" />
<el-table-column label="卖家备注" align="center" prop="sellerWords" />
<el-table-column label="订单状态" align="center" prop="orderStatus" >
<template slot-scope="scope">
<el-tag size="small" v-if="scope.row.orderStatus === 1"> 待支付</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 105"> 已支付</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 2"> 备货中</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 101"> 部分发货</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 3"> 已发货</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 4"> 已取消</el-tag>
<el-tag size="small" v-if="scope.row.orderStatus === 5"> 已完成</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
:loading="pullLoading"
size="mini"
icon="el-icon-refresh"
@click="handlePullUpdate(scope.row)"
>更新订单</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"
/>
</div>
</template>
<script>
import {listOrder, pullOrder, getOrder, pushOms, pullOrderDetail} from "@/api/dou/order";
import { listShop } from "@/api/shop/shop";
export default {
name: "OrderDou",
data() {
return {
//
loading: true,
//
showSearch: true,
pullLoading: false,
//
ids: [],
//
single: true,
detailOpen: false,
multiple: true,
//
total: 0,
//
orderList: [],
shopList:[],
orderTime:null,
//
queryParams: {
pageNum: 1,
pageSize: 10,
shopId: null,
tid: null,
startTime: null,
endTime: null,
status: null
},
//
form: {
},
rules: {
}
};
},
created() {
listShop({platform:6}).then(response => {
this.shopList = response.rows;
if (this.shopList && this.shopList.length > 0) {
this.queryParams.shopId = this.shopList[0].id
}
this.getList();
});
// this.getList();
},
methods: {
amountFormatter(row, column, cellValue, index) {
return '¥' + cellValue.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
},
/** 查询淘宝订单列表 */
getList() {
if(this.orderTime){
this.queryParams.startTime = this.orderTime[0]
this.queryParams.endTime = this.orderTime[1]
}else {
this.queryParams.startTime = null
this.queryParams.endTime = null
}
this.loading = true;
listOrder(this.queryParams).then(response => {
this.orderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.detailOpen = false;
this.saleAfterOpen = false
this.reset();
},
//
reset() {
this.form = {
id: null,
shopId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.orderTime=null
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.orderId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handlePullDetailByTid(){
if(this.queryParams.shopId && this.queryParams.orderId) {
this.pullLoading = true
pullOrderDetail({shopId:this.queryParams.shopId,orderId:this.queryParams.orderId}).then(response => {
console.log('拉取淘宝订单接口返回=====',response)
this.$modal.msgSuccess(JSON.stringify(response));
this.pullLoading = false
})
}else{
this.$modal.msgSuccess("请先输入订单号并且选择店铺");
}
},
handlePull() {
if(this.queryParams.shopId){
this.pullLoading = true
pullOrder({shopId:this.queryParams.shopId,updType:0}).then(response => {
console.log('拉取dou订单接口返回=====',response)
if(response.code === 1401) {
MessageBox.confirm('Token已过期需要重新授权请前往店铺列表重新获取授权', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
this.$router.push({path:"/shop/shop_list",query:{type:3}})
// isRelogin.show = false;
// store.dispatch('LogOut').then(() => {
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
// })
}).catch(() => {
isRelogin.show = false;
});
// return Promise.reject('')
}else{
this.$modal.msgSuccess(JSON.stringify(response));
this.getList()
}
this.pullLoading = false
})
}else{
this.$modal.msgSuccess("请先选择店铺");
}
// this.$modal.msgSuccess("API");
},
handlePullUpdate(row) {
//
this.pullLoading = true
pullOrderDetail({shopId:row.shopId,orderId:row.orderId}).then(response => {
console.log('拉取dou订单接口返回=====',response)
this.$modal.msgSuccess(JSON.stringify(response));
this.pullLoading = false
})
},
handleDetail(row) {
this.reset();
const id = row.id || this.ids
getOrder(id).then(response => {
this.form = response.data;
this.goodsList = response.data.taoOrderItemList;
this.detailOpen = true;
this.detailTitle = "订单详情";
});
this.isAudit = false
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
}
});
},
handlePushOms(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否手动推送到系统?').then(function() {
return pushOms({ids:ids});
}).then(() => {
// this.getList();
this.$modal.msgSuccess("推送成功");
}).catch(() => {});
},
}
};
</script>

View File

@ -25,7 +25,7 @@
<script>
import OrderTao from "@/views/shop/tao/order/index";
import OrderJd from "@/views/shop/jd/order/index";
import OrderDou from "@/views/dou/order/index";
import OrderDou from "@/views/shop/dou/order/index";
import OrderPdd from "@/views/shop/pdd/order/index";
import OrderWei from "@/views/shop/wei/order/index";
export default {