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
622d22ee
Commit
622d22ee
authored
Feb 13, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix202302013
parent
1abb4a3c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
14 deletions
+87
-14
apps/inves_manage/siku_view.py
+1
-1
apps/models.py
+0
-3
apps/util.py
+26
-0
apps/view_360company/view.py
+0
-5
apps/view_atlas/view.py
+8
-4
apps/view_map/view.py
+0
-1
enterprise_to_industry_chain.py
+52
-0
No files found.
apps/inves_manage/siku_view.py
View file @
622d22ee
...
...
@@ -1147,7 +1147,7 @@ def edit_project_detail():
project_obj
.
investment_volume1
=
req_dic
[
'investment_volume1'
]
project_obj
.
project_info1
=
req_dic
[
'project_info1'
]
project_obj
.
stop_reason
=
req_dic
[
'stop_reason'
]
project_obj
.
thread_source
=
req_dic
[
'thread_source'
]
project_obj
.
thread_source
=
req_dic
[
'thread_source'
]
project_obj
.
cooperation_way
=
req_dic
[
'cooperation_way'
]
project_obj
.
other_source
=
req_dic
[
'other_source'
]
project_obj
.
remark
=
req_dic
[
'remark'
]
...
...
apps/models.py
View file @
622d22ee
...
...
@@ -1743,6 +1743,3 @@ class OperationLog(db.Model):
action
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'记录"导入"的动作用于备注(每月十五号前是否进行提报导入)的是和否'
)
read_type
=
db
.
Column
(
db
.
Integer
,
comment
=
'消息类型(用于消息提醒) 0未读,1已读,3已读状态一天后转为历史消息'
)
time
=
db
.
Column
(
db
.
DateTime
,
default
=
''
,
comment
=
'转为已读状态的时间(用于消息提醒)'
)
apps/util.py
View file @
622d22ee
...
...
@@ -115,3 +115,29 @@ def login_required(view_func):
return
view_func
(
*
args
,
**
kwargs
)
return
verify_token
apps/view_360company/view.py
View file @
622d22ee
...
...
@@ -26,16 +26,11 @@ def get_all_enterprise():
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
try
:
# enterprise_all_counts = len(Enterprise.query.all())
enterprise_all_counts
=
Enterprise
.
query
.
count
()
# print(enterprise_all_counts)
enterprise_list
=
Enterprise
.
query
.
paginate
(
page
,
perpage
)
.
items
# counts = len(enterprise_list)
# print(enterprise_list)
if
enterprise_list
:
data
=
{
"data"
:
[{
"id"
:
enterprise
.
id
,
"company"
:
enterprise
.
company_name
,
# 企业名
# "area": enterprise.city + enterprise.district,
"area"
:
''
,
"createtime"
:
(
enterprise
.
build_date
)
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
enterprise
.
build_date
else
''
,
...
...
apps/view_atlas/view.py
View file @
622d22ee
...
...
@@ -108,14 +108,18 @@ def industry_cluster():
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
result
)
def
get_count
(
chain_name
,
flag
):
def
get_count
(
industry_id
,
chain_name
,
flag
):
company_count
=
''
if
flag
==
1
:
# 晋城
company_count
=
Company
.
query
.
filter
(
Company
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
chain_name
)))
.
count
()
Company
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
chain_name
)),
Company
.
c_type
==
industry_id
,
)
.
count
()
if
flag
==
2
:
# 全国
company_count
=
Enterprise
.
query
.
filter
(
Enterprise
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
chain_name
)))
.
count
()
Enterprise
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
chain_name
)),
Enterprise
.
c_type
==
industry_id
,
)
.
count
()
# print(chain_name + '===' + str(company_count))
return
company_count
...
...
@@ -225,7 +229,7 @@ def find_up_thr1(industry_type, industry_id, flag):
chain_name1
=
pname_one
[
"chain_name"
]
total_count
=
0
# 一级的企业数量
company_count
=
get_count
(
chain_name1
,
flag
)
company_count
=
get_count
(
industry_id
,
chain_name1
,
flag
)
total_count
+=
company_count
# 一级
node_one
=
{
...
...
apps/view_map/view.py
View file @
622d22ee
...
...
@@ -398,7 +398,6 @@ def get_chain():
industry_name
=
indu_obj
.
industry_name
enterprise_list
=
Enterprise
.
query
.
filter
(
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)))
.
all
()
for
enterprise_obj
in
enterprise_list
:
#
indu_obj
.
enterprise
.
append
(
enterprise_obj
)
continue
...
...
enterprise_to_industry_chain.py
0 → 100644
View file @
622d22ee
import
threading
from
flask
import
app
from
apps.models
import
IndustryChain
,
Enterprise
from
manager
import
app
from
apps
import
db
def
handle
():
with
app
.
app_context
():
industry_obj_list
=
IndustryChain
.
query
.
all
()
print
(
industry_obj_list
)
# 读取industry_chain数据表的产业名称
num
=
0
for
industry_obj
in
industry_obj_list
:
# 清空原有关联企业
industry_obj
.
enterprise
=
[]
db
.
session
.
commit
()
industry_name
=
industry_obj
.
industry_name
industry_id
=
industry_obj
.
id
# 读取全国企业表,模糊匹配product_all字段
if
industry_name
in
[
"钢铁"
,
"光机电"
,
"煤层气"
,
"装备制造"
,
"铸造"
,
"煤化工"
,
"新材料"
,
"绿色建材"
,
"医药"
,
"丝麻纺织服装"
,
"现代服务业"
,
"数字经济"
,
"文化旅游"
]:
print
(
"正在查询【{}】的相关企业......"
.
format
(
industry_name
))
enterprise_list
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type
==
industry_id
)
.
all
()
else
:
print
(
"正在查询【{}】的相关企业......"
.
format
(
industry_name
))
enterprise_list
=
Enterprise
.
query
.
filter
(
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)),
Enterprise
.
c_type
==
industry_id
)
.
all
()
if
not
enterprise_list
:
continue
# enterprise_num = 0
for
enterprise_obj
in
enterprise_list
:
industry_obj
.
enterprise
.
append
(
enterprise_obj
)
# enterprise_num += 1
# enterprise_rate = str(enterprise_num / len(enterprise_list) * 100) + '%'
# print("需要添加【{}】的企业外键一共{}个,已完成{}".format(industry_name, len(enterprise_list), enterprise_rate))
db
.
session
.
commit
()
continue
# db.session.commit()
num
+=
1
# print("产业链【{}】已完成,全部产业链已完成".format(industry_name) + str(num / 775 * 100) + '%')
print
(
"产业链【{}】已完成"
.
format
(
industry_name
))
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