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
ba444224
authored
2025-10-21 10:36:59 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
merge
2 parents
5998c15e
af9a979b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/common/electronic_hil_contract/get_char.py
src/common/electronic_hil_contract/get_char_fsm.py
src/apps/doc/consts.py
View file @
ba44422
...
...
@@ -1601,7 +1601,7 @@ SE_HIL_CON_1_MAP = {
'合同编号-正文'
:
(
5
,
4
,
7
,
'合同编号(正文)'
,
None
),
'车辆识别代码'
:
(
5
,
4
,
7
,
'车辆识别代码'
,
None
),
'车辆卖方'
:
(
5
,
4
,
7
,
'车辆卖方(经销商)'
,
None
),
'车辆原始销售价格'
:
(
5
,
4
,
7
,
'车辆原始销售价格
(《机动车销售统一发票》所列金额)
'
,
None
),
'车辆原始销售价格'
:
(
5
,
4
,
7
,
'车辆原始销售价格'
,
None
),
'融资成本总额'
:
(
5
,
4
,
7
,
'融资成本总额'
,
None
),
'租期'
:
(
5
,
4
,
7
,
'租期'
,
None
),
'还款计划表'
:
(
5
,
5
,
7
,
'付款计划表'
,
None
),
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
ba44422
...
...
@@ -108,11 +108,11 @@ class Command(BaseCommand, LoggerMixin):
if
zip_doc
is
None
:
self
.
online_log
.
warn
(
'{0} [zip_2_pdfs] [doc not exist] [task_str={1}]'
.
format
(
self
.
log_base
,
task_str
))
return
None
,
business_type
return
None
,
business_type
,
None
elif
zip_doc
.
status
!=
DocStatus
.
INIT
.
value
:
self
.
online_log
.
warn
(
'{0} [zip_2_pdfs] [doc status error] [task_str={1}] [doc_status={2}]'
.
format
(
self
.
log_base
,
task_str
,
zip_doc
.
status
))
return
None
,
business_type
return
None
,
business_type
,
None
zip_doc
.
status
=
DocStatus
.
PROCESSING
.
value
zip_doc
.
start_time
=
timezone
.
now
()
...
...
@@ -120,7 +120,7 @@ class Command(BaseCommand, LoggerMixin):
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (zip_2_pdfs)] [error={1}]'
.
format
(
self
.
log_base
,
traceback
.
format_exc
()))
return
None
,
None
return
None
,
None
,
None
else
:
self
.
online_log
.
info
(
'{0} [zip_2_pdfs] [db save end] [task_str={1}]'
.
format
(
self
.
log_base
,
task_str
))
...
...
@@ -134,6 +134,7 @@ class Command(BaseCommand, LoggerMixin):
business_type
,
doc_id_str
=
info_tuple
classify_1_str
=
'0'
rebuild_task_str
=
task_str
re_ocr_flag
=
'N'
else
:
business_type
,
doc_id_str
,
classify_1_str
,
re_ocr_flag
=
info_tuple
rebuild_task_str
=
'{0}{1}{2}'
.
format
(
business_type
,
consts
.
SPLIT_STR
,
doc_id_str
)
...
...
@@ -1813,7 +1814,7 @@ class Command(BaseCommand, LoggerMixin):
json_data_1
[
'text_list'
]
=
text_list
start_time
=
time
.
time
()
#self.online_log.info('{0} [ocr_1 api] [img={1}] [json_data_1={2}]'.format(self.log_base, img_path, json_data_1))
#
self.online_log.info('{0} [ocr_1 api] [img={1}] [json_data_1={2}]'.format(self.log_base, img_path, json_data_1))
ocr_1_response
=
requests
.
post
(
url
,
json
=
json_data_1
)
if
ocr_1_response
.
status_code
!=
200
:
raise
OCR1Exception
(
'ocr_1 status code: {0}'
.
format
(
ocr_1_response
.
status_code
))
...
...
@@ -1824,7 +1825,7 @@ class Command(BaseCommand, LoggerMixin):
else
:
self
.
online_log
.
info
(
'{0} [ocr_1 start] [img={1}] [url={2}]'
.
format
(
self
.
log_base
,
img_path
,
url
))
ocr_1_res
=
ocr_1_response
.
json
()
#self.online_log.info('{0} [ocr_1 api res] [img={1}] [ocr_1_res={2}]'.format(self.log_base, img_path, ocr_1_res))
#
self.online_log.info('{0} [ocr_1 api res] [img={1}] [ocr_1_res={2}]'.format(self.log_base, img_path, ocr_1_res))
end_time
=
time
.
time
()
speed_time
=
int
(
end_time
-
start_time
)
self
.
online_log
.
info
(
'{0} [ocr_1 success] [img={1}] [url={2}] [speed_time={3}]'
.
format
(
...
...
src/common/electronic_hil_contract/get_char.py
View file @
ba44422
...
...
@@ -61,7 +61,7 @@ class Finder:
"合同编号(正文)"
:
self
.
item
,
"车辆识别代码"
:
self
.
item
,
"车辆卖方(经销商)"
:
self
.
item
,
"车辆原始销售价格
(《机动车销售统一发票》所列金额)
"
:
self
.
item
,
"车辆原始销售价格"
:
self
.
item
,
"车辆附加产品明细表"
:
self
.
item
,
"融资成本总额"
:
self
.
item
,
"租期"
:
self
.
item
,
...
...
@@ -1264,8 +1264,8 @@ class Finder:
self
.
init_result
[
'车辆卖方(经销商)'
]
=
seller
# 找到 —— 车辆原始销售价格
vehicle_price
=
self
.
get_key_value
(
key
=
'车辆原始销售价格
(《机动车销售统一发票》所列金额)
:'
)
self
.
init_result
[
'车辆原始销售价格
(《机动车销售统一发票》所列金额)
'
]
=
vehicle_price
key
=
'车辆原始销售价格:'
)
self
.
init_result
[
'车辆原始销售价格'
]
=
vehicle_price
# 找车辆附加产品明细(表)
table_add_product
=
self
.
get_table_add_product
()
self
.
init_result
[
'车辆附加产品明细表'
]
=
table_add_product
...
...
src/common/electronic_hil_contract/get_char_fsm.py
View file @
ba44422
...
...
@@ -52,7 +52,7 @@ class Finder:
"车辆识别代码"
:
self
.
item
,
"车辆卖方(经销商)"
:
self
.
item
,
"车辆代理商"
:
self
.
item
,
"车辆原始销售价格
(《机动车销售统一发票》所列金额)
"
:
self
.
item
,
"车辆原始销售价格"
:
self
.
item
,
"车辆附加产品明细表"
:
self
.
item
,
"融资成本总额"
:
self
.
item
,
"租期"
:
self
.
item
,
...
...
@@ -1330,8 +1330,8 @@ class Finder:
cldls
=
self
.
get_key_value
(
key
=
'车辆代理商'
,
page_num
=
'4'
)
self
.
init_result
[
'车辆代理商'
]
=
cldls
# 找到 —— 车辆原始销售价格
vehicle_price
=
self
.
get_key_value
(
key
=
'车辆原始销售价格
(《机动车销售统一发票》所列金额)
:'
)
self
.
init_result
[
'车辆原始销售价格
(《机动车销售统一发票》所列金额)
'
]
=
vehicle_price
vehicle_price
=
self
.
get_key_value
(
key
=
'车辆原始销售价格:'
)
self
.
init_result
[
'车辆原始销售价格'
]
=
vehicle_price
# 找车辆附加产品明细(表)
table_add_product
=
self
.
get_table_add_product
()
self
.
init_result
[
'车辆附加产品明细表'
]
=
table_add_product
...
...
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