Authored by chenchao

add watch dog in all gate of set price

... ... @@ -2,11 +2,11 @@ package com.yohoufo.order.service.seller.changePrice;
import com.alibaba.fastjson.JSON;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.model.SellerWalletDetail;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
import com.yohoufo.order.model.dto.LifeCycleSellerGoods;
import com.yohoufo.order.model.dto.SellerTaskDTO;
... ... @@ -15,7 +15,6 @@ import com.yohoufo.order.model.response.OrderSubmitResp;
import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler;
import com.yohoufo.order.service.handler.SellerIncrPriceTaskHandler;
import com.yohoufo.order.service.impl.SellerOrderService;
import com.yohoufo.order.service.seller.imperfect.ImperfectGoodsService;
import com.yohoufo.order.service.seller.processor.SellerTaskProcessor;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
... ... @@ -39,9 +38,6 @@ public class ChangePriceService {
private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor;
@Autowired
private ImperfectGoodsService imperfectGoodsService;
@Autowired
private SellerTaskProcessor sellerTaskProcessor;
@Autowired
... ... @@ -63,7 +59,6 @@ public class ChangePriceService {
public SoldPrdComputeBo computeChangePrice(SingleGoodsChangePriceReq req){
LifeCycleSellerGoods lcsg = getLifeCycleSellerGoods(req.getSkup());
final SkupType skupType = lcsg.getSkupType();
final Payment payment = lcsg.getPayment();
logger.info("in computeChangePrice 4 single goods, req {} LifeCycleSellerGoods {}", req, lcsg);
SoldPrdComputeBo spcb = null;
switch (skupType){
... ...
... ... @@ -14,9 +14,9 @@ import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.service.seller.orderMeta.SellerAddressService;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.PublishProcessor;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.orderMeta.SellerAddressService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -44,7 +44,6 @@ public class NEGChangePricePublishProcessor
@Autowired
private SingleGoodsChangePricePrepareProcessor singleGoodsChangePricePrepareProcessor;
@Override
public ChangePriceOrderContext buildPublishCtx(SingleGoodsChangePriceReq im) {
return buildSellerOrderContext(im);
... ...
... ... @@ -26,6 +26,7 @@ import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.SellerAuthCheckService;
import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.service.seller.processor.ChangePriceCommonPrepareProcessor;
import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
... ... @@ -77,6 +78,9 @@ public class SingleGoodsChangePricePrepareProcessor {
@Autowired
private GoodsAmountService goodsAmountService;
@Autowired
private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
public void checkGoodsStatus(SellerOrderGoods psog){
if (SkupStatus.CAN_SELL.getCode() != psog.getStatus().intValue()){
logger.warn("in SingleGoodsChangePricePrepareProcessor.checkGoodsStatus not can sale, SellerOrderGoods {}", psog);
... ... @@ -128,6 +132,7 @@ public class SingleGoodsChangePricePrepareProcessor {
changePriceCommonPrepareProcessor.checkChangeNecessary(skup, preSalePrice, salePrice);
PrdPrice prdPrice;
int storageId = psog.getStorageId();
sellerOrderRiskWatchDog.checkPublishPriceLimit(uid, storageId, skupType, salePrice);
PrdQueryReq pqr = PrdQueryReq.builder()
.uid(uid).prdPrice(salePrice).storageId(storageId).build();
prdPrice = priceComputePrepareProcessor.checkPriceRange(pqr, true);
... ...
... ... @@ -21,6 +21,7 @@ import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.utils.LoggerUtils;
... ... @@ -73,6 +74,9 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
@Autowired
private GoodsAmountService goodsAmountService;
@Autowired
private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
public ChangePricePrepareDTO checkAndAcquire(T req) {
int uid = req.getUid();
... ... @@ -102,7 +106,7 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sampleSkup);
BigDecimal sourceEM = sellerOrder.getEarnestMoney();
int storageId = sampleSog.getStorageId();
sellerOrderRiskWatchDog.checkPublishPriceLimit(uid, storageId, skupType, salePrice);
PrdQueryReq pqr = PrdQueryReq.builder().uid(uid).storageId(storageId)
.prdPrice(salePrice).build();
PrdPrice prdPrice;
... ...