winter 4 лет назад
Родитель
Сommit
65893f49fa
2 измененных файлов: 20 добавлений и 8 удалений
  1. +7
    -0
      mallinkService/src/main/java/com/iformall/domain/po/StockReduceResult.java
  2. +13
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java

+ 7
- 0
mallinkService/src/main/java/com/iformall/domain/po/StockReduceResult.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.iformall.domain.po;
public class StockReduceResult { public class StockReduceResult {
private boolean isChannelStockReduce; private boolean isChannelStockReduce;
private boolean isChannelPrice;
private Integer currentPrice; private Integer currentPrice;
public boolean isChannelStockReduce() { public boolean isChannelStockReduce() {
@@ -17,4 +18,10 @@ public class StockReduceResult {
public void setCurrentPrice(Integer currentPrice) { public void setCurrentPrice(Integer currentPrice) {
this.currentPrice = currentPrice; this.currentPrice = currentPrice;
} }
public boolean isChannelPrice() {
return isChannelPrice;
}
public void setChannelPrice(boolean isChannelPrice) {
this.isChannelPrice = isChannelPrice;
}
} }

+ 13
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -920,6 +920,7 @@ public class WxOrderServiceImpl implements WxOrderService {
StockReduceResult reduceResult = new StockReduceResult(); StockReduceResult reduceResult = new StockReduceResult();
boolean isChannelStockReduce = false; boolean isChannelStockReduce = false;
boolean isChannelPrice = false;
Integer currentPrice = coupon.getSalePrice(); Integer currentPrice = coupon.getSalePrice();
if (null != couponChannel ) { if (null != couponChannel ) {
if (null != couponChannel.getChannelStock()) { if (null != couponChannel.getChannelStock()) {
@@ -927,6 +928,7 @@ public class WxOrderServiceImpl implements WxOrderService {
} }
if (null != couponChannel.getChannelPrice()) { if (null != couponChannel.getChannelPrice()) {
currentPrice = couponChannel.getChannelPrice(); currentPrice = couponChannel.getChannelPrice();
isChannelPrice = true;
} }
} }
@@ -1009,6 +1011,7 @@ public class WxOrderServiceImpl implements WxOrderService {
} }
reduceResult.setChannelStockReduce(isChannelStockReduce); reduceResult.setChannelStockReduce(isChannelStockReduce);
reduceResult.setCurrentPrice(currentPrice); reduceResult.setCurrentPrice(currentPrice);
reduceResult.setChannelPrice(isChannelPrice);
return reduceResult; return reduceResult;
} }


@@ -2935,7 +2938,7 @@ public class WxOrderServiceImpl implements WxOrderService {
public WxOrder saveNoFreeOrderForCoupon(Date orderDate,boolean allowUnPayOrder,WxComposeOrder composeOrder,WxCUserBasicInfo user, WxCoupon coupon,int couponNumber,WxCouponChannel couponChannel,OrderComposeSaveDto orderdto,EnumPayWay payWay) { public WxOrder saveNoFreeOrderForCoupon(Date orderDate,boolean allowUnPayOrder,WxComposeOrder composeOrder,WxCUserBasicInfo user, WxCoupon coupon,int couponNumber,WxCouponChannel couponChannel,OrderComposeSaveDto orderdto,EnumPayWay payWay) {
WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy();
// 3. 减库存操作
// 3. 减库存操作。所有的订单都跟减库存操作时的订单详情保持一致
StockReduceResult stockReduceResult = proxy.stockReduce(allowUnPayOrder,user, coupon, couponChannel,couponNumber); StockReduceResult stockReduceResult = proxy.stockReduce(allowUnPayOrder,user, coupon, couponChannel,couponNumber);


// 3. 当积分券或者积分停车券时 则进行积分支付 // 3. 当积分券或者积分停车券时 则进行积分支付
@@ -2947,16 +2950,18 @@ public class WxOrderServiceImpl implements WxOrderService {
orderType = EnumOrderType.COUPON.getCode(); orderType = EnumOrderType.COUPON.getCode();
} }
//渠道的库存和价格可以随时修改。这里需要校验一下
//扣库存的时候价格是什么样的,如果此时有变化,则不让继续。渠道的库存和价格可以随时修改。这里需要校验一下
if (stockReduceResult.isChannelStockReduce()) { if (stockReduceResult.isChannelStockReduce()) {
//再查询一下,此时有可能价格已经修改 //再查询一下,此时有可能价格已经修改
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannel.getId(),coupon.getTenantId()); WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannel.getId(),coupon.getTenantId());
//如果这个时候渠道价格已经清空了
if (null == wxCouponChannel.getChannelPrice()) {
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR.getCode(),"["+coupon.getTitle()+"]渠道价格已变动[清空],请刷新后重新下单.");
}
if (wxCouponChannel.getChannelPrice().intValue() != couponChannel.getChannelPrice().intValue()) {
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR.getCode(),"["+coupon.getTitle()+"]渠道价格已变更,请刷新后重新下单.");
if (stockReduceResult.isChannelPrice()) {
//如果这个时候渠道价格已经清空了
if (null == wxCouponChannel.getChannelPrice()) {
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR.getCode(),"["+coupon.getTitle()+"]渠道价格已变动[清空],请刷新后重新下单.");
}
if (wxCouponChannel.getChannelPrice().intValue() != couponChannel.getChannelPrice().intValue()) {
throw new MallinkException(ErrorCode.ORDER_SAVE_ERR.getCode(),"["+coupon.getTitle()+"]渠道价格已变更,请刷新后重新下单.");
}
} }
} }


Загрузка…
Отмена
Сохранить