...
|
...
|
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl; |
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.base.Joiner;
|
|
|
import com.google.common.base.Throwables;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yoho.core.common.helpers.ImagesHelper;
|
|
|
import com.yoho.core.rabbitmq.YhProducer;
|
...
|
...
|
@@ -31,7 +32,6 @@ import com.yohoufo.common.utils.UserInfoHiddenHelper; |
|
|
import com.yohoufo.dal.order.*;
|
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.order.common.ExpressForMqSend;
|
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.constants.SellerConfig;
|
|
|
import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
|
|
|
import com.yohoufo.order.event.ErpBuyerOrderEvent;
|
...
|
...
|
@@ -171,6 +171,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
@Autowired
|
|
|
private SkupService skupService;
|
|
|
|
|
|
@Autowired
|
|
|
private ProductProxyService productProxyService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 这个方法请尽量保持单一原则
|
...
|
...
|
@@ -303,22 +306,27 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
if(existDepositGoods){
|
|
|
//set depot num
|
|
|
depotNum = DepotType.NJ.getCode();
|
|
|
//bind deposit code 2 buyer order
|
|
|
buyerOrderMetaService.saveDepositCode(depositCode, buyerUid, orderCode);
|
|
|
|
|
|
//生成内部使用的物流单号
|
|
|
wayBillCode = new StringBuilder()
|
|
|
.append(orderCode)
|
|
|
.append("_")
|
|
|
.append(depositCode).toString();
|
|
|
//TODO skup 下架
|
|
|
StorageDeposit psd = dscNode.getPsd();
|
|
|
//TODO 寄存商品 出库准备
|
|
|
|
|
|
}
|
|
|
//香港卖家不能售卖现货 在业务规则上天然互斥
|
|
|
if (isHKLargeSettlementSuper(sellerUid)) {
|
|
|
depotNum = DepotType.HK.getCode();
|
|
|
}
|
|
|
updateOrderCnt = processBuyerOrder(preparedData, expressCompanyId, expressType, wayBillCode, depotNum);
|
|
|
if (updateOrderCnt>0){
|
|
|
try {
|
|
|
processOrderDeliverByDepositGoods(preparedData, dscNode);
|
|
|
}catch (Exception ex){
|
|
|
LOGGER.warn("deliverToDepot processOrderDeliverByDepositGoods fail ,req {} error {}",
|
|
|
req, Throwables.getStackTraceAsString(ex));
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case GOODS_SERVICE:
|
...
|
...
|
@@ -364,6 +372,31 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
LOGGER.info("deliverToDepot update buyer order status, orderCode {} result {} ", orderCode, updateOrderCnt);
|
|
|
}
|
|
|
|
|
|
private void processOrderDeliverByDepositGoods(BuyerOrderAssistant.PreparedData preparedData,
|
|
|
BuyerOrderAssistant.DepositSkuCheckNode dscNode){
|
|
|
if (!dscNode.isExistDepositGoods()){
|
|
|
return;
|
|
|
}
|
|
|
BuyerOrder buyerOrder = preparedData.getBuyerOrder();
|
|
|
Integer buyerUid = buyerOrder.getUid();
|
|
|
Long orderCode = buyerOrder.getOrderCode();
|
|
|
String depositCode = dscNode.getDepositCode();
|
|
|
//bind deposit code 2 buyer order
|
|
|
buyerOrderMetaService.saveDepositCode(depositCode, buyerUid, orderCode);
|
|
|
//TODO skup 下架
|
|
|
StorageDeposit psd = dscNode.getPsd();
|
|
|
Integer skup;
|
|
|
Integer productId;
|
|
|
if (Objects.nonNull(skup = psd.getNewSkup())){
|
|
|
// 减库存
|
|
|
productProxyService.subtractStorage(productId=psd.getProductId(), skup);
|
|
|
//
|
|
|
skupService.saleOut(skup);
|
|
|
}
|
|
|
//TODO 寄存商品 出库准备
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void returnBackCauseOfBuyerCancelAfterSellerSendOut(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String sellerMobile, boolean unSureFlag) {
|
|
|
Integer expressType = EnumExpressType.EXPRESS_TYPE_REBACK.getCode();
|
...
|
...
|
|