...
|
...
|
@@ -5,8 +5,6 @@ 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.concurrent.lock.RedisLock;
|
|
|
import com.yohoufo.common.concurrent.lock.RedisLockFactory;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.dal.order.model.SellerWalletDetail;
|
|
|
import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
|
...
|
...
|
@@ -14,8 +12,6 @@ import com.yohoufo.order.model.dto.LifeCycleSellerGoods; |
|
|
import com.yohoufo.order.model.dto.SellerTaskDTO;
|
|
|
import com.yohoufo.order.model.dto.SellerTaskResult;
|
|
|
import com.yohoufo.order.model.response.OrderSubmitResp;
|
|
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
|
|
import com.yohoufo.order.service.cache.ExpiredTime;
|
|
|
import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler;
|
|
|
import com.yohoufo.order.service.handler.SellerIncrPriceTaskHandler;
|
|
|
import com.yohoufo.order.service.impl.SellerOrderService;
|
...
|
...
|
@@ -25,8 +21,6 @@ import org.slf4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2019/4/12.
|
|
|
*/
|
...
|
...
|
@@ -52,10 +46,6 @@ public class ChangePriceService { |
|
|
@Autowired
|
|
|
private SellerDecrPriceTaskHandler sellerDecrPriceTaskHandler;
|
|
|
|
|
|
@Autowired
|
|
|
private RedisLockFactory redisLockFactory;
|
|
|
|
|
|
|
|
|
private LifeCycleSellerGoods getLifeCycleSellerGoods(int skup){
|
|
|
if (skup <=0){
|
|
|
throw new UfoServiceException(400, "skup错误");
|
...
|
...
|
@@ -129,20 +119,7 @@ public class ChangePriceService { |
|
|
// 支持入驻后上架的商品变价,通过钱包支付
|
|
|
resp = changePriceOfEntryGoods(req);
|
|
|
}else{
|
|
|
//现有逻辑只支持 非入驻时上架的现货和预售,不支持瑕疵or二手
|
|
|
RedisLock skupPriceLock = redisLockFactory.newLock(CacheKeyBuilder.skupPriceLockKey(req.getSkup()), ExpiredTime.SKUP_PRICE_LOCK_SECONDS, TimeUnit.SECONDS);
|
|
|
boolean isSkupPriceLocked = skupPriceLock.tryLock();
|
|
|
if(!isSkupPriceLocked) {
|
|
|
logger.warn("skup price locked failed before price change, skup: {}", req.getSkup());
|
|
|
throw new UfoServiceException(400, "买家正在下单,不可改价");
|
|
|
}
|
|
|
try {
|
|
|
resp = singleGoodsChangePriceService.changePrice(req);
|
|
|
} finally {
|
|
|
if(isSkupPriceLocked) {
|
|
|
skupPriceLock.unlock();
|
|
|
}
|
|
|
}
|
|
|
resp = singleGoodsChangePriceService.changePrice(req);
|
|
|
}
|
|
|
break;
|
|
|
}
|
...
|
...
|
|