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
3eee08fd
Commit
3eee08fd
authored
Aug 22, 2022
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG修复
parent
121f1444
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
54 deletions
+137
-54
alarm_static_service.py
...api/modules/alarm_manager/service/alarm_static_service.py
+2
-2
pttl_max.py
unify_api/modules/common/procedures/pttl_max.py
+1
-1
security_info_pds.py
unify_api/modules/home_page/procedures/security_info_pds.py
+119
-40
count_info_proxy.py
unify_api/modules/home_page/views/count_info_proxy.py
+3
-3
security_info.py
unify_api/modules/home_page/views/security_info.py
+3
-4
time_format.py
unify_api/utils/time_format.py
+9
-4
No files found.
unify_api/modules/alarm_manager/service/alarm_static_service.py
View file @
3eee08fd
...
...
@@ -20,7 +20,7 @@ from unify_api.modules.common.procedures.points import points_by_storeys
from
unify_api.modules.home_page.components.security_info_cps
import
\
SecurityCountResp
,
LevelCount
,
ContentCount
,
AlarmContentDistributionResp
from
unify_api.modules.home_page.procedures.security_info_pds
import
\
alarm_co
unt_info
,
alarm_content_time_distribution
alarm_co
ntent_time_distribution
,
alarm_count_info_new15
from
unify_api.utils.common_utils
import
round_1
,
division_two
...
...
@@ -418,7 +418,7 @@ async def sdu_index_alarm_ranking_service_new15(cid, start, end, product):
async
def
zdu_level_distribution_service
(
cid
,
start
,
end
,
product
):
"""报警统计-报警等级-智电u"""
alarm_info_map
=
await
alarm_count_info
([
cid
],
start
,
end
,
"month"
)
alarm_info_map
=
await
alarm_count_info
_new15
([
cid
],
start
,
end
,
"month"
)
first_alarm
,
second_alarm
,
third_alarm
=
(
alarm_info_map
[
"first_alarm"
],
alarm_info_map
[
"second_alarm"
],
...
...
unify_api/modules/common/procedures/pttl_max.py
View file @
3eee08fd
...
...
@@ -132,7 +132,7 @@ async def pttl_max_new15(cid, start, end, point_id=None, inline_id=None):
# 根据时间范围, 返回不同时间格式
if
max_val_time
:
if
date_type
==
"day"
:
max_val_time
=
str
(
max_val_time
)[
:
10
]
max_val_time
=
str
(
max_val_time
)[
11
:
16
]
elif
date_type
==
"month"
:
max_val_time
=
str
(
max_val_time
)[
5
:
10
]
else
:
...
...
unify_api/modules/home_page/procedures/security_info_pds.py
View file @
3eee08fd
This diff is collapsed.
Click to expand it.
unify_api/modules/home_page/views/count_info_proxy.py
View file @
3eee08fd
...
...
@@ -43,7 +43,7 @@ from unify_api.modules.home_page.procedures.count_info_proxy_pds import (
total_run_day_proxy
,
)
from
unify_api.modules.home_page.procedures.security_info_pds
import
\
alarm_count_info
alarm_count_info
_new15
from
unify_api.modules.home_page.service.count_info_service
import
\
safe_run_sdu
,
safe_run_sdu_new15
from
unify_api.modules.elec_charge.components.elec_charge_cps
import
\
...
...
@@ -225,7 +225,7 @@ async def post_reg_alarm_distribution(request,
if
product
==
Product
.
RecognitionElectric
.
value
:
user_id
=
request
.
ctx
.
user_id
cids
=
await
get_cids
(
user_id
,
product
)
alarm_info_map
=
await
alarm_count_info
(
cids
,
start
,
end
,
date_type
)
alarm_info_map
=
await
alarm_count_info
_new15
(
cids
,
start
,
end
,
date_type
)
type_alarm_cnt_map
=
alarm_info_map
[
"type_alarm_cnt_map"
]
return
AlarmDistributionResp
(
alarm_categories
=
RegAlarmCnt
(
...
...
@@ -250,7 +250,7 @@ async def post_reg_alarm_rank(request,
if
product
==
Product
.
RecognitionElectric
.
value
:
user_id
=
request
.
ctx
.
user_id
cids
=
await
get_cids
(
user_id
,
product
)
alarm_info_map
=
await
alarm_count_info
(
cids
,
start
,
end
,
date_type
)
alarm_info_map
=
await
alarm_count_info
_new15
(
cids
,
start
,
end
,
date_type
)
cid_alarm_cnt_map
=
alarm_info_map
[
"cid_alarm_cnt_map"
]
cid_info_map
=
await
get_cid_info
(
all
=
True
)
...
...
unify_api/modules/home_page/views/security_info.py
View file @
3eee08fd
...
...
@@ -19,9 +19,8 @@ from unify_api.modules.home_page.components.security_info_cps import (
AlarmSummaryResp
,
)
from
unify_api.modules.home_page.procedures.security_info_pds
import
(
alarm_count_info
,
alarm_content_time_distribution
,
alarm_summary
,
alarm_summary
,
alarm_count_info_new15
,
)
...
...
@@ -43,7 +42,7 @@ async def post_security_index(request, body: SecurityCountReq) -> SecurityCountR
elif
product
==
Product
.
RecognitionElectric
.
value
:
user_id
=
request
.
ctx
.
user_id
cids
=
await
get_cids
(
user_id
,
product
)
alarm_info_map
=
await
alarm_count_info
(
cids
,
start
,
end
,
date_type
)
alarm_info_map
=
await
alarm_count_info
_new15
(
cids
,
start
,
end
,
date_type
)
first_alarm
,
second_alarm
,
third_alarm
=
(
alarm_info_map
[
"first_alarm"
],
alarm_info_map
[
"second_alarm"
],
...
...
@@ -84,7 +83,7 @@ async def post_alarm_level_distribution(request, body: SecurityCommonReq) -> Sec
else
:
raise
BusinessException
(
message
=
f
"暂时不支持其他产品"
)
alarm_info_map
=
await
alarm_count_info
(
req_cids
,
start
,
end
,
date_type
)
alarm_info_map
=
await
alarm_count_info
_new15
(
req_cids
,
start
,
end
,
date_type
)
first_alarm
,
second_alarm
,
third_alarm
=
(
alarm_info_map
[
"first_alarm"
],
alarm_info_map
[
"second_alarm"
],
...
...
unify_api/utils/time_format.py
View file @
3eee08fd
...
...
@@ -134,14 +134,19 @@ def year_slots(start, end):
return
slots
def
day_slots
():
def
day_slots
(
type
=
'minutes'
):
"""
获取一天时间点
"""
dt
=
my_pendulum
.
now
()
.
start_of
(
'day'
)
if
type
==
'minutes'
:
slots
=
[
dt
.
add
(
minutes
=
i
)
.
format
(
"HH:mm"
)
for
i
in
range
(
1440
)
]
else
:
slots
=
[
dt
.
add
(
hours
=
i
)
.
format
(
"HH"
)
for
i
in
range
(
24
)
]
return
slots
...
...
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