pos 3045 update
Showing
1 changed file
with
25 additions
and
13 deletions
... | @@ -4,7 +4,7 @@ from webargs import fields, validate | ... | @@ -4,7 +4,7 @@ from webargs import fields, validate |
4 | from apps.doc.views import CustomDecimal, CustomDate | 4 | from apps.doc.views import CustomDecimal, CustomDate |
5 | from common import response | 5 | from common import response |
6 | from apps.doc.models import HILSEOCRResult, HILOCRResult, AFCSEOCRResult, AFCOCRResult | 6 | from apps.doc.models import HILSEOCRResult, HILOCRResult, AFCSEOCRResult, AFCOCRResult |
7 | from apps.doc import consts | 7 | from prese import consts |
8 | 8 | ||
9 | params = { | 9 | params = { |
10 | 'invoiceCode': fields.Str(required=True, validate=validate.Length(max=128)), | 10 | 'invoiceCode': fields.Str(required=True, validate=validate.Length(max=128)), |
... | @@ -14,11 +14,11 @@ params = { | ... | @@ -14,11 +14,11 @@ params = { |
14 | "buyerId": fields.Int(required=True), | 14 | "buyerId": fields.Int(required=True), |
15 | 'vin': fields.Str(required=True, validate=validate.Length(max=128)), | 15 | 'vin': fields.Str(required=True, validate=validate.Length(max=128)), |
16 | 'dealer': fields.Str(required=False, validate=validate.Length(max=64)), | 16 | 'dealer': fields.Str(required=False, validate=validate.Length(max=64)), |
17 | 'priceWithVat': CustomDecimal(required=False), | 17 | 'priceWithVat': CustomDecimal(required=True), |
18 | 'priceNoVat': CustomDecimal(required=True), | 18 | 'priceNoVat': CustomDecimal(required=True), |
19 | 'priceInCapitals': fields.Str(required=False), | 19 | 'priceInCapitals': fields.Str(required=False), |
20 | 'vat': CustomDecimal(required=True), | 20 | 'vat': CustomDecimal(required=True), |
21 | 'vatRate': CustomDecimal(required=True), | 21 | 'vatRate': CustomDecimal(required=False), |
22 | } | 22 | } |
23 | 23 | ||
24 | input_args = { | 24 | input_args = { |
... | @@ -75,19 +75,31 @@ class DeMortgageView(GenericView): | ... | @@ -75,19 +75,31 @@ class DeMortgageView(GenericView): |
75 | *consts.CA_ADD_COMPARE_FIELDS_PRE).first() | 75 | *consts.CA_ADD_COMPARE_FIELDS_PRE).first() |
76 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values( | 76 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values( |
77 | *consts.PRE_COMPARE_FIELDS).first() | 77 | *consts.PRE_COMPARE_FIELDS).first() |
78 | if ocr_res_dict is None: | 78 | # if ocr_res_dict is None: |
79 | return get_empty_result() | 79 | # return get_empty_result() |
80 | 80 | ||
81 | id_res_list = [] | 81 | ic_res_list = [] |
82 | for field_name in consts.CA_ADD_COMPARE_FIELDS_PRE: | 82 | ic_res_list.append(ca_ocr_res_dict.get(consts.IC_OCR_FIELD) if isinstance(ca_ocr_res_dict, dict) else None) |
83 | if field_name == consts.IC_OCR_FIELD: | 83 | ic_res_list.append(ocr_res_dict.get(consts.IC_OCR_FIELD) if isinstance(ca_ocr_res_dict, dict) else None) |
84 | id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None) | 84 | |
85 | id_res_list.append(ocr_res_dict.get(field_name)) | 85 | field_name, compare_logic, args, comment = consts.ID_COMPARE_LOGIC.get(consts.ID_FIELDS[0]) |
86 | for ic_res in ic_res_list: | ||
87 | if ic_res: | ||
88 | value = ic_res.get(field_name, '') | ||
89 | compare_logic | ||
86 | 90 | ||
87 | result = { | 91 | result = { |
88 | "is_pass": True, | 92 | "is_pass": True, |
89 | "customer_name": True, | 93 | "fields": [{ |
90 | "application_entity": True, | 94 | "name": "", |
91 | "de_mortgage_date": True | 95 | "input": "张三", |
96 | "ocr": "张三", | ||
97 | "field_is_pass": True, | ||
98 | "comments": "身份证姓名与系统不一致" | ||
99 | }] | ||
100 | # "customer_name": True, | ||
101 | # "application_entity": True, | ||
102 | # "de_mortgage_date": True | ||
92 | } | 103 | } |
93 | return response.ok(data=result) | 104 | return response.ok(data=result) |
105 | ... | ... |
-
Please register or sign in to post a comment