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
0bc47465
Commit
0bc47465
authored
Jun 02, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove es 2023-6-2
parent
448a64af
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
479 deletions
+49
-479
scope_operations_pds.py
unify_api/modules/anshiu/procedures/scope_operations_pds.py
+0
-9
scope_operations_serv.py
unify_api/modules/anshiu/service/scope_operations_serv.py
+1
-10
common_dao.py
unify_api/modules/common/dao/common_dao.py
+1
-1
elec_charge_service.py
unify_api/modules/elec_charge/service/elec_charge_service.py
+3
-4
count_info_pds.py
unify_api/modules/home_page/procedures/count_info_pds.py
+2
-55
count_info_service.py
unify_api/modules/home_page/service/count_info_service.py
+3
-3
tsp_dao.py
unify_api/modules/tsp_water/dao/tsp_dao.py
+3
-191
drop_dust_service.py
unify_api/modules/tsp_water/service/drop_dust_service.py
+4
-4
tsp_service.py
unify_api/modules/tsp_water/service/tsp_service.py
+30
-198
tsp.py
unify_api/modules/tsp_water/views/tsp.py
+2
-4
No files found.
unify_api/modules/anshiu/procedures/scope_operations_pds.py
View file @
0bc47465
import
asyncio
import
asyncio
import
datetime
import
datetime
import
json
import
json
import
math
from
pot_libs.qingstor_util.qs_client
import
QsClient
from
pot_libs.qingstor_util.qs_client
import
QsClient
from
pot_libs.es_util.es_utils
import
EsUtil
from
pot_libs.logger
import
log
from
pot_libs.logger
import
log
from
pot_libs.mysql_util.mysql_util
import
MysqlUtil
from
pot_libs.mysql_util.mysql_util
import
MysqlUtil
from
unify_api
import
constants
from
unify_api.modules.anshiu.components.scope_operations_cps
import
\
ScopeDetail
from
unify_api.modules.anshiu.dao.fine_monitor_dao
import
get_mtid_by_pid_dao
from
unify_api.modules.anshiu.dao.fine_monitor_dao
import
get_mtid_by_pid_dao
from
unify_api.modules.anshiu.dao.scope_operations_dao
import
\
from
unify_api.modules.anshiu.dao.scope_operations_dao
import
\
get_scope_url_by_pid
get_scope_url_by_pid
from
unify_api.modules.electric.procedures.electric_util
import
\
get_wiring_type_new15
from
unify_api.utils.log_utils
import
LOGGER
from
unify_api.utils.log_utils
import
LOGGER
...
...
unify_api/modules/anshiu/service/scope_operations_serv.py
View file @
0bc47465
import
json
import
json
import
math
import
math
from
pot_libs.qingstor_util.qs_client
import
QsClient
from
pot_libs.qingstor_util.qs_client
import
QsClient
import
pandas
as
pd
from
pandas.core.dtypes.inference
import
is_number
from
unify_api.modules.zhiwei_u.fault_foreast.actionFile
import
actionFilemin
from
unify_api.modules.zhiwei_u.fault_foreast.actionFile
import
actionFilemin
from
unify_api.modules.zhiwei_u.fault_foreast.test
import
leakage_reg
from
unify_api.modules.zhiwei_u.fault_foreast.test
import
leakage_reg
from
unify_api.utils.log_utils
import
LOGGER
from
unify_api.utils.log_utils
import
LOGGER
...
@@ -16,8 +13,6 @@ from pot_libs.es_util.es_utils import EsUtil
...
@@ -16,8 +13,6 @@ from pot_libs.es_util.es_utils import EsUtil
from
pot_libs.logger
import
log
from
pot_libs.logger
import
log
from
pot_libs.utils.exc_util
import
BusinessException
from
pot_libs.utils.exc_util
import
BusinessException
from
pot_libs.utils.pendulum_wrapper
import
my_pendulum
from
pot_libs.utils.pendulum_wrapper
import
my_pendulum
from
pot_libs.utils.time_format
import
convert_dt_to_timestr
,
\
convert_to_es_str
,
time_str_to_str
from
unify_api.modules.anshiu.components.scope_operations_cps
import
\
from
unify_api.modules.anshiu.components.scope_operations_cps
import
\
ScopeListItem
,
ScopeContent
,
ScopeDetailsResp
,
GetScopeConfigList
,
\
ScopeListItem
,
ScopeContent
,
ScopeDetailsResp
,
GetScopeConfigList
,
\
init_scope_config_example
,
ScopeItemDownload
,
ScopeDetail
,
ScopeDetails
init_scope_config_example
,
ScopeItemDownload
,
ScopeDetail
,
ScopeDetails
...
@@ -27,16 +22,12 @@ from unify_api.modules.anshiu.dao.scope_operations_dao import \
...
@@ -27,16 +22,12 @@ from unify_api.modules.anshiu.dao.scope_operations_dao import \
from
unify_api.modules.anshiu.procedures.scope_operations_pds
import
\
from
unify_api.modules.anshiu.procedures.scope_operations_pds
import
\
get_scope_config_by_pid
,
set_scope_config_by_pid
,
add_scope_config_by_pid
,
\
get_scope_config_by_pid
,
set_scope_config_by_pid
,
add_scope_config_by_pid
,
\
get_scope_list_by_pid
get_scope_list_by_pid
from
unify_api.modules.common.dao.common_dao
import
point_by_points
,
\
points_by_cid
from
unify_api.modules.device_cloud.procedures.mqtt_helper
import
\
from
unify_api.modules.device_cloud.procedures.mqtt_helper
import
\
change_param_to_config
change_param_to_config
from
unify_api.modules.electric.procedures.electric_util
import
\
from
unify_api.modules.electric.procedures.electric_util
import
\
get_wiring_type_new15
get_wiring_type_new15
from
unify_api.modules.zhiwei_u
import
config
from
unify_api.modules.zhiwei_u
import
config
from
unify_api.modules.zhiwei_u.dao.data_es_dao
import
query_search_scope_pids
,
\
from
unify_api.modules.zhiwei_u.dao.data_es_dao
import
query_search_scope
query_search_scope
from
unify_api.utils
import
time_format
from
unify_api.utils.time_format
import
get_time_duration
,
\
from
unify_api.utils.time_format
import
get_time_duration
,
\
get_current_datetime_str
,
convert_str_to_timestamp
get_current_datetime_str
,
convert_str_to_timestamp
...
...
unify_api/modules/common/dao/common_dao.py
View file @
0bc47465
...
@@ -359,7 +359,7 @@ async def get_fields_by_mtid(mtid, table_name="monitor", fields="m_type"):
...
@@ -359,7 +359,7 @@ async def get_fields_by_mtid(mtid, table_name="monitor", fields="m_type"):
return
result
return
result
async
def
sql_point_15min_index_new15
(
start
,
end
,
pid
):
async
def
load_point_pttl_mean
(
start
,
end
,
pid
):
sql
=
f
"SELECT pttl_mean, create_time FROM `point_15min_electric` "
\
sql
=
f
"SELECT pttl_mean, create_time FROM `point_15min_electric` "
\
f
"where pid=
%
s and create_time BETWEEN '{start}' and '{end}'"
f
"where pid=
%
s and create_time BETWEEN '{start}' and '{end}'"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
...
...
unify_api/modules/elec_charge/service/elec_charge_service.py
View file @
0bc47465
...
@@ -8,8 +8,7 @@ from unify_api.modules.elec_charge.dao.elec_charge_dao import \
...
@@ -8,8 +8,7 @@ from unify_api.modules.elec_charge.dao.elec_charge_dao import \
query_charge_aggs_points
query_charge_aggs_points
from
unify_api.modules.electric.dao.electric_dao
import
\
from
unify_api.modules.electric.dao.electric_dao
import
\
monitor_point_join_by_points
monitor_point_join_by_points
from
unify_api.modules.home_page.procedures.count_info_pds
import
current_load
,
\
from
unify_api.modules.home_page.procedures.count_info_pds
import
real_time_load
current_load_new15
from
unify_api.utils.common_utils
import
round_2
,
division_two
from
unify_api.utils.common_utils
import
round_2
,
division_two
...
@@ -107,9 +106,9 @@ async def kwh_card_level_service(cid, point_list, start, end):
...
@@ -107,9 +106,9 @@ async def kwh_card_level_service(cid, point_list, start, end):
async
def
load_info_service
(
cid_list
):
async
def
load_info_service
(
cid_list
):
# 实时负荷
# 实时负荷
cur_load
=
await
current_load_new15
(
cid_list
)
cur_load
=
await
real_time_load
(
cid_list
)
yesterday_dt
=
pendulum
.
now
(
tz
=
"Asia/Shanghai"
)
.
subtract
(
days
=
1
)
yesterday_dt
=
pendulum
.
now
(
tz
=
"Asia/Shanghai"
)
.
subtract
(
days
=
1
)
yes_load
=
await
current_load_new15
(
cid_list
,
yesterday_dt
)
yes_load
=
await
real_time_load
(
cid_list
,
yesterday_dt
)
load_percent
=
round
((
cur_load
-
yes_load
)
/
yes_load
,
load_percent
=
round
((
cur_load
-
yes_load
)
/
yes_load
,
2
)
if
cur_load
and
yes_load
else
""
2
)
if
cur_load
and
yes_load
else
""
return
cur_load
,
yes_load
,
load_percent
return
cur_load
,
yes_load
,
load_percent
unify_api/modules/home_page/procedures/count_info_pds.py
View file @
0bc47465
...
@@ -260,60 +260,7 @@ async def normal_rate_of_location(cid):
...
@@ -260,60 +260,7 @@ async def normal_rate_of_location(cid):
return
temperature_qr
,
residual_current_qr
return
temperature_qr
,
residual_current_qr
async
def
current_load
(
company_id
):
async
def
real_time_load
(
cid
,
end_dt
=
None
):
"""
实时负荷
:param company_id:
:return:
"""
async
with
MysqlUtil
()
as
conn
:
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
]
if
not
point_ids
:
return
""
async
with
MysqlUtil
()
as
conn
:
meter_sql
=
(
"SELECT pid, mid FROM change_meter_record WHERE pid in
%
s ORDER BY pid, start_time"
)
change_meters
=
await
conn
.
fetchall
(
meter_sql
,
args
=
(
tuple
(
point_ids
),))
# 正序排序,最后这个map存储的是按照start_time是最近的mid
change_meter_map
=
{
m
[
"pid"
]:
m
[
"mid"
]
for
m
in
change_meters
if
m
[
"mid"
]
is
not
None
}
newest_mids
=
list
(
change_meter_map
.
values
())
meterdata_currents
=
[]
if
newest_mids
:
meterdata_currents
=
await
RedisUtils
()
.
hmget
(
METERDATA_CURRENT_KEY
,
*
newest_mids
)
now_tt
=
int
(
time
.
time
())
if
meterdata_currents
:
total
=
0
for
item
in
meterdata_currents
:
# 这里是有可能item为None的
if
item
:
item
=
json
.
loads
(
item
.
decode
())
mdptime_tt
=
None
if
"mdptime"
in
item
:
mdptime
=
datetime
.
strptime
(
item
[
"mdptime"
],
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
mdptime_tt
=
time
.
mktime
(
mdptime
.
timetuple
())
item_tt
=
item
.
get
(
"timestamp"
)
or
mdptime_tt
if
item_tt
:
# 小于2分钟内的数据相加为实时负荷
if
now_tt
-
item_tt
<=
2
*
60
:
total
+=
item
[
"pttl"
]
return
total
return
""
async
def
current_load_new15
(
cid
,
end_dt
=
None
):
"""实时负荷"""
"""实时负荷"""
datas
=
await
get_elec_mtid_sid_by_cid
(
cid
)
datas
=
await
get_elec_mtid_sid_by_cid
(
cid
)
td_mt_tables
=
tuple
(
td_mt_tables
=
tuple
(
...
@@ -362,7 +309,7 @@ async def power_count_info(cid):
...
@@ -362,7 +309,7 @@ async def power_count_info(cid):
end_time
=
now
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
end_time
=
now
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
max_30d_load
,
_time
=
await
pttl_max_new15
(
cid
,
start_time
,
end_time
,
-
1
)
max_30d_load
,
_time
=
await
pttl_max_new15
(
cid
,
start_time
,
end_time
,
-
1
)
cur_load
=
await
current_load_new15
(
cid
)
cur_load
=
await
real_time_load
(
cid
)
return
round_2
(
cur_load
),
round_2
(
max_30d_load
)
return
round_2
(
cur_load
),
round_2
(
max_30d_load
)
...
...
unify_api/modules/home_page/service/count_info_service.py
View file @
0bc47465
...
@@ -19,10 +19,10 @@ from unify_api.modules.home_page.dao.count_info_dao import \
...
@@ -19,10 +19,10 @@ from unify_api.modules.home_page.dao.count_info_dao import \
alarm_aggs_point_location
alarm_aggs_point_location
from
unify_api.modules.home_page.procedures.count_info_pds
import
other_info
,
\
from
unify_api.modules.home_page.procedures.count_info_pds
import
other_info
,
\
electric_use_info
,
cid_alarm_importance_count
,
\
electric_use_info
,
cid_alarm_importance_count
,
\
alarm_importance_count_total
,
current_load
,
\
alarm_importance_count_total
,
\
get_company_charge_price
,
health_status_res
,
carbon_status_res_web
,
\
get_company_charge_price
,
health_status_res
,
carbon_status_res_web
,
\
optimization_count_info
,
economic_index_desc
,
\
optimization_count_info
,
economic_index_desc
,
\
cal_power_factor
,
current_load_new15
cal_power_factor
,
real_time_load
from
unify_api.modules.home_page.procedures.count_info_proxy_pds
import
\
from
unify_api.modules.home_page.procedures.count_info_proxy_pds
import
\
alarm_percentage_count
,
alarm_safe_power
alarm_percentage_count
,
alarm_safe_power
from
unify_api.modules.tsp_water.dao.drop_dust_dao
import
\
from
unify_api.modules.tsp_water.dao.drop_dust_dao
import
\
...
@@ -270,7 +270,7 @@ async def alarm_price_costtl_service(cid):
...
@@ -270,7 +270,7 @@ async def alarm_price_costtl_service(cid):
# 2. 实时功率因数, 上月功率因数
# 2. 实时功率因数, 上月功率因数
cos_ttl
,
last_month_cos
=
await
cal_power_factor
(
cid
)
cos_ttl
,
last_month_cos
=
await
cal_power_factor
(
cid
)
# 3. 实时负荷
# 3. 实时负荷
cur_load
=
await
current_load_new15
(
cid
)
cur_load
=
await
real_time_load
(
cid
)
# 4. 平均电价
# 4. 平均电价
# 昨天
# 昨天
yesterday_start
,
yesterday_end
=
yesterday_range
()
yesterday_start
,
yesterday_end
=
yesterday_range
()
...
...
unify_api/modules/tsp_water/dao/tsp_dao.py
View file @
0bc47465
...
@@ -12,7 +12,7 @@ TSP_15MIN = "poweriot_tsp_15min"
...
@@ -12,7 +12,7 @@ TSP_15MIN = "poweriot_tsp_15min"
async
def
meterdata_tsp_current
(
tsp_id
):
async
def
meterdata_tsp_current
(
tsp_id
):
"""根据tsp_id获取redis实时数据"""
"""根据tsp_id获取redis实时数据"""
res
=
await
RedisUtils
()
.
hget
(
TSP_CURRENT
,
tsp_id
)
res
=
await
RedisUtils
()
.
hget
(
TSP_CURRENT
,
tsp_id
)
res
=
json
.
loads
(
res
)
if
res
else
{}
res
=
json
.
loads
(
res
)
if
res
else
{}
return
res
return
res
...
@@ -76,201 +76,13 @@ async def tsp_histogram_tsp_id(date_start, date_end, tsp_id, interval):
...
@@ -76,201 +76,13 @@ async def tsp_histogram_tsp_id(date_start, date_end, tsp_id, interval):
return
es_re
[
"aggregations"
][
"quarter_time"
][
"buckets"
]
return
es_re
[
"aggregations"
][
"quarter_time"
][
"buckets"
]
async
def
tsp_index_statistics
(
date_start
,
date_end
,
tsp_id
):
"""TSP信息-指标统计"""
start_es
=
convert_es_str
(
date_start
)
end_es
=
convert_es_str
(
date_end
)
query_body
=
{
"query"
:
{
"bool"
:
{
"must"
:
[
{
"term"
:
{
"tsp_id"
:
tsp_id
}
},
{
"range"
:
{
"quarter_time"
:
{
"gte"
:
start_es
,
"lte"
:
end_es
}
}
}
]
}
},
"size"
:
0
,
"aggs"
:
{
"pm25_max"
:
{
"top_hits"
:
{
"sort"
:
[
{
"pm25_max"
:
{
"order"
:
"desc"
}
}
],
"size"
:
1
,
"_source"
:
[
"pm25_max"
,
"pm25_max_time"
]
}
},
"pm25_min"
:
{
"top_hits"
:
{
"sort"
:
[
{
"pm25_min"
:
{
"order"
:
"asc"
}
}
],
"size"
:
1
,
"_source"
:
[
"pm25_min"
,
"pm25_min_time"
]
}
},
"pm10_max"
:
{
"top_hits"
:
{
"sort"
:
[
{
"pm10_max"
:
{
"order"
:
"desc"
}
}
],
"size"
:
1
,
"_source"
:
[
"pm10_max"
,
"pm10_max_time"
]
}
},
"pm10_min"
:
{
"top_hits"
:
{
"sort"
:
[
{
"pm10_min"
:
{
"order"
:
"asc"
}
}
],
"size"
:
1
,
"_source"
:
[
"pm10_min"
,
"pm10_min_time"
]
}
},
"tsp_max"
:
{
"top_hits"
:
{
"sort"
:
[
{
"tsp_max"
:
{
"order"
:
"desc"
}
}
],
"size"
:
1
,
"_source"
:
[
"tsp_max"
,
"tsp_max_time"
]
}
},
"tsp_min"
:
{
"top_hits"
:
{
"sort"
:
[
{
"tsp_min"
:
{
"order"
:
"asc"
}
}
],
"size"
:
1
,
"_source"
:
[
"tsp_min"
,
"tsp_min_time"
]
}
},
"pm25_avg"
:
{
"avg"
:
{
"field"
:
"pm25_max"
}
},
"pm10_avg"
:
{
"avg"
:
{
"field"
:
"pm10_max"
}
},
"tsp_avg"
:
{
"avg"
:
{
"field"
:
"tsp_max"
}
}
}
}
log
.
info
(
query_body
)
async
with
EsUtil
()
as
es
:
es_re
=
await
es
.
search_origin
(
body
=
query_body
,
index
=
TSP_15MIN
)
return
es_re
[
"aggregations"
]
async
def
tsp_aggs_tsp_id
(
date_start
,
date_end
,
tsp_list
):
"""1. 按tsp_id聚合
2. 分别求平均值
"""
start_es
=
convert_es_str
(
date_start
)
end_es
=
convert_es_str
(
date_end
)
query_body
=
{
"size"
:
0
,
"query"
:
{
"bool"
:
{
"must"
:
[
{
"terms"
:
{
"tsp_id"
:
tsp_list
}
},
{
"range"
:
{
"quarter_time"
:
{
"gte"
:
start_es
,
"lte"
:
end_es
}
}
}
]
}
},
"aggs"
:
{
"tsps"
:
{
"terms"
:
{
"field"
:
"tsp_id"
,
"size"
:
1000
},
"aggs"
:
{
"pm25"
:
{
"avg"
:
{
"field"
:
"pm25_mean"
}
},
"pm10"
:
{
"avg"
:
{
"field"
:
"pm10_mean"
}
},
"tsp"
:
{
"avg"
:
{
"field"
:
"tsp_mean"
}
}
}
}
}
}
log
.
info
(
query_body
)
async
with
EsUtil
()
as
es
:
es_re
=
await
es
.
search_origin
(
body
=
query_body
,
index
=
TSP_15MIN
)
return
es_re
[
"aggregations"
][
"tsps"
][
"buckets"
]
async
def
tsp_by_tsp_id_dao
(
start
,
end
,
tsp_list
):
async
def
tsp_by_tsp_id_dao
(
start
,
end
,
tsp_list
):
sql
=
f
'SELECT tsp_id, '
\
sql
=
f
'SELECT tsp_id, '
\
f
'AVG(pm25_mean) pm25,AVG(pm10_mean) pm10,AVG(tsp_mean) tsp '
\
f
'AVG(pm25_mean) pm25,AVG(pm10_mean) pm10,AVG(tsp_mean) tsp '
\
f
'FROM `tsp_day_record` where tsp_id in
%
s and '
\
f
'FROM `tsp_day_record` where tsp_id in
%
s and '
\
f
'create_time BETWEEN "{start}" and "{end}" GROUP BY tsp_id '
f
'create_time BETWEEN "{start}" and "{end}" GROUP BY tsp_id '
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
datas
=
await
conn
.
fetchall
(
sql
,
args
=
(
tsp_list
,
))
datas
=
await
conn
.
fetchall
(
sql
,
args
=
(
tsp_list
,))
return
datas
return
datas
...
...
unify_api/modules/tsp_water/service/drop_dust_service.py
View file @
0bc47465
...
@@ -2,7 +2,7 @@ from unify_api.constants import SLOTS_15MIN, DUST_STATE
...
@@ -2,7 +2,7 @@ from unify_api.constants import SLOTS_15MIN, DUST_STATE
from
unify_api.modules.common.dao.common_dao
import
storey_pl_by_cid
,
\
from
unify_api.modules.common.dao.common_dao
import
storey_pl_by_cid
,
\
storey_wp_by_cid
storey_wp_by_cid
from
unify_api.modules.common.dao.common_dao
import
\
from
unify_api.modules.common.dao.common_dao
import
\
sql_point_15min_index_new15
load_point_pttl_mean
from
unify_api.modules.common.procedures.points
import
points_by_storeys
from
unify_api.modules.common.procedures.points
import
points_by_storeys
from
unify_api.modules.tsp_water.components.drop_dust_cps
import
DdwResp
,
\
from
unify_api.modules.tsp_water.components.drop_dust_cps
import
DdwResp
,
\
DdResp
,
IrmResp
,
IosResp
,
ItiResp
,
WsStatiResp
DdResp
,
IrmResp
,
IosResp
,
ItiResp
,
WsStatiResp
...
@@ -11,7 +11,7 @@ from unify_api.modules.tsp_water.dao.drop_dust_dao import \
...
@@ -11,7 +11,7 @@ from unify_api.modules.tsp_water.dao.drop_dust_dao import \
dust_water_run_state_by_time
,
sum_water_runts_group
,
sum_kwh_runts_group
,
\
dust_water_run_state_by_time
,
sum_water_runts_group
,
sum_kwh_runts_group
,
\
dust_water_run_day_sum_water
,
dust_fogcan_run_day_sum_kwh
,
sum_water_group
dust_water_run_day_sum_water
,
dust_fogcan_run_day_sum_kwh
,
sum_water_group
from
unify_api.modules.tsp_water.service.tsp_service
import
day_env_service
,
\
from
unify_api.modules.tsp_water.service.tsp_service
import
day_env_service
,
\
day_env_service
_new15
day_env_service
from
unify_api.utils.common_utils
import
round_2
from
unify_api.utils.common_utils
import
round_2
from
unify_api.utils.time_format
import
srv_time
,
last7_day_range
,
\
from
unify_api.utils.time_format
import
srv_time
,
last7_day_range
,
\
start_end_date
start_end_date
...
@@ -108,7 +108,7 @@ async def post_drop_dust_wave_service(point_id, start, end):
...
@@ -108,7 +108,7 @@ async def post_drop_dust_wave_service(point_id, start, end):
"""降尘措施-雾炮-运行曲线"""
"""降尘措施-雾炮-运行曲线"""
# 1. 获取聚合信息
# 1. 获取聚合信息
slots_list
=
SLOTS_15MIN
slots_list
=
SLOTS_15MIN
sql_re
=
await
sql_point_15min_index_new15
(
start
,
end
,
point_id
)
sql_re
=
await
load_point_pttl_mean
(
start
,
end
,
point_id
)
if
not
sql_re
:
if
not
sql_re
:
return
DdwResp
(
slots
=
[],
value
=
[])
return
DdwResp
(
slots
=
[],
value
=
[])
es_re_dic
=
{
str
(
i
[
"create_time"
])[
-
8
:
-
3
]:
i
for
i
in
sql_re
}
es_re_dic
=
{
str
(
i
[
"create_time"
])[
-
8
:
-
3
]:
i
for
i
in
sql_re
}
...
@@ -228,7 +228,7 @@ async def index_today_info_service(cid):
...
@@ -228,7 +228,7 @@ async def index_today_info_service(cid):
"""首页-今日数据-扬尘"""
"""首页-今日数据-扬尘"""
# 1. 环境信息
# 1. 环境信息
# dr = await day_env_service(cid)
# dr = await day_env_service(cid)
dr
=
await
day_env_service
_new15
(
cid
)
dr
=
await
day_env_service
(
cid
)
# 2. 今日用水, 用电
# 2. 今日用水, 用电
today_start
,
today_end
,
m_start
,
m_end
=
start_end_date
()
today_start
,
today_end
,
m_start
,
m_end
=
start_end_date
()
start
=
today_start
.
split
(
" "
)[
0
]
start
=
today_start
.
split
(
" "
)[
0
]
...
...
unify_api/modules/tsp_water/service/tsp_service.py
View file @
0bc47465
This diff is collapsed.
Click to expand it.
unify_api/modules/tsp_water/views/tsp.py
View file @
0bc47465
...
@@ -5,8 +5,7 @@ from unify_api.modules.tsp_water.components.drop_dust_cps import DtReq, \
...
@@ -5,8 +5,7 @@ from unify_api.modules.tsp_water.components.drop_dust_cps import DtReq, \
from
unify_api.modules.tsp_water.service.tsp_service
import
\
from
unify_api.modules.tsp_water.service.tsp_service
import
\
real_time_service
,
tsp_history_service
,
tsp_index_statistics_service
,
\
real_time_service
,
tsp_history_service
,
tsp_index_statistics_service
,
\
day_env_service
,
stat_analysis_service
,
tsp_predict_deviation_service
,
\
day_env_service
,
stat_analysis_service
,
tsp_predict_deviation_service
,
\
tsp_contrast_deviation_service
,
analysis_describe_service
,
\
tsp_contrast_deviation_service
,
analysis_describe_service
day_env_service_new15
,
tsp_index_statistics_service_new15
@
summary
(
"TSP信息-实时参数"
)
@
summary
(
"TSP信息-实时参数"
)
...
@@ -62,14 +61,13 @@ async def post_tsp_index_statistics(req, body: TisReq) -> TisResp:
...
@@ -62,14 +61,13 @@ async def post_tsp_index_statistics(req, body: TisReq) -> TisResp:
start
=
body
.
start
start
=
body
.
start
end
=
body
.
end
end
=
body
.
end
# return await tsp_index_statistics_service(tsp_id, start, end)
# return await tsp_index_statistics_service(tsp_id, start, end)
# return await tsp_index_statistics_service_new15(tsp_id, start, end)
return
TisResp
(
pm2_5
=
{},
pm10
=
{},
tsp
=
{})
return
TisResp
(
pm2_5
=
{},
pm10
=
{},
tsp
=
{})
@
summary
(
"当日环境"
)
@
summary
(
"当日环境"
)
async
def
post_day_env
(
req
,
body
:
DeReq
)
->
DeResp
:
async
def
post_day_env
(
req
,
body
:
DeReq
)
->
DeResp
:
cid
=
body
.
cid
cid
=
body
.
cid
return
await
day_env_service
_new15
(
cid
)
return
await
day_env_service
(
cid
)
@
summary
(
"统计分析-扬尘"
)
@
summary
(
"统计分析-扬尘"
)
...
...
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