Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
721c31d7
提交
721c31d7
authored
5月 29, 2024
作者:
LiuLiYuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步数据 05/29
上级
e699dcba
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
11 行删除
+25
-11
同步数据.py
comData/Synchronize_data/同步数据.py
+25
-11
没有找到文件。
comData/Synchronize_data/同步数据.py
浏览文件 @
721c31d7
"""
"""
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
同步正式环境企业表
同步正式环境企业表
"""
"""
from
datetime
import
datetime
from
datetime
import
datetime
import
requests
import
requests
import
urllib3
import
urllib3
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
from
base.BaseCore
import
BaseCore
from
base.BaseCore
import
BaseCore
baseCore
=
BaseCore
()
baseCore
=
BaseCore
()
log
=
baseCore
.
getLogger
()
log
=
baseCore
.
getLogger
()
# 144数据库
# 144数据库
...
@@ -64,7 +65,8 @@ if __name__ == "__main__":
...
@@ -64,7 +65,8 @@ if __name__ == "__main__":
com_code
=
info
.
split
(
'|'
)[
0
]
com_code
=
info
.
split
(
'|'
)[
0
]
com_name
=
info
.
split
(
'|'
)[
1
]
com_name
=
info
.
split
(
'|'
)[
1
]
com_english_name
=
info
.
split
(
'|'
)[
2
]
com_english_name
=
info
.
split
(
'|'
)[
2
]
result
=
search_formal_table
(
'CompanyName, SocialCode, EnglishName, SecuritiesCode, SecuritiesShortName, Place, isIPO, SecuritiesType, Category, Exchange, countryName'
,
'EnterpriseInfo'
,
'SocialCode'
,
com_code
,
cursor_
)
result
=
search_formal_table
(
'CompanyName, SocialCode, EnglishName, SecuritiesCode, SecuritiesShortName, Place, isIPO, SecuritiesType, Category, Exchange, countryName'
,
'EnterpriseInfo'
,
'SocialCode'
,
com_code
,
cursor_
)
u_name
,
u_code
,
u_ename
,
u_short_name
,
u_type
,
u_category
,
u_exchange
=
''
,
''
,
''
,
''
,
''
,
''
,
''
u_name
,
u_code
,
u_ename
,
u_short_name
,
u_type
,
u_category
,
u_exchange
=
''
,
''
,
''
,
''
,
''
,
''
,
''
# 更新语句
# 更新语句
update_sql
=
"""update EnterpriseInfo set {} where SocialCode = {}"""
update_sql
=
"""update EnterpriseInfo set {} where SocialCode = {}"""
...
@@ -84,7 +86,8 @@ if __name__ == "__main__":
...
@@ -84,7 +86,8 @@ if __name__ == "__main__":
u_countryname
=
'中国内地'
u_countryname
=
'中国内地'
fields
+=
f
'countryName = "{u_countryname}", '
fields
+=
f
'countryName = "{u_countryname}", '
if
not
result
[
0
][
3
]:
if
not
result
[
0
][
3
]:
result_ipo
=
search_formal_table
(
'social_credit_code, securities_code, securities_short_name, securities_type, category,exchange'
,
'sys_base_enterprise_ipo'
,
'social_credit_code'
,
com_code
,
cursor
)
result_ipo
=
search_formal_table
(
'social_credit_code, securities_code, securities_short_name, securities_type, category,exchange'
,
'sys_base_enterprise_ipo'
,
'social_credit_code'
,
com_code
,
cursor
)
if
result_ipo
:
if
result_ipo
:
# 是上市企业
# 是上市企业
if
not
result
[
0
][
6
]:
if
not
result
[
0
][
6
]:
...
@@ -117,10 +120,20 @@ if __name__ == "__main__":
...
@@ -117,10 +120,20 @@ if __name__ == "__main__":
log
.
info
(
f
'更新的sql语句--{update_sql}'
)
log
.
info
(
f
'更新的sql语句--{update_sql}'
)
update_table
(
update_sql
,
cursor_
,
cnx_
)
update_table
(
update_sql
,
cursor_
,
cnx_
)
else
:
else
:
# 企业表中没有需要插入数据
result_ipo
=
search_formal_table
(
'social_credit_code, securities_code, securities_short_name, securities_type, category,exchange'
,
'sys_base_enterprise_ipo'
,
'social_credit_code'
,
pass
com_code
,
cursor
)
if
result_ipo
:
SecuritiesCode
=
result_ipo
[
1
]
SecuritiesShortName
=
result_ipo
[
2
]
securities_type
=
result_ipo
[
3
]
Category
=
result_ipo
[
4
]
exchange
=
result_ipo
[
5
]
sqlInsert
=
'insert into EnterpriseInfo(CompanyName, SocialCode, EnglishName, SecuritiesCode, SecuritiesShortName, Place, isIPO, SecuritiesType, Category, Exchange, countryName) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)'
baseCore
.
cursor
.
execute
(
sqlInsert
,
(
com_name
,
com_code
,
com_english_name
,
SecuritiesCode
,
1
,
1
,
securities_type
,
Category
,
exchange
,
'中国内地'
))
baseCore
.
cnx
.
commit
()
log
.
info
(
f
'{com_name}==={com_name}===上市企业===插入成功'
)
else
:
sqlInsert
=
'insert into EnterpriseInfo(CompanyName, SocialCode, EnglishName, Place, isIPO, countryName) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)'
baseCore
.
cursor
.
execute
(
sqlInsert
,
(
com_name
,
com_code
,
com_english_name
,
1
,
1
,
'中国内地'
))
baseCore
.
cnx
.
commit
()
log
.
info
(
f
'{com_name}==={com_name}===非上市企业===插入成功'
)
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论