选品提交重构
2021-12-20 19:51:01 44 举报
AI智能生成
选品提交重构
作者其他创作
大纲/内容
保存/提交选品信息 (独立子事务)
1 cs表数据 upsert
以页面提交的供应商颜色尺码为基准 selection_spu_id+color_name+size_name 存在则更新 不存在则插入
SELECT<br style="user-select: auto;"> count( * ) ,<br style="user-select: auto;"> selection_spu_id,<br style="user-select: auto;"> color_name,<br style="user-select: auto;"> size_name ,<br style="user-select: auto;"> unique_key<br style="user-select: auto;">FROM<br style="user-select: auto;"> goods_crawler_color_size <br style="user-select: auto;">GROUP BY<br style="user-select: auto;"> selection_spu_id,<br style="user-select: auto;"> color_name,<br style="user-select: auto;"> size_name <br style="user-select: auto;">HAVING<br style="user-select: auto;"> count( * ) >1
2 买手数据保存 upsertBuyer
3 skc 原始图片 url接口提供
4 skc 美图
5 goodsCrawlerColorSizeService 更新 bodySize
6 goodsCrawlerColorSizeService 更新 Size
7 选品 skc sku 数据同步
upsert
skc
1 以页面提交dfs数据为基准 selection_spu_id+color_id 存在更新 不存在插入 (需要新增联合索引)
sku
1 以页面提交dfs数据为基准 selection_spu_id+color_id+size_id 存在更新 不存在插入 (需要新增联合索引)
逻辑删除(看业务需求)
直接逻辑删除页面上不存在的颜色尺码
涉及的表
1 cs表
2 goods_selection_skc
3 goods_selection_sku
SELECT<br style="user-select: auto;"> count( * ) ,<br style="user-select: auto;"> selection_spu_id,<br style="user-select: auto;"> color,<br style="user-select: auto;"> size,<br style="user-select: auto;"> sku_code,<br style="user-select: auto;"> unique_key<br style="user-select: auto;">FROM<br style="user-select: auto;"> goods_selection_sku <br style="user-select: auto;">GROUP BY<br style="user-select: auto;"> selection_spu_id,<br style="user-select: auto;"> color,<br style="user-select: auto;"> size<br style="user-select: auto;">HAVING<br style="user-select: auto;"> count( * ) >1
重复数据都是废弃的款号 可以直接清
4 展品skc
5 展品sku
SELECT<br style="user-select: auto;"> count( * ) ,<br style="user-select: auto;"> product_spu_id,<br style="user-select: auto;"> color,<br style="user-select: auto;"> size ,<br style="user-select: auto;"> product_sku_code<br style="user-select: auto;">FROM<br style="user-select: auto;"> goods_product_sku <br style="user-select: auto;">GROUP BY<br style="user-select: auto;"> product_spu_id,<br style="user-select: auto;"> color,<br style="user-select: auto;"> size<br style="user-select: auto;">HAVING<br style="user-select: auto;"> count( * ) >1<br style="user-select: auto;">
6 关联的图片表 价格表 资源扩展表
展品数据同步(每个站点都是独立子事务)
同步spu信息
1 GoodsProductSpuExtImage 选品spu图片同步至展品
2 goodsProductSpuExtSource 选库spu对应的source到展品库
3 GoodsSelectionSpuExtDesc 选库spu对应的desc到展品库
4 spu价格表插入 逻辑较复杂 copy代码 优化批量插入
展品skc sku信息(代码逻辑全部重构)<br style="user-select: auto;">
skc图片
有美图用美图 没有美图取供应商图片 无供应商图片取色块图<br style="user-select: auto;">根据 url+product_spu_id(需要新增字段) 有则更新 无则新增
sinkProductSkcImage
skc表
根据seleciton_skc_id+product+spu_id 有则更新 无则新增
sku表
根据seleciton_sku_id+product+spu_id 有则更新 无则新增
select for update查询出数据后 循环exist_selection_sku <br>1 存在的展品更新 copy属性<br>2 不存在的插入 bean convert
选品skc sku同步状态
sync_status=2
选品spu状态
1 sync_status=2 <br style="user-select: auto;">2 selectionSpu.setProductInfoCompleteStatus((byte) 3);<br style="user-select: auto;">
内部 事件/埋点相关<br style="user-select: auto;">
方案(待评估)
1 需要将 springevent 以及埋点的代码全部迁移
2 将原来的埋点 以及同步聚水潭 skc消息等都封装成接口 供plm服务调用
0 条评论
下一页