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: ...@@ -214,16 +214,19 @@ class PosHandler:
214 @staticmethod 214 @staticmethod
215 def greenbook_process(result_obj, img_base64): 215 def greenbook_process(result_obj, img_base64):
216 url = conf.OCR_URL_FOLDER 216 url = conf.OCR_URL_FOLDER
217 json_data = {"file": img_base64, "classify": consts.MVC_CLASSIFY, "version": "green"} 217 json_data = {"file": img_base64, "classify": consts.MVC_CLASSIFY, "vrc_format": "v2"}
218 try: 218 try:
219 response = requests.post(url, json=json_data) 219 response = requests.post(url, json=json_data)
220 # unicode转中文 220 # unicode转中文
221 response.encoding = 'unicode_escape' 221 response.encoding = 'unicode_escape'
222 if response.status_code != 200: 222 if response.status_code != 200:
223 LoggerMixin.exception_log.error( 223 LoggerMixin.exception_log.error(
224 "[PosHandler de_mortgage_ocr_process1] request error, url: %s, response: %s", 224 "[PosHandler greenbook_process] request error, url: %s, response: %s",
225 url, response.text) 225 url, response.text)
226 return 226 return
227 LoggerMixin.running_log.info(
228 "[PosHandler greenbook_process] request success, url: %s, response: %s",
229 url, response.text)
227 result = response.json() 230 result = response.json()
228 data = result.get('data', []) 231 data = result.get('data', [])
229 for item in data: 232 for item in data:
......
...@@ -5,7 +5,7 @@ from apps.doc.views import CustomDecimal, CustomDate ...@@ -5,7 +5,7 @@ from apps.doc.views import CustomDecimal, CustomDate
5 from common import response 5 from common import response
6 from apps.doc.mixins import PosHandler 6 from apps.doc.mixins import PosHandler
7 from common.tools.comparison import cp 7 from common.tools.comparison import cp
8 8 from common.mixins import LoggerMixin
9 from rest_framework.permissions import IsAuthenticated 9 from rest_framework.permissions import IsAuthenticated
10 from apps.account.authentication import OAuth2AuthenticationWithUser 10 from apps.account.authentication import OAuth2AuthenticationWithUser
11 11
...@@ -67,9 +67,9 @@ de_mortgage_args = { ...@@ -67,9 +67,9 @@ de_mortgage_args = {
67 67
68 68
69 de_mortgage_comments = { 69 de_mortgage_comments = {
70 'customerName': ('机动车所有人识别不一致', ), 70 'customerName': '机动车所有人识别不一致',
71 'applicationName': ('抵押权人姓名/名称识别不一致', ), 71 'applicationName': '抵押权人姓名/名称识别不一致',
72 'deMortgageDate': ('解除抵押日期不一致', ) 72 'deMortgageDate': '解除抵押日期不一致'
73 } 73 }
74 74
75 75
...@@ -106,12 +106,16 @@ class DeMortgageView(GenericView): ...@@ -106,12 +106,16 @@ class DeMortgageView(GenericView):
106 "field_is_pass": False, 106 "field_is_pass": False,
107 "comments": '' 107 "comments": ''
108 } 108 }
109 result, _ = cp.common_compare(field_result['input'], field_result['ocr']) 109 result, _ = cp.common_compare(field_result['input'], field_result['ocr'], None)
110 LoggerMixin.running_log.info(
111 "[DeMortgageView common_compare] input: %s, ocr: %s, result:%s ",
112 field_result['input'], field_result['ocr'], result)
110 if result == cp.RESULT_Y: 113 if result == cp.RESULT_Y:
111 fields_result['field_is_pass'] = result 114 field_result['field_is_pass'] = True
115
112 else: 116 else:
113 request_pass = False 117 request_pass = False
114 fields_result['comments'] = de_mortgage_comments.get(field_name, '') 118 field_result['comments'] = de_mortgage_comments.get(field_name, '')
115 119
116 fields_result.append(field_result) 120 fields_result.append(field_result)
117 121
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!