5073ca54 by 王聪

Merge branch 'feature/pres-3034' into 'feature/uat-tmp'

Feature/pres 3034

See merge request !3
2 parents 362f43f5 8d4b3b05
......@@ -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, "version": "green"}
json_data = {"file": img_base64, "classify": consts.MVC_CLASSIFY, "vrc_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:
......
......@@ -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,12 +106,16 @@ 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:
fields_result['field_is_pass'] = result
field_result['field_is_pass'] = True
else:
request_pass = False
fields_result['comments'] = de_mortgage_comments.get(field_name, '')
field_result['comments'] = de_mortgage_comments.get(field_name, '')
fields_result.append(field_result)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!