|
|
package com.yohoufo.order.service.seller.quickDeliver;
|
|
|
|
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
...
|
...
|
@@ -15,6 +16,8 @@ import com.yohobuy.ufo.model.order.resp.PageResp; |
|
|
import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
|
|
|
import com.yohoufo.common.alarm.EventBusPublisher;
|
|
|
import com.yohoufo.common.alarm.SmsAlarmEvent;
|
|
|
import com.yohoufo.common.cache.RedisLock;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsViewMapper;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.order.model.QuickDeliverOrderContext;
|
...
|
...
|
@@ -37,6 +40,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* @author chenchao
|
...
|
...
|
@@ -76,10 +80,23 @@ public class QuickDeliverGoodsService { |
|
|
@Autowired
|
|
|
private SellerNoticeFacade sellerNoticeFacade;
|
|
|
|
|
|
public DepositPublishResp publish(QuickDeliverOrderSubmitReq req){
|
|
|
@Autowired
|
|
|
private RedisLock redisLock;
|
|
|
|
|
|
QuickDeliverOrderContext qdoc = quickDeliverPublishProcessor.buildPublishCtx(req);
|
|
|
return doPublish(qdoc);
|
|
|
public DepositPublishResp publish(QuickDeliverOrderSubmitReq req) {
|
|
|
RedisKeyBuilder redisLockKey = RedisKeyBuilder.newInstance()
|
|
|
.appendFixed("ufo:order:lock:publishQuickDeliverGoods:")
|
|
|
.appendVar(req.getUid() + "-" + req.getStorageId());
|
|
|
if (redisLock.acquire(redisLockKey, 1, TimeUnit.SECONDS)) {
|
|
|
try {
|
|
|
QuickDeliverOrderContext qdoc = quickDeliverPublishProcessor.buildPublishCtx(req);
|
|
|
return doPublish(qdoc);
|
|
|
} finally {
|
|
|
redisLock.release(redisLockKey);
|
|
|
}
|
|
|
} else {
|
|
|
throw new UfoServiceException(400, "寄存商品上架中,稍后再试");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|