b0c9794f by 王聪

兼容不同文档类型

1 parent be68ba59
...@@ -7,6 +7,7 @@ from . import consts ...@@ -7,6 +7,7 @@ from . import consts
7 from prese.compare import pre_compare, get_empty_result 7 from prese.compare import pre_compare, get_empty_result
8 from common.mixins import LoggerMixin 8 from common.mixins import LoggerMixin
9 from settings import conf 9 from settings import conf
10 from pos.consts import DocumentType
10 11
11 12
12 class MPOSHandler: 13 class MPOSHandler:
...@@ -255,6 +256,6 @@ class PosHandler: ...@@ -255,6 +256,6 @@ class PosHandler:
255 256
256 doc_type = file_obj.get('documentType', '') 257 doc_type = file_obj.get('documentType', '')
257 img_base64 = file_obj.get('fileBase64') 258 img_base64 = file_obj.get('fileBase64')
258 if doc_type == 'Greenbook': 259 if doc_type == DocumentType.GREEN_BOOK.value.en_name:
259 PosHandler.greenbook_process(result_obj, img_base64) 260 PosHandler.greenbook_process(result_obj, img_base64)
260 return result_obj 261 return result_obj
......
1 from enum import Enum
2
3
4 class DocumentTypeModel:
5 def __init__(self, code, en_name, cn_name):
6 self.code = code;
7 self.en_name = en_name
8 self.cn_name = cn_name
9
10
11 class DocumentType(Enum):
12 GREEN_BOOK = DocumentTypeModel("DTGBK", "Green Book", "机动车登记证")
13 CONFIRMATION_LETTER = DocumentTypeModel("DTCLE", "Confirmation Letter", "解抵押确认函")
14 WEBSITE_SCREENSHOT = DocumentTypeModel("DTWES", "Website Screenshot", "网页截图")
15
16
17 if __name__ == '__main__':
18 print(DocumentType.GREEN_BOOK.value.en_name)
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!