Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
e6169241
Commit
e6169241
authored
Jul 20, 2023
by
李科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 预警列表
parent
498bfc45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
31 deletions
+31
-31
src/bean/vo/request/alert.go
src/bean/vo/request/alert.go
+11
-11
src/controller/alert.go
src/controller/alert.go
+20
-20
No files found.
src/bean/vo/request/alert.go
View file @
e6169241
...
...
@@ -8,6 +8,17 @@ type DetailAlert struct {
Id
int
`json:"id" form:"id" binding:"required"`
}
type
ListAlert
struct
{
Id
int
`json:"id" form:"id"`
Ids
[]
int
`json:"ids" form:"ids"`
// 预警ids
RiskLevel
int
`json:"risk_level" form:"risk_level" binding:"omitempty,oneof=1 2 3 4"`
// 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险
Status
int
`json:"status" form:"status" binding:"omitempty,oneof=1 2 3"`
// 状态,1:已恢复 2:未恢复 3:已关闭
Keyword
string
`json:"keyword" form:"keyword"`
// 预警点/分类/指标
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"`
Pagination
}
type
UpdateAlert
struct
{
Id
int
`json:"id" form:"id" binding:"required"`
//Ids []int `json:"ids" form:"ids" binding:"required_without=Id"` // 预警ids
...
...
@@ -33,17 +44,6 @@ type BatchCloseAlert struct {
DeferPush
int
`json:"defer_push" form:"defer_push" binding:"omitempty,oneof=0 1"`
// 延迟三天推送: 0:否 1:是 三天内将不再自动推送该告警信息给处置人员,可手动推送,但告警数据依然会出现
}
type
ListAlert
struct
{
Id
int
`json:"id" form:"id"`
Ids
[]
int
`json:"ids" form:"ids" binding:"required_without=Id"`
// 预警ids
RiskLevel
int
`json:"risk_level" form:"risk_level" binding:"omitempty,oneof=1 2 3 4"`
// 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险
Status
int
`json:"status" form:"status" binding:"omitempty,oneof=1 2 3"`
// 状态,1:已恢复 2:未恢复 3:已关闭
Keyword
string
`json:"keyword" form:"keyword"`
// 预警点/分类/指标
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"`
Pagination
}
type
DisposeAlert
struct
{
Id
int
`json:"id" form:"id" binding:"required"`
Status
int
`json:"status" form:"status" binding:"oneof=1 2"`
// 状态,1:已恢复 2:未恢复 3:已关闭
...
...
src/controller/alert.go
View file @
e6169241
...
...
@@ -8,47 +8,46 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
)
func
Update
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
Update
Alert
func
Detail
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
Detail
Alert
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
svc
:=
service
.
AlertSvc
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
Update
(
req
)
data
,
err
:=
svc
.
GetDataById
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
SendJsonResponse
(
c
,
resp
.
OK
,
data
)
}
func
BatchPush
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
BatchPush
Alert
func
List
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
List
Alert
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
svc
:=
service
.
AlertSvc
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
BatchPushAler
t
(
req
)
data
,
err
:=
svc
.
Lis
t
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
SendJsonResponse
(
c
,
resp
.
OK
,
data
)
}
func
BatchClos
eAlert
(
c
*
gin
.
Context
)
{
var
req
request
.
BatchClos
eAlert
func
Updat
eAlert
(
c
*
gin
.
Context
)
{
var
req
request
.
Updat
eAlert
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
svc
:=
service
.
AlertSvc
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
BatchCloseAlert
(
req
)
err
:=
svc
.
Update
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
...
...
@@ -56,35 +55,36 @@ func BatchCloseAlert(c *gin.Context) {
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
func
Detail
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
Detail
Alert
func
BatchPush
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
BatchPush
Alert
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
svc
:=
service
.
AlertSvc
{
User
:
header
.
GetUser
(
c
)}
data
,
err
:=
svc
.
GetDataById
(
req
)
err
:=
svc
.
BatchPushAlert
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
data
)
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
func
List
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
List
Alert
func
BatchClose
Alert
(
c
*
gin
.
Context
)
{
var
req
request
.
BatchClose
Alert
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
svc
:=
service
.
AlertSvc
{
User
:
header
.
GetUser
(
c
)}
data
,
err
:=
svc
.
Lis
t
(
req
)
err
:=
svc
.
BatchCloseAler
t
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
data
)
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
func
DisposeAlert
(
c
*
gin
.
Context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment