part 1
Showing
3 changed files
with
208 additions
and
41 deletions
... | @@ -1021,6 +1021,8 @@ JYPZ_FIELD_ORDER = (("type", "标题"), | ... | @@ -1021,6 +1021,8 @@ JYPZ_FIELD_ORDER = (("type", "标题"), |
1021 | CONTRACT_CN_NAME = '合同' | 1021 | CONTRACT_CN_NAME = '合同' |
1022 | CONTRACT_CLASSIFY = 41 | 1022 | CONTRACT_CLASSIFY = 41 |
1023 | 1023 | ||
1024 | # 合同编号: 每页 | ||
1025 | |||
1024 | HIL_CONTRACT_1_CN_NAME = '售后回租合同' | 1026 | HIL_CONTRACT_1_CN_NAME = '售后回租合同' |
1025 | HIL_CONTRACT_1_CLASSIFY = 43 | 1027 | HIL_CONTRACT_1_CLASSIFY = 43 |
1026 | 1028 | ||
... | @@ -1379,15 +1381,49 @@ SE_CORPORATE_ALL_FIELD = ['companyName', 'legalRepName', 'firstIdNo', 'businessL | ... | @@ -1379,15 +1381,49 @@ SE_CORPORATE_ALL_FIELD = ['companyName', 'legalRepName', 'firstIdNo', 'businessL |
1379 | 'taxRegistrationCertificateNo', 'establishmentDate', 'businessLicenseDueDate'] | 1381 | 'taxRegistrationCertificateNo', 'establishmentDate', 'businessLicenseDueDate'] |
1380 | SE_NEW_FIELD = ['vinNo', 'dealer', 'vehicleTransactionAmount'] | 1382 | SE_NEW_FIELD = ['vinNo', 'dealer', 'vehicleTransactionAmount'] |
1381 | SE_USED_FIELD = ['vinNo', 'vehicleTransactionAmount'] | 1383 | SE_USED_FIELD = ['vinNo', 'vehicleTransactionAmount'] |
1382 | SE_NEW_ADD_FIELD = ['customerName', 'idNum', 'dateOfInvoice', 'stamp'] | 1384 | SE_NEW_ADD_FIELD = ['customerName', 'idNum', 'dateOfInvoice', 'stamp', '发票联', '发票真伪校验'] |
1385 | SE_FPL_VALUE = '发票联' | ||
1383 | SE_STAMP_VALUE = '有' | 1386 | SE_STAMP_VALUE = '有' |
1384 | SE_GB_NEW_FIELD = ['vinNo'] | 1387 | SE_GB_NEW_FIELD = ['vinNo'] |
1385 | SE_GB_USED_FIELD = ['customerName', 'idNum', 'date'] | 1388 | SE_GB_USED_FIELD = ['customerName', 'idNum', 'date'] |
1386 | SE_HMH_FIELD = ['customerName', 'idNum', 'applicationId'] | 1389 | SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', '申请号', '渠道', '签字'] |
1387 | 1390 | ||
1388 | SE_BANK_FIELD = ['accountNo', 'bankName'] | 1391 | SE_BANK_FIELD = ['accountNo', 'bankName'] |
1389 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] | 1392 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] |
1390 | 1393 | ||
1394 | SE_AFC_CON_FIELD = ['合同编号-每页', '所购车辆价格-小写-重要条款', '车架号-重要条款', '贷款本金金额-重要条款', '贷款期限-重要条款', | ||
1395 | '车辆贷款本金金额-重要条款', '附加产品融资贷款本金总额-重要条款', '所购车辆价格', '车架号', '经销商', | ||
1396 | '贷款本金金额', '车辆贷款本金金额', '附加产品融资贷款本金总额', '贷款期限', '还款账号', '户名', '开户行', | ||
1397 | '还款计划表', '项目1', '用途总金额', '贷款本金', '附加产品融资贷款本金总金额', '购置税校验'] | ||
1398 | # | ||
1399 | # '借款人签字-重要条款' | ||
1400 | # '借款人姓名' | ||
1401 | # '借款人证件号' | ||
1402 | # '主借人签字' | ||
1403 | # '主借人日期' | ||
1404 | # | ||
1405 | # '共借人姓名' | ||
1406 | # '共借人证件号' | ||
1407 | # '共借人签字' | ||
1408 | # '共借人日期' | ||
1409 | # | ||
1410 | # '保证人姓名1' | ||
1411 | # '保证人证件号1' | ||
1412 | # '保证人签字1' | ||
1413 | # '保证人日期' | ||
1414 | # | ||
1415 | # '保证人姓名2' | ||
1416 | # '保证人证件号2' | ||
1417 | # '保证人签字2' | ||
1418 | # '保证人日期' | ||
1419 | # | ||
1420 | # '见证人签字' | ||
1421 | # '见证人日期' | ||
1422 | |||
1423 | GZS_NAME = '车辆购置税' | ||
1424 | GZS_STATUS = ['Y', 'N', 'O'] | ||
1425 | SCHEDULE_SPLIT_STR = '、' | ||
1426 | |||
1391 | HIL_COMPANY_NAME = '先锋国际融资租赁有限公司' | 1427 | HIL_COMPANY_NAME = '先锋国际融资租赁有限公司' |
1392 | AFC_COMPANY_NAME = '宝马汽车金融(中国)有限公司' | 1428 | AFC_COMPANY_NAME = '宝马汽车金融(中国)有限公司' |
1393 | 1429 | ||
... | @@ -1404,6 +1440,7 @@ BC_EN = 'Bank Card' | ... | @@ -1404,6 +1440,7 @@ BC_EN = 'Bank Card' |
1404 | DDA_EN = 'DDA' | 1440 | DDA_EN = 'DDA' |
1405 | HMH_EN = 'Mortgage Waiver Letter' | 1441 | HMH_EN = 'Mortgage Waiver Letter' |
1406 | JYPZ_EN = 'Used Car Document' | 1442 | JYPZ_EN = 'Used Car Document' |
1443 | AFC_CONTRACT_EN = 'AFC Contract' | ||
1407 | 1444 | ||
1408 | SKIP_CARD = {ID_EN, RP_EN} | 1445 | SKIP_CARD = {ID_EN, RP_EN} |
1409 | 1446 | ||
... | @@ -1411,10 +1448,11 @@ SKIP_CARD = {ID_EN, RP_EN} | ... | @@ -1411,10 +1448,11 @@ SKIP_CARD = {ID_EN, RP_EN} |
1411 | ID_COMPARE_LOGIC = { | 1448 | ID_COMPARE_LOGIC = { |
1412 | 'customerName': ('姓名', 'se_name_compare', {}), | 1449 | 'customerName': ('姓名', 'se_name_compare', {}), |
1413 | 'idNum': ('公民身份号码', 'se_common_compare', {}), | 1450 | 'idNum': ('公民身份号码', 'se_common_compare', {}), |
1414 | 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': ''}), | 1451 | # 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': ''}), |
1415 | 'idExpiryDate': ('有效期限', 'se_date_compare', {'long': True, 'ocr_split': True, 'input_replace': '', 'today': True}), | 1452 | 'idExpiryDate': ('有效期限', 'se_date_compare', {'long': True, 'ocr_split': True, 'input_replace': '', 'today': True}), |
1416 | 'hukouProvince': ('住址', 'se_contain_compare', {}), | 1453 | 'hukouProvince': ('住址', 'se_contain_compare', {}), |
1417 | 'hukouCity': ('住址', 'se_contain_compare', {}), | 1454 | 'hukouCity': ('住址', 'se_contain_compare', {}), |
1455 | IC_TURE_OR_FALSE: (IC_TURE_OR_FALSE, 'se_common_compare', {}), | ||
1418 | } | 1456 | } |
1419 | 1457 | ||
1420 | PP_COMPARE_LOGIC = { | 1458 | PP_COMPARE_LOGIC = { |
... | @@ -1463,13 +1501,20 @@ BL_COMPARE_LOGIC = { | ... | @@ -1463,13 +1501,20 @@ BL_COMPARE_LOGIC = { |
1463 | 1501 | ||
1464 | MVI_COMPARE_LOGIC = { | 1502 | MVI_COMPARE_LOGIC = { |
1465 | 'vinNo': ('车辆识别代码', 'se_common_compare', {}), | 1503 | 'vinNo': ('车辆识别代码', 'se_common_compare', {}), |
1466 | 'dealer': ('销方名称', 'se_common_compare', {}), | 1504 | 'dealer': ('销方名称', 'se_contain_compare_2', {}), |
1467 | 'vehicleTransactionAmount': ('价税合计小写', 'se_amount_compare', {}), | 1505 | 'vehicleTransactionAmount': ('价税合计小写', 'se_amount_compare', {}), |
1468 | 'customerName': ('购方名称', 'se_name_compare', {'is_passport': True}), | 1506 | 'customerName': ('购方名称', 'se_common_compare', {}), |
1469 | 'idNum': ('购买方身份证号或组织机构代码', 'se_contain_compare_2', {}), | 1507 | 'idNum': ('购买方身份证号或组织机构代码', 'se_common_compare', {}), |
1470 | 'dateOfInvoice': ('开票日期', 'se_date_compare_2', {'three_month': True}), | 1508 | 'dateOfInvoice': ('开票日期', 'se_date_compare_2', {'three_month': True}), |
1471 | 'stamp': ('销售单位章', 'se_common_compare', {}), | 1509 | 'stamp': ('销售单位章', 'se_common_compare', {}), |
1510 | '发票联': ('发票类型', 'se_common_compare', {}), | ||
1511 | '发票真伪校验': ('发票真伪校验', 'se_common_compare', {}), | ||
1472 | } | 1512 | } |
1513 | ZW_METHOD = 'mvi_special' | ||
1514 | LOWER_AMOUNT_FIELD = '价税合计小写' | ||
1515 | UPPER_AMOUNT_FIELD = '价税合计大写' | ||
1516 | BHSJ_FIELD = '不含税价' | ||
1517 | ZZSSE_FIELD = '增值税税额' | ||
1473 | 1518 | ||
1474 | UCI_COMPARE_LOGIC = { | 1519 | UCI_COMPARE_LOGIC = { |
1475 | 'vinNo': ('车架号', 'se_common_compare', {}), | 1520 | 'vinNo': ('车架号', 'se_common_compare', {}), |
... | @@ -1497,9 +1542,11 @@ MVC34_COMPARE_LOGIC = { | ... | @@ -1497,9 +1542,11 @@ MVC34_COMPARE_LOGIC = { |
1497 | 'date': (TRANSFER_DATE, 'se_date_compare_2', {}), | 1542 | 'date': (TRANSFER_DATE, 'se_date_compare_2', {}), |
1498 | } | 1543 | } |
1499 | 1544 | ||
1545 | BC_TYPE_VALUE = '借记卡' | ||
1500 | BC_COMPARE_LOGIC = { | 1546 | BC_COMPARE_LOGIC = { |
1501 | 'accountNo': ('CardNum', 'se_common_compare', {'remove_space': True}), | 1547 | 'accountNo': ('CardNum', 'se_common_compare', {'remove_space': True}), |
1502 | 'bankName': ('BankName', 'se_both_contain_compare', {}), | 1548 | 'bankName': ('BankName', 'se_both_contain_compare', {}), |
1549 | 'type': ('CardType', 'se_common_compare', {}), | ||
1503 | } | 1550 | } |
1504 | 1551 | ||
1505 | DDA_COMPARE_LOGIC = { | 1552 | DDA_COMPARE_LOGIC = { |
... | @@ -1522,9 +1569,11 @@ JYPZ_COMPARE_LOGIC = { | ... | @@ -1522,9 +1569,11 @@ JYPZ_COMPARE_LOGIC = { |
1522 | } | 1569 | } |
1523 | 1570 | ||
1524 | HMH_COMPARE_LOGIC = { | 1571 | HMH_COMPARE_LOGIC = { |
1525 | 'customerName': ('借款/承租人姓名', 'se_name_compare', {}), | 1572 | '借款人/承租人姓名': ('借款/承租人姓名', 'se_name_compare', {}), |
1526 | 'idNum': ('证件号码', 'se_common_compare', {}), | 1573 | '借款人/承租人证件号': ('证件号码', 'se_common_compare', {}), |
1527 | 'applicationId': ('合同编号', 'se_contain_compare', {}), | 1574 | '申请号': ('合同编号', 'se_common_compare', {}), |
1575 | '渠道': ('渠道', 'se_common_compare', {}), | ||
1576 | '签字': ('借款人签字/盖章', 'se_common_compare', {}), | ||
1528 | } | 1577 | } |
1529 | 1578 | ||
1530 | # MVC_OCR_FIELD = 'mvc_ocr' | 1579 | # MVC_OCR_FIELD = 'mvc_ocr' | ... | ... |
... | @@ -903,7 +903,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -903,7 +903,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
903 | customer_name = individual_info.get('name', '') | 903 | customer_name = individual_info.get('name', '') |
904 | legal_name = individual_info.get('legalRepName', '') | 904 | legal_name = individual_info.get('legalRepName', '') |
905 | establishment_date = individual_info.get('establishmentDate', '') | 905 | establishment_date = individual_info.get('establishmentDate', '') |
906 | date_of_birth = individual_info.get('dateOfBirth', '') | 906 | # date_of_birth = individual_info.get('dateOfBirth', '') |
907 | 907 | ||
908 | for id_info in individual_info.get('IDInformation', []): | 908 | for id_info in individual_info.get('IDInformation', []): |
909 | if id_info.get('idType') in consts.SE_CMS_FIRST_ID_FIELD_MAPPING: | 909 | if id_info.get('idType') in consts.SE_CMS_FIRST_ID_FIELD_MAPPING: |
... | @@ -913,11 +913,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -913,11 +913,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
913 | field_input = [ | 913 | field_input = [ |
914 | ('customerName', customer_name), | 914 | ('customerName', customer_name), |
915 | ('idNum', id_num), | 915 | ('idNum', id_num), |
916 | ('dateOfBirth', date_of_birth), | 916 | # ('dateOfBirth', date_of_birth), |
917 | ('idExpiryDate', id_info.get('idExpiryDate', '')), | 917 | # ('idExpiryDate', id_info.get('idExpiryDate', '')), |
918 | ] | 918 | ] |
919 | if is_prc: | 919 | if is_prc: |
920 | field_input.append(('hukouProvince', province)) | 920 | # field_input.append(('hukouProvince', province)) |
921 | field_input.append(('真伪', province)) | ||
922 | field_input.append(('idExpiryDate', id_info.get('idExpiryDate', ''))) | ||
921 | license_dict[license_en] = field_input | 923 | license_dict[license_en] = field_input |
922 | all_id_num.append(id_num) | 924 | all_id_num.append(id_num) |
923 | elif id_info.get('idType') == 'Unified Social Credit Code': | 925 | elif id_info.get('idType') == 'Unified Social Credit Code': |
... | @@ -971,7 +973,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -971,7 +973,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
971 | dda_num_list.append(dda_num_part) | 973 | dda_num_list.append(dda_num_part) |
972 | dda_name = '、'.join(dda_name_list) | 974 | dda_name = '、'.join(dda_name_list) |
973 | dda_num = '、'.join(dda_num_list) | 975 | dda_num = '、'.join(dda_num_list) |
974 | del main_role_info | 976 | # del main_role_info |
975 | 977 | ||
976 | if len(company_info_list) > 0: | 978 | if len(company_info_list) > 0: |
977 | company_info = company_info_list[0] | 979 | company_info = company_info_list[0] |
... | @@ -983,20 +985,27 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -983,20 +985,27 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
983 | vehicle_status = cms_info.get('vehicleStatus', '') | 985 | vehicle_status = cms_info.get('vehicleStatus', '') |
984 | first_submmison_date = cms_info.get('submissionDate', '') | 986 | first_submmison_date = cms_info.get('submissionDate', '') |
985 | vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '') | 987 | vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '') |
986 | amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '')) | 988 | amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '0.0')) |
987 | if vehicle_status == 'New': | 989 | if vehicle_status == 'New': |
988 | vehicle_field_input.append(('vinNo', vin_no)) | 990 | vehicle_field_input.append(('vinNo', vin_no)) |
989 | vehicle_field_input.append(('dealer', cms_info.get('dealerName', ''))) | 991 | vehicle_field_input.append(('dealer', '、'.join([cms_info.get('dealerName', ''), cms_info.get('fapiaoIssuerDealer', '')]))) |
990 | vehicle_field_input.append(('vehicleTransactionAmount', amount)) | 992 | vehicle_field_input.append(('vehicleTransactionAmount', amount)) |
991 | 993 | ||
992 | if isinstance(company_info, tuple): | 994 | if isinstance(company_info, tuple): |
993 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], company_info[0])) | 995 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], company_info[0])) |
994 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], company_info[1])) | 996 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], company_info[1])) |
995 | else: | 997 | else: |
996 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], main_name)) | 998 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], hmh_name)) |
997 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], main_num)) | 999 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], hmh_id)) |
998 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[2], first_submmison_date)) | 1000 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[2], first_submmison_date)) |
999 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[3], consts.SE_STAMP_VALUE)) | 1001 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[3], consts.SE_STAMP_VALUE)) |
1002 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[4], consts.SE_FPL_VALUE)) | ||
1003 | bhsj = float(amount) / 1.13 | ||
1004 | vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[5], consts.SPLIT_STR.join([ | ||
1005 | str(bhsj), | ||
1006 | str(float(amount) - bhsj), | ||
1007 | consts.RESULT_Y | ||
1008 | ]))) | ||
1000 | vehicle_info[consts.MVI_EN] = vehicle_field_input | 1009 | vehicle_info[consts.MVI_EN] = vehicle_field_input |
1001 | else: | 1010 | else: |
1002 | gb_field_input = [ | 1011 | gb_field_input = [ |
... | @@ -1044,6 +1053,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1044,6 +1053,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1044 | bank_field_input = [ | 1053 | bank_field_input = [ |
1045 | ('accountNo', account_no), | 1054 | ('accountNo', account_no), |
1046 | ('bankName', bank_name), | 1055 | ('bankName', bank_name), |
1056 | ('type', consts.BC_TYPE_VALUE), | ||
1047 | ] | 1057 | ] |
1048 | bank_info[consts.BC_EN] = bank_field_input | 1058 | bank_info[consts.BC_EN] = bank_field_input |
1049 | 1059 | ||
... | @@ -1061,16 +1071,90 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1061,16 +1071,90 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1061 | bank_info[consts.DDA_EN] = dda_field_input | 1071 | bank_info[consts.DDA_EN] = dda_field_input |
1062 | compare_info['bankInfo'] = bank_info | 1072 | compare_info['bankInfo'] = bank_info |
1063 | 1073 | ||
1074 | full_no = cms_info.get('settlemnetVerification', {}).get('applicationNo', '') | ||
1064 | if cms_info.get('mortgageType', '') == 'Mortgage Free': | 1075 | if cms_info.get('mortgageType', '') == 'Mortgage Free': |
1065 | other_info = {} | 1076 | other_info = {} |
1066 | hmh_field_input = [ | 1077 | hmh_field_input = [ |
1067 | (consts.SE_HMH_FIELD[0], hmh_name), | 1078 | (consts.SE_HMH_FIELD[0], hmh_name), |
1068 | (consts.SE_HMH_FIELD[1], hmh_id), | 1079 | (consts.SE_HMH_FIELD[1], hmh_id), |
1069 | (consts.SE_HMH_FIELD[2], last_obj.application_id) | 1080 | (consts.SE_HMH_FIELD[2], full_no), |
1081 | (consts.SE_HMH_FIELD[3], cms_info.get('financeCompany', '')), | ||
1082 | (consts.SE_HMH_FIELD[4], consts.SE_STAMP_VALUE), | ||
1070 | ] | 1083 | ] |
1071 | other_info[consts.HMH_EN] = hmh_field_input | 1084 | other_info[consts.HMH_EN] = hmh_field_input |
1072 | compare_info['other'] = other_info | 1085 | compare_info['other'] = other_info |
1073 | 1086 | ||
1087 | contract_info = {} | ||
1088 | |||
1089 | schedule_list = [] | ||
1090 | for schedule_dict in cms_info.get('paymentSchedule', []): | ||
1091 | tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')), | ||
1092 | str(schedule_dict.get('grossRentalAmount', ''))) | ||
1093 | schedule_list.append(tmp_str) | ||
1094 | schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list) | ||
1095 | |||
1096 | afc_contract_input = [ | ||
1097 | (consts.SE_AFC_CON_FIELD[0], full_no), | ||
1098 | (consts.SE_AFC_CON_FIELD[1], amount), | ||
1099 | (consts.SE_AFC_CON_FIELD[2], vin_no), | ||
1100 | (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1101 | (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))), | ||
1102 | (consts.SE_AFC_CON_FIELD[5], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))), | ||
1103 | (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1104 | (consts.SE_AFC_CON_FIELD[7], amount), | ||
1105 | (consts.SE_AFC_CON_FIELD[8], vin_no), | ||
1106 | (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')), | ||
1107 | (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1108 | (consts.SE_AFC_CON_FIELD[11], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))), | ||
1109 | (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1110 | (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))), | ||
1111 | (consts.SE_AFC_CON_FIELD[14], account_no), | ||
1112 | (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')), | ||
1113 | (consts.SE_AFC_CON_FIELD[16], bank_name), | ||
1114 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | ||
1115 | ] | ||
1116 | |||
1117 | asp_list = [] | ||
1118 | for asp_info in cms_info.get('associatedServices', []): | ||
1119 | asp_list.append( | ||
1120 | ( | ||
1121 | asp_info.get('associatedServices', ''), | ||
1122 | asp_info.get('price', 0.0), | ||
1123 | asp_info.get('financed', 0.0) | ||
1124 | ) | ||
1125 | ) | ||
1126 | |||
1127 | if len(asp_list) > 0: | ||
1128 | fin_total = 0 | ||
1129 | gzs_status = consts.GZS_STATUS[1] | ||
1130 | for asp_name, asp_price, asp_fin in asp_list: | ||
1131 | if gzs_status == consts.GZS_STATUS[1]: | ||
1132 | if consts.GZS_NAME in asp_name: | ||
1133 | gzs_status = consts.GZS_STATUS[0] | ||
1134 | if gzs_status == consts.GZS_STATUS[0]: | ||
1135 | if consts.GZS_NAME not in asp_name: | ||
1136 | gzs_status = consts.GZS_STATUS[2] | ||
1137 | afc_contract_input.extend( | ||
1138 | [ | ||
1139 | (consts.SE_AFC_CON_FIELD[18], asp_name), | ||
1140 | (consts.SE_AFC_CON_FIELD[19], str(asp_price)), | ||
1141 | (consts.SE_AFC_CON_FIELD[20], str(asp_fin)), | ||
1142 | ] | ||
1143 | ) | ||
1144 | fin_total += asp_fin | ||
1145 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], str(fin_total))) | ||
1146 | |||
1147 | # CMS Vehicle Price / 1.13 * 10 % | ||
1148 | gzs_list = [gzs_status] | ||
1149 | if gzs_status != consts.GZS_STATUS[1]: | ||
1150 | gzs_value = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', 0.0) * 0.1 / 1.13) | ||
1151 | gzs_list.append(gzs_value) | ||
1152 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], consts.SPLIT_STR.join(gzs_list))) | ||
1153 | |||
1154 | # role_name, _, role_id = main_role_info[applicant_type][0] | ||
1155 | |||
1156 | contract_info[consts.AFC_CONTRACT_EN] = afc_contract_input | ||
1157 | compare_info['contract'] = contract_info | ||
1074 | return compare_info, cms_info.get('applicationVersion', 1) | 1158 | return compare_info, cms_info.get('applicationVersion', 1) |
1075 | 1159 | ||
1076 | 1160 | ||
... | @@ -1433,28 +1517,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -1433,28 +1517,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
1433 | 1517 | ||
1434 | # 身份证、居住证 过期期限特殊处理 | 1518 | # 身份证、居住证 过期期限特殊处理 |
1435 | if special_expiry_date: | 1519 | if special_expiry_date: |
1436 | expiry_dates = set() | 1520 | expiry_dates = dict() |
1437 | expiry_dates_img_path = set() | ||
1438 | key = compare_logic.get('idExpiryDate')[0] | 1521 | key = compare_logic.get('idExpiryDate')[0] |
1439 | for ocr_res in ocr_res_list: | 1522 | for date_tmp_idx, ocr_res in enumerate(ocr_res_list): |
1440 | if key in ocr_res: | 1523 | if key in ocr_res: |
1441 | expiry_dates.add(ocr_res[key]) | 1524 | expiry_dates[ocr_res[key]] = (ocr_res.get(consts.IMG_PATH_KEY_2, ''), date_tmp_idx) |
1442 | expiry_dates_img_path.add(ocr_res.get(consts.IMG_PATH_KEY_2, '')) | ||
1443 | else: | 1525 | else: |
1444 | expiry_dates = set() | 1526 | expiry_dates = dict() |
1445 | expiry_dates_img_path = set() | ||
1446 | 1527 | ||
1447 | for res_idx in range(length-1, -1, -1): | 1528 | for res_idx in range(length-1, -1, -1): |
1448 | if is_find: | 1529 | if is_find: |
1449 | break | 1530 | break |
1450 | 1531 | ||
1451 | for idx, (name, value) in enumerate(field_list): | 1532 | for idx, (name, value) in enumerate(field_list): |
1452 | ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0]) | 1533 | if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[-1]: |
1534 | ocr_str = getattr(cp, consts.ZW_METHOD)( | ||
1535 | ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''), | ||
1536 | ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''), | ||
1537 | ocr_res_list[res_idx].get(consts.BHSJ_FIELD, ''), | ||
1538 | ocr_res_list[res_idx].get(consts.ZZSSE_FIELD, '') | ||
1539 | ) | ||
1540 | else: | ||
1541 | ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0]) | ||
1453 | if not isinstance(ocr_str, str): | 1542 | if not isinstance(ocr_str, str): |
1454 | result = consts.RESULT_N | 1543 | result = consts.RESULT_N |
1455 | ocr_str = empty_str | 1544 | ocr_str = empty_str |
1545 | no_key = True | ||
1456 | else: | 1546 | else: |
1457 | result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) | 1547 | result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) |
1548 | no_key = False | ||
1458 | 1549 | ||
1459 | if idx == 0 and result == consts.RESULT_N and length > 1: | 1550 | if idx == 0 and result == consts.RESULT_N and length > 1: |
1460 | break | 1551 | break |
... | @@ -1468,21 +1559,25 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -1468,21 +1559,25 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
1468 | 1559 | ||
1469 | # 过期期限特殊处理 | 1560 | # 过期期限特殊处理 |
1470 | if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N: | 1561 | if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N: |
1471 | for expiry_date in expiry_dates: | 1562 | if no_key: |
1472 | expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2]) | 1563 | for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items(): |
1473 | if expiry_date_res == consts.RESULT_Y: | 1564 | expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2]) |
1474 | ocr_str = expiry_date | 1565 | if expiry_date_res == consts.RESULT_N: |
1475 | result = expiry_date_res | 1566 | ocr_str = expiry_date |
1476 | break | 1567 | img_path = date_img_path |
1477 | 1568 | special_expiry_date_slice = True | |
1478 | if result == consts.RESULT_N: | 1569 | section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get( |
1479 | if consts.IMG_PATH_KEY_2 in ocr_res_list[res_idx]: | 1570 | consts.SECTION_IMG_PATH_KEY_2, '') |
1480 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '') | 1571 | section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get( |
1481 | special_expiry_date_slice = True | 1572 | consts.ALL_POSITION_KEY_2, {}) |
1573 | break | ||
1482 | else: | 1574 | else: |
1483 | img_path = expiry_dates_img_path.pop() if len(expiry_dates_img_path) > 0 else empty_str | 1575 | ocr_str = empty_str |
1576 | result = consts.RESULT_Y | ||
1577 | img_path = empty_str | ||
1484 | else: | 1578 | else: |
1485 | img_path = empty_str | 1579 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '') |
1580 | special_expiry_date_slice = True | ||
1486 | else: | 1581 | else: |
1487 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str | 1582 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str |
1488 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | 1583 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value |
... | @@ -1850,8 +1945,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -1850,8 +1945,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
1850 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | 1945 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 |
1851 | if is_ca: | 1946 | if is_ca: |
1852 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | 1947 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult |
1948 | ca_ocr_res_dict = dict() | ||
1853 | else: | 1949 | else: |
1854 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult | 1950 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult |
1951 | ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
1952 | if ocr_res_id is None: | ||
1953 | ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values(consts.IC_OCR_FIELD).first() | ||
1954 | else: | ||
1955 | ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values(consts.IC_OCR_FIELD).first() | ||
1855 | if ocr_res_id is None: | 1956 | if ocr_res_id is None: |
1856 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() | 1957 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() |
1857 | else: | 1958 | else: |
... | @@ -1865,6 +1966,12 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -1865,6 +1966,12 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
1865 | if is_ca: | 1966 | if is_ca: |
1866 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) | 1967 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) |
1867 | else: | 1968 | else: |
1969 | if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(consts.IC_OCR_FIELD), str): | ||
1970 | tmp_ca_result = json.loads(ca_ocr_res_dict.get(consts.IC_OCR_FIELD)) | ||
1971 | if isinstance(ocr_res_dict.get(consts.IC_OCR_FIELD), str): | ||
1972 | tmp_se_result = json.loads(ocr_res_dict.get(consts.IC_OCR_FIELD)) | ||
1973 | tmp_ca_result.extend(tmp_se_result) | ||
1974 | ocr_res_dict[consts.IC_OCR_FIELD] = json.dumps(tmp_ca_result) | ||
1868 | se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms) | 1975 | se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms) |
1869 | 1976 | ||
1870 | 1977 | ... | ... |
... | @@ -16,6 +16,7 @@ class Comparison: | ... | @@ -16,6 +16,7 @@ class Comparison: |
16 | self.CSIBM = 'CSIBM' | 16 | self.CSIBM = 'CSIBM' |
17 | self.CSSME = 'CSSME' | 17 | self.CSSME = 'CSSME' |
18 | self.CSOTH = 'CSOTH' | 18 | self.CSOTH = 'CSOTH' |
19 | self.SPLIT_STR = '_' | ||
19 | 20 | ||
20 | self.TYPE_MAPPING = ( | 21 | self.TYPE_MAPPING = ( |
21 | (r'个体工商户', self.CSIBM), | 22 | (r'个体工商户', self.CSIBM), |
... | @@ -109,6 +110,16 @@ class Comparison: | ... | @@ -109,6 +110,16 @@ class Comparison: |
109 | ocr_output = None | 110 | ocr_output = None |
110 | return self.build_res(input_str == ocr_str), ocr_output | 111 | return self.build_res(input_str == ocr_str), ocr_output |
111 | 112 | ||
113 | def mvi_special(self, amount_lower_str, amount_upper_str, bhsj_str, zzsse_str): | ||
114 | # 不含税价, 增值税税额 | ||
115 | try: | ||
116 | if float(amount_lower_str) != rmb_handler.to_rmb_lower(amount_upper_str): | ||
117 | return self.RESULT_N | ||
118 | except Exception: | ||
119 | return self.RESULT_N | ||
120 | else: | ||
121 | return self.SPLIT_STR.join([bhsj_str, zzsse_str, self.RESULT_Y]) | ||
122 | |||
112 | def rmb_compare(self, input_str, ocr_str, idx, **kwargs): | 123 | def rmb_compare(self, input_str, ocr_str, idx, **kwargs): |
113 | if not isinstance(ocr_str, str) or not isinstance(input_str, str): | 124 | if not isinstance(ocr_str, str) or not isinstance(input_str, str): |
114 | return self.RESULT_NA, None | 125 | return self.RESULT_NA, None |
... | @@ -198,7 +209,7 @@ class Comparison: | ... | @@ -198,7 +209,7 @@ class Comparison: |
198 | ) | 209 | ) |
199 | dti = DatetimeIndex(dt_array, tz=None, name=None) | 210 | dti = DatetimeIndex(dt_array, tz=None, name=None) |
200 | ts = dti[0] | 211 | ts = dti[0] |
201 | if isinstance(ts, NaTType) or ts.date() < datetime.today().date(): | 212 | if isinstance(ts, NaTType) or ts.date() < (datetime.today() + relativedelta(days=8)).date(): |
202 | return False | 213 | return False |
203 | else: | 214 | else: |
204 | return True | 215 | return True | ... | ... |
-
Please register or sign in to post a comment