From e5c22d51f4098ac6ee3c7de8d2fe771cf90fb9da Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Mon, 20 Oct 2025 22:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=9D=E8=BF=85=E5=90=8C=E6=AD=A5=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=97=AE=E9=A2=98=E6=89=A3=E5=87=8F=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=97=A5=E5=BF=97=20=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/sync/service/impl/SyncThirdDataServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java index 13a3bea2..e422980e 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java @@ -950,16 +950,21 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements String key=RedisKey.STOREDATARELEASE+":"+spuItem.getStore_id(); Long productId = spuItem.getProduct_id(); ShopProductBase productBase = shopProductBaseService.get(productId); + logger.info("productBase--{}",productBase); if(productBase==null){ continue; } String itemId=productBase.getProduct_number(); + logger.info("Product_number:{}",itemId); if(itemId.isEmpty()){ continue; } cn.hutool.json.JSONArray array_item_spec= JSONUtil.parseArray(spuItem.getItem_spec()); + logger.info("array_item_spec:{}",array_item_spec); + logger.info("key:{},Product_number:{}",key,itemId); if(array_item_spec.isEmpty()){ redisTemplate.opsForHash().increment(key, itemId+"-"+orderId, delta.doubleValue()); + logger.info("存储无规格库存成功"); continue; } cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) ((cn.hutool.json.JSONObject) array_item_spec.get(0)).get("item"); @@ -967,6 +972,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements BigDecimal itemQuaryty = getBigDecimal(delta, name); // 使用 Redis 的 HINCRBY 保证原子性和高性能 redisTemplate.opsForHash().increment(key, itemId+"-"+orderId, itemQuaryty.doubleValue()); + logger.info("存储有规格库存成功"); } catch (Exception e) { logger.error("库存累计失败,productKey={}, delta={}, error={}", productKey, delta, e.getMessage(), e); }