虾皮在实际测试中发现,存在listing状态与editstatus 状态不一致的情况,数据不准确会导致凤凰计划,自动补货等功能执行异常,需要检查并修复历史数据
二、需求价值
控制风险:减少因为状态不对,导致的错执行,漏执行的问题
三、需求内容
控制风险:减少因为状态不对,导致的错执行,漏执行的问题
三、需求内容

前提:ShopeeV2 listing表存在Status(平台返回状态)与EditStauts(统一转换数字类型状态)两种状态类型。
1、listing店铺纬度,Status状态为已下架,EditStauts状态为在线,数据最后更新时间2022-05-23之前,总数据量23998条,通过排查100条数据为未激活店铺,其他数据为SIP店铺数据(无调用平台接口权限)。
-- 查询店铺纬度状态不一致SQL:
select * from m_shopeev2_listing WHERE CustomerId = 1 and IsGlobal = false and
((`Status` = 'NORMAL' and EditStatus <> 1) or (`Status` = 'UNLIST' and EditStatus <> 2) or (`Status` = 'DELETED' and EditStatus <> 3) or (`Status` = 'BANNED' and EditStatus <> 6));
-- 清理SIP店铺状态不一致数据SQL:
UPDATE m_shopeev2_listing SET EditStatus = 2 WHERE CustomerId = 1 and IsGlobal = false and
((`Status` = 'NORMAL' and EditStatus <> 1) or (`Status` = 'UNLIST' and EditStatus <> 2) or (`Status` = 'DELETED' and EditStatus <> 3) or (`Status` = 'BANNED' and EditStatus <> 6))
and OrderSourceId in (
select OrderSourceId from sys_ordersource b WHERE b.IsActive = 1 AND b.IsDelete = 0 AND b.OrderSourceType = 97 AND b.OrderSourceName like '%【%')
-- 清理未激活店铺状态不一致数据SQL:
update m_shopeev2_listing set EditStatus = 2 WHERE CustomerId = 1 and IsGlobal = false and
((`Status` = 'NORMAL' and EditStatus <> 1) or (`Status` = 'UNLIST' and EditStatus <> 2) or (`Status` = 'DELETED' and EditStatus <> 3) or (`Status` = 'BANNED' and EditStatus <> 6))
and OrderSourceId in (
select OrderSourceId from sys_ordersource b WHERE b.IsActive = 0 AND b.IsDelete = 0 AND b.OrderSourceType = 97)
2、listing全球纬度,Status状态有已删除和已下架,EditStauts状态为在线,数据最后更新时间2022-11-23 13点,总数据量55条,通过SQL与凤凰队列排查出不一致问题来源可能是凤凰下架,排查代码删除状态赋值和变更状态(Status和EditStauts)均不会出现状态不一致问题。因为之前有通过SQL修改过listing状态,无法排除是否为SQL修改的原因,先使用SQL把当前状态不一致的问题处理掉,然后再记录阿里云日志(渠道ID,平台ID,渠道SKU,Status,EditStauts)。
-- 查询全球纬度状态不一致SQL:
select * from m_shopeev2_listing WHERE CustomerId = 1 and IsGlobal = true and
((`Status` = 'NORMAL' and EditStatus <> 1) or (`Status` = 'UNLIST' and EditStatus <> 2) or (`Status` = 'DELETED' and EditStatus <> 3) or (`Status` = 'BANNED' and EditStatus <> 6));
添加更新全球状态UpdateGlobalStatus和更新店铺状态UpdateShopStatus两个API:
单元测试UpdateGlobalStatus:
lising:

Sub:

UpdateShopStatus与UpdateGlobalStatu公用同一方法
| 所属迭代 | 综合平台智能刊登系统优化专项 |
|---|---|
| 所属模块 | / |
| 相关需求 | shopee listing在线状态与系统对应状态不一致问题优化 |
| 指派给 | Closed 于 2023-01-18 09:22:02 |
| 任务类型 | 后端 |
| 任务标签 | 初始 |
| 开发组 | 有品开发组 |
| 任务状态 | 已关闭 |
| 进度 | 100% |
| 优先级 | P2 |
| 关键词 | |
| 抄送给 |
| 由谁创建 | 韦思成 于 2022-11-29 10:07:05 |
|---|---|
| 由谁完成 | 姚杰远 于 2022-11-29 10:09:43 |
| 由谁取消 | 暂无 |
| 由谁关闭 | 韦思成 于 2023-01-18 09:22:02 |
| 关闭原因 | 已完成 |
| 最后编辑 | 韦思成 于 2023-01-18 09:22:02 |
| 团队 | 最初预计 | 总计消耗 | 预计剩余 |
|---|
| 最初预计 | 4工时 |
|---|---|
| 总计消耗 | 4工时 |
| 预计剩余 | 0工时 |
| 预计开始 | 2022-11-29 |
| 实际开始 | 2022-11-29 |
| 截止日期 | 2022-11-29 |