...
|
...
|
@@ -37,6 +37,7 @@ import com.yohoufo.order.service.proxy.DeliveryMinutesService; |
|
|
import com.yohoufo.order.service.proxy.InBoxFacade;
|
|
|
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
|
|
|
import com.yohoufo.order.utils.BuyerOrderUtils;
|
|
|
import com.yohoufo.order.utils.SellerGoodsHelper;
|
|
|
import com.yohoufo.order.utils.TimeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -96,6 +97,17 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { |
|
|
|
|
|
@Autowired
|
|
|
private AppraiseService appraiseService;
|
|
|
|
|
|
private boolean isDepositWithQuickDeliverGoods(int uid, long orderCode, Integer oa){
|
|
|
BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(pbog.getSkup());
|
|
|
Integer goodsAttr=null ;
|
|
|
boolean result = BuyerOrderUtils.isDeposit(oa)
|
|
|
&& SellerGoodsHelper.isQuickDeliver(SkupType.getSkupType(goodsAttr=psog.getAttributes()));
|
|
|
logger.info("after paid isDepositWithQuickDeliverGoods, uid {} ordercode {} orderAttr {} goodsAttr {}",
|
|
|
uid, orderCode, oa, goodsAttr);
|
|
|
return result;
|
|
|
}
|
|
|
/**
|
|
|
* 更新订单状态
|
|
|
* @param orderInfo
|
...
|
...
|
@@ -108,12 +120,16 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { |
|
|
buyerOrder.setUid(uid);
|
|
|
OrderStatus targetOrderStatus = OrderStatus.HAS_PAYED;
|
|
|
boolean isQuickDeliver = false;
|
|
|
boolean isDepositWithQuickDeliverGoods = false;
|
|
|
//门店订单支付后直接完成
|
|
|
if(BuyerOrderUtils.isOffline(orderInfo) ) {
|
|
|
targetOrderStatus = OrderStatus.DONE;
|
|
|
}else if(isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes())){
|
|
|
}else if((isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes()))
|
|
|
|| (isDepositWithQuickDeliverGoods = isDepositWithQuickDeliverGoods(uid, orderCode, orderInfo.getAttributes()))){
|
|
|
targetOrderStatus = OrderStatus.WAITING_RECEIVE;
|
|
|
}
|
|
|
logger.info("after paid updateOrderStatusPaid uid {} orderCode {} isQuickDeliver {} isDepositWithQuickDeliverGoods {} ",
|
|
|
uid, orderCode, isQuickDeliver, isDepositWithQuickDeliverGoods);
|
|
|
int orderStatusCode = targetOrderStatus.getCode();
|
|
|
buyerOrder.setStatus(orderStatusCode);
|
|
|
|
...
|
...
|
@@ -136,24 +152,36 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
|
|
|
//寄存订单 & 闪购商品
|
|
|
if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()){
|
|
|
Integer sellerUid = null;
|
|
|
Integer buyerUid = null;
|
|
|
Long orderCode = null;
|
|
|
Integer skup = null;
|
|
|
try {
|
|
|
depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),
|
|
|
orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), true);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
|
|
|
sellerUid, buyerUid, orderCode, skup);
|
|
|
}
|
|
|
|
|
|
private void processDepositOrderOfQuickDeliverGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
|
|
|
Integer sellerUid = null;
|
|
|
Integer buyerUid = null;
|
|
|
Long orderCode = null;
|
|
|
Integer skup = null;
|
|
|
try {
|
|
|
depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),
|
|
|
orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), true);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
|
|
|
sellerUid, buyerUid, orderCode, skup);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void processDepositOrderOfInstockGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
|
|
|
processInStockOrder(buyerOrder, sellerOrderGoods);
|
|
|
}
|
|
|
|
|
|
|
|
|
private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
|
|
|
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
|
|
|
//寄存订单 & 闪购商品
|
|
|
switch (skupType){
|
|
|
case QUICK_DELIVER:
|
|
|
processDepositOrderOfQuickDeliverGoods(buyerOrder, sellerOrderGoods);
|
|
|
break;
|
|
|
case IN_STOCK:
|
|
|
processDepositOrderOfInstockGoods(buyerOrder, sellerOrderGoods);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void processInStockOrder(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){
|
...
|
...
|
|