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
f75cb473
authored
2022-07-19 16:35:46 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix se bug
1 parent
bb00ae7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
14 deletions
src/apps/doc/ocr/ecm.py
src/celery_compare/tasks.py
src/apps/doc/ocr/ecm.py
View file @
f75cb47
...
...
@@ -62,7 +62,13 @@ class ECM:
self
.
oauth_token
=
token
self
.
token_type
=
response
.
json
()
.
get
(
self
.
token_type_key
,
self
.
token_type
)
expires
=
response
.
json
()
.
get
(
self
.
expires_key
,
3600
)
rh
.
set_ecm_token
(
self
.
oauth_token
,
expires
)
if
isinstance
(
expires
,
int
):
expires_int
=
expires
-
10
elif
isinstance
(
expires
,
str
):
expires_int
=
int
(
expires
)
-
10
else
:
expires_int
=
3600
-
10
rh
.
set_ecm_token
(
self
.
oauth_token
,
expires_int
)
def
get_oauth_token
(
self
):
# if self.oauth_token is None:
...
...
src/celery_compare/tasks.py
View file @
f75cb47
...
...
@@ -2189,21 +2189,26 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
# 过期期限特殊处理
if
special_expiry_date
and
name
==
'idExpiryDate'
and
result
==
consts
.
RESULT_N
:
if
no_key
:
for
expiry_date
,
(
date_img_path
,
date_res_idx
)
in
expiry_dates
.
items
():
expiry_date_res
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
expiry_date
,
**
compare_logic
[
name
][
2
])
if
expiry_date_res
==
consts
.
RESULT_N
:
ocr_str
=
expiry_date
img_path
=
date_img_path
special_expiry_date_slice
=
True
section_img_info
[
consts
.
SECTION_IMG_PATH_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
SECTION_IMG_PATH_KEY_2
,
''
)
section_img_info
[
consts
.
ALL_POSITION_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
ALL_POSITION_KEY_2
,
{})
break
else
:
if
len
(
expiry_dates
)
==
0
:
ocr_str
=
empty_str
result
=
consts
.
RESULT_
Y
result
=
consts
.
RESULT_
N
img_path
=
empty_str
else
:
for
expiry_date
,
(
date_img_path
,
date_res_idx
)
in
expiry_dates
.
items
():
expiry_date_res
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
expiry_date
,
**
compare_logic
[
name
][
2
])
if
expiry_date_res
==
consts
.
RESULT_N
:
ocr_str
=
expiry_date
img_path
=
date_img_path
special_expiry_date_slice
=
True
section_img_info
[
consts
.
SECTION_IMG_PATH_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
SECTION_IMG_PATH_KEY_2
,
''
)
section_img_info
[
consts
.
ALL_POSITION_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
ALL_POSITION_KEY_2
,
{})
break
else
:
ocr_str
=
empty_str
result
=
consts
.
RESULT_Y
img_path
=
empty_str
else
:
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY_2
,
''
)
special_expiry_date_slice
=
True
...
...
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