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
22c2060f
authored
2024-11-25 15:17:03 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/CHINARPA-5155' into feature/uat-tmp
2 parents
2368957d
13e996ee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
src/celery_compare/tasks.py
src/celery_compare/tasks.py
View file @
22c2060
...
...
@@ -39,6 +39,7 @@ from apps.doc.models import (
HILCompareReportNew
,
AFCCompareReportNew
,
AFCDoc
,
HILDoc
,
DealerMapping
,
)
from
apps.doc
import
consts
...
...
@@ -50,6 +51,8 @@ from common.tools.comparison import cp
# from common.tools.des import decode_des
from
common.tools.aes_util
import
aes_decrypt_cbc
import
threading
compare_log
=
logging
.
getLogger
(
'compare'
)
log_base
=
'[Compare]'
# e_log_base = '[e-contract]'
...
...
@@ -3731,6 +3734,10 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=
@app.task
def
compare
(
application_id
,
application_entity
,
uniq_seq
,
ocr_res_id
,
is_ca
=
True
,
is_cms
=
False
):
producer_thread
=
threading
.
Thread
(
target
=
compare_thread
,
args
=
(
application_id
,
application_entity
,
uniq_seq
,
ocr_res_id
,
is_ca
,
is_cms
))
producer_thread
.
start
()
def
compare_thread
(
application_id
,
application_entity
,
uniq_seq
,
ocr_res_id
,
is_ca
=
True
,
is_cms
=
False
):
# POS: application_id, application_entity, uniq_seq, None
# OCR: application_id, business_type(application_entity), None, ocr_res_id
...
...
@@ -3738,6 +3745,15 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
'[is_cms={6}]'
.
format
(
log_base
,
application_entity
,
application_id
,
uniq_seq
,
ocr_res_id
,
is_ca
,
is_cms
))
# 查看此订单号下是否有未完成的文件,如果有,等3分钟
doc_wait_file_class
=
HILDoc
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCDoc
doc_wait_file_result
=
doc_wait_file_class
.
objects
.
filter
(
application_id
=
application_id
,
status
=
1
)
.
first
()
if
doc_wait_file_result
is
not
None
:
compare_log
.
info
(
'{0} [comparison unfinished file wait 180s start] [entity={1}] [id={2}] [doc_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
doc_wait_file_result
.
get
(
'id'
)))
time
.
sleep
(
60
)
compare_log
.
info
(
'{0} [comparison unfinished file wait 180s end] [entity={1}] [id={2}] [doc_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
doc_wait_file_result
.
get
(
'id'
)))
# 根据application_id查找最新的比对信息,如果没有,结束
if
is_ca
:
comparison_class
=
HILComparisonInfo
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCComparisonInfo
...
...
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