Commit bde37a14 authored by 李科's avatar 李科

feat: 预警工单处置

parent 3b09f101
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"` // 处置内容(工单管理,结果反馈)
}
......@@ -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)
}
......@@ -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) // 处置反馈
}
//业务工单管理
......
......@@ -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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment