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
8d4b3b05
authored
2022-12-08 16:01:38 +0800
by
王聪
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
de-mortgage 接口更新
1 parent
6bfb2fb8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
src/apps/doc/mixins.py
src/pos/views.py
src/apps/doc/mixins.py
View file @
8d4b3b0
...
...
@@ -214,16 +214,19 @@ class PosHandler:
@staticmethod
def
greenbook_process
(
result_obj
,
img_base64
):
url
=
conf
.
OCR_URL_FOLDER
json_data
=
{
"file"
:
img_base64
,
"classify"
:
consts
.
MVC_CLASSIFY
,
"v
ersion"
:
"green
"
}
json_data
=
{
"file"
:
img_base64
,
"classify"
:
consts
.
MVC_CLASSIFY
,
"v
rc_format"
:
"v2
"
}
try
:
response
=
requests
.
post
(
url
,
json
=
json_data
)
# unicode转中文
response
.
encoding
=
'unicode_escape'
if
response
.
status_code
!=
200
:
LoggerMixin
.
exception_log
.
error
(
"[PosHandler
de_mortgage_ocr_process1
] request error, url:
%
s, response:
%
s"
,
"[PosHandler
greenbook_process
] request error, url:
%
s, response:
%
s"
,
url
,
response
.
text
)
return
LoggerMixin
.
running_log
.
info
(
"[PosHandler greenbook_process] request success, url:
%
s, response:
%
s"
,
url
,
response
.
text
)
result
=
response
.
json
()
data
=
result
.
get
(
'data'
,
[])
for
item
in
data
:
...
...
src/pos/views.py
View file @
8d4b3b0
...
...
@@ -5,7 +5,7 @@ from apps.doc.views import CustomDecimal, CustomDate
from
common
import
response
from
apps.doc.mixins
import
PosHandler
from
common.tools.comparison
import
cp
from
common.mixins
import
LoggerMixin
from
rest_framework.permissions
import
IsAuthenticated
from
apps.account.authentication
import
OAuth2AuthenticationWithUser
...
...
@@ -67,9 +67,9 @@ de_mortgage_args = {
de_mortgage_comments
=
{
'customerName'
:
(
'机动车所有人识别不一致'
,
)
,
'applicationName'
:
(
'抵押权人姓名/名称识别不一致'
,
)
,
'deMortgageDate'
:
(
'解除抵押日期不一致'
,
)
'customerName'
:
'机动车所有人识别不一致'
,
'applicationName'
:
'抵押权人姓名/名称识别不一致'
,
'deMortgageDate'
:
'解除抵押日期不一致'
}
...
...
@@ -106,9 +106,13 @@ class DeMortgageView(GenericView):
"field_is_pass"
:
False
,
"comments"
:
''
}
result
,
_
=
cp
.
common_compare
(
field_result
[
'input'
],
field_result
[
'ocr'
])
result
,
_
=
cp
.
common_compare
(
field_result
[
'input'
],
field_result
[
'ocr'
],
None
)
LoggerMixin
.
running_log
.
info
(
"[DeMortgageView common_compare] input:
%
s, ocr:
%
s, result:
%
s "
,
field_result
[
'input'
],
field_result
[
'ocr'
],
result
)
if
result
==
cp
.
RESULT_Y
:
field_result
[
'field_is_pass'
]
=
result
field_result
[
'field_is_pass'
]
=
True
else
:
request_pass
=
False
field_result
[
'comments'
]
=
de_mortgage_comments
.
get
(
field_name
,
''
)
...
...
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