Commit cfeeaf9c by dong

fix20230319

parent 4f570fd9
...@@ -625,7 +625,7 @@ def batch_delete1(): ...@@ -625,7 +625,7 @@ def batch_delete1():
for select_id in delete_id_list: for select_id in delete_id_list:
project_obj_list = ProjectManagement.query.filter_by(id=select_id, is_delete=0).all() project_obj_list = ProjectManagement.query.filter_by(id=select_id, is_delete=0).all()
if not project_obj_list: if not project_obj_list:
return jsonify(code=RET.DBERR, msg="数据不存在!") continue
for project_obj in project_obj_list: for project_obj in project_obj_list:
project_obj.is_delete = 1 project_obj.is_delete = 1
db.session.commit() db.session.commit()
......
...@@ -275,7 +275,79 @@ def find_zero(): ...@@ -275,7 +275,79 @@ def find_zero():
# 获取供应链图谱 查询企业的产品接口 # 获取供应链图谱 查询企业的产品接口
@api_atlas.route("/SupplyChain/FindNext", methods=['POST']) # @api_atlas.route("/SupplyChain/FindNext", methods=['POST'])
# def find_next():
# req_dict = request.get_json()
# name = req_dict.get('name') # 名称
# # id = req_dict.get("id") # id
# category = req_dict.get("category")
# # 检查参数的完整性
# if not all([name, category]):
# return jsonify(code=RET.DATAERR, msg="参数不完整")
# try:
# if category == "1": # 查询企业的产品
# url = "http://39.100.39.50:9200/jc_supply_chain/_search" # 产品对企业
# # 1、根据公司查询产品
# body = body_by_companyName(name)
# result_es = json.loads(requests.post(url=url, json=body).text)
# res = list(set([i["_source"]["product"] for i in result_es["hits"]["hits"]]))
# if res:
# nodes = list()
# links = list()
# result = dict()
# products = list(set(res))
# for item in products:
# # nodes.append({"id": "{}".format(item), "name": "{}↓".format(item), "category": "2"})
# nodes.append({"data": {"category": "2", "real_name": item}, "id": "{}".format(item),
# "name": "{}↓".format(item), "category": "2"})
# links.append({"from": "a", "to": "{}".format(item), "text": "产品"})
# result["nodes"] = nodes
# result["links"] = links
# return jsonify(code=RET.OK, msg="获取成功", data=result)
# else:
# return jsonify(code=RET.NODATA, msg="无数据", data={})
# elif category == "2": # 根据产品查询上下游产品
# nodes = list()
# links = list()
# center_product = findCenterProducts(name) # 获取中间产品
# for udp in center_product:
# # findUpDownCompany(udp) # 获取上下游行业
# antity, relation = findUpDownCompany(name, udp) # 获取上下游行业
# nodes.extend(antity)
# links.extend(relation)
# nodes = deleteDuplicate(nodes)
# links = deleteDuplicate(links)
# result = {
# "nodes": nodes,
# "links": links
# }
# return jsonify(code=RET.OK, msg="获取成功", data=result)
# elif category == "3": # 产品查询供应商
# url = "http://39.100.39.50:9200/jc_supply_chain/_search"
# body = body_by_products(name)
# companys_return = json.loads(requests.post(url=url, json=body).text)
# res = [i["_source"]["company_name"] for i in companys_return["hits"]["hits"]]
# if res:
# nodes = list()
# links = list()
# result = dict()
# products = list(set(res))
# for item in products:
# nodes.append({"data": {"category": "4", "real_name": item}, "id": "{}".format(item),
# "name": "{}".format(item), "category": "4"})
# links.append({"from": "{}".format(name), "to": "{}".format(item), "text": "{}".format("供应商企业")})
# result["nodes"] = nodes
# result["links"] = links
# return jsonify(code=RET.OK, msg="获取成功", data=result)
# else:
# return jsonify(code=RET.NODATA, msg="无数据")
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="数据异常", data={})
# 企业供应链地图
@api_atlas.route("/SupplyChain/FindNext", methods=['POST']) # 获取供应链图谱 查询企业的产品接口
def find_next(): def find_next():
req_dict = request.get_json() req_dict = request.get_json()
name = req_dict.get('name') # 名称 name = req_dict.get('name') # 名称
...@@ -344,9 +416,6 @@ def find_next(): ...@@ -344,9 +416,6 @@ def find_next():
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据异常", data={}) return jsonify(code=RET.DBERR, msg="数据异常", data={})
# 企业供应链地图
@api_atlas.route("/SupplyChain/Map", methods=['POST']) @api_atlas.route("/SupplyChain/Map", methods=['POST'])
def get_semic_map(): def get_semic_map():
try: try:
......
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