Commit 1b340470 authored by wang.wenrong's avatar wang.wenrong

Merge branch 'wwr' into 'develop'

fix_common_list_point

See merge request !51
parents 41b13f28 58419214
......@@ -110,6 +110,7 @@ async def get_meter_by_point_new15(point_id):
meter_info = await conn.fetchone(sql, args=(point_id,))
return meter_info
async def list_point(cid):
list_point = []
points = {}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment