Commit a29ebf56 by dong

fix20230130

parent 3f294b94
......@@ -47,6 +47,7 @@ def upload_xiansuo_project(row_content, time_strf, upload_time, upload_unity, up
investor_name = row_content[2] # 投资方名称
investor_district1 = row_content[3] # 投资方所在地,sheng
investor_district2 = row_content[4] # 投资方所在地,市
if investor_district2:
investor_district = investor_district1 + '/' + investor_district2
else:
......@@ -769,7 +770,6 @@ def upload_project_data1():
data_type = request.form['data_type'] # 1为线索库,2为对接库,3为签约库,4为开工库
try:
user_obj = verify_token(token)
# district_name = user_obj.district_name
upload_people = user_obj.real_name
user_id = user_obj.id
upload_unity = user_obj.belong_organization
......
......@@ -90,6 +90,7 @@ def get_cluster():
def industry_cluster():
req_dic = request.get_json()
industry_name = req_dic['industry_name']
flag = req_dic['flag']
try:
industry_obj = IndustryChain.query.filter_by(industry_name=industry_name).first()
industry_id = industry_obj.id
......@@ -97,9 +98,9 @@ def industry_cluster():
result = {
"industryChain": industry_name,
"nodeList": [find_up_thr1(1, industry_id),
find_up_thr1(2, industry_id),
find_up_thr1(3, industry_id)]
"nodeList": [find_up_thr1(1, industry_id, flag),
find_up_thr1(2, industry_id, flag),
find_up_thr1(3, industry_id, flag)]
}
except Exception as e:
current_app.logger.error(e)
......@@ -107,9 +108,14 @@ def industry_cluster():
return jsonify(code=RET.OK, msg="获取成功", data=result)
def get_count(chain_name):
company_count = Company.query.filter(
Company.product_all.like('%{}%'.format(chain_name))).count()
def get_count(chain_name, flag):
company_count = ''
if flag == 1: # 晋城
company_count = Company.query.filter(
Company.product_all.like('%{}%'.format(chain_name))).count()
if flag == 2: # 全国
company_count = Enterprise.query.filter(
Enterprise.product_all.like('%{}%'.format(chain_name))).count()
# print(chain_name + '===' + str(company_count))
return company_count
......@@ -192,7 +198,7 @@ def get_count(chain_name):
# node_one["subNodeList"].append(node_two)
# data["subNodeList"].append(node_one)
# return data
def find_up_thr1(industry_type, industry_id):
def find_up_thr1(industry_type, industry_id, flag):
# relation 1为上游,2为中游,3为下游
relation = ''
if industry_type == 1:
......@@ -219,7 +225,7 @@ def find_up_thr1(industry_type, industry_id):
chain_name1 = pname_one["chain_name"]
total_count = 0
# 一级的企业数量
company_count = get_count(chain_name1)
company_count = get_count(chain_name1, flag)
total_count += company_count
# 一级
node_one = {
......@@ -236,7 +242,7 @@ def find_up_thr1(industry_type, industry_id):
for pname_two in res_two:
chain_name2 = pname_two["chain_name"]
company_count = get_count(chain_name2)
company_count = get_count(chain_name2, flag)
total_count += company_count
# 二级
......@@ -253,7 +259,7 @@ def find_up_thr1(industry_type, industry_id):
} for chain_three_obj in chain_three_obj_list]
for pname_thr in res_three:
chain_name3 = pname_thr["chain_name"]
company_count = get_count(chain_name3)
company_count = get_count(chain_name3, flag)
total_count += company_count
# 三级
......
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