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
56ab5c00
Commit
56ab5c00
authored
Jun 20, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
e601b279
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
36 deletions
+3
-36
hardware_pds.py
unify_api/modules/product_info/procedures/hardware_pds.py
+0
-33
hardware_info.py
unify_api/modules/product_info/views/hardware_info.py
+3
-3
No files found.
unify_api/modules/product_info/procedures/hardware_pds.py
View file @
56ab5c00
...
@@ -253,37 +253,4 @@ async def hardware_statistics(company_id):
...
@@ -253,37 +253,4 @@ async def hardware_statistics(company_id):
"legal_measurement_number"
:
inline_count
,
"legal_measurement_number"
:
inline_count
,
"start_time"
:
start_time
,
"start_time"
:
start_time
,
"power_capacity"
:
power_capacity
if
power_capacity
else
""
,
"power_capacity"
:
power_capacity
if
power_capacity
else
""
,
}
async
def
hardware_statistics_new15
(
cid
):
"""
获取硬件信息总统计
"""
sql
=
"SELECT c.create_time, p.pid FROM `point` p left join monitor m "
\
"on p.mtid=m.mtid LEFT JOIN company c on c.cid =p.cid "
\
"where m.demolished=0 and p.cid=
%
s"
async
with
MysqlUtil
()
as
conn
:
datas
=
await
conn
.
fetchall
(
sql
=
sql
,
args
=
(
cid
,))
if
not
datas
:
point_count
,
inline_count
=
0
,
0
start_time
,
power_capacity
=
""
,
""
else
:
point_count
=
len
(
datas
)
create_time
=
datas
[
0
][
"create_time"
]
start_time
=
datetime
.
strftime
(
datetime
.
fromtimestamp
(
create_time
),
"
%
Y-
%
m-
%
d
%
H:
%
M"
)
inline_sql
=
"select tc_runtime from inline where cid =
%
s"
async
with
MysqlUtil
()
as
conn
:
inline_dats
=
await
conn
.
fetchall
(
sql
=
inline_sql
,
args
=
(
cid
,))
inline_count
=
len
(
inline_dats
)
power_capacity
=
0
for
inline_data
in
inline_dats
:
if
inline_data
.
get
(
"tc_runtime"
):
power_capacity
+=
1
return
{
"installed_number"
:
point_count
,
"legal_measurement_number"
:
inline_count
,
"start_time"
:
start_time
,
"power_capacity"
:
power_capacity
if
power_capacity
else
""
,
}
}
\ No newline at end of file
unify_api/modules/product_info/views/hardware_info.py
View file @
56ab5c00
...
@@ -5,7 +5,7 @@ from unify_api.modules.product_info.components.hardware_cps import (
...
@@ -5,7 +5,7 @@ from unify_api.modules.product_info.components.hardware_cps import (
HardwareInfoManResq
,
HardwareInfoListReq
,
HardwareInfoListResq
HardwareInfoManResq
,
HardwareInfoListReq
,
HardwareInfoListResq
)
)
from
unify_api.modules.product_info.procedures.hardware_pds
import
(
from
unify_api.modules.product_info.procedures.hardware_pds
import
(
company_available
,
get_user_hardware_info_new15
,
hardware_statistics
_new15
company_available
,
get_user_hardware_info_new15
,
hardware_statistics
)
)
from
pot_libs.logger
import
log
from
pot_libs.logger
import
log
from
unify_api.modules.product_info.service.hardware_info
import
\
from
unify_api.modules.product_info.service.hardware_info
import
\
...
@@ -25,7 +25,7 @@ async def post_hardware_info_list(request,
...
@@ -25,7 +25,7 @@ async def post_hardware_info_list(request,
comp_available
=
await
company_available
(
company_id
)
comp_available
=
await
company_available
(
company_id
)
if
not
comp_available
:
if
not
comp_available
:
return
HardwareInfoRespList
.
user_error
()
return
HardwareInfoRespList
.
user_error
()
# page_map = await get_user_hardware_info(company_id, page_num, page_size)
# page_map = await get_user_hardware_info(company_id, page_num, page_size)
page_map
=
await
get_user_hardware_info_new15
(
company_id
,
page_num
,
page_map
=
await
get_user_hardware_info_new15
(
company_id
,
page_num
,
page_size
)
page_size
)
...
@@ -37,7 +37,7 @@ async def post_hardware_info_count(request,
...
@@ -37,7 +37,7 @@ async def post_hardware_info_count(request,
body
:
HardwareInfoCountReq
)
->
HardwareInfoCountResp
:
body
:
HardwareInfoCountReq
)
->
HardwareInfoCountResp
:
company_id
=
body
.
cid
company_id
=
body
.
cid
# statistics_info_map = await hardware_statistics(company_id)
# statistics_info_map = await hardware_statistics(company_id)
statistics_info_map
=
await
hardware_statistics
_new15
(
company_id
)
statistics_info_map
=
await
hardware_statistics
(
company_id
)
return
HardwareInfoCountResp
(
return
HardwareInfoCountResp
(
installed_number
=
statistics_info_map
[
"installed_number"
],
installed_number
=
statistics_info_map
[
"installed_number"
],
legal_measurement_number
=
statistics_info_map
[
legal_measurement_number
=
statistics_info_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