思迅同步库存问题修改,类型问题扣减为空问题日志 记录
This commit is contained in:
parent
4959f8ae64
commit
66498ff82d
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user