Authored by chenchao

add watch dog in all gate of set price

@@ -2,11 +2,11 @@ package com.yohoufo.order.service.seller.changePrice; @@ -2,11 +2,11 @@ package com.yohoufo.order.service.seller.changePrice;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; 4 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
  5 +import com.yohobuy.ufo.model.order.common.Payment;
5 import com.yohobuy.ufo.model.order.constants.SkupType; 6 import com.yohobuy.ufo.model.order.constants.SkupType;
6 import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq; 7 import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq;
7 import com.yohoufo.common.exception.UfoServiceException; 8 import com.yohoufo.common.exception.UfoServiceException;
8 import com.yohoufo.dal.order.model.SellerWalletDetail; 9 import com.yohoufo.dal.order.model.SellerWalletDetail;
9 -import com.yohobuy.ufo.model.order.common.Payment;  
10 import com.yohoufo.order.model.dto.ChangePricePrepareDTO; 10 import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
11 import com.yohoufo.order.model.dto.LifeCycleSellerGoods; 11 import com.yohoufo.order.model.dto.LifeCycleSellerGoods;
12 import com.yohoufo.order.model.dto.SellerTaskDTO; 12 import com.yohoufo.order.model.dto.SellerTaskDTO;
@@ -15,7 +15,6 @@ import com.yohoufo.order.model.response.OrderSubmitResp; @@ -15,7 +15,6 @@ import com.yohoufo.order.model.response.OrderSubmitResp;
15 import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler; 15 import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler;
16 import com.yohoufo.order.service.handler.SellerIncrPriceTaskHandler; 16 import com.yohoufo.order.service.handler.SellerIncrPriceTaskHandler;
17 import com.yohoufo.order.service.impl.SellerOrderService; 17 import com.yohoufo.order.service.impl.SellerOrderService;
18 -import com.yohoufo.order.service.seller.imperfect.ImperfectGoodsService;  
19 import com.yohoufo.order.service.seller.processor.SellerTaskProcessor; 18 import com.yohoufo.order.service.seller.processor.SellerTaskProcessor;
20 import com.yohoufo.order.utils.LoggerUtils; 19 import com.yohoufo.order.utils.LoggerUtils;
21 import org.slf4j.Logger; 20 import org.slf4j.Logger;
@@ -39,9 +38,6 @@ public class ChangePriceService { @@ -39,9 +38,6 @@ public class ChangePriceService {
39 private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor; 38 private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor;
40 39
41 @Autowired 40 @Autowired
42 - private ImperfectGoodsService imperfectGoodsService;  
43 -  
44 - @Autowired  
45 private SellerTaskProcessor sellerTaskProcessor; 41 private SellerTaskProcessor sellerTaskProcessor;
46 42
47 @Autowired 43 @Autowired
@@ -63,7 +59,6 @@ public class ChangePriceService { @@ -63,7 +59,6 @@ public class ChangePriceService {
63 public SoldPrdComputeBo computeChangePrice(SingleGoodsChangePriceReq req){ 59 public SoldPrdComputeBo computeChangePrice(SingleGoodsChangePriceReq req){
64 LifeCycleSellerGoods lcsg = getLifeCycleSellerGoods(req.getSkup()); 60 LifeCycleSellerGoods lcsg = getLifeCycleSellerGoods(req.getSkup());
65 final SkupType skupType = lcsg.getSkupType(); 61 final SkupType skupType = lcsg.getSkupType();
66 - final Payment payment = lcsg.getPayment();  
67 logger.info("in computeChangePrice 4 single goods, req {} LifeCycleSellerGoods {}", req, lcsg); 62 logger.info("in computeChangePrice 4 single goods, req {} LifeCycleSellerGoods {}", req, lcsg);
68 SoldPrdComputeBo spcb = null; 63 SoldPrdComputeBo spcb = null;
69 switch (skupType){ 64 switch (skupType){
@@ -14,9 +14,9 @@ import com.yohoufo.order.model.SellerOrderContext; @@ -14,9 +14,9 @@ import com.yohoufo.order.model.SellerOrderContext;
14 import com.yohoufo.order.model.dto.ChangePricePrepareDTO; 14 import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
15 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 15 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
16 import com.yohoufo.order.model.dto.SkupDto; 16 import com.yohoufo.order.model.dto.SkupDto;
17 -import com.yohoufo.order.service.seller.orderMeta.SellerAddressService;  
18 -import com.yohoufo.order.service.seller.SkupService;  
19 import com.yohoufo.order.service.seller.PublishProcessor; 17 import com.yohoufo.order.service.seller.PublishProcessor;
  18 +import com.yohoufo.order.service.seller.SkupService;
  19 +import com.yohoufo.order.service.seller.orderMeta.SellerAddressService;
20 import com.yohoufo.order.utils.LoggerUtils; 20 import com.yohoufo.order.utils.LoggerUtils;
21 import org.slf4j.Logger; 21 import org.slf4j.Logger;
22 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,7 +44,6 @@ public class NEGChangePricePublishProcessor @@ -44,7 +44,6 @@ public class NEGChangePricePublishProcessor
44 @Autowired 44 @Autowired
45 private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor; 45 private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor;
46 46
47 -  
48 @Override 47 @Override
49 public ChangePriceOrderContext buildPublishCtx(SingleGoodsChangePriceReq im) { 48 public ChangePriceOrderContext buildPublishCtx(SingleGoodsChangePriceReq im) {
50 return buildSellerOrderContext(im); 49 return buildSellerOrderContext(im);
@@ -26,6 +26,7 @@ import com.yohoufo.order.model.request.PrdQueryReq; @@ -26,6 +26,7 @@ import com.yohoufo.order.model.request.PrdQueryReq;
26 import com.yohoufo.order.service.seller.OrderComputeHandler; 26 import com.yohoufo.order.service.seller.OrderComputeHandler;
27 import com.yohoufo.order.service.seller.OrderComputeProvider; 27 import com.yohoufo.order.service.seller.OrderComputeProvider;
28 import com.yohoufo.order.service.seller.SellerAuthCheckService; 28 import com.yohoufo.order.service.seller.SellerAuthCheckService;
  29 +import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
29 import com.yohoufo.order.service.seller.fee.GoodsAmountService; 30 import com.yohoufo.order.service.seller.fee.GoodsAmountService;
30 import com.yohoufo.order.service.seller.processor.ChangePriceCommonPrepareProcessor; 31 import com.yohoufo.order.service.seller.processor.ChangePriceCommonPrepareProcessor;
31 import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor; 32 import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
@@ -77,6 +78,9 @@ public class SingleGoodsChangePricePrepareProcessor { @@ -77,6 +78,9 @@ public class SingleGoodsChangePricePrepareProcessor {
77 @Autowired 78 @Autowired
78 private GoodsAmountService goodsAmountService; 79 private GoodsAmountService goodsAmountService;
79 80
  81 + @Autowired
  82 + private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
  83 +
80 public void checkGoodsStatus(SellerOrderGoods psog){ 84 public void checkGoodsStatus(SellerOrderGoods psog){
81 if (SkupStatus.CAN_SELL.getCode() != psog.getStatus().intValue()){ 85 if (SkupStatus.CAN_SELL.getCode() != psog.getStatus().intValue()){
82 logger.warn("in SingleGoodsChangePricePrepareProcessor.checkGoodsStatus not can sale, SellerOrderGoods {}", psog); 86 logger.warn("in SingleGoodsChangePricePrepareProcessor.checkGoodsStatus not can sale, SellerOrderGoods {}", psog);
@@ -128,6 +132,7 @@ public class SingleGoodsChangePricePrepareProcessor { @@ -128,6 +132,7 @@ public class SingleGoodsChangePricePrepareProcessor {
128 changePriceCommonPrepareProcessor.checkChangeNecessary(skup, preSalePrice, salePrice); 132 changePriceCommonPrepareProcessor.checkChangeNecessary(skup, preSalePrice, salePrice);
129 PrdPrice prdPrice; 133 PrdPrice prdPrice;
130 int storageId = psog.getStorageId(); 134 int storageId = psog.getStorageId();
  135 + sellerOrderRiskWatchDog.checkPublishPriceLimit(uid, storageId, skupType, salePrice);
131 PrdQueryReq pqr = PrdQueryReq.builder() 136 PrdQueryReq pqr = PrdQueryReq.builder()
132 .uid(uid).prdPrice(salePrice).storageId(storageId).build(); 137 .uid(uid).prdPrice(salePrice).storageId(storageId).build();
133 prdPrice = priceComputePrepareProcessor.checkPriceRange(pqr, true); 138 prdPrice = priceComputePrepareProcessor.checkPriceRange(pqr, true);
@@ -21,6 +21,7 @@ import com.yohoufo.order.model.dto.SkupDto; @@ -21,6 +21,7 @@ import com.yohoufo.order.model.dto.SkupDto;
21 import com.yohoufo.order.model.request.PrdQueryReq; 21 import com.yohoufo.order.model.request.PrdQueryReq;
22 import com.yohoufo.order.service.seller.OrderComputeHandler; 22 import com.yohoufo.order.service.seller.OrderComputeHandler;
23 import com.yohoufo.order.service.seller.OrderComputeProvider; 23 import com.yohoufo.order.service.seller.OrderComputeProvider;
  24 +import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
24 import com.yohoufo.order.service.seller.fee.GoodsAmountService; 25 import com.yohoufo.order.service.seller.fee.GoodsAmountService;
25 import com.yohoufo.order.service.seller.setting.SellerService; 26 import com.yohoufo.order.service.seller.setting.SellerService;
26 import com.yohoufo.order.utils.LoggerUtils; 27 import com.yohoufo.order.utils.LoggerUtils;
@@ -73,6 +74,9 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh @@ -73,6 +74,9 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
73 @Autowired 74 @Autowired
74 private GoodsAmountService goodsAmountService; 75 private GoodsAmountService goodsAmountService;
75 76
  77 + @Autowired
  78 + private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
  79 +
76 80
77 public ChangePricePrepareDTO checkAndAcquire(T req) { 81 public ChangePricePrepareDTO checkAndAcquire(T req) {
78 int uid = req.getUid(); 82 int uid = req.getUid();
@@ -102,7 +106,7 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh @@ -102,7 +106,7 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
102 SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sampleSkup); 106 SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sampleSkup);
103 BigDecimal sourceEM = sellerOrder.getEarnestMoney(); 107 BigDecimal sourceEM = sellerOrder.getEarnestMoney();
104 int storageId = sampleSog.getStorageId(); 108 int storageId = sampleSog.getStorageId();
105 - 109 + sellerOrderRiskWatchDog.checkPublishPriceLimit(uid, storageId, skupType, salePrice);
106 PrdQueryReq pqr = PrdQueryReq.builder().uid(uid).storageId(storageId) 110 PrdQueryReq pqr = PrdQueryReq.builder().uid(uid).storageId(storageId)
107 .prdPrice(salePrice).build(); 111 .prdPrice(salePrice).build();
108 PrdPrice prdPrice; 112 PrdPrice prdPrice;