Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
355de5c2
提交
355de5c2
authored
11月 16, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
使用多线程补采公告
上级
3278b6b6
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
13 行删除
+18
-13
公告补采1.py
comData/noticeReport/公告补采1.py
+18
-13
没有找到文件。
comData/noticeReport/公告补采1.py
浏览文件 @
355de5c2
"""
"""
...
@@ -24,8 +24,8 @@ baseCore = BaseCore.BaseCore()
...
@@ -24,8 +24,8 @@ baseCore = BaseCore.BaseCore()
# cnx_ = baseCore.pool_11.connection()
# cnx_ = baseCore.pool_11.connection()
# cursor_ = cnx_.cursor()
# cursor_ = cnx_.cursor()
cnx_
=
baseCore
.
cnx_
#
cnx_ = baseCore.cnx_
cursor_
=
cnx_
.
cursor
()
#
cursor_ = cnx_.cursor()
lock
=
threading
.
Lock
()
lock
=
threading
.
Lock
()
pathType
=
'QYNotice/'
pathType
=
'QYNotice/'
...
@@ -178,17 +178,17 @@ def getOBSres(pathType,name, response):
...
@@ -178,17 +178,17 @@ def getOBSres(pathType,name, response):
# resp = obsClient.putFile('zzsn', pathType + name, file_path='要上传的那个文件的本地路径')
# resp = obsClient.putFile('zzsn', pathType + name, file_path='要上传的那个文件的本地路径')
return
result
return
result
def
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
):
def
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
,
cnx_
,
cursor_
):
sel_sql
=
'''select id from clb_sys_attachment where item_id =
%
s and path =
%
s and type_id=
%
s and order_by=
%
s '''
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
()
#
lock.acquire()
cursor_
.
execute
(
sel_sql
,
(
item_id
,
retData
[
'path'
],
type_id
,
order_by
))
cursor_
.
execute
(
sel_sql
,
(
item_id
,
retData
[
'path'
],
type_id
,
order_by
))
selects
=
cursor_
.
fetchone
()
selects
=
cursor_
.
fetchone
()
lock
.
release
()
#
lock.release()
return
selects
return
selects
# 插入到att表 返回附件id
# 插入到att表 返回附件id
def
tableUpdate
(
retData
,
year
,
pdf_name
,
num
,
pub_time
,
origin
):
def
tableUpdate
(
retData
,
year
,
pdf_name
,
num
,
pub_time
,
origin
,
cnx_
,
cursor_
):
item_id
=
retData
[
'item_id'
]
item_id
=
retData
[
'item_id'
]
type_id
=
retData
[
'type_id'
]
type_id
=
retData
[
'type_id'
]
group_name
=
retData
[
'group_name'
]
group_name
=
retData
[
'group_name'
]
...
@@ -216,19 +216,19 @@ def tableUpdate(retData, year, pdf_name, num,pub_time,origin):
...
@@ -216,19 +216,19 @@ def tableUpdate(retData, year, pdf_name, num,pub_time,origin):
status
,
create_by
,
status
,
create_by
,
create_time
,
page_size
,
full_path
.
split
(
'https://zzsn.obs.cn-north-1.myhuaweicloud.com/'
)[
1
],
'zzsn'
,
create_time
,
page_size
,
full_path
.
split
(
'https://zzsn.obs.cn-north-1.myhuaweicloud.com/'
)[
1
],
'zzsn'
,
pub_time
,
origin
)
pub_time
,
origin
)
lock
.
acquire
()
#
lock.acquire()
cursor_
.
execute
(
Upsql
,
values
)
# 插入
cursor_
.
execute
(
Upsql
,
values
)
# 插入
cnx_
.
commit
()
# 提交
cnx_
.
commit
()
# 提交
lock
.
release
()
#
lock.release()
except
Exception
as
e
:
except
Exception
as
e
:
log
.
info
(
e
)
log
.
info
(
e
)
return
''
return
''
log
.
info
(
f
"更新完成:{item_id}===={pdf_name}"
)
log
.
info
(
f
"更新完成:{item_id}===={pdf_name}"
)
selects
=
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
)
selects
=
secrchATT
(
item_id
,
retData
,
type_id
,
order_by
,
cnx_
,
cursor_
)
id
=
selects
[
0
]
id
=
selects
[
0
]
return
id
return
id
def
upload
(
sourceAddress
,
num
,
title
,
social_code
,
year
,
publishDate
,
createDate
):
def
upload
(
sourceAddress
,
num
,
title
,
social_code
,
year
,
publishDate
,
createDate
,
cnx_
,
cursor_
):
# todo:链接上传obs
# todo:链接上传obs
retData
=
uptoOBS
(
sourceAddress
,
title
+
'.pdf'
,
8
,
social_code
,
createDate
)
retData
=
uptoOBS
(
sourceAddress
,
title
+
'.pdf'
,
8
,
social_code
,
createDate
)
# 附件插入att数据库
# 附件插入att数据库
...
@@ -239,7 +239,7 @@ def upload(sourceAddress,num,title,social_code,year,publishDate,createDate):
...
@@ -239,7 +239,7 @@ def upload(sourceAddress,num,title,social_code,year,publishDate,createDate):
return
None
return
None
num
=
num
+
1
num
=
num
+
1
origin
=
'证监会'
origin
=
'证监会'
att_id
=
tableUpdate
(
retData
,
year
,
title
+
'.pdf'
,
num
,
publishDate
,
origin
)
att_id
=
tableUpdate
(
retData
,
year
,
title
+
'.pdf'
,
num
,
publishDate
,
origin
,
cnx_
,
cursor_
)
if
att_id
:
if
att_id
:
return
att_id
return
att_id
else
:
else
:
...
@@ -248,6 +248,8 @@ def upload(sourceAddress,num,title,social_code,year,publishDate,createDate):
...
@@ -248,6 +248,8 @@ def upload(sourceAddress,num,title,social_code,year,publishDate,createDate):
def
main
(
page
,
p
,
esMethod
):
def
main
(
page
,
p
,
esMethod
):
# esMethod = EsMethod()
# esMethod = EsMethod()
# esMethod.getFileds(index_name=esMethod.index_name)
# esMethod.getFileds(index_name=esMethod.index_name)
cnx_
=
baseCore
.
cnx_
cursor_
=
cnx_
.
cursor
()
result
=
esMethod
.
queryatt
(
index_name
=
esMethod
.
index_name
,
pnum
=
p
)
result
=
esMethod
.
queryatt
(
index_name
=
esMethod
.
index_name
,
pnum
=
p
)
total
=
result
[
'hits'
][
'total'
][
'value'
]
total
=
result
[
'hits'
][
'total'
][
'value'
]
if
total
==
0
:
if
total
==
0
:
...
@@ -267,12 +269,15 @@ def main(page,p,esMethod):
...
@@ -267,12 +269,15 @@ def main(page,p,esMethod):
publishDate
=
mms
[
'_source'
][
'publishDate'
]
publishDate
=
mms
[
'_source'
][
'publishDate'
]
createDate
=
mms
[
'_source'
][
'createDate'
]
createDate
=
mms
[
'_source'
][
'createDate'
]
log
.
info
(
f
'{id}---{title}--{sourceAddress}---{social_code}'
)
log
.
info
(
f
'{id}---{title}--{sourceAddress}---{social_code}'
)
att_id
=
upload
(
sourceAddress
,
num
,
title
,
social_code
,
year
,
publishDate
,
createDate
)
att_id
=
upload
(
sourceAddress
,
num
,
title
,
social_code
,
year
,
publishDate
,
createDate
,
cnx_
,
cursor_
)
u_attid
=
att_id
u_attid
=
att_id
esMethod
.
updateaunn
(
esMethod
.
index_name
,
str
(
id
),
u_attid
)
esMethod
.
updateaunn
(
esMethod
.
index_name
,
str
(
id
),
u_attid
)
end_time
=
time
.
time
()
end_time
=
time
.
time
()
elapsed_time
=
end_time
-
start_time
elapsed_time
=
end_time
-
start_time
# log.info(f'******更新一条数据耗时{elapsed_time}秒******')
# log.info(f'******更新一条数据耗时{elapsed_time}秒******')
cursor_
.
close
()
cnx_
.
close
()
def
run_threads
(
num_threads
,
esMethod
):
def
run_threads
(
num_threads
,
esMethod
):
threads
=
[]
threads
=
[]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论