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
5bada56c
Commit
5bada56c
authored
Mar 07, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230307
parent
a0cf8c3a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
4 deletions
+126
-4
apps/models.py
+1
-1
apps/view_map/view.py
+1
-1
apps/view_radar/view.py
+1
-1
apps/view_xiaocx/view.py
+1
-1
insert_chain_master.py
+45
-0
insert_company_hots.py
+77
-0
No files found.
apps/models.py
View file @
5bada56c
...
@@ -48,7 +48,7 @@ class Enterprise(db.Model):
...
@@ -48,7 +48,7 @@ class Enterprise(db.Model):
__tablename__
=
"enterprise"
__tablename__
=
"enterprise"
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
doc
=
'企业主键id'
,
comment
=
'企业主键id主键id'
)
# 企业
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
doc
=
'企业主键id'
,
comment
=
'企业主键id主键id'
)
# 企业
# company_id = db.Column(db.Integer, index=True, unique=True, comment='企业id') # 企业
chain_master
=
db
.
Column
(
db
.
String
(
20
),
doc
=
'链主企业'
,
comment
=
'链主企业'
)
company_id
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
comment
=
'企业id'
)
# 企业
company_id
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
comment
=
'企业id'
)
# 企业
company_name
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
doc
=
'企业名'
,
comment
=
'企业名'
)
# 企业名
company_name
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
doc
=
'企业名'
,
comment
=
'企业名'
)
# 企业名
status
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'经营状态'
,
comment
=
'经营状态'
)
# 经营状态
status
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'经营状态'
,
comment
=
'经营状态'
)
# 经营状态
...
...
apps/view_map/view.py
View file @
5bada56c
...
@@ -445,7 +445,7 @@ def attract_enterprise():
...
@@ -445,7 +445,7 @@ def attract_enterprise():
)
)
size
=
enterprise_obj
.
count
()
size
=
enterprise_obj
.
count
()
enterprise_obj_list
=
enterprise_obj
.
paginate
(
page
,
perpage
)
.
items
enterprise_obj_list
=
enterprise_obj
.
order_by
(
Company
.
hots
.
desc
())
.
paginate
(
page
,
perpage
)
.
items
df
=
[{
"id"
:
i
.
id
,
df
=
[{
"id"
:
i
.
id
,
"company_name"
:
i
.
company_name
,
"company_name"
:
i
.
company_name
,
...
...
apps/view_radar/view.py
View file @
5bada56c
...
@@ -1221,7 +1221,7 @@ def newList1():
...
@@ -1221,7 +1221,7 @@ def newList1():
remind
=
""
remind
=
""
enterprise
=
enterprise
enterprise
=
enterprise
size
=
enterprise
.
count
()
size
=
enterprise
.
count
()
enters
=
enterprise
.
paginate
(
page
,
perpage
)
.
items
enters
=
enterprise
.
order_by
(
enterprise
.
hots
.
desc
())
.
paginate
(
page
,
perpage
)
.
items
enter
=
[{
"id"
:
i
.
id
,
enter
=
[{
"id"
:
i
.
id
,
"name"
:
i
.
company_name
,
"name"
:
i
.
company_name
,
"industry"
:
i
.
company_industry
if
i
.
company_industry
else
"-"
,
# 行业
"industry"
:
i
.
company_industry
if
i
.
company_industry
else
"-"
,
# 行业
...
...
apps/view_xiaocx/view.py
View file @
5bada56c
...
@@ -434,7 +434,7 @@ def company_detail():
...
@@ -434,7 +434,7 @@ def company_detail():
company_obj
=
Company
.
query
.
get
(
_id
)
company_obj
=
Company
.
query
.
get
(
_id
)
data
=
{
data
=
{
"company_name"
:
company_obj
.
company_name
,
"company_name"
:
company_obj
.
company_name
,
"chain_master"
:
company_obj
.
chain_master
,
"chain_master"
:
'链主'
if
company_obj
.
chain_master
==
'1'
else
''
,
"district"
:
company_obj
.
district
,
"district"
:
company_obj
.
district
,
"lng"
:
company_obj
.
lng
,
"lng"
:
company_obj
.
lng
,
"lat"
:
company_obj
.
lat
,
"lat"
:
company_obj
.
lat
,
...
...
insert_chain_master.py
0 → 100644
View file @
5bada56c
"""
更新企业是否为链主字段
"""
# # -*- coding:utf-8 -*-
import
threading
import
pandas
as
pd
from
apps.models
import
IndustryChain
,
Enterprise
,
Company
from
manager
import
app
from
apps
import
db
"""
根据资质计算企业的热度,并提交保存
"""
# 读取链主企业文件
xl_path
=
"晋城链主企业.xlsx"
data
=
pd
.
read_excel
(
xl_path
)
com_li
=
[]
for
i
in
range
(
len
(
data
)):
com_name
=
str
(
data
.
loc
[
i
,
"企业名称"
])
com_li
.
append
(
com_name
)
def
handle
():
with
app
.
app_context
():
company_obj_list
=
Company
.
query
.
all
()
# 读取企业数据表的资质
i
=
0
for
company_obj
in
company_obj_list
:
company_name
=
company_obj
.
company_name
if
company_name
in
com_li
:
company_obj
.
chain_master
=
'1'
db
.
session
.
commit
()
i
+=
1
else
:
company_obj
.
chain_master
=
'0'
db
.
session
.
commit
()
print
(
'已完成,一共{}个'
.
format
(
i
))
if
__name__
==
'__main__'
:
t
=
threading
.
Thread
(
target
=
handle
)
t
.
start
()
insert_company_hots.py
0 → 100644
View file @
5bada56c
# # -*- coding:utf-8 -*-
import
threading
from
apps.models
import
IndustryChain
,
Enterprise
,
Company
from
manager
import
app
from
apps
import
db
"""
根据资质计算企业的热度,并提交保存
"""
def
handle
():
with
app
.
app_context
():
company_obj_list
=
Company
.
query
.
all
()
# print(company_obj_list)
# 读取企业数据表的资质
i
=
1
for
company_obj
in
company_obj_list
:
grade_li
=
[]
if
company_obj
.
isfive
and
company_obj
.
isfive
==
'1'
:
# 五百强
grade_li
.
append
(
5
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
quoted_company
and
company_obj
.
quoted_company
==
'1'
:
# 上市
grade_li
.
append
(
5
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
chain_master
and
company_obj
.
chain_master
==
'1'
:
# 链主
grade_li
.
append
(
5
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
unicorn
and
company_obj
.
unicorn
==
'1'
:
# 独角兽
grade_li
.
append
(
4
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
high_new
and
company_obj
.
high_new
==
'1'
:
# 高新技术企业
grade_li
.
append
(
3
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
dengl
and
company_obj
.
dengl
==
'1'
:
# 瞪羚
grade_li
.
append
(
3
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
scale
and
company_obj
.
scale
==
'1'
:
# 规模以上企业
grade_li
.
append
(
3
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
tbe
and
company_obj
.
tbe
==
'1'
:
# 科技型中小企业
grade_li
.
append
(
2
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
zjtg
and
company_obj
.
zjtg
==
'1'
:
# 山西专精特新企业
grade_li
.
append
(
2
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
fianacing
and
company_obj
.
fianacing
==
'1'
:
# 融资企业
grade_li
.
append
(
1
)
else
:
grade_li
.
append
(
0
)
if
company_obj
.
patent
and
company_obj
.
patent
==
'1'
:
# 专利企业
grade_li
.
append
(
1
)
else
:
grade_li
.
append
(
0
)
total_grede
=
sum
(
grade_li
)
if
not
total_grede
:
total_grede
=
0
company_obj
.
hots
=
total_grede
db
.
session
.
commit
()
print
(
str
(
round
(
i
/
len
(
company_obj_list
)
*
100
,
2
))
+
'
%
'
)
i
+=
1
if
__name__
==
'__main__'
:
t
=
threading
.
Thread
(
target
=
handle
)
t
.
start
()
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