cms part 1
Showing
2 changed files
with
126 additions
and
10 deletions
| ... | @@ -647,7 +647,7 @@ class CompareView(GenericView): | ... | @@ -647,7 +647,7 @@ class CompareView(GenericView): |
| 647 | corporate_cus_info=corporate_cus_info, | 647 | corporate_cus_info=corporate_cus_info, |
| 648 | ) | 648 | ) |
| 649 | # 触发比对 | 649 | # 触发比对 |
| 650 | compare.apply_async((application_id, business_type, uniq_seq, None, True), | 650 | compare.apply_async((application_id, business_type, uniq_seq, None, True, False), |
| 651 | queue='queue_compare') | 651 | queue='queue_compare') |
| 652 | return response.ok() | 652 | return response.ok() |
| 653 | 653 | ||
| ... | @@ -708,7 +708,7 @@ class SECompareView(GenericView): | ... | @@ -708,7 +708,7 @@ class SECompareView(GenericView): |
| 708 | quotationt_info=quotationt_info | 708 | quotationt_info=quotationt_info |
| 709 | ) | 709 | ) |
| 710 | # 触发比对 | 710 | # 触发比对 |
| 711 | compare.apply_async((application_id, business_type, uniq_seq, None, False), | 711 | compare.apply_async((application_id, business_type, uniq_seq, None, False, False), |
| 712 | queue='queue_compare') | 712 | queue='queue_compare') |
| 713 | return response.ok() | 713 | return response.ok() |
| 714 | 714 | ||
| ... | @@ -1091,7 +1091,10 @@ class SECMSView(GenericView): | ... | @@ -1091,7 +1091,10 @@ class SECMSView(GenericView): |
| 1091 | # pos上传比对信息接口 SE | 1091 | # pos上传比对信息接口 SE |
| 1092 | @use_args(se_cms_args, location='data') | 1092 | @use_args(se_cms_args, location='data') |
| 1093 | def post(self, request, args): | 1093 | def post(self, request, args): |
| 1094 | self.running_log.info('cms in') | 1094 | |
| 1095 | # 触发比对 | ||
| 1096 | compare.apply_async((application_id, business_type, uniq_seq, None, False, True), | ||
| 1097 | queue='queue_compare') | ||
| 1095 | return response.ok() | 1098 | return response.ok() |
| 1096 | 1099 | ||
| 1097 | post.openapi_doc = ''' | 1100 | post.openapi_doc = ''' | ... | ... |
| ... | @@ -881,6 +881,110 @@ def get_se_compare_info(last_obj, application_entity, detect_list): | ... | @@ -881,6 +881,110 @@ def get_se_compare_info(last_obj, application_entity, detect_list): |
| 881 | return compare_info, is_gsyh | 881 | return compare_info, is_gsyh |
| 882 | 882 | ||
| 883 | 883 | ||
| 884 | def cms_get_se_compare_info(last_obj, application_entity, detect_list): | ||
| 885 | # { | ||
| 886 | # "content": { | ||
| 887 | # "financeCompany": "宝马汽车金融有限公司", | ||
| 888 | # "contractNo": "CH-B100000123", | ||
| 889 | # "status": "HIL", | ||
| 890 | # "branch": "宝马汽车金融有限公司", | ||
| 891 | # "fpCampaign": "Q1_2021_BMW_BASIC", | ||
| 892 | # "applicationVersion": 1, | ||
| 893 | # "submissionDate": {}, | ||
| 894 | # "mortgageType": "Mortgage Contract", | ||
| 895 | # "dealerRegion": "West", | ||
| 896 | # "insuranceRealNameCity": false, | ||
| 897 | # "totalFinanceAmount": 1234.56, | ||
| 898 | # "terms": 24, | ||
| 899 | # "dealerName": "乐山长宝汽车销售服务有限公司", | ||
| 900 | # "tier": "2", | ||
| 901 | # "province": "四川省", | ||
| 902 | # "fapiaoIssuerDealer": "乐山长宝汽车销售服务有限公司", | ||
| 903 | # "customerName": "蔡红", | ||
| 904 | # "customerIdNo": "511102196706080000", | ||
| 905 | # "vehicleStatus": "Used", | ||
| 906 | # "applicationSource": "eApp", | ||
| 907 | # "contractSource": "Online Sign", | ||
| 908 | # "applicationRating": 100, | ||
| 909 | # "applicantInformation": [ | ||
| 910 | # { | ||
| 911 | # "applicantType": "Borrower", | ||
| 912 | # "customersubType": "TCCOR", | ||
| 913 | # "selfEmployedSubType": "CSIBM", | ||
| 914 | # "name": "李四", | ||
| 915 | # "legalRepName": "张三", | ||
| 916 | # "dateOfBirth": {}, | ||
| 917 | # "nationality": "中国", | ||
| 918 | # "establishmentDate": {}, | ||
| 919 | # "IDInformation": [ | ||
| 920 | # { | ||
| 921 | # "idType": "ITARI", | ||
| 922 | # "idNum": "111111199404251100", | ||
| 923 | # "idExpiryDate": {} | ||
| 924 | # } | ||
| 925 | # ] | ||
| 926 | # } | ||
| 927 | # ], | ||
| 928 | # "autoApprovedDetails": { | ||
| 929 | # "aaType": "CAA1" | ||
| 930 | # }, | ||
| 931 | # "financialInformation": { | ||
| 932 | # "vehiclePrice": 1234.56, | ||
| 933 | # "grossPrice": 1234.56, | ||
| 934 | # "associatedServicePrice": 1234.56, | ||
| 935 | # "vehiclePrincipal": 1234.56, | ||
| 936 | # "associatedServicePrincipal": 1234.56, | ||
| 937 | # "originationPrincipal": 1234.56, | ||
| 938 | # "totalDownPayment": 1234.56, | ||
| 939 | # "vehicleDownPaymentRatio": 1234.56, | ||
| 940 | # "optionAmount": 1234.56, | ||
| 941 | # "sumOfMSRPAndOption": 1234.56 | ||
| 942 | # }, | ||
| 943 | # "paymentSchedule": [ | ||
| 944 | # { | ||
| 945 | # "no": 3, | ||
| 946 | # "grossRentalAmount": 1234.56 | ||
| 947 | # } | ||
| 948 | # ], | ||
| 949 | # "associatedServices": [ | ||
| 950 | # { | ||
| 951 | # "associatedServices": "机动车保险", | ||
| 952 | # "price": 1234.56, | ||
| 953 | # "financed": 1234.56, | ||
| 954 | # "total": 1234.56 | ||
| 955 | # } | ||
| 956 | # ], | ||
| 957 | # "vehicleInformation": { | ||
| 958 | # "vinNo": "LBV23482934DJFKD" | ||
| 959 | # }, | ||
| 960 | # "bankAccountDetails": { | ||
| 961 | # "bankName": "中国银行", | ||
| 962 | # "accountHolderName": "张三", | ||
| 963 | # "accountNo": "12312123123123124" | ||
| 964 | # }, | ||
| 965 | # "insuranceDetails": { | ||
| 966 | # "insuranceType": "ComprehensiveInsurance", | ||
| 967 | # "insuranceAmount": "60000000", | ||
| 968 | # "startDate": {}, | ||
| 969 | # "endDate": {} | ||
| 970 | # }, | ||
| 971 | # "corporateFinancialInformation": { | ||
| 972 | # "hashCode": "238231", | ||
| 973 | # "borrowerName": "张三", | ||
| 974 | # "fiscalYear": 2019, | ||
| 975 | # "totaAssets": 1234.56, | ||
| 976 | # "totalLiabilitiesAndOwnersEquity": 1234.56, | ||
| 977 | # "cashAndCashEquivalentAtEndOfPeriod": 1234.56, | ||
| 978 | # "netProfit": 1234.56 | ||
| 979 | # }, | ||
| 980 | # "settlemnetVerification": { | ||
| 981 | # "applicationNo": "CH-B100000123" | ||
| 982 | # } | ||
| 983 | # } | ||
| 984 | # } | ||
| 985 | pass | ||
| 986 | |||
| 987 | |||
| 884 | def se_compare_license(license_en, ocr_res_dict, field_list): | 988 | def se_compare_license(license_en, ocr_res_dict, field_list): |
| 885 | ocr_field, compare_logic, special_expiry_date = consts.SE_COMPARE_FIELD[license_en] | 989 | ocr_field, compare_logic, special_expiry_date = consts.SE_COMPARE_FIELD[license_en] |
| 886 | 990 | ||
| ... | @@ -1094,11 +1198,15 @@ def se_result_detect(ocr_res_dict): | ... | @@ -1094,11 +1198,15 @@ def se_result_detect(ocr_res_dict): |
| 1094 | detect_list.append(ocr_res_str is None) | 1198 | detect_list.append(ocr_res_str is None) |
| 1095 | return detect_list | 1199 | return detect_list |
| 1096 | 1200 | ||
| 1097 | def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict): | 1201 | |
| 1202 | def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms): | ||
| 1098 | try: | 1203 | try: |
| 1099 | # 比对逻辑 | 1204 | # 比对逻辑 |
| 1100 | start_time = datetime.now() | 1205 | start_time = datetime.now() |
| 1101 | detect_list = se_result_detect(ocr_res_dict) | 1206 | detect_list = se_result_detect(ocr_res_dict) |
| 1207 | if is_cms: | ||
| 1208 | compare_info, is_gsyh = cms_get_se_compare_info(last_obj, application_entity, detect_list) | ||
| 1209 | else: | ||
| 1102 | compare_info, is_gsyh = get_se_compare_info(last_obj, application_entity, detect_list) | 1210 | compare_info, is_gsyh = get_se_compare_info(last_obj, application_entity, detect_list) |
| 1103 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str = se_compare_process( | 1211 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str = se_compare_process( |
| 1104 | compare_info, ocr_res_dict, is_gsyh) | 1212 | compare_info, ocr_res_dict, is_gsyh) |
| ... | @@ -1155,14 +1263,17 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -1155,14 +1263,17 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
| 1155 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | 1263 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, |
| 1156 | traceback.format_exc())) | 1264 | traceback.format_exc())) |
| 1157 | 1265 | ||
| 1266 | # cms结果发送 | ||
| 1267 | |||
| 1158 | 1268 | ||
| 1159 | @app.task | 1269 | @app.task |
| 1160 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True): | 1270 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 1161 | # POS: application_id, application_entity, uniq_seq, None | 1271 | # POS: application_id, application_entity, uniq_seq, None |
| 1162 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 1272 | # OCR: application_id, business_type(application_entity), None, ocr_res_id |
| 1163 | 1273 | ||
| 1164 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}]'.format( | 1274 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' |
| 1165 | log_base, application_entity, application_id, uniq_seq, ocr_res_id, is_ca)) | 1275 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 1276 | is_ca, is_cms)) | ||
| 1166 | 1277 | ||
| 1167 | # 根据application_id查找最新的比对信息,如果没有,结束 | 1278 | # 根据application_id查找最新的比对信息,如果没有,结束 |
| 1168 | if is_ca: | 1279 | if is_ca: |
| ... | @@ -1172,7 +1283,8 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -1172,7 +1283,8 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 1172 | last_obj = comparison_class.objects.filter(application_id=application_id).last() | 1283 | last_obj = comparison_class.objects.filter(application_id=application_id).last() |
| 1173 | if last_obj is None: | 1284 | if last_obj is None: |
| 1174 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | 1285 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' |
| 1175 | '[is_ca={5}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, is_ca)) | 1286 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, |
| 1287 | ocr_res_id, is_ca, is_cms)) | ||
| 1176 | return | 1288 | return |
| 1177 | 1289 | ||
| 1178 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | 1290 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 |
| ... | @@ -1186,13 +1298,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -1186,13 +1298,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 1186 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() | 1298 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() |
| 1187 | if ocr_res_dict is None: | 1299 | if ocr_res_dict is None: |
| 1188 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | 1300 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' |
| 1189 | '[is_ca={5}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, is_ca)) | 1301 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, |
| 1302 | uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 1190 | return | 1303 | return |
| 1191 | 1304 | ||
| 1192 | if is_ca: | 1305 | if is_ca: |
| 1193 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) | 1306 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) |
| 1194 | else: | 1307 | else: |
| 1195 | se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) | 1308 | se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms) |
| 1196 | 1309 | ||
| 1197 | 1310 | ||
| 1198 | 1311 | ... | ... |
-
Please register or sign in to post a comment