Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
fd45fd1b
Commit
fd45fd1b
authored
Mar 17, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230317
parent
d0593b51
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
26 deletions
+68
-26
apps/view_atlas/view.py
+32
-18
apps/view_index/view.py
+36
-8
No files found.
apps/view_atlas/view.py
View file @
fd45fd1b
...
...
@@ -155,27 +155,28 @@ def industry_cluster():
# return company_count
def
get_count
(
chain_id
,
industry_id
,
chain_name
,
flag
):
company_count
=
''
id_list
=
[]
if
flag
==
1
:
# 晋城
# if industry_id in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]:
# company_count = Company.query.filter(
# Company.c_type == industry_id
# Company.product_all.like('%{}%'.format(chain_name)),
# Company.c_type == chain_id,
# ).count()
# else:
company_count
=
Company
.
query
.
filter
(
company_obj_li
=
Company
.
query
.
filter
(
Company
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
chain_name
)),
Company
.
c_type
==
chain_id
,
)
.
count
()
)
.
all
()
# 企业id列表,用于一级产业的企业数量去重
id_list
=
[
company_obj
.
id
for
company_obj
in
company_obj_li
]
company_count
=
len
(
company_obj_li
)
if
flag
==
2
:
# 全国
# if industry_id in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]:
# chain_obj = IndustryChain.query.get(industry_id)
# company_count = chain_obj.enterprise_num
# else:
chain_obj
=
IndustryChain
.
query
.
filter
(
IndustryChain
.
industry_name
==
chain_name
,
IndustryChain
.
chain_id
==
chain_id
,
)
.
first
()
company_count
=
chain_obj
.
enterprise_num
return
company_count
return
id_list
,
company_count
# def find_up_thr1(industry_type, industry_id):
...
...
@@ -280,16 +281,20 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_one_obj_list
]
for
pname_one
in
res_one
:
# 一级节点
one_id_li
=
[]
chain_name1
=
pname_one
[
"chain_name"
]
total_count
=
0
# 一级的企业数量
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name1
,
flag
)
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name1
,
flag
)
one_id_li
.
extend
(
id_list
)
total_count
+=
company_count
# 一级
node_one
=
{
"node"
:
"{}"
.
format
(
chain_name1
),
"level"
:
2
,
"company_count"
:
total_count
,
"company_count"
:
len
(
set
(
one_id_li
)),
"enterprise_count"
:
total_count
,
"subNodeList"
:
[]
}
# 获取二级节点
...
...
@@ -299,9 +304,11 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
}
for
chain_two_obj
in
chain_two_obj_list
]
for
pname_two
in
res_two
:
two_id_li
=
[]
chain_name2
=
pname_two
[
"chain_name"
]
# company_count = get_count(chain_id, industry_id, chain_name2, flag)
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
two_id_li
.
extend
(
id_list
)
one_id_li
.
extend
(
two_id_li
)
total_count
+=
company_count
...
...
@@ -309,7 +316,8 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
node_two
=
{
"node"
:
"{}"
.
format
(
chain_name2
),
"level"
:
3
,
"company_count"
:
company_count
,
"company_count"
:
len
(
set
(
two_id_li
)),
"enterprise_count"
:
company_count
,
"subNodeList"
:
[]
}
# 获取第三级节点
...
...
@@ -318,20 +326,26 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
"chain_name_id"
:
chain_three_obj
.
id
}
for
chain_three_obj
in
chain_three_obj_list
]
for
pname_thr
in
res_three
:
three_id_li
=
[]
chain_name3
=
pname_thr
[
"chain_name"
]
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name3
,
flag
)
id_list
,
company_count
,
=
get_count
(
chain_id
,
industry_id
,
chain_name3
,
flag
)
three_id_li
.
extend
(
id_list
)
two_id_li
.
extend
(
three_id_li
)
one_id_li
.
extend
(
two_id_li
)
total_count
+=
company_count
# 三级
node_thr
=
{
"node"
:
"{}"
.
format
(
chain_name3
),
"level"
:
4
,
"company_count"
:
company_count
,
"company_count"
:
len
(
set
(
three_id_li
)),
"enterprise_count"
:
company_count
,
"subNodeList"
:
[]
}
node_two
[
"subNodeList"
]
.
append
(
node_thr
)
node_one
[
"subNodeList"
]
.
append
(
node_two
)
node_one
.
update
({
"company_count"
:
total_count
})
# node_one.update({"company_count": total_count})
node_one
.
update
({
"company_count"
:
len
(
set
(
one_id_li
)),
"enterprise_count"
:
total_count
})
data
[
"subNodeList"
]
.
append
(
node_one
)
return
data
...
...
apps/view_index/view.py
View file @
fd45fd1b
...
...
@@ -851,6 +851,7 @@ def get_enterprise_licence():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -861,7 +862,10 @@ def get_enterprise_licence():
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -896,7 +900,7 @@ def get_enterprise_taxInfo():
'''
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -905,7 +909,10 @@ def get_enterprise_taxInfo():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -940,7 +947,7 @@ def get_enterprise_inoutInfo():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -949,7 +956,10 @@ def get_enterprise_inoutInfo():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -981,7 +991,7 @@ def get_enterprise_supplier():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -990,7 +1000,10 @@ def get_enterprise_supplier():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -1023,7 +1036,7 @@ def get_enterprise_client():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -1032,7 +1045,10 @@ def get_enterprise_client():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -1065,7 +1081,7 @@ def get_enterprise_equity():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -1074,7 +1090,10 @@ def get_enterprise_equity():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -1109,7 +1128,7 @@ def get_enterprise_punish():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -1118,7 +1137,10 @@ def get_enterprise_punish():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -1152,7 +1174,7 @@ def get_enterprise_certificate():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -1161,7 +1183,10 @@ def get_enterprise_certificate():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
@@ -1193,7 +1218,7 @@ def get_enterprise_patent():
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
# token = request.headers['token']
type
=
req_dict
.
get
(
"type"
)
# 校验参数完整性
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -1202,7 +1227,10 @@ def get_enterprise_patent():
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
try
:
if
type
==
'enterprise'
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
else
:
enterprise
=
Company
.
query
.
get
(
id
)
company_id
=
enterprise
.
company_id
if
not
company_id
:
return
jsonify
(
RET
.
NODATA
,
msg
=
'无关联信息'
)
...
...
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