思迅同步库存问题修改,分隔符问题
This commit is contained in:
parent
47b8f474a9
commit
cfc0f6fcbc
@ -3303,7 +3303,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
// RMK 第三方数据同步相关:redis 给这个商品减去对应的库存
|
||||
Map<String, Integer> 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<ShopOrderBaseMappe
|
||||
log.debug("释放库存Item_src_id:{},数量:{}", shopProductItem.getItem_src_id(), order_item_quantity);
|
||||
// RMK 第三方数据同步相关:redis 给这个商品加上对应的库存
|
||||
Map<String, Integer> 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);
|
||||
}
|
||||
}
|
||||
@ -7257,7 +7257,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
// RMK 第三方数据同步相关:redis 给这个商品减去上对应的库存
|
||||
log.debug("减库存Item_src_id:{},数量:{}", item_src_id, cart_quantity);
|
||||
Map<String, Integer> stockDeltaMap = new HashMap<>();
|
||||
stockDeltaMap.put(item_src_id + "_" + order_id, -cart_quantity);
|
||||
stockDeltaMap.put(item_src_id + "-" + order_id, -cart_quantity);
|
||||
syncThirdDataService.incrProductStockToRedis(stockDeltaMap);
|
||||
|
||||
}
|
||||
|
||||
@ -894,7 +894,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
List<ProductQuantityConsumption> 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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user