|
|
|
@ -106,39 +106,19 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
|
|
|
|
|
@Override |
|
|
|
|
public BasicdataWarehouseEntity getWarehouseEntityByWarehouseCode(String warehouseCode) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key =RedisKeyConstant.BASIC_DATA_WAREHOUSE_KEY + warehouseCode; |
|
|
|
|
BasicdataWarehouseEntity o = bladeRedis.get(key); |
|
|
|
|
log.info(">>> 获取的仓库的信息 o ={}",o); |
|
|
|
|
if(ObjectUtils.isNull(o)){ |
|
|
|
|
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("warehouse_code",warehouseCode) |
|
|
|
|
.eq("is_deleted",0) |
|
|
|
|
.eq("enable_status",2); |
|
|
|
|
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(queryWrapper); |
|
|
|
|
if(!Objects.isNull(list) && !list.isEmpty()){ |
|
|
|
|
|
|
|
|
|
// 寻找中心仓
|
|
|
|
|
for (BasicdataWarehouseEntity basicdataWarehouseEntity : list) { |
|
|
|
|
if(basicdataWarehouseEntity.getFunctionType().equals("2")){ |
|
|
|
|
o = basicdataWarehouseEntity; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 找不到 就去第一个
|
|
|
|
|
if(ObjectUtils.isNull(o)){ |
|
|
|
|
o= list.get(0); |
|
|
|
|
} |
|
|
|
|
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// 设定缓存时间 1小时的缓存时间
|
|
|
|
|
bladeRedis.setEx(key,o, 60 * 60L); |
|
|
|
|
if(!Objects.isNull(list) && !list.isEmpty()){ |
|
|
|
|
return list.get(0); |
|
|
|
|
}else{ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return o; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,16 +172,39 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key =RedisKeyConstant.BASIC_DATA_WAREHOUSE_KEY + deptId; |
|
|
|
|
BasicdataWarehouseEntity o = bladeRedis.get(key); |
|
|
|
|
log.info(">>> 获取的仓库的信息 o ={}",o); |
|
|
|
|
if(ObjectUtils.isNull(o)){ |
|
|
|
|
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("department",deptId) |
|
|
|
|
.eq("is_deleted",0) |
|
|
|
|
.eq("enable_status",2); |
|
|
|
|
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(queryWrapper); |
|
|
|
|
if(!Objects.isNull(list) && !list.isEmpty()){ |
|
|
|
|
|
|
|
|
|
// 寻找中心仓
|
|
|
|
|
for (BasicdataWarehouseEntity basicdataWarehouseEntity : list) { |
|
|
|
|
if(basicdataWarehouseEntity.getFunctionType().equals("2")){ |
|
|
|
|
o = basicdataWarehouseEntity; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 找不到 就去第一个
|
|
|
|
|
if(ObjectUtils.isNull(o)){ |
|
|
|
|
o= list.get(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设定缓存时间 1小时的缓存时间
|
|
|
|
|
bladeRedis.setEx(key,o, 60 * 60L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return o; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list.get(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|