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
4e23f1f3
authored
2025-04-18 14:52:06 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'hotfix/2025-04'
2 parents
1a883ccb
f3491a1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
30 deletions
src/apps/doc/management/commands/ocr_process.py
src/celery_compare/tasks.py
src/apps/doc/management/commands/ocr_process.py
View file @
4e23f1f
...
...
@@ -1344,8 +1344,8 @@ class Command(BaseCommand, LoggerMixin):
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (get doc info out)] [error={1}]'
.
format
(
self
.
log_base
,
traceback
.
format_exc
()))
error_list
.
append
(
1
)
return
#
error_list.append(1)
#
return
else
:
doc_data_path
=
os
.
path
.
join
(
self
.
data_dir
,
business_type
,
consts
.
TMP_DIR_NAME
,
str
(
doc
.
id
))
os
.
makedirs
(
doc_data_path
,
exist_ok
=
True
)
...
...
@@ -1502,8 +1502,8 @@ class Command(BaseCommand, LoggerMixin):
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (db save)] [error={1}]'
.
format
(
self
.
log_base
,
traceback
.
format_exc
()))
error_list
.
append
(
1
)
return
#
error_list.append(1)
#
return
else
:
# e-contract or or e-fsm-contract or e-hmh
try
:
# pdf下载 处理 图片存储 识别
...
...
@@ -1645,8 +1645,8 @@ class Command(BaseCommand, LoggerMixin):
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (db save)] [error={1}]'
.
format
(
self
.
e_log_base
,
traceback
.
format_exc
()))
error_list
.
append
(
1
)
return
#
error_list.append(1)
#
return
def
img_2_ocr_1
(
self
,
img_queue
,
todo_count_dict
,
res_dict
,
finish_queue
,
lock
,
url
,
error_list
):
while
len
(
error_list
)
==
0
or
not
img_queue
.
empty
():
...
...
src/celery_compare/tasks.py
View file @
4e23f1f
...
...
@@ -3938,29 +3938,6 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_
ocr_res_id
,
is_ca
,
is_cms
))
return
# 根据application_id查找OCR累计结果指定license字段,如果没有,结束
if
is_ca
:
result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
ca_ocr_res_dict
=
dict
()
else
:
result_class
=
HILSEOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCSEOCRResult
ca_result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
# if ocr_res_id is None:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
CA_ADD_COMPARE_FIELDS
)
.
first
()
# else:
# ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values(
# *consts.CA_ADD_COMPARE_FIELDS).first()
if
ocr_res_id
is
None
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
else
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
id
=
ocr_res_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
if
ocr_res_dict
is
None
:
compare_log
.
info
(
'{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] '
'[is_ca={5}] [is_cms]={6}'
.
format
(
log_base
,
application_entity
,
application_id
,
uniq_seq
,
ocr_res_id
,
is_ca
,
is_cms
))
return
# 查看此订单号下是否有未完成的文件,如果有,等?分钟
try
:
doc_wait_file_class
=
HILDoc
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCDoc
...
...
@@ -3988,7 +3965,29 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_
except
Exception
as
e
:
compare_log
.
info
(
'[sleep error] [error={0}]'
.
format
(
traceback
.
format_exc
()))
compare_log
.
info
(
'{0} [comparison unfinished file wait delay_time end] [entity={1}] [id={2}] [doc_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
doc_wait_file_result
.
id
))
# 根据application_id查找OCR累计结果指定license字段,如果没有,结束
if
is_ca
:
result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
ca_ocr_res_dict
=
dict
()
else
:
result_class
=
HILSEOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCSEOCRResult
ca_result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
# if ocr_res_id is None:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
CA_ADD_COMPARE_FIELDS
)
.
first
()
# else:
# ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values(
# *consts.CA_ADD_COMPARE_FIELDS).first()
if
ocr_res_id
is
None
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
else
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
id
=
ocr_res_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
if
ocr_res_dict
is
None
:
compare_log
.
info
(
'{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] '
'[is_ca={5}] [is_cms]={6}'
.
format
(
log_base
,
application_entity
,
application_id
,
uniq_seq
,
ocr_res_id
,
is_ca
,
is_cms
))
return
if
is_ca
:
ca_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
)
...
...
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