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:
@@ -112,6 +112,9 @@ func RegisterAdminRoutes(router fiber.Router, handlers *bootstrap.Handlers, midd
|
||||
if handlers.AssetAutoRenewal != nil {
|
||||
registerAssetAutoRenewalRoutes(authGroup, handlers.AssetAutoRenewal, doc, basePath)
|
||||
}
|
||||
if handlers.StopResumeRule != nil {
|
||||
registerStopResumeRuleRoutes(authGroup, handlers.StopResumeRule, doc, basePath)
|
||||
}
|
||||
if handlers.OperationsReport != nil {
|
||||
registerOperationsReportRoutes(authGroup, handlers.OperationsReport, doc, basePath)
|
||||
}
|
||||
|
||||
46
internal/routes/stop_resume_rule.go
Normal file
46
internal/routes/stop_resume_rule.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/middleware"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
||||
)
|
||||
|
||||
// registerStopResumeRuleRoutes 注册停复机规则演练路由。
|
||||
// 门禁挂在独立前缀 /stop-resume-rule 的分组上,只作用于本组接口:代理、企业与个人客户账号一律 403。
|
||||
func registerStopResumeRuleRoutes(router fiber.Router, handler *admin.StopResumeRuleHandler, doc *openapi.Generator, basePath string) {
|
||||
group := router.Group("/stop-resume-rule", func(c *fiber.Ctx) error {
|
||||
userType := middleware.GetUserTypeFromContext(c.UserContext())
|
||||
if userType != constants.UserTypeSuperAdmin && userType != constants.UserTypePlatform {
|
||||
return errors.New(errors.CodeForbidden, constants.PlatformManagementForbiddenMessage)
|
||||
}
|
||||
return c.Next()
|
||||
})
|
||||
path := basePath + "/stop-resume-rule"
|
||||
|
||||
Register(group, doc, path, "GET", "/dry-run", handler.DryRun, RouteSpec{
|
||||
Summary: "停复机规则演练",
|
||||
Description: "对全部开机与停机卡按停复机新规则只判断不执行(不调用网关、不写任何状态),不受停复机总开关影响。" +
|
||||
"返回按运营商账户 × 当前停机原因 × 判断结果 × 原因的汇总,以及按卡ID升序的分页明细;" +
|
||||
"可按运营商账户与停机原因筛选,可用 assume_control_on / assume_control_off 假设通道实名管控配置预演。" +
|
||||
"全量扫描较慢,生产使用请按运营商账户筛选或使用导出。仅超级管理员与平台账号可用。",
|
||||
Tags: []string{"停复机规则"},
|
||||
Input: new(dto.StopResumeRuleDryRunRequest),
|
||||
Output: new(dto.StopResumeRuleDryRunResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(group, doc, path, "POST", "/dry-run/export", handler.Export, RouteSpec{
|
||||
Summary: "导出停复机规则演练明细",
|
||||
Description: "创建异步导出任务(场景 stop_resume_rule_dry_run),一行对应一张卡的判断结果;筛选与假设配置同演练接口。仅超级管理员与平台账号可用。",
|
||||
Tags: []string{"停复机规则"},
|
||||
Input: new(dto.StopResumeRuleDryRunExportRequest),
|
||||
Output: new(dto.CreateExportTaskResponse),
|
||||
Auth: true,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user