Commit 552480b8 by dong

fix20230319

parent 163efc05
......@@ -358,10 +358,13 @@ def get_semic_map():
# 1、根据公司查询产品
body = body_by_companyName(company_name)
result_es = json.loads(requests.post(url=url, json=body).text)
if result_es["status"] == 404:
# if result_es["status"] == 404:
# return jsonify(code=RET.NODATA, msg="无相关供应链地图数据!")
try:
products = list(set([i["_source"]["product"] for i in result_es["hits"]["hits"]])) # 无需去重,最终数据不会出现重复项
except:
return jsonify(code=RET.NODATA, msg="无相关供应链地图数据!")
products = list(set([i["_source"]["product"] for i in result_es["hits"]["hits"]])) # 无需去重,最终数据不会出现重复项
# print("直接产品:", products)
# 2、查询上下游产品
products_center = list()
......
......@@ -1222,7 +1222,7 @@ def get_enterprise_patent():
# 校验参数完整性
if not all([id]):
return jsonify(code=RET.PARAMERR, msg="参数不完整")
name_query = "GetEnterprisePatent" + str(id)
name_query = "GetEnterprisePatent" + type + str(id)
if redis_store.get(name_query) is not None:
data = json.loads(redis_store.get(name_query))
return jsonify(code=RET.OK, msg="获取成功", data=data)
......@@ -1249,6 +1249,7 @@ def get_enterprise_patent():
"inventor": data.inventor
} for data in data_info9 if data_info9]
# redis缓存
redis_store.setex(name_query, 30 * 24 * 3600, json.dumps(data))
except Exception as e:
current_app.logger.error(e)
......
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