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
58419214
Commit
58419214
authored
May 15, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix_common_list_point
parent
7df953fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
47 deletions
+2
-47
points.py
unify_api/modules/common/procedures/points.py
+2
-1
list_point.py
unify_api/modules/common/views/list_point.py
+0
-46
No files found.
unify_api/modules/common/procedures/points.py
View file @
58419214
...
...
@@ -109,7 +109,8 @@ async def get_meter_by_point_new15(point_id):
"m on m.mtid=p.mtid where m.demolished=0 and p.pid=
%
s"
meter_info
=
await
conn
.
fetchone
(
sql
,
args
=
(
point_id
,))
return
meter_info
async
def
list_point
(
cid
):
list_point
=
[]
points
=
{}
...
...
unify_api/modules/common/views/list_point.py
View file @
58419214
...
...
@@ -14,52 +14,6 @@ from unify_api.modules.common.components.list_points_cps import (
Inline
,
LsRep
,
LtpRep
,
LplResp
,
LpiResp
)
# @summary('获取监测点,进线列表')
# async def post_list_point(req, body: ListPointRequest) -> ListPointResponse:
# cid = body.cid
# list_point, inline_list, points = [], [], {}
# sql = "SELECT pid,name,mtid,inlid,add_to_company FROM point where cid=%s"
# async with MysqlUtil() as conn:
# result = await conn.fetchall(sql, args=(cid,))
# add_to_company = []
# for res in result:
# # mtids.append(res["mtid"])
# inline_list.append({"inline_id": res["inlid"], "name": res["name"]})
# points[res["mtid"]] = res
# add_to_company.append(res["add_to_company"])
# if points:
# if len(points) == 1:
# l_sql = f"SELECT mtid,lid,ad_field from location " \
# f"where mtid = {list(points.keys())[0]}"
# else:
# l_sql = f"SELECT mtid,lid,ad_field from location " \
# f"where mtid in {tuple(points.keys())}"
# async with MysqlUtil() as conn:
# datas = await conn.fetchall(l_sql)
# for data in datas:
# if data["mtid"] in points.keys():
# temp_dict = {"temp1": "A相", "temp2": "B相", "temp3": "C相",
# "temp4": "N相", "residual_current": "default"}
# flag = temp_dict.get(data["ad_field"]) or ""
# locations_dict = {
# "item": flag,
# "location_id": data.get("lid")
# }
# if "locations" not in points[data["mtid"]]:
# points[data["mtid"]]["locations"] = [locations_dict]
# else:
# points[data["mtid"]]["locations"].append(locations_dict)
# for k, v in points.items():
# list_point.append({
# "name": v["name"], "point_id": v["pid"],
# "locations": v.get("locations") or [],
# "add_to_company": v["add_to_company"]
# })
# return ListPointResponse(
# points=list_point,
# inlines=inline_list,
# power_show_all=1 if any(add_to_company) else 0
# )
@
summary
(
'获取监测点,进线列表'
)
async
def
post_list_point
(
req
,
body
:
ListPointRequest
)
->
ListPointResponse
:
cid
=
body
.
cid
...
...
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