dev
袁野 5 months ago
parent c2040cab21
commit 6aedff2fa6
  1. 5
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java

@ -111,9 +111,9 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, goodsId);
System.out.println("==========================================================lock" + lock);
GoodsMsg goodsMsg = queryDetail(goodsId);
System.out.println("==========================================================goodsMsg" + goodsMsg);
if (goodsMsg != null) {
if(Boolean.TRUE.equals(lock)) {
@ -126,6 +126,7 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
update(goodsMsg);
} else {
System.out.println("==========================================================加锁失败,重试");
// 加锁失败,重试
Thread.sleep(100);
editSaleNum(goodsId , num , type);

Loading…
Cancel
Save