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:
70
internal/model/dto/stop_resume_rule_dto.go
Normal file
70
internal/model/dto/stop_resume_rule_dto.go
Normal file
@@ -0,0 +1,70 @@
|
||||
package dto
|
||||
|
||||
// StopResumeRuleDryRunRequest 停复机规则演练请求。
|
||||
type StopResumeRuleDryRunRequest struct {
|
||||
CarrierID *uint `json:"carrier_id" query:"carrier_id" validate:"omitempty,min=1" minimum:"1" description:"运营商账户ID,不传为全部"`
|
||||
StopReason string `json:"stop_reason" query:"stop_reason" validate:"omitempty,max=50" maxLength:"50" description:"停机原因筛选:传停机原因编码(如 not_realname、carrier_stopped、manual),传 none 表示停机原因为空,不传为全部"`
|
||||
AssumeControlOn string `json:"assume_control_on" query:"assume_control_on" validate:"omitempty,max=2000" maxLength:"2000" description:"假设开启实名管控的运营商账户ID,逗号分隔;只用于预演,不改实际配置"`
|
||||
AssumeControlOff string `json:"assume_control_off" query:"assume_control_off" validate:"omitempty,max=2000" maxLength:"2000" description:"假设关闭实名管控的运营商账户ID,逗号分隔;只用于预演,不改实际配置"`
|
||||
Result string `json:"result" query:"result" validate:"omitempty,oneof=will_resume will_stop no_action" enum:"will_resume,will_stop,no_action" description:"明细按判断结果筛选 (will_resume:将复机, will_stop:将停机, no_action:不动作),汇总不受影响"`
|
||||
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"明细页码,默认1"`
|
||||
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=500" minimum:"1" maximum:"500" description:"明细每页数量,默认20,最大500"`
|
||||
}
|
||||
|
||||
// StopResumeRuleDryRunExportRequest 停复机规则演练明细导出请求。
|
||||
type StopResumeRuleDryRunExportRequest struct {
|
||||
CarrierID *uint `json:"carrier_id" validate:"omitempty,min=1" minimum:"1" description:"运营商账户ID,不传为全部"`
|
||||
StopReason string `json:"stop_reason" validate:"omitempty,max=50" maxLength:"50" description:"停机原因筛选,none 表示停机原因为空"`
|
||||
AssumeControlOn string `json:"assume_control_on" validate:"omitempty,max=2000" maxLength:"2000" description:"假设开启实名管控的运营商账户ID,逗号分隔"`
|
||||
AssumeControlOff string `json:"assume_control_off" validate:"omitempty,max=2000" maxLength:"2000" description:"假设关闭实名管控的运营商账户ID,逗号分隔"`
|
||||
Format string `json:"format" validate:"omitempty,oneof=xlsx csv" enum:"xlsx,csv" description:"导出格式 (xlsx:Excel, csv:CSV),默认 xlsx"`
|
||||
}
|
||||
|
||||
// StopResumeRuleDryRunSummaryItem 演练汇总项:运营商账户 × 当前停机原因 × 判断结果 × 原因。
|
||||
type StopResumeRuleDryRunSummaryItem struct {
|
||||
CarrierID uint `json:"carrier_id" description:"运营商账户ID"`
|
||||
CarrierName string `json:"carrier_name" description:"运营商账户名称"`
|
||||
StopReason string `json:"stop_reason" description:"当前停机原因,空表示无"`
|
||||
StopReasonName string `json:"stop_reason_name" description:"当前停机原因名称"`
|
||||
Result string `json:"result" description:"判断结果 (will_resume:将复机, will_stop:将停机, no_action:不动作)"`
|
||||
ResultName string `json:"result_name" description:"判断结果名称"`
|
||||
Reason string `json:"reason" description:"将停机时为目标停机原因,不动作时为不动作原因 (polling_suspended:暂停轮询, conditions_met:满足开机条件, no_package:无套餐, traffic_exhausted:流量已用完, not_realname:未实名, threshold_locked:持通道阈值锁, carrier_missing:所属通道不存在)"`
|
||||
ReasonName string `json:"reason_name" description:"原因名称"`
|
||||
Count int64 `json:"count" description:"卡数"`
|
||||
}
|
||||
|
||||
// StopResumeRuleDryRunTotals 演练总计。
|
||||
type StopResumeRuleDryRunTotals struct {
|
||||
Total int64 `json:"total" description:"参与演练的开机与停机卡数"`
|
||||
WillResume int64 `json:"will_resume" description:"将复机卡数"`
|
||||
WillStop int64 `json:"will_stop" description:"将停机卡数"`
|
||||
NoAction int64 `json:"no_action" description:"不动作卡数"`
|
||||
}
|
||||
|
||||
// StopResumeRuleDryRunItem 演练明细。
|
||||
type StopResumeRuleDryRunItem struct {
|
||||
CardID uint `json:"card_id" description:"卡ID"`
|
||||
ICCID string `json:"iccid" description:"ICCID"`
|
||||
CarrierID uint `json:"carrier_id" description:"运营商账户ID"`
|
||||
CarrierName string `json:"carrier_name" description:"运营商账户名称"`
|
||||
DeviceID uint `json:"device_id" description:"有效绑定设备ID,独立卡为 0"`
|
||||
NetworkStatus int `json:"network_status" description:"当前网络状态 (0:停机, 1:开机)"`
|
||||
StopReason string `json:"stop_reason" description:"当前停机原因"`
|
||||
StopReasonName string `json:"stop_reason_name" description:"当前停机原因名称"`
|
||||
CardCategory string `json:"card_category" description:"卡类别"`
|
||||
RealnameOK bool `json:"realname_ok" description:"按(假设的)通道实名管控是否满足实名条件"`
|
||||
Result string `json:"result" description:"判断结果"`
|
||||
ResultName string `json:"result_name" description:"判断结果名称"`
|
||||
Reason string `json:"reason" description:"将停机时为目标停机原因,不动作时为不动作原因"`
|
||||
ReasonName string `json:"reason_name" description:"原因名称"`
|
||||
}
|
||||
|
||||
// StopResumeRuleDryRunResponse 停复机规则演练响应。
|
||||
type StopResumeRuleDryRunResponse struct {
|
||||
Totals StopResumeRuleDryRunTotals `json:"totals" description:"总计"`
|
||||
Summary []StopResumeRuleDryRunSummaryItem `json:"summary" description:"按运营商账户 × 当前停机原因 × 判断结果 × 原因汇总"`
|
||||
Items []StopResumeRuleDryRunItem `json:"items" description:"明细(按卡ID升序分页)"`
|
||||
Total int64 `json:"total" description:"明细总数(按 result 筛选后)"`
|
||||
Page int `json:"page" description:"当前页"`
|
||||
PageSize int `json:"size" description:"每页数量"`
|
||||
}
|
||||
Reference in New Issue
Block a user