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
6aff3dca
Commit
6aff3dca
authored
Apr 11, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cid修改
parent
e49a7c87
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
47 additions
and
47 deletions
+47
-47
list_static_dao.py
unify_api/modules/alarm_manager/dao/list_static_dao.py
+1
-1
common_dao.py
unify_api/modules/common/dao/common_dao.py
+2
-2
level_dao.py
unify_api/modules/common/dao/level_dao.py
+4
-4
points.py
unify_api/modules/common/procedures/points.py
+4
-4
pttl_max.py
unify_api/modules/common/procedures/pttl_max.py
+4
-4
syncretize_energy_dao.py
unify_api/modules/elec_charge/dao/syncretize_energy_dao.py
+1
-1
elec_statis_proxy.py
unify_api/modules/elec_charge/views/elec_statis_proxy.py
+1
-1
power_index.py
unify_api/modules/electric_optimization/dao/power_index.py
+1
-1
proxy_optimization_pds.py
...lectric_optimization/procedures/proxy_optimization_pds.py
+6
-6
power_index.py
..._api/modules/electric_optimization/service/power_index.py
+3
-3
energy_store_optimize.py
.../modules/energy_optimize/service/energy_store_optimize.py
+6
-6
pv_distributed_photovoltaic.py
...es/energy_optimize/service/pv_distributed_photovoltaic.py
+4
-4
count_info_pds.py
unify_api/modules/home_page/procedures/count_info_pds.py
+2
-2
hardware_pds.py
unify_api/modules/product_info/procedures/hardware_pds.py
+1
-1
output_result.py
unify_api/modules/shidianu/procedures/output_result.py
+2
-2
tsp_dao.py
unify_api/modules/tsp_water/dao/tsp_dao.py
+1
-1
tsp_map_dao.py
unify_api/modules/tsp_water/dao/tsp_map_dao.py
+3
-3
data_operations_dao.py
unify_api/modules/zhiwei_u/dao/data_operations_dao.py
+1
-1
No files found.
unify_api/modules/alarm_manager/dao/list_static_dao.py
View file @
6aff3dca
...
...
@@ -416,7 +416,7 @@ async def zdu_alarm_aggs_date_impotent(cid, start, end):
return
es_result
[
"aggregations"
][
"date_day"
][
"buckets"
]
async
def
sdu_alarm_aggs_date_importance
(
cid
):
async
def
sdu_alarm_aggs_date_importance
(
cid
):
# todo: 扬尘es待改
"""按日期,再按等级聚合"""
query_body
=
{
"size"
:
0
,
...
...
unify_api/modules/common/dao/common_dao.py
View file @
6aff3dca
...
...
@@ -146,7 +146,7 @@ async def change_sensor_by_location(location_id):
async
def
tsp_by_cid
(
cid
):
"""根据cid查询points"""
sql
=
"SELECT tsp_id, name FROM tsp WHERE cid
_belongedto
=
%
s "
\
sql
=
"SELECT tsp_id, name FROM tsp WHERE cid =
%
s "
\
"order by name"
async
with
MysqlUtil
()
as
conn
:
tsp_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
...
...
@@ -212,7 +212,7 @@ async def inline_zdu_all_by_cid(cid):
async
def
water_by_cid
(
cid
):
sql
=
"SELECT * FROM water WHERE cid
_belongedto
=
%
s"
sql
=
"SELECT * FROM water WHERE cid =
%
s"
async
with
MysqlUtil
()
as
conn
:
water_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
return
water_list
...
...
unify_api/modules/common/dao/level_dao.py
View file @
6aff3dca
...
...
@@ -14,7 +14,7 @@ async def inline_zdu_by_cid(cid):
async
def
feeder_by_cid
(
cid
):
"""馈线"""
sql
=
"SELECT * from feeder f inner join monitor m2 "
\
"on f.mtid = m2.mtid where f.cid
_belongedto
=
%
s "
\
"on f.mtid = m2.mtid where f.cid =
%
s "
\
"order by f.sort_num"
async
with
MysqlUtil
()
as
conn
:
feeder_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
...
...
@@ -24,7 +24,7 @@ async def feeder_by_cid(cid):
async
def
transformer_by_cid
(
cid
):
"""变压器"""
sql
=
"SELECT * from transformer t inner join monitor m2 "
\
"on t.mtid = m2.mtid where t.cid
_belongedto
=
%
s "
\
"on t.mtid = m2.mtid where t.cid =
%
s "
\
"order by t.sort_num"
async
with
MysqlUtil
()
as
conn
:
transformer_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
...
...
@@ -34,7 +34,7 @@ async def transformer_by_cid(cid):
async
def
power_dist_by_cid
(
cid
):
"""配电"""
sql
=
"SELECT * from power_dist pd inner join monitor m2 "
\
"on pd.mtid = m2.mtid where pd.cid
_belongedto
=
%
s "
\
"on pd.mtid = m2.mtid where pd.cid =
%
s "
\
"order by pd.sort_num"
async
with
MysqlUtil
()
as
conn
:
power_dist_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
...
...
@@ -44,7 +44,7 @@ async def power_dist_by_cid(cid):
async
def
device_level_by_cid
(
cid
):
"""设备级"""
sql
=
"SELECT * from device_level dl inner join monitor m2 "
\
"on dl.mtid = m2.mtid where dl.cid
_belongedto
=
%
s "
\
"on dl.mtid = m2.mtid where dl.cid =
%
s "
\
"order by dl.sort_num"
async
with
MysqlUtil
()
as
conn
:
device_list
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
...
...
unify_api/modules/common/procedures/points.py
View file @
6aff3dca
...
...
@@ -15,12 +15,12 @@ async def get_points(company_ids):
company_point_map
=
defaultdict
(
dict
)
async
with
MysqlUtil
()
as
conn
:
point_sql
=
(
"select pid, cid cid
_belongedto
, inlid from point where cid in
%
s"
"select pid, cid cid, inlid from point where cid in
%
s"
)
points
=
await
conn
.
fetchall
(
point_sql
,
args
=
(
company_ids
,))
company_point_ids_map
=
defaultdict
(
list
)
for
point
in
points
:
company_point_ids_map
[
point
[
"cid
_belongedto
"
]]
.
append
(
point
[
"pid"
])
company_point_ids_map
[
point
[
"cid"
]]
.
append
(
point
[
"pid"
])
point_map
=
{
i
[
"pid"
]:
i
for
i
in
points
}
point_ids
=
list
(
point_map
.
keys
())
...
...
@@ -114,7 +114,7 @@ async def list_point(cid):
list_point
=
[]
points
=
{}
groups
=
{}
sql
=
"SELECT pid, name, add_to_company FROM point WHERE cid
_belongedto
=
%
s"
sql
=
"SELECT pid, name, add_to_company FROM point WHERE cid=
%
s"
async
with
MysqlUtil
()
as
conn
:
result
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
for
res
in
result
:
...
...
@@ -146,7 +146,7 @@ async def list_point(cid):
list_point
.
append
(
comm_point
)
async
with
MysqlUtil
()
as
conn
:
sql
=
"SELECT inlid, `name` FROM inline WHERE cid
_belongedto
=
%
s"
sql
=
"SELECT inlid, `name` FROM inline WHERE cid=
%
s"
inlines
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,))
inline_list
=
[
Inline
(
inline_id
=
inline
[
"inlid"
],
name
=
inline
[
"name"
])
for
inline
in
inlines
]
...
...
unify_api/modules/common/procedures/pttl_max.py
View file @
6aff3dca
...
...
@@ -9,7 +9,7 @@ from unify_api.utils.time_format import power_slots, range_to_type
async
def
pttl_max
(
cid
,
start
,
end
,
point_id
=
None
,
inline_id
=
None
):
# 根据进线,找point
if
inline_id
:
sql
=
"SELECT pid from `point` WHERE cid
_belongedto
=
%
s "
\
sql
=
"SELECT pid from `point` WHERE cid =
%
s "
\
"and inlid_belongedto =
%
s and add_to_company = 1"
async
with
MysqlUtil
()
as
conn
:
point_info
=
await
conn
.
fetchall
(
sql
=
sql
,
...
...
@@ -18,7 +18,7 @@ async def pttl_max(cid, start, end, point_id=None, inline_id=None):
terms
=
{
"pid"
:
point_list
}
elif
point_id
==
-
1
:
# 选的全部
# 1.找出工厂所有pid,point表add_to_company字段为1
sql
=
"SELECT pid from `point` WHERE cid
_belongedto
=
%
s "
\
sql
=
"SELECT pid from `point` WHERE cid =
%
s "
\
"and add_to_company = 1"
async
with
MysqlUtil
()
as
conn
:
point_info
=
await
conn
.
fetchall
(
sql
=
sql
,
args
=
(
cid
,))
...
...
@@ -144,7 +144,7 @@ async def pttl_max_15min(cid, start, end, point_id=None, inline_id=None):
"""负荷分布,最高负荷需要拿15min"""
# 根据进线,找point
if
inline_id
:
sql
=
"SELECT pid from `point` WHERE cid
_belongedto
=
%
s "
\
sql
=
"SELECT pid from `point` WHERE cid =
%
s "
\
"and inlid_belongedto =
%
s"
async
with
MysqlUtil
()
as
conn
:
point_info
=
await
conn
.
fetchall
(
sql
=
sql
,
...
...
@@ -153,7 +153,7 @@ async def pttl_max_15min(cid, start, end, point_id=None, inline_id=None):
terms
=
{
"pid"
:
point_list
}
elif
point_id
==
-
1
:
# 选的全部
# 1.找出工厂所有pid,point表add_to_company字段为1
sql
=
"SELECT pid from `point` WHERE cid
_belongedto
=
%
s"
sql
=
"SELECT pid from `point` WHERE cid =
%
s"
async
with
MysqlUtil
()
as
conn
:
point_info
=
await
conn
.
fetchall
(
sql
=
sql
,
args
=
(
cid
,))
point_list
=
[
point
.
get
(
"pid"
)
for
point
in
point_info
]
...
...
unify_api/modules/elec_charge/dao/syncretize_energy_dao.py
View file @
6aff3dca
...
...
@@ -62,7 +62,7 @@ async def inset_algorithm_power_factor_dao(inline_id, start_time, std_cos):
async
def
get_algorithm_power_factor_dao
(
cid
):
sql
=
"select a.std_cos from algo_power_factor a "
\
"LEFT JOIN inline_zdu line on line.inlid =a.inlid "
\
"WHERE line.cid
_belongedto
=
%
s ORDER BY a.start_time desc limit 1"
"WHERE line.cid =
%
s ORDER BY a.start_time desc limit 1"
async
with
MysqlUtil
()
as
conn
:
datas
=
await
conn
.
fetchone
(
sql
,
args
=
(
cid
,))
return
datas
...
...
unify_api/modules/elec_charge/views/elec_statis_proxy.py
View file @
6aff3dca
...
...
@@ -587,7 +587,7 @@ async def get_power_company_download(req):
# 参数为point_id, 转换为point_list
if
point_id
==
-
1
:
# 选的全部
# 1.找出工厂所有pid,point表add_to_company字段为1
sql
=
"SELECT pid from `point` WHERE cid
_belongedto
=
%
s "
sql
=
"SELECT pid from `point` WHERE cid =
%
s "
async
with
MysqlUtil
()
as
conn
:
point_info
=
await
conn
.
fetchall
(
sql
=
sql
,
args
=
(
cid
,))
point_list
=
[
point
.
get
(
"pid"
)
for
point
in
point_info
]
...
...
unify_api/modules/electric_optimization/dao/power_index.py
View file @
6aff3dca
...
...
@@ -3,7 +3,7 @@ from pot_libs.mysql_util.mysql_util import MysqlUtil
async
def
tc_by_inline_id
(
inline_id
):
async
with
MysqlUtil
()
as
conn
:
sql
=
"select inlid, tc_runtime, cid cid
_belongedto
"
\
sql
=
"select inlid, tc_runtime, cid cid"
\
" from inline where inlid=
%
s;"
inline
=
await
conn
.
fetchone
(
sql
,
args
=
(
inline_id
,))
return
inline
...
...
unify_api/modules/electric_optimization/procedures/proxy_optimization_pds.py
View file @
6aff3dca
...
...
@@ -6,13 +6,13 @@ from unify_api.modules.common.procedures.power_cps import \
async
def
get_inline_datas_dao
(
cids
):
inline_sql
=
f
"select `inlid`, `name`, cid cid
_belongedto
, "
\
inline_sql
=
f
"select `inlid`, `name`, cid cid, "
\
f
"`inline_tc`, `tc_runtime` from `inline` "
\
f
"where cid in
%
s order by cid"
async
with
MysqlUtil
()
as
conn
:
inlines
=
await
conn
.
fetchall
(
inline_sql
,
args
=
(
cids
,))
if
cids
else
[]
inline_map
=
{
i
[
"inlid"
]:
i
for
i
in
inlines
}
inline_cid_map
=
{
i
[
"inlid"
]:
i
[
"cid
_belongedto
"
]
for
i
in
inlines
}
inline_cid_map
=
{
i
[
"inlid"
]:
i
[
"cid"
]
for
i
in
inlines
}
return
inline_map
,
inline_cid_map
...
...
@@ -246,12 +246,12 @@ async def proxy_power_save_list(
cids
,
month_str
,
page_size
=
10
,
page_num
=
1
,
sort_field
=
"company_name"
,
sort_direction
=
"asc"
,
):
async
with
MysqlUtil
()
as
conn
:
inline_sql
=
f
"select `inlid`, `name`,cid cid
_belongedto
, "
\
inline_sql
=
f
"select `inlid`, `name`,cid cid, "
\
f
"`inline_tc`, `tc_runtime` from `inline` "
\
f
"where cid in
%
s order by cid"
inlines
=
await
conn
.
fetchall
(
inline_sql
,
args
=
(
cids
,))
if
cids
else
[]
inline_map
=
{
i
[
"inlid"
]:
i
for
i
in
inlines
}
inline_cid_map
=
{
i
[
"inlid"
]:
i
[
"cid
_belongedto
"
]
for
i
in
inlines
}
inline_cid_map
=
{
i
[
"inlid"
]:
i
[
"cid"
]
for
i
in
inlines
}
company_map
=
await
get_cid_info
(
cids
)
...
...
@@ -293,7 +293,7 @@ async def proxy_power_save_summary(
if
not
inline_map
:
# 为了代码复用,减少数据库查询,如果外部传了进线信息,那么没必要再查询了
async
with
MysqlUtil
()
as
conn
:
inline_sql
=
f
"select `inlid`, `name`, cid `cid
_belongedto
`, "
\
inline_sql
=
f
"select `inlid`, `name`, cid `cid`, "
\
f
"`inline_tc`, `tc_runtime` from `inline` "
\
f
"where cid in
%
s order by cid"
inlines
=
await
conn
.
fetchall
(
inline_sql
,
args
=
(
cids
,))
if
cids
else
[]
...
...
@@ -470,7 +470,7 @@ async def proxy_pcvf_summary(
async
def
proxy_electric_optimization_summary
(
cids
,
month_str
):
inline_sql
=
f
"select inlid,name,cid cid
_belongedto
,inline_tc,tc_runtime"
\
inline_sql
=
f
"select inlid,name,cid cid,inline_tc,tc_runtime"
\
f
" from inline where `cid` in
%
s order by cid"
async
with
MysqlUtil
()
as
conn
:
inlines
=
await
conn
.
fetchall
(
inline_sql
,
args
=
(
cids
,))
if
cids
else
[]
...
...
unify_api/modules/electric_optimization/service/power_index.py
View file @
6aff3dca
...
...
@@ -30,7 +30,7 @@ async def md_space_service(inline_id):
latest_12_months
]
md_space_map
=
await
month_md_space
(
inline_id
,
monthstr_list
)
inline
=
await
tc_by_inline_id
(
inline_id
)
price_policy
=
await
price_policy_by_cid
(
inline
[
"cid
_belongedto
"
])
price_policy
=
await
price_policy_by_cid
(
inline
[
"cid"
])
last_month
=
monthstr_list
[
-
1
]
return
MdSpaceResp
(
...
...
@@ -83,7 +83,7 @@ async def power_factor_service(inline_id):
# 功率因数大于0.9不返回save_charge
save_charge
=
None
inline
=
await
tc_by_inline_id
(
inline_id
)
point_list
=
await
pids_by_cid
(
inline
.
get
(
"cid
_belongedto
"
))
point_list
=
await
pids_by_cid
(
inline
.
get
(
"cid"
))
charge_res
=
await
point_aggs_kwh_new15
(
point_list
)
# total_charge = charge_res["aggregations"]["charge"]["value"]
total_charge
=
charge_res
.
get
(
"charge"
)
or
0
...
...
@@ -152,7 +152,7 @@ async def power_peakcut_service(inline_id):
save_charge
=
power_pcvf_map
.
get
(
str
(
last_month
),
{})
.
get
(
"cost_save"
)
inline
=
await
tc_by_inline_id
(
inline_id
)
price_policy
=
await
price_policy_by_cid
(
inline
[
"cid
_belongedto
"
])
price_policy
=
await
price_policy_by_cid
(
inline
[
"cid"
])
if
avg_price
and
price_policy
[
"price_f"
]:
growth_percentage
=
round
(
(
...
...
unify_api/modules/energy_optimize/service/energy_store_optimize.py
View file @
6aff3dca
...
...
@@ -36,7 +36,7 @@ class EnergyStoreOptimize(object):
rlt
=
{
'rlt_flag'
:
True
}
inl_info
=
await
self
.
_get_inline_info
()
inline_vc
=
inl_info
[
'inline_vc'
]
cid
=
inl_info
[
'cid
_belongedto
'
]
cid
=
inl_info
[
'cid'
]
pp
=
await
self
.
_get_company_price_policy
(
cid
)
max_dt
=
await
self
.
_find_kwh_max_day
()
# 00:00:00 of the max kwh day
if
not
max_dt
:
...
...
@@ -124,18 +124,18 @@ class EnergyStoreOptimize(object):
return
section
async
def
_get_inline_info
(
self
):
""" get inline_vc, tc_runtime, cid
_belongedto
from redis.
""" get inline_vc, tc_runtime, cid from redis.
:return: a dict
"""
# inline_j = self._r_cache.hget(INLINE_HASHNAME, str(self._inlid))
# info = json.loads(inline_j)
sql
=
"SELECT inline_vc, tc_runtime, cid cid
_belongedto
from "
\
sql
=
"SELECT inline_vc, tc_runtime, cid cid from "
\
"inline where inlid =
%
s"
async
with
MysqlUtil
()
as
conn
:
info
=
await
conn
.
fetchone
(
sql
,
args
=
(
self
.
_inlid
,))
rlt
=
{
'inline_vc'
:
info
[
'inline_vc'
],
'tc_runtime'
:
info
[
'tc_runtime'
],
'cid
_belongedto'
:
info
[
'cid_belongedto
'
]}
'cid
'
:
info
[
'cid
'
]}
return
rlt
async
def
_get_company_price_policy
(
self
,
cid
):
...
...
@@ -310,10 +310,10 @@ class EnergyStoreOptimize(object):
async
def
ess_out_result
(
inlid
,
ess_system
):
"""结果输出函数"""
# get cid
sql
=
"select cid cid
_belongedto
from inline where inlid =
%
s"
sql
=
"select cid cid from inline where inlid =
%
s"
async
with
MysqlUtil
()
as
conn
:
cid_info
=
await
conn
.
fetchone
(
sql
=
sql
,
args
=
(
inlid
,))
cid
=
cid_info
.
get
(
"cid
_belongedto
"
)
cid
=
cid_info
.
get
(
"cid"
)
# get proxy_id
sql
=
"select cpm.proxy from company c inner join company_proxy_map cpm "
\
"on cpm.cid=c.cid where c.cid =
%
s"
...
...
unify_api/modules/energy_optimize/service/pv_distributed_photovoltaic.py
View file @
6aff3dca
...
...
@@ -26,7 +26,7 @@ class PhotovoltaicOptimize(object):
rlt
=
{
'rlt_flag'
:
True
}
inl_info
=
await
self
.
_get_inline_info
()
inline_vc
=
inl_info
[
'inline_vc'
]
cid
=
inl_info
[
'cid
_belongedto
'
]
cid
=
inl_info
[
'cid'
]
city
=
await
self
.
_get_company_city
(
cid
)
df_pv
=
await
self
.
_construct_pv_curve
(
city
)
# construct df_pv
...
...
@@ -376,16 +376,16 @@ class PhotovoltaicOptimize(object):
return
df
async
def
_get_inline_info
(
self
):
""" get inline_vc, tc_runtime, cid
_belongedto
from redis.
""" get inline_vc, tc_runtime, cid from redis.
:return: a dict
"""
sql
=
"SELECT inline_vc, tc_runtime, cid cid
_belongedto
from "
\
sql
=
"SELECT inline_vc, tc_runtime, cid cid from "
\
"inline where inlid =
%
s"
async
with
MysqlUtil
()
as
conn
:
info
=
await
conn
.
fetchone
(
sql
,
args
=
(
self
.
_inlid
,))
rlt
=
{
'inline_vc'
:
info
[
'inline_vc'
],
'tc_runtime'
:
info
[
'tc_runtime'
],
'cid
_belongedto'
:
info
[
'cid_belongedto
'
]}
'cid
'
:
info
[
'cid
'
]}
return
rlt
async
def
_get_company_price_policy
(
self
,
cid
):
...
...
unify_api/modules/home_page/procedures/count_info_pds.py
View file @
6aff3dca
...
...
@@ -552,7 +552,7 @@ async def current_load(company_id):
:return:
"""
async
with
MysqlUtil
()
as
conn
:
point_sql
=
"select pid from point where cid
_belongedto
=
%
s "
\
point_sql
=
"select pid from point where cid=
%
s "
\
"and add_to_company = 1"
points
=
await
conn
.
fetchall
(
point_sql
,
args
=
(
company_id
,))
point_ids
=
[
p
[
"pid"
]
for
p
in
points
]
...
...
@@ -855,7 +855,7 @@ async def power_factor(company_id):
"""
async
with
MysqlUtil
()
as
conn
:
point_sql
=
(
"select pid, inlid_belongedto from point where cid
_belongedto
=
%
s and add_to_company=
%
s"
"select pid, inlid_belongedto from point where cid=
%
s and add_to_company=
%
s"
)
points
=
await
conn
.
fetchall
(
point_sql
,
args
=
(
company_id
,
1
))
point_ids
=
[
i
[
"pid"
]
for
i
in
points
]
...
...
unify_api/modules/product_info/procedures/hardware_pds.py
View file @
6aff3dca
...
...
@@ -196,7 +196,7 @@ async def hardware_statistics(company_id):
:return:
"""
# async with MysqlUtil() as conn:
# point_sql = "select count(*) as point_count from point where cid
_belongedto
= %s"
# point_sql = "select count(*) as point_count from point where cid = %s"
# point_count_map = await conn.fetchone(sql=point_sql, args=(company_id,))
#
# point_count = point_count_map["point_count"]
...
...
unify_api/modules/shidianu/procedures/output_result.py
View file @
6aff3dca
...
...
@@ -276,11 +276,11 @@ async def algorithm_result_to_front(point_id, req_date, user_id, product, detail
# 根据配置扩展模块取不同的算法结果字段
async
with
MysqlUtil
()
as
conn
:
point_sql
=
"select pid, cid
_belongedto
from point where pid=
%
s"
point_sql
=
"select pid, cid from point where pid=
%
s"
point_map
=
await
conn
.
fetchone
(
point_sql
,
args
=
(
point_id
,))
if
not
point_map
:
raise
BusinessException
(
message
=
"没有该监测点的信息,请联系运维人员!"
)
cid
=
point_map
[
"cid
_belongedto
"
]
cid
=
point_map
[
"cid"
]
# 2.调用函数获取到用户信息
product_auth_map
=
await
get_product_auth
(
user_id
,
product
)
cid_ext_module_map
=
product_auth_map
[
"product"
]
...
...
unify_api/modules/tsp_water/dao/tsp_dao.py
View file @
6aff3dca
...
...
@@ -273,7 +273,7 @@ async def tsp_by_tsp_id_dao(start, end, tsp_list):
return
datas
async
def
tsp_histogram_day_tsp_id
(
interval
):
async
def
tsp_histogram_day_tsp_id
(
interval
):
# todo: 扬尘es 待改
"""空气优-按天聚合, 再按tsp_id聚合"""
query_body
=
{
"size"
:
0
,
...
...
unify_api/modules/tsp_water/dao/tsp_map_dao.py
View file @
6aff3dca
...
...
@@ -44,7 +44,7 @@ async def get_contrast_data_month_dao(tsp_id, start, end):
async
def
get_index_data_dao
():
sql
=
"SELECT DISTINCT c.cid, c.shortname, c.fullname, c.industry, "
\
"c.province FROM tsp t LEFT JOIN company c on t.cid
_belongedto
=c.cid"
"c.province FROM tsp t LEFT JOIN company c on t.cid=c.cid"
async
with
MysqlUtil
()
as
conn
:
companys
=
await
conn
.
fetchall
(
sql
)
return
companys
...
...
@@ -59,8 +59,8 @@ async def get_position_dao(company_list):
async
def
get_tsp_id_list_dao
(
company_list
):
sql
=
"select cid
_belongedto
cid,group_concat(tsp_id) tsp_ids from tsp "
\
"WHERE cid
_belongedto in
%
s GROUP BY cid_belongedto
"
sql
=
"select cid cid,group_concat(tsp_id) tsp_ids from tsp "
\
"WHERE cid
in
%
s GROUP BY cid
"
async
with
MysqlUtil
()
as
conn
:
data
=
await
conn
.
fetchall
(
sql
,
args
=
(
company_list
,))
return
data
...
...
unify_api/modules/zhiwei_u/dao/data_operations_dao.py
View file @
6aff3dca
...
...
@@ -80,7 +80,7 @@ async def get_residual_current_threhold(location_id,
async
def
get_name_by_pid
(
pid
):
sql
=
"SELECT c.shortname,p.name FROM `point` p LEFT JOIN company c "
\
"on c.cid=p.cid
_belongedto
where p.pid=
%
s"
"on c.cid=p.cid where p.pid=
%
s"
async
with
MysqlUtil
()
as
conn
:
data
=
await
conn
.
fetchone
(
sql
,
args
=
(
pid
,))
return
data
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