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
95140e9a
Commit
95140e9a
authored
May 19, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
fd3450a0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
14 deletions
+24
-14
list_alarm_dao.py
unify_api/modules/alarm_manager/dao/list_alarm_dao.py
+11
-8
list_alarm.py
unify_api/modules/alarm_manager/views/list_alarm.py
+4
-1
proxy_ranking.py
unify_api/modules/electric/views/proxy_ranking.py
+5
-1
count_info_pds.py
unify_api/modules/home_page/procedures/count_info_pds.py
+1
-1
count_info_proxy.py
unify_api/modules/home_page/views/count_info_proxy.py
+1
-1
security_info.py
unify_api/modules/home_page/views/security_info.py
+2
-2
No files found.
unify_api/modules/alarm_manager/dao/list_alarm_dao.py
View file @
95140e9a
...
...
@@ -350,6 +350,9 @@ async def alarm_content_time_distribution_dao(cid, start, end, ):
"""
智电温度漏电流电参数分布
"""
if
isinstance
(
cid
,
list
):
mid_li
=
[
f
"cid in {str(tuple(cid)).replace(',)', ')')}"
]
else
:
mid_li
=
[
f
"cid={cid}"
]
if
start
and
end
:
mid_li
.
append
(
f
"event_datetime BETWEEN '{start}' and '{end}'"
)
...
...
unify_api/modules/alarm_manager/views/list_alarm.py
View file @
95140e9a
...
...
@@ -66,7 +66,10 @@ async def post_list_alarm(req, body: PageRequest) -> ListAlarmResponse:
# cids = await get_cids(user_id, product)
proxy_cids
=
await
get_proxy_cids
(
user_id
,
product
,
proxy_id
)
if
req_cids
and
proxy_cids
:
cids
=
list
(
set
(
req_cids
)
&
set
(
proxy_cids
))
else
:
cids
=
proxy_cids
if
req
.
json
.
get
(
"product"
)
in
[
Product
.
RecognitionElectric
.
value
,
Product
.
IntelligentU
.
value
]:
...
...
unify_api/modules/electric/views/proxy_ranking.py
View file @
95140e9a
...
...
@@ -14,7 +14,11 @@ async def post_elec_count_info(req, body: ProxyRankingReq) -> ProxyRankingResp:
product
=
body
.
product
# sql = "SELECT cid,safe_exp,health_exp,ele_quan,ele_charge " \
# "FROM safe_health_stats_cid where cid in %s and cal_month = %s"
sql
=
"SELECT safe_exp,health_exp,ele_quan,ele_charge,shsc.cid,"
\
sql
=
"SELECT ifnull(safe_exp,0) safe_exp,"
\
"ifnull(health_exp,0) health_exp,"
\
"ifnull(ele_quan,0) ele_quan,"
\
"ifnull(ele_charge,0) ele_charge,"
\
"shsc.cid,"
\
"company.shortname FROM safe_health_stats_cid shsc "
\
"left join company on shsc.cid=company.cid where "
\
"shsc.cid in
%
s and shsc.cal_month =
%
s"
...
...
unify_api/modules/home_page/procedures/count_info_pds.py
View file @
95140e9a
...
...
@@ -63,7 +63,7 @@ async def other_info(company_id):
# 获取到工厂安装时间create_time
async
with
MysqlUtil
()
as
conn
:
company_sql
=
"select create_time from company where cid =
%
s"
alarm_data
=
await
conn
.
fetch
one
(
alarm_sql
,
(
company_id
,))
alarm_data
=
await
conn
.
fetch
all
(
alarm_sql
,
(
company_id
,))
company
=
await
conn
.
fetchone
(
company_sql
,
(
company_id
,))
create_time_timestamp
=
company
[
"create_time"
]
create_time
=
datetime
.
fromtimestamp
(
create_time_timestamp
)
...
...
unify_api/modules/home_page/views/count_info_proxy.py
View file @
95140e9a
...
...
@@ -79,7 +79,7 @@ async def post_count_info_proxy(req) -> CountInfoProxyResp:
safe_operation_days
+=
safe_run_days
total_alarm
+=
alarm_count
# 4. 累计监测用电
total_power
=
await
proxy_power
(
cid_list
)
total_power
=
await
proxy_power
15
(
cid_list
)
return
CountInfoProxyResp
(
total_cid
=
total_cid
,
total_monitor
=
total_monitor
,
...
...
unify_api/modules/home_page/views/security_info.py
View file @
95140e9a
...
...
@@ -120,7 +120,7 @@ async def post_alarm_content_distribution(
date_type
=
body
.
date_type
if
product
==
Product
.
AndianUManage
.
value
:
user_id
=
request
.
ctx
.
user_id
user_id
=
jwt_user
(
request
)
# cids = await get_cids(user_id, product)
proxy_id
=
body
.
proxy_id
cids
=
await
get_proxy_cids
(
user_id
,
product
,
proxy_id
)
...
...
@@ -129,7 +129,7 @@ async def post_alarm_content_distribution(
else
:
raise
BusinessException
(
message
=
f
"暂时不支持其他产品"
)
alarm_info_map
=
await
alarm_content_time_distribution_pds
(
req_cids
,
start
,
end
,
date_type
)
alarm_info_map
=
await
alarm_content_time_distribution_pds
(
req_cids
,
start
,
end
)
temperature
,
residual_current
,
electric_param
,
electric_param_detail
=
(
alarm_info_map
[
"temperature"
],
alarm_info_map
[
"residual_current"
],
...
...
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