From 4774ab8aaba057cd7da34b046633237e438fcb64 Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Fri, 17 Oct 2025 16:55:53 +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=E5=88=86?= =?UTF-8?q?=E9=9A=94=E7=AC=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/order/service/impl/ShopOrderBaseServiceImpl.java | 6 +++--- .../shop/sync/service/impl/SyncThirdDataServiceImpl.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java index 1ae5359f..5a02f88c 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java @@ -3303,7 +3303,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl stockDeltaMap = new HashMap<>(); - stockDeltaMap.put(item_src_id + "_" + order_item_row.getOrder_id(), -order_item_quantity); + stockDeltaMap.put(item_src_id + "-" + order_item_row.getOrder_id(), -order_item_quantity); syncThirdDataService.incrProductStockToRedis(stockDeltaMap); } } @@ -4226,7 +4226,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl stockDeltaMap = new HashMap<>(); - stockDeltaMap.put(shopProductItem.getItem_src_id() + "_" + order_item_row.getOrder_id(), order_item_quantity); + stockDeltaMap.put(shopProductItem.getItem_src_id() + "-" + order_item_row.getOrder_id(), order_item_quantity); syncThirdDataService.incrProductStockToRedis(stockDeltaMap); } } @@ -7254,7 +7254,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl stockDeltaMap = new HashMap<>(); - stockDeltaMap.put(item_src_id + "_" + order_id, -cart_quantity); + stockDeltaMap.put(item_src_id + "-" + order_id, -cart_quantity); syncThirdDataService.incrProductStockToRedis(stockDeltaMap); } 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 fa39feb8..55006bbf 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 @@ -894,7 +894,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements List productQuantityConsumptionList=new ArrayList<>(); redisHash.forEach((k, v)->{ ProductQuantityConsumption productQuantityConsumption=new ProductQuantityConsumption(); - String[] productKeyArrys=k.split("_"); + String[] productKeyArrys=k.split("-"); if(productKeyArrys.length!=2){ return; } @@ -929,7 +929,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements if (StrUtil.isBlank(productKey) || delta == null) { continue; } - String[] productKeyArrys=productKey.split("_"); + String[] productKeyArrys=productKey.split("-"); if(productKeyArrys.length!=2){ continue; } @@ -959,7 +959,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements String name = Convert.toStr(item.get("name")); BigDecimal itemQuaryty = getBigDecimal(delta, name); // 使用 Redis 的 HINCRBY 保证原子性和高性能 - redisTemplate.opsForHash().increment(key, itemId+"_"+orderId, itemQuaryty.doubleValue()); + redisTemplate.opsForHash().increment(key, itemId+"-"+orderId, itemQuaryty.doubleValue()); } catch (Exception e) { logger.error("库存累计失败,productKey={}, delta={}, error={}", productKey, delta, e.getMessage(), e); }