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
bd738e36
authored
2020-10-09 16:00:17 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix keywords
1 parent
454bef83
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/doc_ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
bd738e3
...
...
@@ -37,7 +37,7 @@ DEALER_CODE = 'ocr_situ_group'
# ---------银行流水模板相关--------------------------------------------------------------------------------------------
TRANS
=
str
.
maketrans
(
'Cc((oODlL
mAsSbg'
,
'00000001134556
9'
)
TRANS
=
str
.
maketrans
(
'Cc((oODlL
AsSbgE'
,
'00000001145569
9'
)
CARD_RATIO
=
0.9
UNKNOWN_CARD
=
'未知卡号'
...
...
src/apps/doc/management/commands/doc_ocr_process.py
View file @
bd738e3
...
...
@@ -429,7 +429,6 @@ class Command(BaseCommand, LoggerMixin):
# EDMS异常:下载异常-->回队列-->邮件;上传异常-->重新上传队列-->邮件
# 算法异常:第一道异常-->识别失败-->邮件;第二道异常-->识别失败-->邮件
# TODO 数据库断联问题
# TODO EDMS API GATEWAY
def
handle
(
self
,
*
args
,
**
kwargs
):
sleep_second
=
int
(
conf
.
SLEEP_SECOND
)
max_sleep_second
=
int
(
conf
.
MAX_SLEEP_SECOND
)
...
...
@@ -464,11 +463,11 @@ class Command(BaseCommand, LoggerMixin):
license_summary
=
{}
unknown_summary
=
{}
interest_keyword
=
Keywords
.
objects
.
filter
(
type
=
KeywordsType
.
INTEREST
.
value
)
.
values_list
(
'keyword'
,
flat
=
True
)
type
=
KeywordsType
.
INTEREST
.
value
,
on_off
=
True
)
.
values_list
(
'keyword'
,
flat
=
True
)
salary_keyword
=
Keywords
.
objects
.
filter
(
type
=
KeywordsType
.
SALARY
.
value
)
.
values_list
(
'keyword'
,
flat
=
True
)
type
=
KeywordsType
.
SALARY
.
value
,
on_off
=
True
)
.
values_list
(
'keyword'
,
flat
=
True
)
loan_keyword
=
Keywords
.
objects
.
filter
(
type__in
=
[
KeywordsType
.
LOAN
.
value
,
KeywordsType
.
ALI_WECHART
.
value
])
.
values_list
(
type__in
=
[
KeywordsType
.
LOAN
.
value
,
KeywordsType
.
ALI_WECHART
.
value
]
,
on_off
=
True
)
.
values_list
(
'keyword'
,
flat
=
True
)
wb
=
BSWorkbook
(
interest_keyword
,
salary_keyword
,
loan_keyword
)
...
...
@@ -504,8 +503,8 @@ class Command(BaseCommand, LoggerMixin):
else
:
try
:
# 5.上传至EDMS
#
self.edms.upload(excel_path, doc, business_type)
print
(
'upload pass'
)
self
.
edms
.
upload
(
excel_path
,
doc
,
business_type
)
#
print('upload pass')
except
Exception
as
e
:
doc
.
status
=
DocStatus
.
UPLOAD_FAILED
.
value
doc
.
save
()
...
...
src/apps/doc/ocr/wb.py
View file @
bd738e3
...
...
@@ -191,9 +191,9 @@ class BSWorkbook(Workbook):
def
create_meta_sheet
(
self
,
card
):
if
self
.
worksheets
[
0
]
.
title
==
'Sheet'
:
ms
=
self
.
worksheets
[
0
]
ms
.
title
=
'{0}({1})'
.
format
(
self
.
meta_sheet_title
,
card
)
ms
.
title
=
'{0}({1})'
.
format
(
self
.
meta_sheet_title
,
card
[
-
6
:]
)
else
:
ms
=
self
.
create_sheet
(
'{0}({1})'
.
format
(
self
.
meta_sheet_title
,
card
))
ms
=
self
.
create_sheet
(
'{0}({1})'
.
format
(
self
.
meta_sheet_title
,
card
[
-
6
:]
))
return
ms
def
build_meta_sheet
(
self
,
card
,
confidence
,
code
,
print_time
,
start_date
,
end_date
):
...
...
@@ -243,7 +243,7 @@ class BSWorkbook(Workbook):
else
:
over_cell
.
number_format
=
numbers
.
FORMAT_NUMBER_COMMA_SEPARATED1
# 3.4.
余
额转数值
# 3.4.
金
额转数值
try
:
try
:
if
isinstance
(
amount_cell
.
value
,
str
):
# TODO 可在转化数字失败后,再替换
...
...
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