b0c9794f by 王聪

兼容不同文档类型

1 parent be68ba59
......@@ -7,6 +7,7 @@ from . import consts
from prese.compare import pre_compare, get_empty_result
from common.mixins import LoggerMixin
from settings import conf
from pos.consts import DocumentType
class MPOSHandler:
......@@ -255,6 +256,6 @@ class PosHandler:
doc_type = file_obj.get('documentType', '')
img_base64 = file_obj.get('fileBase64')
if doc_type == 'Greenbook':
if doc_type == DocumentType.GREEN_BOOK.value.en_name:
PosHandler.greenbook_process(result_obj, img_base64)
return result_obj
......
from enum import Enum
class DocumentTypeModel:
def __init__(self, code, en_name, cn_name):
self.code = code;
self.en_name = en_name
self.cn_name = cn_name
class DocumentType(Enum):
GREEN_BOOK = DocumentTypeModel("DTGBK", "Green Book", "机动车登记证")
CONFIRMATION_LETTER = DocumentTypeModel("DTCLE", "Confirmation Letter", "解抵押确认函")
WEBSITE_SCREENSHOT = DocumentTypeModel("DTWES", "Website Screenshot", "网页截图")
if __name__ == '__main__':
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!