add bd compare
Showing
5 changed files
with
188 additions
and
47 deletions
... | @@ -1178,6 +1178,7 @@ DDA_OCR_FIELD = 'bs_ocr' | ... | @@ -1178,6 +1178,7 @@ DDA_OCR_FIELD = 'bs_ocr' |
1178 | HMH_OCR_FIELD = 'hmh_ocr' | 1178 | HMH_OCR_FIELD = 'hmh_ocr' |
1179 | JYPZ_OCR_FIELD = 'jypz_ocr' | 1179 | JYPZ_OCR_FIELD = 'jypz_ocr' |
1180 | HT_FIELD = 'ht_ocr' | 1180 | HT_FIELD = 'ht_ocr' |
1181 | BD_FIELD = 'bd_ocr' | ||
1181 | 1182 | ||
1182 | RESULT_MAPPING = { | 1183 | RESULT_MAPPING = { |
1183 | MVI_CLASSIFY: MVI_OCR_FIELD, | 1184 | MVI_CLASSIFY: MVI_OCR_FIELD, |
... | @@ -1195,6 +1196,7 @@ RESULT_MAPPING = { | ... | @@ -1195,6 +1196,7 @@ RESULT_MAPPING = { |
1195 | HMH_CLASSIFY: HMH_OCR_FIELD, | 1196 | HMH_CLASSIFY: HMH_OCR_FIELD, |
1196 | JYPZ_CLASSIFY: JYPZ_OCR_FIELD, | 1197 | JYPZ_CLASSIFY: JYPZ_OCR_FIELD, |
1197 | CONTRACT_CLASSIFY: HT_FIELD, | 1198 | CONTRACT_CLASSIFY: HT_FIELD, |
1199 | INSURANCE_CLASSIFY: BD_FIELD, | ||
1198 | } | 1200 | } |
1199 | 1201 | ||
1200 | CA_ADD_COMPARE_FIELDS = (IC_OCR_FIELD, BL_OCR_FIELD) | 1202 | CA_ADD_COMPARE_FIELDS = (IC_OCR_FIELD, BL_OCR_FIELD) |
... | @@ -1213,6 +1215,7 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, | ... | @@ -1213,6 +1215,7 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, |
1213 | HMH_OCR_FIELD, | 1215 | HMH_OCR_FIELD, |
1214 | JYPZ_OCR_FIELD, | 1216 | JYPZ_OCR_FIELD, |
1215 | HT_FIELD, | 1217 | HT_FIELD, |
1218 | BD_FIELD, | ||
1216 | ) | 1219 | ) |
1217 | 1220 | ||
1218 | # 身份证 | 1221 | # 身份证 |
... | @@ -1394,6 +1397,8 @@ SE_LAYOUT_VALUE = '旧版-旧打印、新版-新打印' | ... | @@ -1394,6 +1397,8 @@ SE_LAYOUT_VALUE = '旧版-旧打印、新版-新打印' |
1394 | SE_GB_NEW_FIELD = ['vinNo'] | 1397 | SE_GB_NEW_FIELD = ['vinNo'] |
1395 | SE_GB_USED_FIELD = ['customerName', 'idNum', 'date'] | 1398 | SE_GB_USED_FIELD = ['customerName', 'idNum', 'date'] |
1396 | SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', '申请号', '渠道', '签字'] | 1399 | SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', '申请号', '渠道', '签字'] |
1400 | SE_BD_FIELD = ['被保险人姓名', '被保险人证件号码', '车架号', '机动车损失保险金额', '第三者责任保险金额', '绝对免赔率', '保险起始日期', '保险截止日期', '保单章', '第一受益人', '保险费合计'] | ||
1401 | JDMPV_VALUE = ['-', '--', '0%', '0.00', '/', '0'] | ||
1397 | 1402 | ||
1398 | SE_BANK_FIELD = ['accountNo', 'bankName'] | 1403 | SE_BANK_FIELD = ['accountNo', 'bankName'] |
1399 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] | 1404 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] |
... | @@ -1502,6 +1507,7 @@ DDA_EN = 'DDA' | ... | @@ -1502,6 +1507,7 @@ DDA_EN = 'DDA' |
1502 | HMH_EN = 'Mortgage Waiver Letter' | 1507 | HMH_EN = 'Mortgage Waiver Letter' |
1503 | JYPZ_EN = 'Used Car Document' | 1508 | JYPZ_EN = 'Used Car Document' |
1504 | AFC_CONTRACT_EN = 'AFC Contract' | 1509 | AFC_CONTRACT_EN = 'AFC Contract' |
1510 | BD_EN = 'Insurance' | ||
1505 | 1511 | ||
1506 | SKIP_CARD = {SME_BL_EN} | 1512 | SKIP_CARD = {SME_BL_EN} |
1507 | 1513 | ||
... | @@ -1643,6 +1649,20 @@ HMH_COMPARE_LOGIC = { | ... | @@ -1643,6 +1649,20 @@ HMH_COMPARE_LOGIC = { |
1643 | '签字': ('借款人签字/盖章', 'se_common_compare', {}, '抵押登记豁免函签字需人工核查'), | 1649 | '签字': ('借款人签字/盖章', 'se_common_compare', {}, '抵押登记豁免函签字需人工核查'), |
1644 | } | 1650 | } |
1645 | 1651 | ||
1652 | BD_COMPARE_LOGIC = { | ||
1653 | '被保险人姓名': ('被保险人姓名', 'se_name_compare', {}, '保单被保险人姓名与系统不一致'), | ||
1654 | '被保险人证件号码': ('被保险人证件号码', 'se_common_compare', {}, '保单被保险人证件号码与系统不一致'), | ||
1655 | '车架号': ('车架号', 'se_common_compare', {}, '保单车架号与系统不一致'), | ||
1656 | '机动车损失保险金额': ('机动车损失保险金额', 'se_amount_lte_compare', {}, '保单车损险异常'), | ||
1657 | '第三者责任保险金额': ('机动车第三者责任保险金额', 'se_amount_lte_compare', {}, '保单三者险异常'), | ||
1658 | '绝对免赔率': ('机动车损失保险绝对免赔率/绝对免赔额', 'se_one_compare', {}, '保单无绝对免赔项'), | ||
1659 | '保险起始日期': ('保险起始日期', 'se_bd_date_compare', {'start': True}, '保单起始时间有误'), | ||
1660 | '保险截止日期': ('保险截止日期', 'se_bd_date_compare', {}, '保单截止时间有误'), | ||
1661 | '保单章': ('保单章', 'se_common_compare', {}, '保单无保单章'), | ||
1662 | '第一受益人': ('特别约定第一受益人', 'se_common_compare', {}, '保单第一受益人有误,需人工核查'), | ||
1663 | '保险费合计': ('保险费合计', 'se_amount_compare', {}, '保单保费疑似无法覆盖ASP保险融资'), | ||
1664 | } | ||
1665 | |||
1646 | HT_COMPARE_LOGIC = { | 1666 | HT_COMPARE_LOGIC = { |
1647 | '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'), | 1667 | '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'), |
1648 | '所购车辆价格-小写-重要条款': ('所购车辆价格-小写-重要条款', 'se_amount_str_compare', {}, '合同首页中车辆价格与系统不一致'), | 1668 | '所购车辆价格-小写-重要条款': ('所购车辆价格-小写-重要条款', 'se_amount_str_compare', {}, '合同首页中车辆价格与系统不一致'), |
... | @@ -1710,7 +1730,8 @@ SE_COMPARE_FIELD = { | ... | @@ -1710,7 +1730,8 @@ SE_COMPARE_FIELD = { |
1710 | DDA_EN: (DDA_OCR_FIELD, DDA_COMPARE_LOGIC, False), | 1730 | DDA_EN: (DDA_OCR_FIELD, DDA_COMPARE_LOGIC, False), |
1711 | HMH_EN: (HMH_OCR_FIELD, HMH_COMPARE_LOGIC, False), | 1731 | HMH_EN: (HMH_OCR_FIELD, HMH_COMPARE_LOGIC, False), |
1712 | JYPZ_EN: (JYPZ_OCR_FIELD, JYPZ_COMPARE_LOGIC, False), | 1732 | JYPZ_EN: (JYPZ_OCR_FIELD, JYPZ_COMPARE_LOGIC, False), |
1713 | AFC_CONTRACT_EN: (HT_FIELD, HT_COMPARE_LOGIC, False) | 1733 | AFC_CONTRACT_EN: (HT_FIELD, HT_COMPARE_LOGIC, False), |
1734 | BD_EN: (BD_FIELD, BD_COMPARE_LOGIC, False), | ||
1714 | } | 1735 | } |
1715 | 1736 | ||
1716 | 1737 | ... | ... |
... | @@ -314,6 +314,7 @@ class AFCOCRResult(models.Model): | ... | @@ -314,6 +314,7 @@ class AFCOCRResult(models.Model): |
314 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") | 314 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") |
315 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") | 315 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") |
316 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 316 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
317 | bd_ocr = models.TextField(null=True, verbose_name="保单") | ||
317 | 318 | ||
318 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 319 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
319 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 320 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -344,6 +345,7 @@ class HILOCRResult(models.Model): | ... | @@ -344,6 +345,7 @@ class HILOCRResult(models.Model): |
344 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") | 345 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") |
345 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") | 346 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") |
346 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 347 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
348 | bd_ocr = models.TextField(null=True, verbose_name="保单") | ||
347 | 349 | ||
348 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 350 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
349 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 351 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -373,6 +375,7 @@ class AFCSEOCRResult(models.Model): | ... | @@ -373,6 +375,7 @@ class AFCSEOCRResult(models.Model): |
373 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") | 375 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") |
374 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") | 376 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") |
375 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 377 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
378 | bd_ocr = models.TextField(null=True, verbose_name="保单") | ||
376 | 379 | ||
377 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 380 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
378 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 381 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -403,6 +406,7 @@ class HILSEOCRResult(models.Model): | ... | @@ -403,6 +406,7 @@ class HILSEOCRResult(models.Model): |
403 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") | 406 | hmh_ocr = models.TextField(null=True, verbose_name="豁免函") |
404 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") | 407 | jypz_ocr = models.TextField(null=True, verbose_name="二手车交易凭证") |
405 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 408 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
409 | bd_ocr = models.TextField(null=True, verbose_name="保单") | ||
406 | 410 | ||
407 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 411 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
408 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 412 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ... | ... |
... | @@ -879,8 +879,8 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -879,8 +879,8 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
879 | main_role_info = {} | 879 | main_role_info = {} |
880 | company_info_list = [] | 880 | company_info_list = [] |
881 | 881 | ||
882 | # 个人信息证件--------------------------------------------------------------------------------------------------------- | ||
882 | province = cms_info.get('province', '') | 883 | province = cms_info.get('province', '') |
883 | |||
884 | for individual_info in cms_info.get('applicantInformation', []): | 884 | for individual_info in cms_info.get('applicantInformation', []): |
885 | all_id_num = [] | 885 | all_id_num = [] |
886 | 886 | ||
... | @@ -908,6 +908,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -908,6 +908,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
908 | field_input.append(('idExpiryDate', id_info.get('idExpiryDate', ''))) | 908 | field_input.append(('idExpiryDate', id_info.get('idExpiryDate', ''))) |
909 | license_dict[license_en] = field_input | 909 | license_dict[license_en] = field_input |
910 | all_id_num.append(id_num) | 910 | all_id_num.append(id_num) |
911 | # 营业执照 -------------------------------------------------------------------------------------------------- | ||
911 | elif id_info.get('idType') in ['Unified Social Credit Code', 'Tax Number', 'Business License Number']: | 912 | elif id_info.get('idType') in ['Unified Social Credit Code', 'Tax Number', 'Business License Number']: |
912 | # ['companyName', 'legalRepName', 'businessLicenseNo', 'organizationCreditCode', | 913 | # ['companyName', 'legalRepName', 'businessLicenseNo', 'organizationCreditCode', |
913 | # 'taxRegistrationCertificateNo', 'establishmentDate', 'businessLicenseDueDate'] | 914 | # 'taxRegistrationCertificateNo', 'establishmentDate', 'businessLicenseDueDate'] |
... | @@ -926,6 +927,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -926,6 +927,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
926 | if individual_info.get('customersubType', '') == 'Corporate': | 927 | if individual_info.get('customersubType', '') == 'Corporate': |
927 | company_info_list.append((customer_name, id_num)) | 928 | company_info_list.append((customer_name, id_num)) |
928 | 929 | ||
930 | # SME营业执照--------------------------------------------------------------------------------------------------- | ||
929 | if individual_info.get('customersubType', '').startswith('Self Employed'): | 931 | if individual_info.get('customersubType', '').startswith('Self Employed'): |
930 | sep_field_input = [ | 932 | sep_field_input = [ |
931 | ('legalRepName', customer_name), | 933 | ('legalRepName', customer_name), |
... | @@ -972,6 +974,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -972,6 +974,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
972 | first_submmison_date = cms_info.get('submissionDate', '') | 974 | first_submmison_date = cms_info.get('submissionDate', '') |
973 | vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '') | 975 | vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '') |
974 | amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '0.0')) | 976 | amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '0.0')) |
977 | # 新车发票---------------------------------------------------------------------------------------------------------- | ||
975 | if vehicle_status == 'New': | 978 | if vehicle_status == 'New': |
976 | vehicle_field_input.append(('vinNo', vin_no)) | 979 | vehicle_field_input.append(('vinNo', vin_no)) |
977 | vehicle_field_input.append(('dealer', '、'.join([cms_info.get('dealerName', ''), cms_info.get('fapiaoIssuerDealer', '')]))) | 980 | vehicle_field_input.append(('dealer', '、'.join([cms_info.get('dealerName', ''), cms_info.get('fapiaoIssuerDealer', '')]))) |
... | @@ -994,6 +997,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -994,6 +997,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
994 | ]))) | 997 | ]))) |
995 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[6], consts.SE_LAYOUT_VALUE)) | 998 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[6], consts.SE_LAYOUT_VALUE)) |
996 | vehicle_info[consts.MVI_EN] = vehicle_field_input | 999 | vehicle_info[consts.MVI_EN] = vehicle_field_input |
1000 | # 二手车发票、交易凭证、绿本------------------------------------------------------------------------------------------ | ||
997 | else: | 1001 | else: |
998 | gb_field_input = [ | 1002 | gb_field_input = [ |
999 | ('vinNo', vin_no), | 1003 | ('vinNo', vin_no), |
... | @@ -1033,6 +1037,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1033,6 +1037,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1033 | vehicle_info[consts.UCI_EN] = vehicle_field_input | 1037 | vehicle_info[consts.UCI_EN] = vehicle_field_input |
1034 | compare_info['vehicleInfo'] = vehicle_info | 1038 | compare_info['vehicleInfo'] = vehicle_info |
1035 | 1039 | ||
1040 | # 银行卡------------------------------------------------------------------------------------------------------- | ||
1036 | bank_info = {} | 1041 | bank_info = {} |
1037 | bank_name = cms_info.get('bankAccountDetails', {}).get('bankName', '') | 1042 | bank_name = cms_info.get('bankAccountDetails', {}).get('bankName', '') |
1038 | account_no = decode_des(cms_info.get('bankAccountDetails', {}).get('accountNo', ''), des_key) | 1043 | account_no = decode_des(cms_info.get('bankAccountDetails', {}).get('accountNo', ''), des_key) |
... | @@ -1044,6 +1049,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1044,6 +1049,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1044 | ] | 1049 | ] |
1045 | bank_info[consts.BC_EN] = bank_field_input | 1050 | bank_info[consts.BC_EN] = bank_field_input |
1046 | 1051 | ||
1052 | # DDA------------------------------------------------------------------------------------------------------------ | ||
1047 | if is_gsyh or not detect_list[-1]: | 1053 | if is_gsyh or not detect_list[-1]: |
1048 | dda_field_input = [ | 1054 | dda_field_input = [ |
1049 | ('applicationId(1)', last_obj.application_id), | 1055 | ('applicationId(1)', last_obj.application_id), |
... | @@ -1058,9 +1064,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1058,9 +1064,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1058 | bank_info[consts.DDA_EN] = dda_field_input | 1064 | bank_info[consts.DDA_EN] = dda_field_input |
1059 | compare_info['bankInfo'] = bank_info | 1065 | compare_info['bankInfo'] = bank_info |
1060 | 1066 | ||
1067 | # 抵押登记豁免函---------------------------------------------------------------------------------------------------- | ||
1068 | other_info = {} | ||
1061 | full_no = cms_info.get('settlemnetVerification', {}).get('applicationNo', '') | 1069 | full_no = cms_info.get('settlemnetVerification', {}).get('applicationNo', '') |
1062 | if cms_info.get('mortgageType', '') == 'Mortgage Free' or cms_info.get('mortgageType', '') == 'MortgageFree': | 1070 | if cms_info.get('mortgageType', '') == 'Mortgage Free' or cms_info.get('mortgageType', '') == 'MortgageFree': |
1063 | other_info = {} | ||
1064 | hmh_field_input = [ | 1071 | hmh_field_input = [ |
1065 | (consts.SE_HMH_FIELD[0], hmh_name), | 1072 | (consts.SE_HMH_FIELD[0], hmh_name), |
1066 | (consts.SE_HMH_FIELD[1], hmh_id), | 1073 | (consts.SE_HMH_FIELD[1], hmh_id), |
... | @@ -1069,51 +1076,16 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1069,51 +1076,16 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1069 | (consts.SE_HMH_FIELD[4], consts.SE_STAMP_VALUE), | 1076 | (consts.SE_HMH_FIELD[4], consts.SE_STAMP_VALUE), |
1070 | ] | 1077 | ] |
1071 | other_info[consts.HMH_EN] = hmh_field_input | 1078 | other_info[consts.HMH_EN] = hmh_field_input |
1072 | compare_info['other'] = other_info | ||
1073 | |||
1074 | if application_entity in consts.HIL_SET: | ||
1075 | return compare_info, cms_info.get('applicationVersion', 1) | ||
1076 | 1079 | ||
1077 | contract_info = {} | 1080 | # ASP ------------------------------------------------------------------------------------------------------- |
1078 | |||
1079 | schedule_list = [] | ||
1080 | for schedule_dict in cms_info.get('paymentSchedule', []): | ||
1081 | tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')), | ||
1082 | str(schedule_dict.get('grossRentalAmount', ''))) | ||
1083 | schedule_list.append(tmp_str) | ||
1084 | schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list) | ||
1085 | |||
1086 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) | ||
1087 | afc_contract_input = [ | ||
1088 | (consts.SE_AFC_CON_FIELD[0], full_no), | ||
1089 | (consts.SE_AFC_CON_FIELD[1], amount), | ||
1090 | (consts.SE_AFC_CON_FIELD[2], vin_no), | ||
1091 | (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1092 | (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))), | ||
1093 | (consts.SE_AFC_CON_FIELD[5], vehicle_principal_str), | ||
1094 | (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1095 | (consts.SE_AFC_CON_FIELD[7], amount), | ||
1096 | (consts.SE_AFC_CON_FIELD[8], vin_no), | ||
1097 | (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')), | ||
1098 | (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1099 | (consts.SE_AFC_CON_FIELD[11], vehicle_principal_str), | ||
1100 | (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1101 | (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))), | ||
1102 | (consts.SE_AFC_CON_FIELD[14], account_no), | ||
1103 | (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')), | ||
1104 | (consts.SE_AFC_CON_FIELD[16], bank_name), | ||
1105 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | ||
1106 | ] | ||
1107 | |||
1108 | if str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.00')) == '0.00': | ||
1109 | afc_contract_input.pop(5) | ||
1110 | afc_contract_input.pop(5) | ||
1111 | afc_contract_input.pop(9) | ||
1112 | afc_contract_input.pop(9) | ||
1113 | else: | ||
1114 | asp_list = [] | 1081 | asp_list = [] |
1115 | gzs_status = consts.GZS_STATUS[1] | 1082 | gzs_status = consts.GZS_STATUS[1] |
1083 | gzs_list = [gzs_status] | ||
1116 | gzs_price = '0.00' | 1084 | gzs_price = '0.00' |
1085 | is_asp = False | ||
1086 | insurance_price = None | ||
1087 | if str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.00')) != '0.00': | ||
1088 | is_asp = True | ||
1117 | # for asp_info in cms_info.get('associatedServices', []): | 1089 | # for asp_info in cms_info.get('associatedServices', []): |
1118 | for asp_info in cms_info.get('associatedServices', {}).get('SubassociatedServices', []): | 1090 | for asp_info in cms_info.get('associatedServices', {}).get('SubassociatedServices', []): |
1119 | tmp_asp_name = asp_info.get('associatedServices') | 1091 | tmp_asp_name = asp_info.get('associatedServices') |
... | @@ -1128,6 +1100,9 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1128,6 +1100,9 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1128 | asp_info.get('financed', '0.00') | 1100 | asp_info.get('financed', '0.00') |
1129 | ) | 1101 | ) |
1130 | ) | 1102 | ) |
1103 | # 保单费合计 | ||
1104 | if tmp_asp_name.find('机动车辆保险') != -1: | ||
1105 | insurance_price = asp_info.get('price', '0.00') | ||
1131 | 1106 | ||
1132 | # fin_total = 0 | 1107 | # fin_total = 0 |
1133 | fin_total_tmp = cms_info.get('associatedServices', {}).get('financed total', '0.00') | 1108 | fin_total_tmp = cms_info.get('associatedServices', {}).get('financed total', '0.00') |
... | @@ -1144,16 +1119,93 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1144,16 +1119,93 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1144 | # format(fin_total, '.2f'), | 1119 | # format(fin_total, '.2f'), |
1145 | ) | 1120 | ) |
1146 | ) | 1121 | ) |
1147 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[20], asp_list)) | ||
1148 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], asp_list)) | ||
1149 | 1122 | ||
1150 | # CMS Vehicle Price / 1.13 * 10 % | 1123 | # CMS Vehicle Price / 1.13 * 10 % |
1151 | gzs_list = [gzs_status] | ||
1152 | if gzs_status != consts.GZS_STATUS[1]: | 1124 | if gzs_status != consts.GZS_STATUS[1]: |
1153 | gzs_value = float(amount) * 0.1 / 1.13 | 1125 | gzs_value = float(amount) * 0.1 / 1.13 |
1154 | gzs_list.append(gzs_value) | 1126 | gzs_list.append(gzs_value) |
1155 | gzs_list.append(float(gzs_price)) | 1127 | gzs_list.append(float(gzs_price)) |
1128 | |||
1129 | # 保单 ----------------------------------------------------------------------------------------------------------- | ||
1130 | is_insurance = 0 | ||
1131 | insurance_type = cms_info.get('insuranceDetails', {}).get('insuranceType', '') | ||
1132 | if insurance_type == 'Waive Insurance' and isinstance(insurance_price, str): | ||
1133 | is_insurance = 1 | ||
1134 | elif insurance_type == 'Comprehensive Insurance': | ||
1135 | is_insurance = 2 | ||
1136 | if is_insurance != 0: | ||
1137 | fp_campaign = cms_info.get('fpCampaign', '') | ||
1138 | if fp_campaign.find('OCU') == -1: | ||
1139 | ssx_amount = amount | ||
1140 | else: | ||
1141 | ssx_amount = format(float(amount) * 0.8, '.2f') | ||
1142 | if fp_campaign.find('Joy_Plus') == -1: | ||
1143 | dszx_amount = '200000' | ||
1144 | else: | ||
1145 | dszx_amount = '500000' | ||
1146 | bd_field_input = [ | ||
1147 | (consts.SE_BD_FIELD[0], hmh_name), | ||
1148 | (consts.SE_BD_FIELD[1], hmh_id), | ||
1149 | (consts.SE_BD_FIELD[2], vin_no), | ||
1150 | (consts.SE_BD_FIELD[3], ssx_amount), | ||
1151 | (consts.SE_BD_FIELD[4], dszx_amount), | ||
1152 | (consts.SE_BD_FIELD[5], consts.JDMPV_VALUE), | ||
1153 | (consts.SE_BD_FIELD[6], cms_info.get('insuranceDetails', {}).get('startDate', '')), | ||
1154 | (consts.SE_BD_FIELD[7], cms_info.get('insuranceDetails', {}).get('endDate', '')), | ||
1155 | (consts.SE_BD_FIELD[8], consts.SE_STAMP_VALUE), | ||
1156 | (consts.SE_BD_FIELD[9], consts.SE_STAMP_VALUE), | ||
1157 | ] | ||
1158 | if is_insurance == 1: | ||
1159 | bd_field_input.append((consts.SE_BD_FIELD[10], insurance_price)) | ||
1160 | other_info[consts.BD_EN] = bd_field_input | ||
1161 | |||
1162 | if len(other_info) > 0: | ||
1163 | compare_info['other'] = other_info | ||
1164 | |||
1165 | if application_entity in consts.HIL_SET: | ||
1166 | return compare_info, cms_info.get('applicationVersion', 1) | ||
1167 | |||
1168 | # AFC合同----------------------------------------------------------------------------------------------------------- | ||
1169 | contract_info = {} | ||
1170 | |||
1171 | schedule_list = [] | ||
1172 | for schedule_dict in cms_info.get('paymentSchedule', []): | ||
1173 | tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')), | ||
1174 | str(schedule_dict.get('grossRentalAmount', ''))) | ||
1175 | schedule_list.append(tmp_str) | ||
1176 | schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list) | ||
1177 | |||
1178 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) | ||
1179 | afc_contract_input = [ | ||
1180 | (consts.SE_AFC_CON_FIELD[0], full_no), | ||
1181 | (consts.SE_AFC_CON_FIELD[1], amount), | ||
1182 | (consts.SE_AFC_CON_FIELD[2], vin_no), | ||
1183 | (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1184 | (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))), | ||
1185 | (consts.SE_AFC_CON_FIELD[5], vehicle_principal_str), | ||
1186 | (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1187 | (consts.SE_AFC_CON_FIELD[7], amount), | ||
1188 | (consts.SE_AFC_CON_FIELD[8], vin_no), | ||
1189 | (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')), | ||
1190 | (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1191 | (consts.SE_AFC_CON_FIELD[11], vehicle_principal_str), | ||
1192 | (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1193 | (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))), | ||
1194 | (consts.SE_AFC_CON_FIELD[14], account_no), | ||
1195 | (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')), | ||
1196 | (consts.SE_AFC_CON_FIELD[16], bank_name), | ||
1197 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | ||
1198 | ] | ||
1199 | |||
1200 | if is_asp: | ||
1201 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[20], asp_list)) | ||
1202 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], asp_list)) | ||
1156 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], gzs_list)) | 1203 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], gzs_list)) |
1204 | else: | ||
1205 | afc_contract_input.pop(5) | ||
1206 | afc_contract_input.pop(5) | ||
1207 | afc_contract_input.pop(9) | ||
1208 | afc_contract_input.pop(9) | ||
1157 | 1209 | ||
1158 | # '借款人签字及时间', 'Borrower', 0, 0, True | 1210 | # '借款人签字及时间', 'Borrower', 0, 0, True |
1159 | online_sign = cms_info.get('contractSource', 'Online Sign') == 'Online Sign' | 1211 | online_sign = cms_info.get('contractSource', 'Online Sign') == 'Online Sign' |
... | @@ -1445,6 +1497,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -1445,6 +1497,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
1445 | special_expiry_date_slice = True | 1497 | special_expiry_date_slice = True |
1446 | else: | 1498 | else: |
1447 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str | 1499 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str |
1500 | if isinstance(value, list): | ||
1501 | value = json.dumps(value, ensure_ascii=False) | ||
1448 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | 1502 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value |
1449 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, compare_logic[name][3])) | 1503 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, compare_logic[name][3])) |
1450 | else: | 1504 | else: |
... | @@ -1452,6 +1506,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -1452,6 +1506,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
1452 | 1506 | ||
1453 | if not is_find: | 1507 | if not is_find: |
1454 | for name, value in field_list: | 1508 | for name, value in field_list: |
1509 | if isinstance(value, list): | ||
1510 | value = json.dumps(value, ensure_ascii=False) | ||
1455 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, '{0}未找到'.format(license_en))) | 1511 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, '{0}未找到'.format(license_en))) |
1456 | 1512 | ||
1457 | if is_find: | 1513 | if is_find: | ... | ... |
... | @@ -363,6 +363,15 @@ class Comparison: | ... | @@ -363,6 +363,15 @@ class Comparison: |
363 | input_tmp = input_str.replace('元', '').replace(',', '') | 363 | input_tmp = input_str.replace('元', '').replace(',', '') |
364 | return self.build_res(ocr_tmp == input_tmp) | 364 | return self.build_res(ocr_tmp == input_tmp) |
365 | 365 | ||
366 | def se_amount_lte_compare(self, input_str, ocr_str, **kwargs): | ||
367 | try: | ||
368 | float_input = float(input_str) | ||
369 | float_ocr = float(ocr_str) | ||
370 | except Exception as e: | ||
371 | return self.RESULT_N | ||
372 | else: | ||
373 | return self.build_res(float_ocr >= float_input) | ||
374 | |||
366 | def se_amount_compare(self, input_str, ocr_str, **kwargs): | 375 | def se_amount_compare(self, input_str, ocr_str, **kwargs): |
367 | if input_str == ocr_str: | 376 | if input_str == ocr_str: |
368 | return self.RESULT_Y | 377 | return self.RESULT_Y |
... | @@ -375,6 +384,12 @@ class Comparison: | ... | @@ -375,6 +384,12 @@ class Comparison: |
375 | else: | 384 | else: |
376 | return self.build_res(float_ocr == float_input) | 385 | return self.build_res(float_ocr == float_input) |
377 | 386 | ||
387 | def se_one_compare(self, input_list, ocr_str, **kwargs): | ||
388 | if isinstance(input_list, list): | ||
389 | if ocr_str in input_list: | ||
390 | return self.RESULT_Y | ||
391 | return self.RESULT_N | ||
392 | |||
378 | def se_company_compare(self, input_str, ocr_str, **kwargs): | 393 | def se_company_compare(self, input_str, ocr_str, **kwargs): |
379 | input_tmp = re.sub(self.re_obj, '', input_str).strip() | 394 | input_tmp = re.sub(self.re_obj, '', input_str).strip() |
380 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() | 395 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() |
... | @@ -439,6 +454,24 @@ class Comparison: | ... | @@ -439,6 +454,24 @@ class Comparison: |
439 | else: | 454 | else: |
440 | return self.build_res(compare_date <= ocr_date) | 455 | return self.build_res(compare_date <= ocr_date) |
441 | 456 | ||
457 | def se_bd_date_compare(self, input_str, ocr_str, **kwargs): | ||
458 | try: | ||
459 | input_date = datetime.strptime(input_str, "%Y-%m-%d").date() | ||
460 | ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d").date() | ||
461 | if kwargs.get('start', False): | ||
462 | if input_date != ocr_date: | ||
463 | return self.RESULT_N | ||
464 | |||
465 | six_month_date = (datetime.today() - relativedelta(months=6)).date() | ||
466 | today_date = datetime.today().date() | ||
467 | return self.build_res(six_month_date <= ocr_date <= today_date) | ||
468 | else: | ||
469 | if input_date == ocr_date or ocr_date == input_date + relativedelta(days=1): | ||
470 | return self.RESULT_Y | ||
471 | return self.RESULT_N | ||
472 | except Exception as e: | ||
473 | return self.RESULT_N | ||
474 | |||
442 | 475 | ||
443 | cp = Comparison() | 476 | cp = Comparison() |
444 | 477 | ... | ... |
src/common/tools/mssql_script11.py
0 → 100644
1 | import pyodbc | ||
2 | |||
3 | hil_sql = """ | ||
4 | ALTER TABLE hil_ocr_result ADD bd_ocr nvarchar(max); | ||
5 | ALTER TABLE hil_se_ocr_result ADD bd_ocr nvarchar(max); | ||
6 | """ | ||
7 | |||
8 | afc_sql = """ | ||
9 | ALTER TABLE afc_ocr_result ADD bd_ocr nvarchar(max); | ||
10 | ALTER TABLE afc_se_ocr_result ADD bd_ocr nvarchar(max); | ||
11 | """ | ||
12 | |||
13 | hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
14 | |||
15 | hil_cursor = hil_cnxn.cursor() | ||
16 | hil_cursor.execute(hil_sql) | ||
17 | |||
18 | hil_cursor.close() | ||
19 | hil_cnxn.close() | ||
20 | |||
21 | afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
22 | |||
23 | afc_cursor = afc_cnxn.cursor() | ||
24 | afc_cursor.execute(afc_sql) | ||
25 | |||
26 | afc_cursor.close() | ||
27 | afc_cnxn.close() |
-
Please register or sign in to post a comment