Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
04deaad2
提交
04deaad2
authored
11月 15, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
使用多线程补采公告
上级
0227ff97
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
13 行删除
+12
-13
公告补采1.py
comData/noticeReport/公告补采1.py
+12
-13
没有找到文件。
comData/noticeReport/公告补采1.py
浏览文件 @
04deaad2
"""
"""
...
...
@@ -19,12 +19,15 @@ from urllib.parse import unquote
baseCore
=
BaseCore
.
BaseCore
()
log
=
baseCore
.
getLogger
()
baseCore
=
BaseCore
.
BaseCore
()
local
=
threading
.
local
()
# 使用连接池
cnx_
=
baseCore
.
pool_11
.
connection
()
# cnx_ = baseCore.pool_11.connection()
# cursor_ = cnx_.cursor()
cnx_
=
baseCore
.
cnx_
cursor_
=
cnx_
.
cursor
()
lock
=
threading
.
Lock
()
pathType
=
'QYNotice/'
taskType
=
'企业公告/证监会'
obsClient
=
ObsClient
(
...
...
@@ -101,15 +104,6 @@ class EsMethod(object):
,
body
=
body
)
log
.
info
(
'更新结果:
%
s'
%
result
)
# 获取当前线程的数据库连接
def
get_connection
():
# 检查当前线程是否已经有连接对象
if
not
hasattr
(
local
,
'conn'
):
# 如果没有,则创建一个连接对象并保存到thread-local中
local
.
conn
=
baseCore
.
pool_11
.
connection
()
return
local
.
conn
def
getuuid
():
get_timestamp_uuid
=
uuid
.
uuid1
()
# 根据 时间戳生成 uuid , 保证全球唯一
return
get_timestamp_uuid
...
...
@@ -185,9 +179,12 @@ def getOBSres(pathType,name, response):
return
result
def
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
):
sel_sql
=
'''select id from clb_sys_attachment where item_id =
%
s and path =
%
s and type_id=
%
s and order_by=
%
s '''
lock
.
acquire
()
cursor_
.
execute
(
sel_sql
,
(
item_id
,
retData
[
'path'
],
type_id
,
order_by
))
selects
=
cursor_
.
fetchone
()
lock
.
release
()
return
selects
# 插入到att表 返回附件id
...
...
@@ -219,11 +216,13 @@ def tableUpdate(retData, year, pdf_name, num,pub_time,origin):
status
,
create_by
,
create_time
,
page_size
,
full_path
.
split
(
'https://zzsn.obs.cn-north-1.myhuaweicloud.com/'
)[
1
],
'zzsn'
,
pub_time
,
origin
)
lock
.
acquire
()
cursor_
.
execute
(
Upsql
,
values
)
# 插入
cnx_
.
commit
()
# 提交
lock
.
release
()
except
Exception
as
e
:
log
.
info
(
e
)
return
''
log
.
info
(
f
"更新完成:{item_id}===={pdf_name}"
)
selects
=
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
)
id
=
selects
[
0
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论