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
746d8728
Commit
746d8728
authored
Sep 08, 2022
by
peng.xiaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
electric-economic-index-new 大屏接口修复
parent
3eca62e3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
count_info_dao.py
unify_api/modules/home_page/dao/count_info_dao.py
+8
-8
count_info_pds.py
unify_api/modules/home_page/procedures/count_info_pds.py
+3
-2
actionFile.py
unify_api/modules/zhiwei_u/fault_foreast/actionFile.py
+1
-1
No files found.
unify_api/modules/home_page/dao/count_info_dao.py
View file @
746d8728
...
@@ -56,7 +56,7 @@ async def alarm_aggs_point_location(date_start, date_end, cid):
...
@@ -56,7 +56,7 @@ async def alarm_aggs_point_location(date_start, date_end, cid):
async
def
get_inline_by_cid
(
cid
):
async
def
get_inline_by_cid
(
cid
):
sql
=
"SELECT inlid, `name` FROM inline WHERE cid
_belongedto
=
%
s"
sql
=
"SELECT inlid, `name` FROM inline WHERE cid=
%
s"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
inlines
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
inlines
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
return
inlines
return
inlines
...
@@ -66,7 +66,7 @@ async def get_inline_by_cid(cid):
...
@@ -66,7 +66,7 @@ async def get_inline_by_cid(cid):
async
def
get_power_factor_kpi
(
inline_ids
,
month_str
):
async
def
get_power_factor_kpi
(
inline_ids
,
month_str
):
sql
=
"SELECT b.name, a.inlid, a.save_charge pf_cost, a.kpi_x, "
\
sql
=
"SELECT b.name, a.inlid, a.save_charge pf_cost, a.kpi_x, "
\
"a.save_charge FROM algo_power_factor_result a LEFT JOIN inline b "
\
"a.save_charge FROM algo_power_factor_result a LEFT JOIN inline b "
\
"on a.inlid = b.inlid WHERE a.inlid in
%
s and a.
res_time
=
%
s"
"on a.inlid = b.inlid WHERE a.inlid in
%
s and a.
`month`
=
%
s"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
power_factor_results
=
await
conn
.
fetchall
(
sql
,
args
=
(
power_factor_results
=
await
conn
.
fetchall
(
sql
,
args
=
(
inline_ids
,
month_str
))
inline_ids
,
month_str
))
...
@@ -76,7 +76,7 @@ async def get_power_factor_kpi(inline_ids, month_str):
...
@@ -76,7 +76,7 @@ async def get_power_factor_kpi(inline_ids, month_str):
# 移峰填谷
# 移峰填谷
async
def
get_pcvf_kpi
(
inline_ids
,
last_month_str
):
async
def
get_pcvf_kpi
(
inline_ids
,
last_month_str
):
sql
=
"select b.name, a.score, a.cost_save "
\
sql
=
"select b.name, a.score, a.cost_save "
\
"from algo
rithm
_plsi_result a left join inline b "
\
"from algo_plsi_result a left join inline b "
\
"on a.inlid = b.inlid where a.inlid in
%
s and a.month =
%
s"
"on a.inlid = b.inlid where a.inlid in
%
s and a.month =
%
s"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
pcvfs
=
await
conn
.
fetchall
(
sql
,
args
=
(
inline_ids
,
last_month_str
))
pcvfs
=
await
conn
.
fetchall
(
sql
,
args
=
(
inline_ids
,
last_month_str
))
...
@@ -86,7 +86,7 @@ async def get_pcvf_kpi(inline_ids, last_month_str):
...
@@ -86,7 +86,7 @@ async def get_pcvf_kpi(inline_ids, last_month_str):
# 经济运行
# 经济运行
async
def
get_economic_kpi
(
inline_ids
,
last_month_str
):
async
def
get_economic_kpi
(
inline_ids
,
last_month_str
):
sql
=
"select b.name, a.kpi_x, a.save_charge, a.mean_load_factor "
\
sql
=
"select b.name, a.kpi_x, a.save_charge, a.mean_load_factor "
\
"from algo
rithm
_economic_operation_result a "
\
"from algo_economic_operation_result a "
\
"left join inline b on a.inlid = b.inlid "
\
"left join inline b on a.inlid = b.inlid "
\
"where a.inlid in
%
s and a.month =
%
s"
"where a.inlid in
%
s and a.month =
%
s"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
...
@@ -98,11 +98,11 @@ async def get_economic_kpi(inline_ids, last_month_str):
...
@@ -98,11 +98,11 @@ async def get_economic_kpi(inline_ids, last_month_str):
async
def
get_md_space
(
inline_ids
,
last_month_str
):
async
def
get_md_space
(
inline_ids
,
last_month_str
):
sql
=
(
sql
=
(
"select a.inline_md_charge, a.kpi_x, a.save_charge, "
"select a.inline_md_charge, a.kpi_x, a.save_charge, "
"a.inline_md_predict, b.
related_inlids
,b.tc_runtime "
"a.inline_md_predict, b.
inlid
,b.tc_runtime "
"from algo
rithm
_md_space_analysis_result a "
"from algo_md_space_analysis_result a "
"inner join algo
rithm
_md_space_analysis_unit b "
"inner join algo_md_space_analysis_unit b "
"on a.space_analysis_id=b.id "
"on a.space_analysis_id=b.id "
"where b.
related_inlids
in
%
s and a.month =
%
s and valid=1;"
"where b.
inlid
in
%
s and a.month =
%
s and valid=1;"
)
)
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
md_spaces
=
await
conn
.
fetchall
(
sql
,
args
=
(
inline_ids
,
last_month_str
))
md_spaces
=
await
conn
.
fetchall
(
sql
,
args
=
(
inline_ids
,
last_month_str
))
...
...
unify_api/modules/home_page/procedures/count_info_pds.py
View file @
746d8728
...
@@ -1453,6 +1453,7 @@ async def electric_use_info_points_sdu_new15(start, end, points):
...
@@ -1453,6 +1453,7 @@ async def electric_use_info_points_sdu_new15(start, end, points):
electric_use_score
=
electric_use_score
,
electric_use_score
=
electric_use_score
,
)
)
async
def
optimization_count_info_new
(
company_id
:
int
):
async
def
optimization_count_info_new
(
company_id
:
int
):
"""
"""
首页用电经济指数和用电优化模块统计数据
首页用电经济指数和用电优化模块统计数据
...
@@ -1472,7 +1473,7 @@ async def optimization_count_info_new(company_id: int):
...
@@ -1472,7 +1473,7 @@ async def optimization_count_info_new(company_id: int):
)
)
es_end_time
=
pendulum
.
datetime
(
now
.
year
,
now
.
month
,
1
)
.
strftime
(
es_end_time
=
pendulum
.
datetime
(
now
.
year
,
now
.
month
,
1
)
.
strftime
(
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S+08:00"
)
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S+08:00"
)
power_use_info
=
await
company_power_use_info
(
company_id
,
es_start_time
,
power_use_info
=
await
company_power_use_info
_new15
(
company_id
,
es_start_time
,
es_end_time
)
es_end_time
)
month_charge
=
power_use_info
[
"charge"
]
month_charge
=
power_use_info
[
"charge"
]
count_info_map
=
{
count_info_map
=
{
...
@@ -1659,7 +1660,7 @@ async def optimization_count_info_new(company_id: int):
...
@@ -1659,7 +1660,7 @@ async def optimization_count_info_new(company_id: int):
price_md
=
price_policy
[
"price_md"
]
if
price_policy
[
"price_md"
]
else
0
price_md
=
price_policy
[
"price_md"
]
if
price_policy
[
"price_md"
]
else
0
price_tc
=
price_policy
[
"price_tc"
]
if
price_policy
[
"price_tc"
]
else
0
price_tc
=
price_policy
[
"price_tc"
]
if
price_policy
[
"price_tc"
]
else
0
# 最大需量
# 最大需量
md_spaces
=
await
get_md_space
(
inline_ids
,
last_month_
str
)
md_spaces
=
await
get_md_space
(
inline_ids
,
last_month_
dt
)
md_space_kpi_x_list
=
[
i
[
"kpi_x"
]
for
i
in
md_spaces
if
md_space_kpi_x_list
=
[
i
[
"kpi_x"
]
for
i
in
md_spaces
if
type
(
i
[
"kpi_x"
])
in
[
int
,
float
]]
type
(
i
[
"kpi_x"
])
in
[
int
,
float
]]
...
...
unify_api/modules/zhiwei_u/fault_foreast/actionFile.py
View file @
746d8728
# /usr/bin/env python
# /usr/bin/env python
# -*- coding: UTF-8 -*-l
# -*- coding: UTF-8 -*-l
import
sys
import
sys
sys
.
path
.
append
(
f
'/home/ubuntu/data/code/unify_api2/unify_api/modules/'
sys
.
path
.
append
(
f
'/home/ubuntu/data/
pxz_
code/unify_api2/unify_api/modules/'
f
'zhiwei_u/fault_foreast'
)
f
'zhiwei_u/fault_foreast'
)
from
filterSteadyData
import
filterSteadyData
,
testFeat
from
filterSteadyData
import
filterSteadyData
,
testFeat
from
knnForecast
import
classify
from
knnForecast
import
classify
...
...
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