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
ada4307b
Commit
ada4307b
authored
Feb 14, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix202302014
parent
cc7c428d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
apps/models.py
+10
-1
apps/view_atlas/view.py
+10
-9
No files found.
apps/models.py
View file @
ada4307b
...
...
@@ -122,12 +122,21 @@ class Enterprise(db.Model):
unicorn
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'独角兽企业'
,
comment
=
'独角兽企业'
)
# 独角兽企业
isfive
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'是否中国500强'
,
comment
=
'是否中国500强'
)
# 是否中国500强
product_all
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'公司拥有产品'
,
comment
=
'公司拥有产品'
)
# 公司拥有产品
takingn
=
db
.
Column
(
db
.
Float
,
doc
=
'营收'
,
comment
=
'营收'
)
# 营收
hots
=
db
.
Column
(
db
.
Integer
,
doc
=
'企业热度(权重值)'
,
comment
=
'企业热度(权重值)'
)
# 企业热度(权重值)
c_name
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'行业类名'
,
comment
=
'行业类名'
)
# 行业类名
c_type
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'行业类id'
,
comment
=
'行业类id'
)
# 行业类id
product_all
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'公司拥有产品'
,
comment
=
'公司拥有产品'
)
# 公司拥有产品
c_name1
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'行业类名'
,
comment
=
'行业类名'
)
# 行业类名
c_type1
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'行业类id'
,
comment
=
'行业类id'
)
# 行业类id
product_all1
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'公司拥有产品'
,
comment
=
'公司拥有产品'
)
# 公司拥有产品
c_name2
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'行业类名'
,
comment
=
'行业类名'
)
# 行业类名
c_type2
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'行业类id'
,
comment
=
'行业类id'
)
# 行业类id
product_all2
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'公司拥有产品'
,
comment
=
'公司拥有产品'
)
# 公司拥有产品
f_name
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'父行业类名'
,
comment
=
'父行业类名'
)
# 父行业类名
f_type
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'父行业类id'
,
comment
=
'父行业类id'
)
# 父行业类id
...
...
apps/view_atlas/view.py
View file @
ada4307b
...
...
@@ -94,13 +94,14 @@ def industry_cluster():
try
:
industry_obj
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
industry_name
)
.
first
()
industry_id
=
industry_obj
.
id
chain_id
=
industry_obj
.
chain_id
# 查询redis
result
=
{
"industryChain"
:
industry_name
,
"nodeList"
:
[
find_up_thr1
(
1
,
industry_id
,
flag
),
find_up_thr1
(
2
,
industry_id
,
flag
),
find_up_thr1
(
3
,
industry_id
,
flag
)]
"nodeList"
:
[
find_up_thr1
(
chain_id
,
1
,
industry_id
,
flag
),
find_up_thr1
(
chain_id
,
2
,
industry_id
,
flag
),
find_up_thr1
(
chain_id
,
3
,
industry_id
,
flag
)]
}
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -137,7 +138,7 @@ def industry_cluster():
# Enterprise.c_type == industry_id,
# ).count()
# return company_count
def
get_count
(
industry_id
,
chain_name
,
flag
):
def
get_count
(
chain_id
,
industry_id
,
chain_name
,
flag
):
company_count
=
''
if
flag
==
1
:
# 晋城
# if industry_id in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]:
...
...
@@ -156,7 +157,7 @@ def get_count(industry_id, chain_name, flag):
# else:
chain_obj
=
IndustryChain
.
query
.
filter
(
IndustryChain
.
industry_name
==
chain_name
,
IndustryChain
.
chain_id
==
industry
_id
,
IndustryChain
.
chain_id
==
chain
_id
,
)
.
first
()
company_count
=
chain_obj
.
enterprise_num
return
company_count
...
...
@@ -240,7 +241,7 @@ def get_count(industry_id, chain_name, flag):
# node_one["subNodeList"].append(node_two)
# data["subNodeList"].append(node_one)
# return data
def
find_up_thr1
(
industry_type
,
industry_id
,
flag
):
def
find_up_thr1
(
chain_id
,
industry_type
,
industry_id
,
flag
):
# relation 1为上游,2为中游,3为下游
relation
=
''
if
industry_type
==
1
:
...
...
@@ -267,7 +268,7 @@ def find_up_thr1(industry_type, industry_id, flag):
chain_name1
=
pname_one
[
"chain_name"
]
total_count
=
0
# 一级的企业数量
company_count
=
get_count
(
industry_id
,
chain_name1
,
flag
)
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name1
,
flag
)
total_count
+=
company_count
# 一级
node_one
=
{
...
...
@@ -284,7 +285,7 @@ def find_up_thr1(industry_type, industry_id, flag):
for
pname_two
in
res_two
:
chain_name2
=
pname_two
[
"chain_name"
]
company_count
=
get_count
(
industry_id
,
chain_name2
,
flag
)
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
total_count
+=
company_count
# 二级
...
...
@@ -301,7 +302,7 @@ def find_up_thr1(industry_type, industry_id, flag):
}
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
(
industry_id
,
chain_name3
,
flag
)
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name3
,
flag
)
total_count
+=
company_count
# 三级
...
...
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