思迅同步库存问题修改,类型问题扣减问题
This commit is contained in:
parent
5b7be1a41c
commit
a8fce86d84
@ -766,7 +766,9 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
|
||||
@Override
|
||||
public ThirdApiRes getStoreDataRelease(String appKey, String sign) {
|
||||
// incrProductStockToRedis(new HashMap<>());
|
||||
// Map<String,Integer> map=new HashMap<>();
|
||||
// map.put("33638-DD_20251020_3",-1);
|
||||
// incrProductStockToRedis(map);
|
||||
if (StrUtil.isBlank(appKey) || StrUtil.isBlank(sign)) {
|
||||
return new ThirdApiRes().fail(1003, I18nUtil._("缺少必要参数!"));
|
||||
}
|
||||
@ -781,6 +783,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
//持久化保存数据到数据库队列
|
||||
String key=RedisKey.STOREDATARELEASE+":"+syncAppO.getStore_id();
|
||||
Map redisHash = redisTemplate.opsForHash().entries(key);
|
||||
logger.info("获取扣减库存数据redisHash:{}",redisHash);
|
||||
List<ProductQuantityConsumption> productQuantityConsumptionList=getProductStockFromRedis(syncAppO.getStore_id(),redisHash);
|
||||
List<ProductQuantityConsumption> productQuantityConsumptions=new ArrayList<>();
|
||||
if (!productQuantityConsumptionList.isEmpty()) {
|
||||
@ -886,6 +889,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
@Override
|
||||
public List<ProductQuantityConsumption> getProductStockFromRedis(String storeId,Map redisHash) {
|
||||
try {
|
||||
logger.info("获取redis的库存扣减redisHash:{}",redisHash);
|
||||
// 从 Redis 获取 hash 结构的所有键值对
|
||||
if (redisHash.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@ -896,6 +900,8 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
ProductQuantityConsumption productQuantityConsumption=new ProductQuantityConsumption();
|
||||
String productKey= (String) k;
|
||||
String[] productKeyArrys=productKey.split("-");
|
||||
logger.info("productNumber:{}",productKeyArrys[0]);
|
||||
logger.info("orderId:{}",productKeyArrys[0]);
|
||||
if(productKeyArrys.length!=2){
|
||||
return;
|
||||
}
|
||||
@ -918,7 +924,6 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
|
||||
@Override
|
||||
public void incrProductStockToRedis(Map<String, Integer> stockDeltaMap) {
|
||||
// stockDeltaMap.put("5458", 1);
|
||||
// 校验参数,避免空指针
|
||||
if (CollectionUtil.isEmpty(stockDeltaMap)) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user