Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
1c264a88
Commit
1c264a88
authored
Sep 07, 2022
by
peng.xiaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
condition-monitor 首页报警相关bug修复
parent
04eac214
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
list_static_dao.py
unify_api/modules/alarm_manager/dao/list_static_dao.py
+19
-0
count_info_proxy_pds.py
..._api/modules/home_page/procedures/count_info_proxy_pds.py
+7
-7
No files found.
unify_api/modules/alarm_manager/dao/list_static_dao.py
View file @
1c264a88
...
@@ -459,6 +459,25 @@ async def sdu_alarm_aggs_date_importance(cid):
...
@@ -459,6 +459,25 @@ async def sdu_alarm_aggs_date_importance(cid):
async
def
sdu_alarm_aggs_type
(
cid
,
start
,
end
):
async
def
sdu_alarm_aggs_type
(
cid
,
start
,
end
):
sql
=
f
"""
SELECT
COUNT(*) doc_count,
event_type
FROM
point_1min_event pevent
WHERE
cid = {cid}
AND pevent.event_datetime >= '{start}'
AND pevent.event_datetime <= '{end}'
GROUP BY
pevent.event_type;
"""
async
with
MysqlUtil
()
as
conn
:
datas
=
await
conn
.
fetchall
(
sql
)
return
datas
if
datas
else
[]
async
def
sdu_alarm_aggs_type_old
(
cid
,
start
,
end
):
start_dt
=
datetime
.
strptime
(
start
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
start_dt
=
datetime
.
strptime
(
start
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
end_dt
=
datetime
.
strptime
(
end
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
end_dt
=
datetime
.
strptime
(
end
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
es_start_str
=
datetime
(
year
=
start_dt
.
year
,
month
=
start_dt
.
month
,
es_start_str
=
datetime
(
year
=
start_dt
.
year
,
month
=
start_dt
.
month
,
...
...
unify_api/modules/home_page/procedures/count_info_proxy_pds.py
View file @
1c264a88
...
@@ -511,26 +511,26 @@ async def alarm_safe_power(cid, start, end):
...
@@ -511,26 +511,26 @@ async def alarm_safe_power(cid, start, end):
for
bucket
in
es_res
:
for
bucket
in
es_res
:
# 温度
# 温度
if
bucket
[
"
key
"
]
in
(
"overTemp"
,
"overTempRange1min"
,
if
bucket
[
"
event_type
"
]
in
(
"overTemp"
,
"overTempRange1min"
,
"overTempRange15min"
):
"overTempRange15min"
):
temperature_cnt
+=
bucket
[
"doc_count"
]
temperature_cnt
+=
bucket
[
"doc_count"
]
# 漏电流
# 漏电流
elif
bucket
[
"
key
"
]
in
(
"overResidualCurrent"
,):
elif
bucket
[
"
event_type
"
]
in
(
"overResidualCurrent"
,):
residual_current_cnt
+=
bucket
[
"doc_count"
]
residual_current_cnt
+=
bucket
[
"doc_count"
]
# 负载率
# 负载率
elif
bucket
[
"
key
"
]
in
(
"overPR"
,):
elif
bucket
[
"
event_type
"
]
in
(
"overPR"
,):
lr_cnt
+=
bucket
[
"doc_count"
]
lr_cnt
+=
bucket
[
"doc_count"
]
# 功率因数
# 功率因数
elif
bucket
[
"
key
"
]
in
(
"underPhasePF"
,
"underTotalPF"
):
elif
bucket
[
"
event_type
"
]
in
(
"underPhasePF"
,
"underTotalPF"
):
power_factor_cnt
+=
bucket
[
"doc_count"
]
power_factor_cnt
+=
bucket
[
"doc_count"
]
# 欠压
# 欠压
elif
bucket
[
"
key
"
]
in
(
"underU"
,):
elif
bucket
[
"
event_type
"
]
in
(
"underU"
,):
under_u_cnt
+=
bucket
[
"doc_count"
]
under_u_cnt
+=
bucket
[
"doc_count"
]
# 过压
# 过压
elif
bucket
[
"
key
"
]
in
(
"overU"
,):
elif
bucket
[
"
event_type
"
]
in
(
"overU"
,):
over_u_cnt
+=
bucket
[
"doc_count"
]
over_u_cnt
+=
bucket
[
"doc_count"
]
# 过流
# 过流
elif
bucket
[
"
key
"
]
in
(
"overI"
,):
elif
bucket
[
"
event_type
"
]
in
(
"overI"
,):
over_i_cnt
+=
bucket
[
"doc_count"
]
over_i_cnt
+=
bucket
[
"doc_count"
]
alarm_map
=
{
alarm_map
=
{
...
...
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