08e21eab by 冯轩

MOD:yace

1 parent d14e16ea
...@@ -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
...@@ -1460,6 +1462,12 @@ class SECMSView(GenericView): ...@@ -1460,6 +1462,12 @@ class SECMSView(GenericView):
1460 # CMS上传比对信息接口 SE 1462 # CMS上传比对信息接口 SE
1461 # @use_args(se_cms_args, location='data') 1463 # @use_args(se_cms_args, location='data')
1462 def post(self, request): # interface_report cms to ocr 1464 def post(self, request): # interface_report cms to ocr
1465 # 如果是压测 直接返回通过结果
1466 is_pressure = notifyCmsPass(self, request)
1467 if is_pressure:
1468 return response.ok()
1469
1470 # 以下时非压测时的正常逻辑
1463 start_time = time.time() 1471 start_time = time.time()
1464 1472
1465 args = request.data 1473 args = request.data
...@@ -1847,3 +1855,38 @@ class GoView(GenericView): ...@@ -1847,3 +1855,38 @@ class GoView(GenericView):
1847 return response.ok(data=result) 1855 return response.ok(data=result)
1848 else: 1856 else:
1849 return response.error_msg(msg='识别错误') 1857 return response.error_msg(msg='识别错误')
1858
1859 def notifyCmsPass(self, request):
1860 args = request.data
1861 cms_info = args.get('content', {})
1862 business_type = consts.AFC_PREFIX if cms_info.get('financeCompany', '').startswith('宝马') else consts.HIL_PREFIX
1863 src_application_id = cms_info.get('settlemnetVerification', {}).get('applicationNo', '')
1864 application_id = src_application_id[:src_application_id.rfind('-')]
1865
1866 pressure_switch = Configs.objects.filter(id=3).first()
1867 if pressure_switch is None or (pressure_switch is not None and pressure_switch.value == 'N'):
1868 self.running_log.info('[pressure_switch] [entity={0}]]'.format(pressure_switch))
1869 return False
1870
1871 application_link = '{0}/showList/showList?entity={1}&scheme={2}&case_id={3}'.format(
1872 conf.BASE_URL, business_type, consts.COMPARE_DOC_SCHEME_LIST[1], application_id)
1873 data = {
1874 "SubtenantId": consts.TENANT_MAP[business_type],
1875 "Data": {
1876 "Result_Message": "Pass",
1877 "AutoCheckResult": "Pass",
1878 "Failure_Reason": "",
1879 "Application_Number": application_id,
1880 "Bank_Statement": "",
1881 "Link_URL": application_link,
1882 "OCR_Version": 1,
1883 "Origin": consts.INFO_SOURCE[1]
1884 }
1885 }
1886 try:
1887 response = cms.send(data) # interface_report ocr to cms
1888 except Exception as e:
1889 self.running_log.error('[pressure cms error] [error={0}]'.format(traceback.format_exc()))
1890 else:
1891 self.running_log.info('[pressure cms success] [response={0}]'.format(response))
1892 return True
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!