de-mortgage 接口更新
Showing
2 changed files
with
15 additions
and
8 deletions
... | @@ -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,9 +106,13 @@ class DeMortgageView(GenericView): | ... | @@ -106,9 +106,13 @@ 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 | field_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 | field_result['comments'] = de_mortgage_comments.get(field_name, '') | 118 | field_result['comments'] = de_mortgage_comments.get(field_name, '') | ... | ... |
-
Please register or sign in to post a comment