Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
蒋勇
zhichan
Commits
db7edf37
Commit
db7edf37
authored
Aug 03, 2020
by
黄静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hj
parent
f81759dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
entprofile/db/mod_db.py
+4
-1
entprofile/service/company_30s.py
+12
-11
No files found.
entprofile/db/mod_db.py
View file @
db7edf37
...
@@ -58,7 +58,6 @@ class DataBase:
...
@@ -58,7 +58,6 @@ class DataBase:
# 数据库连接
# 数据库连接
@property
@property
def
connectMySQL
(
self
):
def
connectMySQL
(
self
):
conn
=
False
try
:
try
:
conn
=
pymysql
.
connect
(
host
=
self
.
_dbhost
,
conn
=
pymysql
.
connect
(
host
=
self
.
_dbhost
,
user
=
self
.
_dbuser
,
user
=
self
.
_dbuser
,
...
@@ -79,6 +78,7 @@ class DataBase:
...
@@ -79,6 +78,7 @@ class DataBase:
res
=
''
res
=
''
if
(
self
.
_conn
):
if
(
self
.
_conn
):
try
:
try
:
self
.
_conn
.
ping
(
reconnect
=
True
)
self
.
_cursor
.
execute
(
sql
)
self
.
_cursor
.
execute
(
sql
)
res
=
self
.
_cursor
.
fetchall
()
res
=
self
.
_cursor
.
fetchall
()
except
Exception
as
data
:
except
Exception
as
data
:
...
@@ -89,6 +89,7 @@ class DataBase:
...
@@ -89,6 +89,7 @@ class DataBase:
res
=
''
res
=
''
if
(
self
.
_conn
):
if
(
self
.
_conn
):
try
:
try
:
self
.
_conn
.
ping
(
reconnect
=
True
)
self
.
_cursor
.
execute
(
sql
)
self
.
_cursor
.
execute
(
sql
)
res
=
self
.
_cursor
.
fetchone
()
res
=
self
.
_cursor
.
fetchone
()
except
Exception
as
data
:
except
Exception
as
data
:
...
@@ -101,6 +102,7 @@ class DataBase:
...
@@ -101,6 +102,7 @@ class DataBase:
if
(
self
.
_conn
):
if
(
self
.
_conn
):
try
:
try
:
print
(
sql
,
"=============================="
)
print
(
sql
,
"=============================="
)
self
.
_conn
.
ping
(
reconnect
=
True
)
self
.
_cursor
.
execute
(
sql
,
params
)
self
.
_cursor
.
execute
(
sql
,
params
)
self
.
_conn
.
commit
()
self
.
_conn
.
commit
()
flag
=
True
flag
=
True
...
@@ -114,6 +116,7 @@ class DataBase:
...
@@ -114,6 +116,7 @@ class DataBase:
flag
=
False
flag
=
False
if
(
self
.
_conn
):
if
(
self
.
_conn
):
try
:
try
:
self
.
_conn
.
ping
(
reconnect
=
True
)
self
.
_cursor
.
execute
(
sql
)
self
.
_cursor
.
execute
(
sql
)
flag
=
True
flag
=
True
self
.
_conn
.
commit
()
self
.
_conn
.
commit
()
...
...
entprofile/service/company_30s.py
View file @
db7edf37
...
@@ -67,6 +67,8 @@ def hx_30s(companyName):
...
@@ -67,6 +67,8 @@ def hx_30s(companyName):
}
}
'''
'''
def
final_hx
(
company_industry
,
hx_info_dict
):
def
final_hx
(
company_industry
,
hx_info_dict
):
print
(
'hx_info_dicthx_info_dict'
,
hx_info_dict
)
lable_data
=
[]
data
=
[]
data
=
[]
productData_dict
=
{}
productData_dict
=
{}
industryData_dict
=
{}
industryData_dict
=
{}
...
@@ -78,21 +80,19 @@ def final_hx (company_industry,hx_info_dict):
...
@@ -78,21 +80,19 @@ def final_hx (company_industry,hx_info_dict):
industryData_dict
[
'label_data'
]
=
company_industry_list
industryData_dict
[
'label_data'
]
=
company_industry_list
industryData_dict
[
'label_type'
]
=
'行业标签'
industryData_dict
[
'label_type'
]
=
'行业标签'
data
.
append
(
industryData_dict
)
data
.
append
(
industryData_dict
)
print
(
"jdksjdskjsk"
,
type
(
hx_info_dict
[
'product'
]))
productData
=
hx_info_dict
[
'product'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
if
hx_info_dict
[
'product'
]:
print
(
'productData'
,
productData
)
productData
=
hx_info_dict
[
'product'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
print
(
type
(
productData
))
if
productData
and
productData
!=
[
''
]:
if
productData
and
productData
!=
[
''
]:
if
len
(
productData
)
>
2
:
if
len
(
productData
)
>
2
:
lable_data
=
productData
[
0
:
2
]
lable_data
=
productData
[
0
:
2
]
else
:
else
:
lable_data
=
productData
lable_data
=
productData
else
:
else
:
lable_data
=
[]
lable_data
=
[]
productData_dict
[
'label_data'
]
=
lable_data
productData_dict
[
'label_data'
]
=
lable_data
productData_dict
[
'label_type'
]
=
'产品标签'
productData_dict
[
'label_type'
]
=
'产品标签'
data
.
append
(
productData_dict
)
data
.
append
(
productData_dict
)
knowledgeData
=
hx_info_dict
[
'knowledge_info'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
knowledgeData
=
hx_info_dict
[
'knowledge_info'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
print
(
knowledgeData
,
"knowledgeData====="
)
print
(
knowledgeData
,
"knowledgeData====="
)
knowledgeData_list
=
[]
knowledgeData_list
=
[]
...
@@ -103,7 +103,6 @@ def final_hx (company_industry,hx_info_dict):
...
@@ -103,7 +103,6 @@ def final_hx (company_industry,hx_info_dict):
knowledgeData_dict
[
'label_data'
]
=
knowledgeData_list
knowledgeData_dict
[
'label_data'
]
=
knowledgeData_list
knowledgeData_dict
[
'label_type'
]
=
'资产标签'
knowledgeData_dict
[
'label_type'
]
=
'资产标签'
data
.
append
(
knowledgeData_dict
)
data
.
append
(
knowledgeData_dict
)
baseData
=
hx_info_dict
[
'company_base'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
baseData
=
hx_info_dict
[
'company_base'
]
.
replace
(
'['
,
''
)
.
replace
(
']'
,
''
)
.
replace
(
"'"
,
''
)
.
replace
(
" "
,
''
)
.
split
(
','
)
branchData_list
=
[]
branchData_list
=
[]
for
base_item
in
baseData
:
for
base_item
in
baseData
:
...
@@ -114,6 +113,7 @@ def final_hx (company_industry,hx_info_dict):
...
@@ -114,6 +113,7 @@ def final_hx (company_industry,hx_info_dict):
branchLable_dict
[
'label_data'
]
=
branchData_list
branchLable_dict
[
'label_data'
]
=
branchData_list
branchLable_dict
[
'label_type'
]
=
'分公司标签'
branchLable_dict
[
'label_type'
]
=
'分公司标签'
data
.
append
(
branchLable_dict
)
data
.
append
(
branchLable_dict
)
print
(
'datadatadata'
,
data
)
return
data
return
data
...
@@ -134,6 +134,7 @@ def tj_30s_hx(server):
...
@@ -134,6 +134,7 @@ def tj_30s_hx(server):
hx_info_dict
=
hx_30s
(
standard_company_name
)
hx_info_dict
=
hx_30s
(
standard_company_name
)
print
(
hx_info_dict
,
"hx_info_dict==="
)
print
(
hx_info_dict
,
"hx_info_dict==="
)
data
=
final_hx
(
industryLable
,
hx_info_dict
)
data
=
final_hx
(
industryLable
,
hx_info_dict
)
print
(
'data111'
,
data
)
hx_30s_result
=
{
"status"
:
0
,
"msg"
:
"成功"
,
"data"
:
data
}
hx_30s_result
=
{
"status"
:
0
,
"msg"
:
"成功"
,
"data"
:
data
}
except
Exception
as
error
:
except
Exception
as
error
:
hx_30s_result
=
{
"status"
:
-
1
,
"msg"
:
"失败"
,
"data"
:
error
}
hx_30s_result
=
{
"status"
:
-
1
,
"msg"
:
"失败"
,
"data"
:
error
}
...
...
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