Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
23dffcc7
authored
2023-01-04 15:24:41 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
init:文件名前加'关注'
1 parent
4398d1df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/ecm.py
src/apps/doc/ocr/wb.py
src/apps/doc/management/commands/ocr_process.py
View file @
23dffcc
...
...
@@ -1874,7 +1874,8 @@ class Command(BaseCommand, LoggerMixin):
# 重构Excel文件
# src_excel_path = os.path.join(doc_data_path, 'src.xlsx')
# wb.save(src_excel_path)
count_list
=
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
,
contract_result
,
doc
.
metadata
)
#need_follow表示在上传edms时文件名是否要添加"关注"两字
count_list
,
need_follow
=
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
,
contract_result
,
doc
.
metadata
)
wb
.
save
(
excel_path
)
except
Exception
as
e
:
...
...
@@ -1895,7 +1896,7 @@ class Command(BaseCommand, LoggerMixin):
# 上传至EDMS
for
times
in
range
(
consts
.
RETRY_TIMES
):
try
:
self
.
edms
.
upload
(
excel_path
,
doc
,
business_type
)
self
.
edms
.
upload
(
excel_path
,
doc
,
business_type
,
need_follow
)
except
Exception
as
e
:
self
.
online_log
.
warn
(
'{0} [edms upload failed] [times={1}] [task={2}] [error={3}]'
.
format
(
...
...
src/apps/doc/ocr/ecm.py
View file @
23dffcc
...
...
@@ -110,15 +110,16 @@ class ECM:
return
'{0}{1}'
.
format
(
self
.
prefix
,
name
)
return
'{0}{1}'
.
format
(
self
.
prefix
,
doc_name
)
def
upload
(
self
,
file_path
,
doc
,
business_type
):
def
upload
(
self
,
file_path
,
doc
,
business_type
,
need_follow
):
doc_type
,
folder_afc
,
folder_hil
=
self
.
doc_type_map
.
get
(
doc
.
document_scheme
)
folder
=
folder_afc
if
business_type
==
'AFC'
else
folder_hil
object_name
=
'关注'
+
self
.
get_doc_file_name
(
doc
.
document_name
)
if
need_follow
else
self
.
get_doc_file_name
(
doc
.
document_name
)
args
=
{
"username"
:
self
.
username
,
"password"
:
self
.
pwd
,
"docbase"
:
self
.
doc_base_map
.
get
(
business_type
),
"documentType"
:
doc_type
,
"object_name"
:
self
.
get_doc_file_name
(
doc
.
document_name
)
,
"object_name"
:
object_name
,
"folder"
:
folder
,
"format"
:
"excel12book"
,
"r_content_type"
:
"excel12book"
,
...
...
src/apps/doc/ocr/wb.py
View file @
23dffcc
...
...
@@ -37,6 +37,7 @@ class BSWorkbook(Workbook):
# self.bd = Side(style='thin', color="000000")
# self.border = Border(left=self.bd, top=self.bd, right=self.bd, bottom=self.bd)
self
.
MAX_MEAN
=
31
self
.
need_follow
=
False
@staticmethod
def
replace_newline
(
queryset_value
):
...
...
@@ -322,6 +323,8 @@ class BSWorkbook(Workbook):
verify_res
=
'疑似伪造'
if
len
(
verify_list
)
>
0
else
'正常'
else
:
verify_res
=
''
if
verify_res
==
'疑似伪造'
:
self
.
need_follow
=
True
metadata_rows
.
append
((
'流水检测结果'
,
verify_res
))
metadata_rows
.
append
((
'图片总数'
,
res_count_tuple
[
0
]))
metadata_rows
.
append
((
'识别成功'
,
res_count_tuple
[
1
]))
...
...
@@ -333,6 +336,8 @@ class BSWorkbook(Workbook):
metadata_dict
=
json
.
loads
(
metadata
)
author
=
metadata_dict
.
pop
(
'author'
,
''
)
producer
=
metadata_dict
.
pop
(
'producer'
,
''
)
if
author
!=
''
or
'iText'
not
in
producer
or
'Qt'
not
in
producer
or
'Haru Free'
not
in
producer
:
self
.
need_follow
=
True
metadata_rows
.
append
((
'Author'
,
author
))
metadata_rows
.
append
((
'Producer'
,
producer
))
if
len
(
author
)
>
0
:
...
...
@@ -908,4 +913,4 @@ class BSWorkbook(Workbook):
self
.
license_rebuild
(
license_summary
,
document_scheme
,
count_list
)
self
.
move_res_sheet
()
self
.
remove_base_sheet
()
return
count_list
return
count_list
,
self
.
need_follow
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment