定时任务把仓库刷到redis中(1小时执行一次):
一、渠道维度(key=source_id,value=warehouse_id)
FBA仓库取法(rb_ware_house表在warehouse库,warehouse_type全部默认==3):
select id warehouse_id,autonomous_ware_house_id source_id from rb_ware_house where customer_id=1 and ware_house_type=3 and is_active=1 limit 1,1000
二、SKU维度(key=source_id,value=warehouse_id):
FBM仓库取法(warehouse_type全部默认==1):
1、先获取最大与最小product的ID,每500区间为一个MQ
2、消费MQ:
=startId and id
如果warehouse_id为空:
1、则通过供应商仓库获取库ID(product库)
select ps.TheWareHouseID from RB_Product_Supplier ps (nolock) left join RB_Product_SupplierPrice psp (nolock) on ps.id=psp.SupplierID
where ps.CustomerID=1 and psp.CustomerID=1 and psp.IsDefault=1 and psp.SKU='1002254'
@张居瓦未同步表(RB_Product_Supplier与RB_Product_SupplierPrice),需要同步到product库,然后在执行调价策略时,直接从redis中获取
定时任务把仓库刷到redis中(1小时执行一次):
一、渠道维度(key=source_id,value=warehouse_id)
FBA仓库取法(rb_ware_house表在warehouse库,warehouse_type全部默认==3):
select id warehouse_id,autonomous_ware_house_id source_id from rb_ware_house where customer_id=1 and ware_house_type=3 and is_active=1 limit 1,1000
二、SKU维度(key=source_id,value=warehouse_id):
FBM仓库取法(warehouse_type全部默认==1):
1、先获取最大与最小product的ID,每500区间为一个MQ
2、消费MQ:
select sku,default_local_warehouse warehouse_id from rb_product where 正常SKU AND id >=startId and id <endId
如果warehouse_id为空:
1、则通过供应商仓库获取库ID(product库)
select ps.TheWareHouseID from RB_Product_Supplier ps (nolock) left join RB_Product_SupplierPrice psp (nolock) on ps.id=psp.SupplierID
where ps.CustomerID=1 and psp.CustomerID=1 and psp.IsDefault=1 and psp.SKU='1002254'
@张居瓦未同步表(RB_Product_Supplier与RB_Product_SupplierPrice),需要同步到product库,然后在执行调价策略时,直接从redis中获取
【相关信息】仓库ID存到redis地址
fba:
map结构,hashkey是渠道ID,value是WarehouseResp(wareHouseType=3,wareHouseId))
bus-strategy:fbm_warehouse_id
fbm:
map结构,hashkey是sku,value是WarehouseResp(wareHouseType,wareHouseId)
【验证过程】
优化后执行策略,配置策略条件与计算器价格相关,日志中查看获取仓库ID的时间以及占比
一共1530条listing,执行获取仓库ID话费时间20ms,总时间占比只有0.0002
正式环境没有info级别的日志,无法确定这个流程在正式环境跑大量数据需要多久,优化上线前,一个晚上只执行了三四百条数据,优化上线后执行了一千多万条lisitng