...
|
...
|
@@ -4,7 +4,10 @@ import com.yoho.core.dal.datasource.annotation.Database; |
|
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
|
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.dal.order.SellerGoodsStatusFlowMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.model.SellerGoodsStatusFlow;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.order.convert.GoodsInfoConvertor;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
...
|
...
|
@@ -27,6 +30,9 @@ public class BidSkupService { |
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerGoodsStatusFlowMapper sellerGoodsStatusFlowMapper;
|
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED)
|
|
|
@Database(ForceMaster = true, DataSource = "ufo_order")
|
...
|
...
|
@@ -53,18 +59,24 @@ public class BidSkupService { |
|
|
*/
|
|
|
@Transactional(propagation = Propagation.REQUIRED)
|
|
|
@Database(ForceMaster = true, DataSource = "ufo_order")
|
|
|
public void bind(int uid, int skup, boolean finishPay) {
|
|
|
public void bind(int uid, int skup, long orderCode, boolean finishPay) {
|
|
|
SkupStatus targetStatus = finishPay ? SkupStatus.SELL_OUT : SkupStatus.CAN_NOT_SELL;
|
|
|
SellerOrderGoods condition = new SellerOrderGoods();
|
|
|
condition.setId(skup);
|
|
|
condition.setExceptUid(0);
|
|
|
condition.setUid(uid);
|
|
|
condition.setExceptStatus(SkupStatus.CAN_NOT_SELL.getCode());
|
|
|
condition.setStatus(finishPay ? SkupStatus.SELL_OUT.getCode() : SkupStatus.CAN_NOT_SELL.getCode());
|
|
|
condition.setStatus(targetStatus.getCode());
|
|
|
boolean success = sellerOrderGoodsMapper.updateStatusAndUidBySkpu(condition) > 0;
|
|
|
if (!success) {
|
|
|
log.warn("[{}] is bind with seller order goods uid:{} fail", skup ,uid );
|
|
|
throw new UfoServiceException(500, "操作失败");
|
|
|
}
|
|
|
SellerGoodsStatusFlow sgsf = SellerGoodsStatusFlow.builder()
|
|
|
.skup(skup).status(targetStatus.getCode()).createTime(DateUtil.getCurrentTimeSecond())
|
|
|
.orderCode(orderCode)
|
|
|
.build();
|
|
|
sellerGoodsStatusFlowMapper.insert(sgsf);
|
|
|
log.info("[{}] is bind with seller order goods uid:{} success", skup ,uid );
|
|
|
}
|
|
|
|
...
|
...
|
|