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
07546873
authored
2022-03-25 14:59:56 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add auto result to CMS
1 parent
e553ed13
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
src/celery_compare/tasks.py
src/celery_compare/tasks.py
View file @
0754687
...
...
@@ -2764,7 +2764,7 @@ def se_result_detect(ocr_res_dict):
return
detect_list
def
se_compare_auto
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
auto_obj
,
full_result
):
def
se_compare_auto
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
auto_obj
):
try
:
# 比对逻辑
# detect_list = se_result_detect(ocr_res_dict)
...
...
@@ -2779,10 +2779,11 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc
traceback
.
format_exc
()))
else
:
# 将比对结果写入数据库 auto settlement
try
:
# try:
auto_obj
.
aa_type
=
aa_type
auto_obj
.
ocr_auto_result_pass
=
successful_at_this_level
auto_obj
.
ocr_whole_result_pass
=
full_result
#
auto_obj.ocr_whole_result_pass = full_result
auto_obj
.
ocr_auto_result
=
json
.
dumps
(
compare_result
)
auto_obj
.
ocr_latest_comparison_time
=
datetime
.
now
()
auto_obj
.
rpa_result
=
None
...
...
@@ -2795,16 +2796,19 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc
auto_obj
.
rpa_get_case_from_oc_time
=
None
auto_obj
.
rpa_payment_authorize_time
=
None
auto_obj
.
rpa_second_eye_time
=
None
auto_obj
.
save
()
compare_log
.
info
(
'{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
))
except
Exception
as
e
:
compare_log
.
error
(
'{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] '
'[error={4}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
,
traceback
.
format_exc
()))
# auto_obj.save()
# compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format(
# log_base, application_entity, application_id, ocr_res_id))
# except Exception as e:
# compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] '
# '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id,
# traceback.format_exc()))
return
successful_at_this_level
def
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
):
def
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
,
auto_result
):
try
:
# 比对逻辑
start_time
=
datetime
.
now
()
...
...
@@ -2882,6 +2886,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
"SubtenantId"
:
consts
.
TENANT_MAP
[
application_entity
],
"Data"
:
{
"Result_Message"
:
"Pass"
if
successful_at_this_level
else
"Fail"
,
"AutoCheckResult"
:
"Pass"
if
auto_result
else
"Fail"
,
"Failure_Reason"
:
cn_failure_reason_str
,
"Application_Number"
:
application_id
,
"Bank_Statement"
:
bs_failure_reason_str
,
...
...
@@ -2960,10 +2965,21 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
tmp_se_result
=
json
.
loads
(
ocr_res_dict
.
get
(
field_name
))
tmp_ca_result
.
extend
(
tmp_se_result
)
ocr_res_dict
[
field_name
]
=
json
.
dumps
(
tmp_ca_result
)
full_result
=
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
)
# auto settlement
auto_class
=
HILAutoSettlement
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCAutoSettlement
auto_obj
=
auto_class
.
objects
.
filter
(
application_id
=
application_id
,
on_off
=
True
)
.
first
()
if
auto_obj
is
not
None
:
se_compare_auto
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
auto_obj
,
full_result
)
auto_result
=
se_compare_auto
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
auto_obj
)
full_result
=
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
,
auto_result
)
if
auto_obj
is
not
None
:
try
:
auto_obj
.
ocr_whole_result_pass
=
full_result
auto_obj
.
save
()
compare_log
.
info
(
'{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
))
except
Exception
as
e
:
compare_log
.
error
(
'{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] '
'[error={4}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
,
traceback
.
format_exc
()))
...
...
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