|
|
|
@ -81,30 +81,36 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
|
|
|
|
|
|
|
|
|
|
String key = orderCode + warehouseId; |
|
|
|
|
|
|
|
|
|
Boolean exists = bladeRedis.exists(key); |
|
|
|
|
if(exists){ |
|
|
|
|
String idStr = bladeRedis.get(key); |
|
|
|
|
if("1".equals(idStr)){ |
|
|
|
|
return 1L; |
|
|
|
|
}else{ |
|
|
|
|
return Long.valueOf(idStr); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
bladeRedis.setEx(key,"1",30L); |
|
|
|
|
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); |
|
|
|
|
if(ObjectUtils.isNotEmpty(distributionStockArticle)){ |
|
|
|
|
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); |
|
|
|
|
return distributionStockArticle.getId(); |
|
|
|
|
try{ |
|
|
|
|
Boolean exists = bladeRedis.exists(key); |
|
|
|
|
if(exists){ |
|
|
|
|
String idStr = bladeRedis.get(key); |
|
|
|
|
if("1".equals(idStr)){ |
|
|
|
|
return 1L; |
|
|
|
|
}else{ |
|
|
|
|
return Long.valueOf(idStr); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); |
|
|
|
|
if(saveFlag){ |
|
|
|
|
bladeRedis.setEx(key,"1",30L); |
|
|
|
|
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); |
|
|
|
|
if(ObjectUtils.isNotEmpty(distributionStockArticle)){ |
|
|
|
|
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); |
|
|
|
|
return distributionStockArticleEntity.getId(); |
|
|
|
|
return distributionStockArticle.getId(); |
|
|
|
|
}else{ |
|
|
|
|
return 0L; |
|
|
|
|
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); |
|
|
|
|
if(saveFlag){ |
|
|
|
|
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); |
|
|
|
|
return distributionStockArticleEntity.getId(); |
|
|
|
|
}else{ |
|
|
|
|
return 0L; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("#######addData: 保存订单失败",e); |
|
|
|
|
return 0L; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|