diff --git a/src/bean/vo/request/alert_list.go b/src/bean/vo/request/alert_list.go index 4e10d2af6d729ffc8e4d33026e4a01c4749971bf..097e7c739e31eb1c7aeaf45078cb8e693b5ee2e0 100644 --- a/src/bean/vo/request/alert_list.go +++ b/src/bean/vo/request/alert_list.go @@ -1,6 +1,8 @@ package request -import "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity" +import ( + "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity" +) type DetailAlertList struct { Id int `json:"id" form:"id" binding:"required"` @@ -34,3 +36,9 @@ type ListAlertList struct { StartTime string `json:"start_time" form:"start_time" binding:"omitempty,datetime=2006-01-02 15:04:05"` EndTime string `json:"end_time" form:"end_time" binding:"omitempty,datetime=2006-01-02 15:04:05"` } + +type DisposeAlertList struct { + Id int `json:"id" form:"id" binding:"required"` + Status int `json:"status" form:"status" binding:"oneof=1 2"` // 状态,1:已恢复 2:未恢复 3:已关闭 + DisposalContent string `json:"disposal_content" binding:"required"` // 处置内容(工单管理,结果反馈) +} diff --git a/src/controller/alert_list.go b/src/controller/alert_list.go index 770e25f95b87951408224d9dd82e438648e4ff6d..8fd8a4bf282f3271cae45cd46d3df32e0f79ede1 100644 --- a/src/controller/alert_list.go +++ b/src/controller/alert_list.go @@ -102,3 +102,24 @@ func ListAlertList(c *gin.Context) { } SendJsonResponse(c, resp.OK, data) } + +func DisposeAlertList(c *gin.Context) { + var req request.DisposeAlertList + if err := c.ShouldBind(&req); err != nil { + SendJsonResponse(c, resp.InvalidParam.TranslateError(err), nil) + return + } + db, err := client.GetDbClient() + if err != nil { + SendJsonResponse(c, resp.DbConnectError.WithError(err), nil) + return + } + + svc := service.AlertListSvc{User: header.GetUser(c)} + err = svc.DisposeAlertList(db.NewSession(), req) + if err != nil { + SendJsonResponse(c, resp.FAIL.WithError(err), nil) + return + } + SendJsonResponse(c, resp.OK, nil) +} diff --git a/src/router/workorderrouter.go b/src/router/workorderrouter.go index de53297b440bee83347188a65698042d733b387e..9b8d73dc6d8b9d76aa590e38bc27377abae1d111 100644 --- a/src/router/workorderrouter.go +++ b/src/router/workorderrouter.go @@ -12,10 +12,11 @@ import ( func InitWorkOrderRouter(e *gin.Engine) { so := e.Group(fmt.Sprintf("%s/work_order", conf.Options.Prefix)) //预警工单管理 - alert := so.Group("/alert", header.SetContext) + alert := so.Group("/alert") { - alert.GET("", controller.DetailAlertList) // 详情 - alert.GET("/list", controller.ListAlertList) // 列表 + alert.GET("", controller.DetailAlertList) // 详情 + alert.GET("/list", controller.ListAlertList) // 列表 + alert.PUT("/dispose", controller.DisposeAlertList) // 处置反馈 } //业务工单管理 diff --git a/src/service/alert_list.go b/src/service/alert_list.go index 41132515c50e49a0553889b4d040c92d111e952b..d98223a9f7ddcb500c611842af785d9ddaac22cc 100644 --- a/src/service/alert_list.go +++ b/src/service/alert_list.go @@ -290,3 +290,11 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL resp.TotalCount = int64(len(resp.List)) return } + +func (a *AlertListSvc) DisposeAlertList(session *xorm.Session, req request.DisposeAlertList) error { + now := jsontime.Now() + _ = now + // TODO 我的预警工单处置 + conf.Logger.Info("dispose alert", zap.Any("payload", req)) + return nil +}