init 4302 cms all pass
Showing
1 changed file
with
44 additions
and
1 deletions
| ... | @@ -20,6 +20,7 @@ from common import response | ... | @@ -20,6 +20,7 @@ from common import response |
| 20 | from common.mixins import GenericView,DocGenericView | 20 | from common.mixins import GenericView,DocGenericView |
| 21 | from common.tools.file_tools import file_write | 21 | from common.tools.file_tools import file_write |
| 22 | from common.redis_cache import redis_handler as rh | 22 | from common.redis_cache import redis_handler as rh |
| 23 | from apps.doc.ocr.cms import cms | ||
| 23 | from .models import ( | 24 | from .models import ( |
| 24 | # UploadDocRecords, | 25 | # UploadDocRecords, |
| 25 | DocStatus, | 26 | DocStatus, |
| ... | @@ -53,7 +54,8 @@ from .models import ( | ... | @@ -53,7 +54,8 @@ from .models import ( |
| 53 | AFCOCRResult, | 54 | AFCOCRResult, |
| 54 | AFCSEOCRResult, | 55 | AFCSEOCRResult, |
| 55 | HILCmsStatusInfo, | 56 | HILCmsStatusInfo, |
| 56 | AFCCmsStatusInfo | 57 | AFCCmsStatusInfo, |
| 58 | Configs | ||
| 57 | ) | 59 | ) |
| 58 | from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemName, RequestTeam | 60 | from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemName, RequestTeam |
| 59 | from .mixins import DocHandler, MPOSHandler, PreSEHandler | 61 | from .mixins import DocHandler, MPOSHandler, PreSEHandler |
| ... | @@ -1455,6 +1457,12 @@ class SECMSView(GenericView): | ... | @@ -1455,6 +1457,12 @@ class SECMSView(GenericView): |
| 1455 | # CMS上传比对信息接口 SE | 1457 | # CMS上传比对信息接口 SE |
| 1456 | # @use_args(se_cms_args, location='data') | 1458 | # @use_args(se_cms_args, location='data') |
| 1457 | def post(self, request): # interface_report cms to ocr | 1459 | def post(self, request): # interface_report cms to ocr |
| 1460 | # 如果是压测 直接返回通过结果 | ||
| 1461 | is_pressure = notifyCmsPass(self, request) | ||
| 1462 | if is_pressure: | ||
| 1463 | return response.ok() | ||
| 1464 | |||
| 1465 | # 以下时非压测时的正常逻辑 | ||
| 1458 | start_time = time.time() | 1466 | start_time = time.time() |
| 1459 | 1467 | ||
| 1460 | args = request.data | 1468 | args = request.data |
| ... | @@ -1840,3 +1848,38 @@ class GoView(GenericView): | ... | @@ -1840,3 +1848,38 @@ class GoView(GenericView): |
| 1840 | return response.ok(data=result) | 1848 | return response.ok(data=result) |
| 1841 | else: | 1849 | else: |
| 1842 | return response.error_msg(msg='识别错误') | 1850 | return response.error_msg(msg='识别错误') |
| 1851 | |||
| 1852 | def notifyCmsPass(self, request): | ||
| 1853 | args = request.data | ||
| 1854 | cms_info = args.get('content', {}) | ||
| 1855 | business_type = consts.AFC_PREFIX if cms_info.get('financeCompany', '').startswith('宝马') else consts.HIL_PREFIX | ||
| 1856 | src_application_id = cms_info.get('settlemnetVerification', {}).get('applicationNo', '') | ||
| 1857 | application_id = src_application_id[:src_application_id.rfind('-')] | ||
| 1858 | |||
| 1859 | pressure_switch = Configs.objects.filter(id=3).first() | ||
| 1860 | if pressure_switch is None or (pressure_switch is not None and pressure_switch.value == 'N'): | ||
| 1861 | self.running_log.info('[pressure_switch] [entity={0}]]'.format(pressure_switch)) | ||
| 1862 | return False | ||
| 1863 | |||
| 1864 | application_link = '{0}/showList/showList?entity={1}&scheme={2}&case_id={3}'.format( | ||
| 1865 | conf.BASE_URL, business_type, consts.COMPARE_DOC_SCHEME_LIST[1], application_id) | ||
| 1866 | data = { | ||
| 1867 | "SubtenantId": consts.TENANT_MAP[business_type], | ||
| 1868 | "Data": { | ||
| 1869 | "Result_Message": "Pass", | ||
| 1870 | "AutoCheckResult": "Pass", | ||
| 1871 | "Failure_Reason": "", | ||
| 1872 | "Application_Number": application_id, | ||
| 1873 | "Bank_Statement": "", | ||
| 1874 | "Link_URL": application_link, | ||
| 1875 | "OCR_Version": 1, | ||
| 1876 | "Origin": consts.INFO_SOURCE[1] | ||
| 1877 | } | ||
| 1878 | } | ||
| 1879 | try: | ||
| 1880 | response = cms.send(data) # interface_report ocr to cms | ||
| 1881 | except Exception as e: | ||
| 1882 | self.running_log.error('[pressure cms error] [error={0}]'.format(traceback.format_exc())) | ||
| 1883 | else: | ||
| 1884 | self.running_log.info('[pressure cms success] [response={0}]'.format(response)) | ||
| 1885 | return True | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment