master
袁野 5 months ago
parent 883fb09e84
commit 0b74fe6f88
  1. 6
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java
  2. 4
      service/src/main/java/com/hfkj/service/goods/impl/GoodsSpecsServiceImpl.java

@ -107,10 +107,12 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
public void editSaleNum(Long goodsId, Integer num , Integer type) {
String key = "GOODS" + goodsId;
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, goodsId);
try {
System.out.println("==========================================================lock" + lock);
GoodsMsg goodsMsg = queryDetail(goodsId);
System.out.println("==========================================================goodsMsg" + goodsMsg);

@ -102,11 +102,11 @@ public class GoodsSpecsServiceImpl implements GoodsSpecsService {
String key = "GOODS_STOCK_NUM";
GoodsSpecs goodsSpecs = queryDetailByGoodsId(specsId);
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, specsId);
try {
if(Boolean.TRUE.equals(lock)) {
if (type == 1) {

Loading…
Cancel
Save