3d599f3d by 冯轩

init 4302 cms all pass

1 parent 9b9dcb37
......@@ -20,6 +20,7 @@ from common import response
from common.mixins import GenericView,DocGenericView
from common.tools.file_tools import file_write
from common.redis_cache import redis_handler as rh
from apps.doc.ocr.cms import cms
from .models import (
# UploadDocRecords,
DocStatus,
......@@ -53,7 +54,8 @@ from .models import (
AFCOCRResult,
AFCSEOCRResult,
HILCmsStatusInfo,
AFCCmsStatusInfo
AFCCmsStatusInfo,
Configs
)
from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemName, RequestTeam
from .mixins import DocHandler, MPOSHandler, PreSEHandler
......@@ -1455,6 +1457,12 @@ class SECMSView(GenericView):
# CMS上传比对信息接口 SE
# @use_args(se_cms_args, location='data')
def post(self, request): # interface_report cms to ocr
# 如果是压测 直接返回通过结果
is_pressure = notifyCmsPass(self, request)
if is_pressure:
return response.ok()
# 以下时非压测时的正常逻辑
start_time = time.time()
args = request.data
......@@ -1840,3 +1848,38 @@ class GoView(GenericView):
return response.ok(data=result)
else:
return response.error_msg(msg='识别错误')
def notifyCmsPass(self, request):
args = request.data
cms_info = args.get('content', {})
business_type = consts.AFC_PREFIX if cms_info.get('financeCompany', '').startswith('宝马') else consts.HIL_PREFIX
src_application_id = cms_info.get('settlemnetVerification', {}).get('applicationNo', '')
application_id = src_application_id[:src_application_id.rfind('-')]
pressure_switch = Configs.objects.filter(id=3).first()
if pressure_switch is None or (pressure_switch is not None and pressure_switch.value == 'N'):
self.running_log.info('[pressure_switch] [entity={0}]]'.format(pressure_switch))
return False
application_link = '{0}/showList/showList?entity={1}&scheme={2}&case_id={3}'.format(
conf.BASE_URL, business_type, consts.COMPARE_DOC_SCHEME_LIST[1], application_id)
data = {
"SubtenantId": consts.TENANT_MAP[business_type],
"Data": {
"Result_Message": "Pass",
"AutoCheckResult": "Pass",
"Failure_Reason": "",
"Application_Number": application_id,
"Bank_Statement": "",
"Link_URL": application_link,
"OCR_Version": 1,
"Origin": consts.INFO_SOURCE[1]
}
}
try:
response = cms.send(data) # interface_report ocr to cms
except Exception as e:
self.running_log.error('[pressure cms error] [error={0}]'.format(traceback.format_exc()))
else:
self.running_log.info('[pressure cms success] [response={0}]'.format(response))
return True
\ 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!