Authored by TANLING

Merge branch 'test6.9.22' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.22

@@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; @@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
5 import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; 5 import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
6 import com.yohobuy.ufo.model.order.common.OrderStatus; 6 import com.yohobuy.ufo.model.order.common.OrderStatus;
7 import com.yohobuy.ufo.model.order.constants.OrderConstant; 7 import com.yohobuy.ufo.model.order.constants.OrderConstant;
  8 +import com.yohoufo.common.exception.UfoServiceException;
8 import com.yohoufo.dal.order.model.*; 9 import com.yohoufo.dal.order.model.*;
9 import com.yohoufo.dal.product.model.Product; 10 import com.yohoufo.dal.product.model.Product;
10 import com.yohoufo.order.common.RefundCase; 11 import com.yohoufo.order.common.RefundCase;
@@ -13,14 +14,17 @@ import com.yohoufo.order.model.PayRefundBo; @@ -13,14 +14,17 @@ import com.yohoufo.order.model.PayRefundBo;
13 import com.yohoufo.order.model.RequestedStatusChangeBuyerOrder; 14 import com.yohoufo.order.model.RequestedStatusChangeBuyerOrder;
14 import com.yohoufo.order.model.request.PaymentRequest; 15 import com.yohoufo.order.model.request.PaymentRequest;
15 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger; 16 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger;
  17 +import com.yohoufo.order.service.impl.BuyerChangePriceRecordService;
16 import com.yohoufo.order.service.impl.PayRefundService; 18 import com.yohoufo.order.service.impl.PayRefundService;
17 import lombok.val; 19 import lombok.val;
  20 +import org.apache.commons.collections.CollectionUtils;
18 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
20 23
21 import java.math.BigDecimal; 24 import java.math.BigDecimal;
22 import java.util.Collection; 25 import java.util.Collection;
23 import java.util.LinkedHashMap; 26 import java.util.LinkedHashMap;
  27 +import java.util.List;
24 28
25 import static com.yoho.message.sdk.common.constants.UFOMessageScene.*; 29 import static com.yoho.message.sdk.common.constants.UFOMessageScene.*;
26 import static com.yohobuy.ufo.model.order.common.OrderStatus.*; 30 import static com.yohobuy.ufo.model.order.common.OrderStatus.*;
@@ -37,6 +41,9 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange @@ -37,6 +41,9 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange
37 @Autowired 41 @Autowired
38 private PayRefundService payRefundService; 42 private PayRefundService payRefundService;
39 43
  44 + @Autowired
  45 + private BuyerChangePriceRecordService buyerChangePriceRecordService;
  46 +
40 /** 47 /**
41 * @param statusChangeBuyerOrder 48 * @param statusChangeBuyerOrder
42 * @return 49 * @return
@@ -44,6 +51,15 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange @@ -44,6 +51,15 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange
44 @Override 51 @Override
45 protected boolean beforeChange(RequestedStatusChangeBuyerOrder statusChangeBuyerOrder) { 52 protected boolean beforeChange(RequestedStatusChangeBuyerOrder statusChangeBuyerOrder) {
46 BuyerOrder buyerOrder = statusChangeBuyerOrder.getBuyerOrder(); 53 BuyerOrder buyerOrder = statusChangeBuyerOrder.getBuyerOrder();
  54 + /**
  55 + * 调价未完成,会将原skup重新上架,如果不判断是否有待处理的调价记录,会导致买家订单取消了,但求购skup还在求购状态中
  56 + */
  57 + List<BuyerChangePriceRecord> buyerChangePriceRecords = buyerChangePriceRecordService.queryWaitingRecordsByPreOrderCode(buyerOrder.getOrderCode());
  58 + if (CollectionUtils.isNotEmpty(buyerChangePriceRecords)) {
  59 + logger.warn("[{}] orderCode exist waiting deal change price record,can't cancel", buyerOrder.getOrderCode());
  60 + throw new UfoServiceException(500, "有未完成的调价");
  61 + }
  62 +
47 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrder.getOrderCode()); 63 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrder.getOrderCode());
48 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup()); 64 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup());
49 /** 65 /**
@@ -45,6 +45,11 @@ public class BuyerOrderWaitingPayDepositCancelChanger extends AbstractBuyerOrder @@ -45,6 +45,11 @@ public class BuyerOrderWaitingPayDepositCancelChanger extends AbstractBuyerOrder
45 if (buyerChangePriceRecord == null) { 45 if (buyerChangePriceRecord == null) {
46 return; 46 return;
47 } 47 }
  48 +
  49 + //还原原skup为可售状态
  50 + logger.info("[{}] bid skup need to be reset saleable status", buyerChangePriceRecord.getPreSkup());
  51 + bidProductProxyService.resetSaleableFromUserCancel(buyerChangePriceRecord.getPreSkup());
  52 +
48 ChangePriceStatus targetStatus; 53 ChangePriceStatus targetStatus;
49 switch (operator) { 54 switch (operator) {
50 case CS: 55 case CS:
@@ -56,10 +61,6 @@ public class BuyerOrderWaitingPayDepositCancelChanger extends AbstractBuyerOrder @@ -56,10 +61,6 @@ public class BuyerOrderWaitingPayDepositCancelChanger extends AbstractBuyerOrder
56 } 61 }
57 //状态变成取消 62 //状态变成取消
58 buyerChangePriceRecordService.changeRecordStatus(buyerChangePriceRecord.getOrderCode(), ChangePriceStatus.WAITING_DEAL, targetStatus); 63 buyerChangePriceRecordService.changeRecordStatus(buyerChangePriceRecord.getOrderCode(), ChangePriceStatus.WAITING_DEAL, targetStatus);
59 -  
60 - //还原原skup为可售状态  
61 - logger.info("[{}] bid skup need to be reset saleable status", buyerChangePriceRecord.getPreSkup());  
62 - bidProductProxyService.resetSaleableFromUserCancel(buyerChangePriceRecord.getPreSkup());  
63 } 64 }
64 65
65 private BuyerChangePriceRecord getWaitingDealBuyerChangePriceRecord(long orderCode) { 66 private BuyerChangePriceRecord getWaitingDealBuyerChangePriceRecord(long orderCode) {