Browse Source

1.优化卸车数据逻辑

pre-production
zhenghaoyu 2 days ago
parent
commit
7b07c064e0
  1. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

42
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -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

Loading…
Cancel
Save