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
f69fc5fa
authored
2024-03-04 10:14:12 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:add log
1 parent
70735d1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/management/commands/ocr_process.py
View file @
f69fc5f
...
...
@@ -2033,10 +2033,10 @@ class Command(BaseCommand, LoggerMixin):
# 更新OCR累计识别结果表
if
business_type
==
consts
.
HIL_PREFIX
:
result_class
=
HILOCRResult
if
is_ca
else
HILSEOCRResult
res_obj
=
atomicSaveDBHIL
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
)
res_obj
=
atomicSaveDBHIL
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
,
task_str
)
else
:
result_class
=
AFCOCRResult
if
is_ca
else
AFCSEOCRResult
res_obj
=
atomicSaveDBAFC
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
)
res_obj
=
atomicSaveDBAFC
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
,
task_str
)
except
Exception
as
e
:
self
.
online_log
.
error
(
...
...
@@ -2413,13 +2413,14 @@ class Command(BaseCommand, LoggerMixin):
self
.
online_log
.
info
(
'{0} [stop safely]'
.
format
(
self
.
log_base
))
@transaction.atomic
def
atomicSaveDBAFC
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
):
def
atomicSaveDBAFC
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
,
task_str
):
with
transaction
.
atomic
(
'afc'
):
res_obj
=
result_class
.
objects
.
using
(
'afc'
)
.
select_for_update
()
.
filter
(
application_id
=
doc
.
application_id
)
.
first
()
self
.
online_log
.
info
(
'{0} [sql lock AFC application_id={1}
]'
.
format
(
self
.
log_base
,
doc
.
application_
id
))
self
.
online_log
.
info
(
'{0} [sql lock AFC application_id={1}
doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
if
res_obj
is
None
:
res_obj
=
result_class
()
res_obj
.
application_id
=
doc
.
application_id
self
.
online_log
.
info
(
'{0} [res_obj is None application_id={1} doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
for
classify
,
field
in
consts
.
RESULT_MAPPING
.
items
():
if
not
hasattr
(
res_obj
,
field
):
continue
...
...
@@ -2441,17 +2442,18 @@ def atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge):
last_res_str
=
json
.
dumps
(
old_res_list
)
setattr
(
res_obj
,
field
,
last_res_str
)
res_obj
.
save
()
self
.
online_log
.
info
(
'{0} [sql lock release application_id={1}
]'
.
format
(
self
.
log_base
,
doc
.
application_
id
))
self
.
online_log
.
info
(
'{0} [sql lock release application_id={1}
doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
return
res_obj
@transaction.atomic
def
atomicSaveDBHIL
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
):
def
atomicSaveDBHIL
(
self
,
result_class
,
doc
,
license_summary
,
ic_merge
,
rp_merge
,
task_str
):
with
transaction
.
atomic
(
'default'
):
res_obj
=
result_class
.
objects
.
using
(
'default'
)
.
select_for_update
()
.
filter
(
application_id
=
doc
.
application_id
)
.
first
()
self
.
online_log
.
info
(
'{0} [sql lock HIL application_id={1}
]'
.
format
(
self
.
log_base
,
doc
.
application_
id
))
self
.
online_log
.
info
(
'{0} [sql lock HIL application_id={1}
doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
if
res_obj
is
None
:
res_obj
=
result_class
()
res_obj
.
application_id
=
doc
.
application_id
self
.
online_log
.
info
(
'{0} [res_obj is None application_id={1} doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
for
classify
,
field
in
consts
.
RESULT_MAPPING
.
items
():
if
not
hasattr
(
res_obj
,
field
):
continue
...
...
@@ -2473,5 +2475,5 @@ def atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge):
last_res_str
=
json
.
dumps
(
old_res_list
)
setattr
(
res_obj
,
field
,
last_res_str
)
res_obj
.
save
()
self
.
online_log
.
info
(
'{0} [sql lock release application_id={1}
]'
.
format
(
self
.
log_base
,
doc
.
application_
id
))
self
.
online_log
.
info
(
'{0} [sql lock release application_id={1}
doc_id={2}]'
.
format
(
self
.
log_base
,
doc
.
application_id
,
doc
.
id
))
return
res_obj
\ No newline at end of file
...
...
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