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
68fa4a8c
Commit
68fa4a8c
authored
Jul 19, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix longgang data 2023-7-19
parent
2bd87ca5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
open_data_service.py
unify_api/modules/shidianu/service/open_data_service.py
+2
-3
open_data.py
unify_api/modules/shidianu/views/open_data.py
+2
-2
No files found.
unify_api/modules/shidianu/service/open_data_service.py
View file @
68fa4a8c
...
@@ -168,12 +168,11 @@ async def supplement_data_service(user_id, cid, start, end, d_type):
...
@@ -168,12 +168,11 @@ async def supplement_data_service(user_id, cid, start, end, d_type):
db_name
=
topic2db
[
d_type
]
db_name
=
topic2db
[
d_type
]
stb_url
=
f
"{SETTING.stb_url}{db_name}?tz=Asia/Shanghai"
stb_url
=
f
"{SETTING.stb_url}{db_name}?tz=Asia/Shanghai"
table_name
=
f
"{d_type}_stb"
if
d_type
==
"electric"
:
if
d_type
==
"electric"
:
sql
=
f
"select * from {
table_name}
where cpyid={cid} and "
\
sql
=
f
"select * from {
d_type}_stb
where cpyid={cid} and "
\
f
"ts >= '{start}' and ts <= '{end}'"
f
"ts >= '{start}' and ts <= '{end}'"
else
:
else
:
sql
=
f
"select * from {
table_name}
where cpyid={cid} and "
\
sql
=
f
"select * from {
d_type}_stb
where cpyid={cid} and "
\
f
"ts_origin >= '{start}' and ts_origin <= '{end}'"
f
"ts_origin >= '{start}' and ts_origin <= '{end}'"
resp_str
,
status
=
await
AioHttpUtils
()
.
post_data
(
resp_str
,
status
=
await
AioHttpUtils
()
.
post_data
(
stb_url
,
data
=
sql
,
timeout
=
50
,
stb_url
,
data
=
sql
,
timeout
=
50
,
...
...
unify_api/modules/shidianu/views/open_data.py
View file @
68fa4a8c
...
@@ -15,7 +15,7 @@ from unify_api.utils.time_format import last30_day_range
...
@@ -15,7 +15,7 @@ from unify_api.utils.time_format import last30_day_range
from
unify_api.modules.common.dao.common_dao
import
monitor_by_cid
from
unify_api.modules.common.dao.common_dao
import
monitor_by_cid
from
unify_api.modules.home_page.service.count_info_service
import
safe_run_sdu
from
unify_api.modules.home_page.service.count_info_service
import
safe_run_sdu
from
unify_api.modules.common.procedures.power_cps
import
power_use_count
from
unify_api.modules.common.procedures.power_cps
import
power_use_count
from
unify_api.modules.common.procedures.alarm_cps
import
alarm_count_sdu_new
from
unify_api.modules.common.procedures.alarm_cps
import
load_alarm_cnt_sdu
from
unify_api.modules.shidianu.service.open_data_service
import
get_power
from
unify_api.modules.shidianu.service.open_data_service
import
get_power
from
unify_api.modules.common.components.select_company_cps
import
CmReq
from
unify_api.modules.common.components.select_company_cps
import
CmReq
from
pot_libs.common.components.responses
import
success_res
from
pot_libs.common.components.responses
import
success_res
...
@@ -115,7 +115,7 @@ async def post_home_page_data(req, body: CmReq) -> HomeDataResp:
...
@@ -115,7 +115,7 @@ async def post_home_page_data(req, body: CmReq) -> HomeDataResp:
total_power
=
await
power_use_count
(
cids
)
total_power
=
await
power_use_count
(
cids
)
# 5. 累计报警
# 5. 累计报警
total_alarm
=
await
alarm_count_sdu_new
(
cids
)
total_alarm
=
await
load_alarm_cnt_sdu
(
cids
)
return
HomeDataResp
(
return
HomeDataResp
(
risk_distribution
=
res
.
risk_distribution
,
risk_distribution
=
res
.
risk_distribution
,
content_distribution
=
res
.
content_distribution
,
content_distribution
=
res
.
content_distribution
,
...
...
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