feat: 停复机规则演练与终态自动关闭轮询
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m26s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m26s
统一停复机规则转正的第一次发布:总开关仍关闭,现有停复机行为不变。 - 新增停复机规则演练:GET /stop-resume-rule/dry-run 按新规则对开机与停机卡只判断不执行,返回运营商账户 × 停机原因 × 判断结果汇总与分页明细,可假设通道实名管控配置;POST /stop-resume-rule/dry-run/export 导出明细(场景 stop_resume_rule_dry_run);仅超级管理员与平台账号 - 风险停机、已销户关闭轮询不再限于独立卡,只关该卡自身轮询,不级联设备 - 错误分类规则增加 auto_disable_polling,仅终态类别可勾选;停复机(含设备停复机)命中该规则时不重试、关闭该卡轮询、回写网关扩展状态并写审计 iot_card.terminal_disable_polling - 迁移 000250 加列与约束,并为"已销户""仅支持风险复机"置位
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
## 0. 前置确认
|
||||
|
||||
- [ ] 0.1 确认 `rebuild-card-traffic-metering-and-stop-resume` 已归档并上线生产(总开关可仍为关闭);第 1、3 个 Change 已上线。
|
||||
- [x] 0.1 确认 `rebuild-card-traffic-metering-and-stop-resume` 已归档并上线生产(总开关可仍为关闭);第 1、3 个 Change 已上线。(按用户 2026-10-24 决定以测试环境为准:`rebuild-card-traffic-metering-and-stop-resume` 代码与迁移已在测试环境,第 1、3 个 Change 已部署测试环境;生产前置由维护者发布时确认)
|
||||
|
||||
## 第一次发布:演练与口径补齐(总开关仍关闭,行为不变)
|
||||
|
||||
## 1. 迁移
|
||||
|
||||
- [ ] 1.1 新增成对迁移:`tb_gateway_error_classification` 增加 `auto_disable_polling boolean not null default false`,为"已销户""风险停机"类终态规则置位;down 删列。
|
||||
- [x] 1.1 新增成对迁移:`tb_gateway_error_classification` 增加 `auto_disable_polling boolean not null default false`,为"已销户""风险停机"类终态规则置位;down 删列。(`000250_add_error_classification_auto_disable_polling`,含"仅终态可置位"约束)
|
||||
|
||||
## 2. 规则演练
|
||||
|
||||
- [ ] 2.1 新增演练 Query:按批读取卡与资产数据,复用新规则判断函数(不受总开关影响,始终按新规则判断),支持假设的实名管控配置;只读。
|
||||
- [ ] 2.2 `GET /stop-resume-rule/dry-run`(运营商账户、停机原因筛选,汇总 + 分页明细),仅超级管理员与平台用户;导出场景 `stop_resume_rule_dry_run`。
|
||||
- [ ] 2.3 同步路由与文档生成入口,重新生成接口文档。
|
||||
- [x] 2.1 新增演练 Query:按批读取卡与资产数据,复用新规则判断函数(不受总开关影响,始终按新规则判断),支持假设的实名管控配置;只读。(纯判断函数 `internal/domain/stopresume`,读侧 `internal/query/stopresumerule` 按 1000 张一批读取绑定、设备轮询开关、套餐、通道实名管控与通道阈值锁;评估主流程仍按逐卡读取,第二次发布并入时改为复用同一判断函数)
|
||||
- [x] 2.2 `GET /stop-resume-rule/dry-run`(运营商账户、停机原因筛选,汇总 + 分页明细),仅超级管理员与平台用户;导出场景 `stop_resume_rule_dry_run`。(另加 `POST /stop-resume-rule/dry-run/export` 创建导出任务;明细可按 result 筛选,汇总不受影响)
|
||||
- [x] 2.3 同步路由与文档生成入口,重新生成接口文档。
|
||||
|
||||
## 3. 风险停机与已销户关闭轮询
|
||||
|
||||
- [ ] 3.1 `ShouldStopPollingForRisk` 去掉独立卡限制,只关闭该卡自身 `enable_polling`,不级联设备。
|
||||
- [ ] 3.2 停复机调用失败时按错误分类查 `auto_disable_polling`:置位则不重试、关闭该卡轮询、回写 `gateway_extend`、写审计。
|
||||
- [ ] 3.3 错误分类接口增加 `auto_disable_polling` 字段,非终态类别勾选时拒绝。
|
||||
- [x] 3.1 `ShouldStopPollingForRisk` 去掉独立卡限制,只关闭该卡自身 `enable_polling`,不级联设备。
|
||||
- [x] 3.2 停复机调用失败时按错误分类查 `auto_disable_polling`:置位则不重试、关闭该卡轮询、回写 `gateway_extend`、写审计。(`gatewaylimit.TerminalPollingDisabler`,卡级停复机与设备停复机共用;扩展状态按返回信息推断"已销户/风险停机",推断不出保留原值;新增审计动作 `iot_card.terminal_disable_polling`)
|
||||
- [x] 3.3 错误分类接口增加 `auto_disable_polling` 字段,非终态类别勾选时拒绝。(更新请求不传该字段时保留原值;类别改为非终态时自动清除)
|
||||
|
||||
## 4. 第一次发布的编译与验证
|
||||
|
||||
- [ ] 4.1 `gofmt -w`;`go build ./cmd/api ./cmd/worker` 通过;`openspec validate finalize-unified-stop-resume-rule` 通过。
|
||||
- [x] 4.1 `gofmt -w`;`go build ./cmd/api ./cmd/worker` 通过;`openspec validate finalize-unified-stop-resume-rule` 通过。
|
||||
- [ ] 4.2 测试环境:演练不改任何状态;开启总开关后抽取 `not_realname`、`carrier_stopped`、`manual`、停因为空各若干张,实际评估结果与演练一致。
|
||||
- [ ] 4.3 测试环境:绑定设备的卡返回已销户时只关该卡轮询;复机返回风险停机时不重试并关闭轮询;号码封存不关闭轮询。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user