mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-22 12:48:59 +08:00
fix(PmsSkuServiceImpl.java):修复循环依赖问题
This commit is contained in:
parent
d5348e29ee
commit
1cbcdec8b5
@ -18,7 +18,7 @@ public interface IPmsSkuService extends IService<PmsSku> {
|
||||
/**
|
||||
* 锁定库存
|
||||
*/
|
||||
Boolean lockStockTcc(List<LockStockDTO> list);
|
||||
// Boolean lockStockTcc(List<LockStockDTO> list);
|
||||
|
||||
/**
|
||||
* 解锁库存
|
||||
|
@ -15,8 +15,6 @@ import com.youlai.mall.pms.pojo.dto.app.LockStockDTO;
|
||||
import com.youlai.mall.pms.pojo.dto.app.SkuDTO;
|
||||
import com.youlai.mall.pms.pojo.entity.PmsSku;
|
||||
import com.youlai.mall.pms.service.IPmsSkuService;
|
||||
import com.youlai.mall.pms.tcc.service.SeataTccSkuService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RLock;
|
||||
@ -34,17 +32,8 @@ public class PmsSkuServiceImpl extends ServiceImpl<PmsSkuMapper, PmsSku> impleme
|
||||
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
private final RedissonClient redissonClient;
|
||||
private final SeataTccSkuService seataTccSkuService;
|
||||
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public Boolean lockStockTcc(List<LockStockDTO> skuLockList) {
|
||||
|
||||
seataTccSkuService.prepareSkuLockList(null, skuLockList);
|
||||
String orderToken = skuLockList.get(0).getOrderToken();
|
||||
redisTemplate.opsForValue().set(PmsConstants.LOCKED_STOCK_PREFIX + orderToken, JSONUtil.toJsonStr(skuLockList));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单时锁定库存
|
||||
@ -189,4 +178,16 @@ public class PmsSkuServiceImpl extends ServiceImpl<PmsSkuMapper, PmsSku> impleme
|
||||
return this.baseMapper.getSkuById(id);
|
||||
}
|
||||
|
||||
|
||||
/* private final SeataTccSkuService seataTccSkuService;
|
||||
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public Boolean lockStockTcc(List<LockStockDTO> skuLockList) {
|
||||
seataTccSkuService.prepareSkuLockList(null, skuLockList);
|
||||
String orderToken = skuLockList.get(0).getOrderToken();
|
||||
redisTemplate.opsForValue().set(PmsConstants.LOCKED_STOCK_PREFIX + orderToken, JSONUtil.toJsonStr(skuLockList));
|
||||
return true;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user