...
|
...
|
@@ -31,7 +31,6 @@ import com.yohoufo.order.model.response.BidPrePublishResponse; |
|
|
import com.yohoufo.order.model.response.BidPublishResponse;
|
|
|
import com.yohoufo.order.mq.DelayTime;
|
|
|
import com.yohoufo.order.mq.TopicConstants;
|
|
|
import com.yohoufo.order.service.BuyerOrderStateChangers;
|
|
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
|
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
|
|
import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
|
...
|
...
|
@@ -101,9 +100,6 @@ public class BuyerBidPublishService { |
|
|
@Autowired
|
|
|
private OrderChangeListenerContainer orderChangeListenerContainer;
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderStateChangers buyerOrderStateChangers;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 计算
|
...
|
...
|
@@ -112,22 +108,11 @@ public class BuyerBidPublishService { |
|
|
* 2.商品金额 + 运费
|
|
|
*/
|
|
|
public BidComputeResponse compute(BuyerBidPublishRequest request) {
|
|
|
int uid = request.getUid();
|
|
|
//1.校验如下规则
|
|
|
//1.1 sku必须存在的
|
|
|
//1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高
|
|
|
//求购金额
|
|
|
BuyerBidConfig buyerBidConfig = metaConfigService.getBuyerBidConfig();
|
|
|
BidAndSuggestPrice bidPrice = new BidAndSuggestPrice(request.getPrice(),
|
|
|
productProxyService.getPrdPriceRange(request.getUid(), request.getStorageId()),
|
|
|
buyerBidConfig.getBasConfig());
|
|
|
//2.计算定金
|
|
|
Deposit deposit = computeDeposit(bidPrice, buyerBidConfig.getDConfig());
|
|
|
logger.info("[{}] buyerBid compute deposit result:{}", uid, deposit);
|
|
|
|
|
|
//3.计算商品金额 + 运费
|
|
|
ChargeContext chargeContext = computeGoods(request, bidPrice);
|
|
|
//计算
|
|
|
BidComputeResult bidComputeResult = doCompute(request);
|
|
|
|
|
|
Deposit deposit = bidComputeResult.deposit;
|
|
|
ChargeContext chargeContext = bidComputeResult.chargeContext;
|
|
|
//算费结果
|
|
|
ChargeResult chargeResult = chargeContext.getChargeResult();
|
|
|
//返回结果
|
...
|
...
|
@@ -249,6 +234,11 @@ public class BuyerBidPublishService { |
|
|
* @return
|
|
|
*/
|
|
|
public BidPublishResult bidPublish(BuyerBidPublishRequest request) {
|
|
|
BidComputeResult bidComputeResult = doCompute(request);
|
|
|
return doBidPublish(request,bidComputeResult);
|
|
|
}
|
|
|
|
|
|
public BidComputeResult doCompute(BuyerBidPublishRequest request) {
|
|
|
int uid = request.getUid();
|
|
|
int storageId = request.getStorageId();
|
|
|
//1.校验如下规则
|
...
|
...
|
@@ -264,6 +254,21 @@ public class BuyerBidPublishService { |
|
|
//3.计算商品金额 + 运费
|
|
|
ChargeContext chargeContext = computeGoods(request, bidPrice);
|
|
|
|
|
|
return new BidComputeResult(buyerBidConfig, bidPrice, deposit, chargeContext);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发布
|
|
|
* @param request
|
|
|
* @param bidComputeResult
|
|
|
* @return
|
|
|
*/
|
|
|
public BidPublishResult doBidPublish(BuyerBidPublishRequest request, BidComputeResult bidComputeResult) {
|
|
|
int uid = request.getUid();
|
|
|
int storageId = request.getStorageId();
|
|
|
BidAndSuggestPrice bidPrice = bidComputeResult.bidPrice;
|
|
|
Deposit deposit = bidComputeResult.deposit;
|
|
|
ChargeContext chargeContext = bidComputeResult.chargeContext;
|
|
|
//获取商品信息
|
|
|
GoodsInfo goodsInfo = skupService.getProductDetail(uid, storageId, bidPrice.getPrice(), SkupType.getSkupType(request.getSkupType()));
|
|
|
|
...
|
...
|
@@ -300,6 +305,7 @@ public class BuyerBidPublishService { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* skup 发布
|
|
|
* 记录到seller_order_goods中
|
...
|
...
|
@@ -365,4 +371,18 @@ public class BuyerBidPublishService { |
|
|
return request.getUserAddressPair();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class BidComputeResult {
|
|
|
BuyerBidConfig buyerBidConfig;
|
|
|
BidAndSuggestPrice bidPrice;
|
|
|
Deposit deposit;
|
|
|
ChargeContext chargeContext;
|
|
|
|
|
|
public BidComputeResult(BuyerBidConfig buyerBidConfig, BidAndSuggestPrice bidPrice, Deposit deposit, ChargeContext chargeContext) {
|
|
|
this.buyerBidConfig = buyerBidConfig;
|
|
|
this.bidPrice = bidPrice;
|
|
|
this.deposit = deposit;
|
|
|
this.chargeContext = chargeContext;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|