同步价改为订单价格

This commit is contained in:
liyj 2025-11-04 11:17:37 +08:00
parent 5259e85f98
commit 4b13a8c0d3
3 changed files with 5 additions and 5 deletions

View File

@ -1525,7 +1525,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
// RMK 第三方数据同步相关redis 新增返还思迅库存
Map<String, Integer> stockDeltaMap = new HashMap<>();
String item_src_id = productItem.getItem_src_id();
stockDeltaMap.put(item_src_id + "-" + shopOrderItem.getOrder_id(), returnNum);
stockDeltaMap.put(item_src_id + "-" + shopOrderItem.getOrder_id()+"-"+shopOrderItem.getItem_unit_price(), returnNum);
syncThirdDataService.incrProductStockToRedis(stockDeltaMap);
logger.info("退货返回给思迅,存入redis成功,item_src_id:{},订单号:{},数量:{}", item_src_id, shopOrderReturn.getOrder_id(), returnNum);
} else {

View File

@ -1159,7 +1159,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
Map<String, Integer> stockDeltaMap = new HashMap<>();
String item_src_id = shopOrderItem.getItem_src_id();
Integer order_item_quantity = shopOrderItem.getOrder_item_quantity();
stockDeltaMap.put(item_src_id + "-" + shopStoreSfOrder.getShop_order_id(), -order_item_quantity);
stockDeltaMap.put(item_src_id + "-" + shopStoreSfOrder.getShop_order_id()+"-"+shopOrderItem.getItem_unit_price(), -order_item_quantity);
syncThirdDataService.incrProductStockToRedis(stockDeltaMap);
}
}
@ -1328,7 +1328,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
Map<String, Integer> stockDeltaMap = new HashMap<>();
String item_src_id = shopOrderItem.getItem_src_id();
Integer order_item_quantity = shopOrderItem.getOrder_item_quantity();
stockDeltaMap.put(item_src_id + "-" + shopOrderItem.getOrder_id(), -order_item_quantity);
stockDeltaMap.put(item_src_id + "-" + shopOrderItem.getOrder_id()+"-"+shopOrderItem.getItem_unit_price(), -order_item_quantity);
syncThirdDataService.incrProductStockToRedis(stockDeltaMap);
}
}

View File

@ -938,12 +938,13 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
continue;
}
String[] productKeyArrys=productKey.split("-");
if(productKeyArrys.length!=2){
if(productKeyArrys.length!=3){
continue;
}
try {
String item_src_id=productKeyArrys[0];
String orderId=productKeyArrys[1];
String unitPrice=productKeyArrys[2];
QueryWrapper<ShopProductItem> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_src_id", item_src_id);
List<ShopProductItem> shopProductItems=shopProductItemService.list(queryWrapper);
@ -973,7 +974,6 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
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);
String unitPrice= String.valueOf(spuItem.getItem_unit_price());
if(array_item_spec.isEmpty()){
redisTemplate.opsForHash().increment(key, itemId+"-"+orderId+"-"+unitPrice, delta.doubleValue());
logger.info("存储无规格库存成功");