d24fcf2c by 周伟奇

fix merge

2 parents fdb7ca98 806c91b2
...@@ -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,24 +1440,26 @@ BC_EN = 'Bank Card' ...@@ -1404,24 +1440,26 @@ 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
1410 1447
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 = {
1421 'customerName': ('英文姓名', 'se_name_compare', {'is_passport': True}), # 1 1459 'customerName': ('英文姓名', 'se_name_compare', {'is_passport': True}, '护照姓名与系统不一致'), # 1
1422 'idNum': ('护照号码', 'se_common_compare', {}), # 2 1460 'idNum': ('护照号码', 'se_common_compare', {}, '护照号码与系统不一致'), # 2
1423 'dateOfBirth': ('出生日期', 'se_date_compare', {'input_replace': ''}), # 2 1461 'dateOfBirth': ('出生日期', 'se_date_compare', {'input_replace': ''}, '护照出生日期与系统不一致'), # 2
1424 'idExpiryDate': ('有效期至', 'se_date_compare', {'input_replace': '', 'today': True}), # 2 1462 'idExpiryDate': ('有效期至', 'se_date_compare', {'input_replace': '', 'today': True}, '护照有效期疑似过期'), # 2
1425 } 1463 }
1426 1464
1427 PP_SLICE_MAP = { 1465 PP_SLICE_MAP = {
...@@ -1433,55 +1471,62 @@ PP_SLICE_MAP = { ...@@ -1433,55 +1471,62 @@ PP_SLICE_MAP = {
1433 } 1471 }
1434 1472
1435 EEP_COMPARE_LOGIC = { 1473 EEP_COMPARE_LOGIC = {
1436 'customerName': ('中文名', 'se_common_compare', {}), 1474 'customerName': ('中文名', 'se_common_compare', {}, '港澳台姓名与系统不一致'),
1437 'idNum': ('证件号码', 'se_common_compare', {}), 1475 'idNum': ('证件号码', 'se_common_compare', {}, '港澳台证件号码与系统不一致'),
1438 'dateOfBirth': ('出生日期', 'se_date_compare', {'input_replace': '.'}), 1476 'dateOfBirth': ('出生日期', 'se_date_compare', {'input_replace': '.'}, '港澳台出生日期与系统不一致'),
1439 'idExpiryDate': ('有效期限', 'se_date_compare', {'ocr_split': True, 'input_replace': '.', 'today': True}), 1477 'idExpiryDate': ('有效期限', 'se_date_compare', {'ocr_split': True, 'input_replace': '.', 'today': True}, '港澳台证件有效期疑似过期'),
1440 } 1478 }
1441 1479
1442 RP_COMPARE_LOGIC = { 1480 RP_COMPARE_LOGIC = {
1443 'customerName': ('姓名', 'se_name_compare', {}), 1481 'customerName': ('姓名', 'se_name_compare', {}, '居住证姓名与系统不一致'),
1444 'idNum': ('公民身份号码', 'se_common_compare', {}), 1482 'idNum': ('公民身份号码', 'se_common_compare', {}, '居住证公民号码与系统不一致'),
1445 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': ''}), 1483 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': '居住证出生年月与系统不一致'}),
1446 'idExpiryDate': ('有效期限', 'se_date_compare', {'ocr_split': True, 'input_replace': '', 'today': True}), 1484 'idExpiryDate': ('有效期限', 'se_date_compare', {'ocr_split': True, 'input_replace': '', 'today': True}, '居住证有效期疑似过期'),
1447 'hukouProvince': ('住址', 'se_contain_compare', {}), 1485 'hukouProvince': ('住址', 'se_contain_compare', {}, '居住证住址与系统不一致'),
1448 'hukouCity': ('住址', 'se_contain_compare', {}), 1486 'hukouCity': ('住址', 'se_contain_compare', {}, '居住证住址与系统不一致'),
1449 } 1487 }
1450 1488
1451 BL_COMPARE_LOGIC = { 1489 BL_COMPARE_LOGIC = {
1452 'companyName': ('企业名称', 'se_company_compare', {}), 1490 'companyName': ('企业名称', 'se_company_compare', {}, '营业执照公司名称与系统不一致'),
1453 'legalRepName': ('经营者姓名', 'se_name_compare', {}), 1491 'legalRepName': ('经营者姓名', 'se_name_compare', {}, '营业执照法定代表人与系统不一致'),
1454 'firstIdNo': ('注册号', 'se_common_compare', {}), 1492 'firstIdNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
1455 'businessLicenseNo': ('注册号', 'se_common_compare', {}), 1493 'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
1456 'organizationCreditCode': ('注册号', 'se_common_compare', {}), 1494 'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
1457 'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}), 1495 'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
1458 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True}), 1496 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True}, '营业执照显示公司成立不满足2年'),
1459 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}), 1497 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'),
1460 'organizationType': ('企业类型', 'se_type_compare', {}), 1498 'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'),
1461 'registeredCapital': ('注册资本', 'se_rmb_compare', {}), 1499 'registeredCapital': ('注册资本', 'se_rmb_compare', {}, '营业执照注册资本与系统不一致'),
1462 } 1500 }
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', {}, '二手车发票车架号与系统不一致'),
1476 'vehicleTransactionAmount': ('价税合计小写', 'se_amount_compare', {}), 1521 'vehicleTransactionAmount': ('价税合计小写', 'se_amount_compare', {}, '二手车发票车价合计与系统车辆价格不一致'),
1477 'customerName': ('购方名称', 'se_name_compare', {'is_passport': True}), 1522 'customerName': ('购方名称', 'se_name_compare', {'is_passport': True}, '二手车发票买方姓名与系统不一致'),
1478 'idNum': ('购方纳税人识别号', 'se_contain_compare_2', {}), 1523 'idNum': ('购方纳税人识别号', 'se_contain_compare_2', {}, '二手车发票买方证件号码与系统不一致'),
1479 'dateOfInvoice': ('开票日期', 'se_date_compare_2', {'three_month': True}), 1524 'dateOfInvoice': ('开票日期', 'se_date_compare_2', {'three_month': True}, '二手车发票开票日期早于首次提交申请日期'),
1480 'stamp': ('发票章', 'se_common_compare', {}), 1525 'stamp': ('发票章', 'se_common_compare', {}, '二手车发票章需人工核查'),
1481 } 1526 }
1482 1527
1483 MVC_COMPARE_LOGIC = { 1528 MVC_COMPARE_LOGIC = {
1484 'vinNo': ('9.车辆识别代号/车架号', 'se_common_compare', {}), 1529 'vinNo': ('9.车辆识别代号/车架号', 'se_common_compare', {}, '绿本车架号与系统车架号不一致'),
1485 # 'customerName': ('姓名/名称', ), 1530 # 'customerName': ('姓名/名称', ),
1486 # 'idNum': ('身份证明名称/号码', ), 1531 # 'idNum': ('身份证明名称/号码', ),
1487 # 'date': ('转移登记日期', ), 1532 # 'date': ('转移登记日期', ),
...@@ -1492,39 +1537,43 @@ TRANSFER_NUM = '身份证明名称/号码' ...@@ -1492,39 +1537,43 @@ TRANSFER_NUM = '身份证明名称/号码'
1492 TRANSFER_DATE = '转移登记日期' 1537 TRANSFER_DATE = '转移登记日期'
1493 1538
1494 MVC34_COMPARE_LOGIC = { 1539 MVC34_COMPARE_LOGIC = {
1495 'customerName': (TRANSFER_NAME, 'se_company_compare', {}), 1540 'customerName': (TRANSFER_NAME, 'se_company_compare', {}, '绿本最新转移登记人姓名与系统主借人不一致'),
1496 'idNum': (TRANSFER_NUM, 'se_contain_compare_2', {}), 1541 'idNum': (TRANSFER_NUM, 'se_contain_compare_2', {}, '绿本最新转移登记日证件号码与系统主借人证件号码不一致'),
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 = {
1506 'applicationId(1)': ('check_Num', 'se_common_compare', {}), 1553 'applicationId(1)': ('check_Num', 'se_common_compare', {}, 'DDA缴费编号与系统不一致'),
1507 'applicationId(2)': ('check_Num', 'se_common_compare', {}), 1554 'applicationId(2)': ('check_Num', 'se_common_compare', {}, 'DDA签署编号系统不一致'),
1508 'bankName': ('to_bank', 'se_both_contain_compare', {}), 1555 'bankName': ('to_bank', 'se_both_contain_compare', {}, 'DDA非工商银行'),
1509 'companyName': ('to_company', 'se_company_compare', {}), 1556 'companyName': ('to_company', 'se_company_compare', {}, 'DDA渠道与系统不一致'),
1510 'customerName': (DDA_IC_NAME, 'se_contain_compare_2', {}), 1557 'customerName': (DDA_IC_NAME, 'se_contain_compare_2', {}, 'DDA客户姓名与系统不一致'),
1511 'idNum': (DDA_IC_ID, 'se_contain_compare_2', {}), 1558 'idNum': (DDA_IC_ID, 'se_contain_compare_2', {}, 'DDA身份证号码与系统不一致'),
1512 'accountHolderName': (DDA_BC_NAME, 'se_common_compare', {}), 1559 'accountHolderName': (DDA_BC_NAME, 'se_common_compare', {}, 'DDA账户名与系统不一致'),
1513 'accountNo': (DDA_BC_ID, 'se_common_compare', {'remove_space': True}), 1560 'accountNo': (DDA_BC_ID, 'se_common_compare', {'remove_space': True}, 'DDA账号与系统不一致'),
1514 } 1561 }
1515 1562
1516 JYPZ_COMPARE_LOGIC = { 1563 JYPZ_COMPARE_LOGIC = {
1517 'vinNo': ('vin', 'se_common_compare', {}), 1564 'vinNo': ('vin', 'se_common_compare', {}, '二手车凭证车辆识别代号与系统车架号不一致'),
1518 'vehicleTransactionAmount': ('price', 'se_amount_compare', {}), 1565 'vehicleTransactionAmount': ('price', 'se_amount_compare', {}, '二手车凭证购买方交易价格与系统车辆价格不一致'),
1519 'customerName': ('buyer_name', 'se_name_compare', {'is_passport': True}), 1566 'customerName': ('buyer_name', 'se_name_compare', {'is_passport': True}, '二手车凭证购买方姓名与系统主借人姓名不一致'),
1520 'idNum': ('buyer_id', 'se_contain_compare_2', {}), 1567 'idNum': ('buyer_id', 'se_contain_compare_2', {}, '二手车凭证购买方证件号与系统主借人证件号不一致'),
1521 'date': ('date', 'se_date_compare_2', {}), 1568 'date': ('date', 'se_date_compare_2', {}, '二手车凭证购买方交易价格早于submissionDate'),
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'
......
...@@ -907,7 +907,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -907,7 +907,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
907 customer_name = individual_info.get('name', '') 907 customer_name = individual_info.get('name', '')
908 legal_name = individual_info.get('legalRepName', '') 908 legal_name = individual_info.get('legalRepName', '')
909 establishment_date = individual_info.get('establishmentDate', '') 909 establishment_date = individual_info.get('establishmentDate', '')
910 date_of_birth = individual_info.get('dateOfBirth', '') 910 # date_of_birth = individual_info.get('dateOfBirth', '')
911 911
912 for id_info in individual_info.get('IDInformation', []): 912 for id_info in individual_info.get('IDInformation', []):
913 if id_info.get('idType') in consts.SE_CMS_FIRST_ID_FIELD_MAPPING: 913 if id_info.get('idType') in consts.SE_CMS_FIRST_ID_FIELD_MAPPING:
...@@ -917,11 +917,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -917,11 +917,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
917 field_input = [ 917 field_input = [
918 ('customerName', customer_name), 918 ('customerName', customer_name),
919 ('idNum', id_num), 919 ('idNum', id_num),
920 ('dateOfBirth', date_of_birth), 920 # ('dateOfBirth', date_of_birth),
921 ('idExpiryDate', id_info.get('idExpiryDate', '')), 921 # ('idExpiryDate', id_info.get('idExpiryDate', '')),
922 ] 922 ]
923 if is_prc: 923 if is_prc:
924 field_input.append(('hukouProvince', province)) 924 # field_input.append(('hukouProvince', province))
925 field_input.append(('真伪', province))
926 field_input.append(('idExpiryDate', id_info.get('idExpiryDate', '')))
925 license_dict[license_en] = field_input 927 license_dict[license_en] = field_input
926 all_id_num.append(id_num) 928 all_id_num.append(id_num)
927 elif id_info.get('idType') == 'Unified Social Credit Code': 929 elif id_info.get('idType') == 'Unified Social Credit Code':
...@@ -975,7 +977,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -975,7 +977,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
975 dda_num_list.append(dda_num_part) 977 dda_num_list.append(dda_num_part)
976 dda_name = '、'.join(dda_name_list) 978 dda_name = '、'.join(dda_name_list)
977 dda_num = '、'.join(dda_num_list) 979 dda_num = '、'.join(dda_num_list)
978 del main_role_info 980 # del main_role_info
979 981
980 if len(company_info_list) > 0: 982 if len(company_info_list) > 0:
981 company_info = company_info_list[0] 983 company_info = company_info_list[0]
...@@ -987,20 +989,27 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -987,20 +989,27 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
987 vehicle_status = cms_info.get('vehicleStatus', '') 989 vehicle_status = cms_info.get('vehicleStatus', '')
988 first_submmison_date = cms_info.get('submissionDate', '') 990 first_submmison_date = cms_info.get('submissionDate', '')
989 vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '') 991 vin_no = cms_info.get('vehicleInformation', {}).get('vinNo', '')
990 amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '')) 992 amount = str(cms_info.get('financialInformation', {}).get('vehiclePrice', '0.0'))
991 if vehicle_status == 'New': 993 if vehicle_status == 'New':
992 vehicle_field_input.append(('vinNo', vin_no)) 994 vehicle_field_input.append(('vinNo', vin_no))
993 vehicle_field_input.append(('dealer', cms_info.get('dealerName', ''))) 995 vehicle_field_input.append(('dealer', '、'.join([cms_info.get('dealerName', ''), cms_info.get('fapiaoIssuerDealer', '')])))
994 vehicle_field_input.append(('vehicleTransactionAmount', amount)) 996 vehicle_field_input.append(('vehicleTransactionAmount', amount))
995 997
996 if isinstance(company_info, tuple): 998 if isinstance(company_info, tuple):
997 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], company_info[0])) 999 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], company_info[0]))
998 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], company_info[1])) 1000 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], company_info[1]))
999 else: 1001 else:
1000 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], main_name)) 1002 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[0], hmh_name))
1001 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], main_num)) 1003 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[1], hmh_id))
1002 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[2], first_submmison_date)) 1004 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[2], first_submmison_date))
1003 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[3], consts.SE_STAMP_VALUE)) 1005 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[3], consts.SE_STAMP_VALUE))
1006 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[4], consts.SE_FPL_VALUE))
1007 bhsj = float(amount) / 1.13
1008 vehicle_field_input.append((consts.SE_NEW_ADD_FIELD[5], consts.SPLIT_STR.join([
1009 str(bhsj),
1010 str(float(amount) - bhsj),
1011 consts.RESULT_Y
1012 ])))
1004 vehicle_info[consts.MVI_EN] = vehicle_field_input 1013 vehicle_info[consts.MVI_EN] = vehicle_field_input
1005 else: 1014 else:
1006 gb_field_input = [ 1015 gb_field_input = [
...@@ -1048,6 +1057,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -1048,6 +1057,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
1048 bank_field_input = [ 1057 bank_field_input = [
1049 ('accountNo', account_no), 1058 ('accountNo', account_no),
1050 ('bankName', bank_name), 1059 ('bankName', bank_name),
1060 ('type', consts.BC_TYPE_VALUE),
1051 ] 1061 ]
1052 bank_info[consts.BC_EN] = bank_field_input 1062 bank_info[consts.BC_EN] = bank_field_input
1053 1063
...@@ -1065,16 +1075,90 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): ...@@ -1065,16 +1075,90 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
1065 bank_info[consts.DDA_EN] = dda_field_input 1075 bank_info[consts.DDA_EN] = dda_field_input
1066 compare_info['bankInfo'] = bank_info 1076 compare_info['bankInfo'] = bank_info
1067 1077
1078 full_no = cms_info.get('settlemnetVerification', {}).get('applicationNo', '')
1068 if cms_info.get('mortgageType', '') == 'Mortgage Free': 1079 if cms_info.get('mortgageType', '') == 'Mortgage Free':
1069 other_info = {} 1080 other_info = {}
1070 hmh_field_input = [ 1081 hmh_field_input = [
1071 (consts.SE_HMH_FIELD[0], hmh_name), 1082 (consts.SE_HMH_FIELD[0], hmh_name),
1072 (consts.SE_HMH_FIELD[1], hmh_id), 1083 (consts.SE_HMH_FIELD[1], hmh_id),
1073 (consts.SE_HMH_FIELD[2], last_obj.application_id) 1084 (consts.SE_HMH_FIELD[2], full_no),
1085 (consts.SE_HMH_FIELD[3], cms_info.get('financeCompany', '')),
1086 (consts.SE_HMH_FIELD[4], consts.SE_STAMP_VALUE),
1074 ] 1087 ]
1075 other_info[consts.HMH_EN] = hmh_field_input 1088 other_info[consts.HMH_EN] = hmh_field_input
1076 compare_info['other'] = other_info 1089 compare_info['other'] = other_info
1077 1090
1091 # contract_info = {}
1092 #
1093 # schedule_list = []
1094 # for schedule_dict in cms_info.get('paymentSchedule', []):
1095 # tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')),
1096 # str(schedule_dict.get('grossRentalAmount', '')))
1097 # schedule_list.append(tmp_str)
1098 # schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list)
1099 #
1100 # afc_contract_input = [
1101 # (consts.SE_AFC_CON_FIELD[0], full_no),
1102 # (consts.SE_AFC_CON_FIELD[1], amount),
1103 # (consts.SE_AFC_CON_FIELD[2], vin_no),
1104 # (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))),
1105 # (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))),
1106 # (consts.SE_AFC_CON_FIELD[5], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))),
1107 # (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))),
1108 # (consts.SE_AFC_CON_FIELD[7], amount),
1109 # (consts.SE_AFC_CON_FIELD[8], vin_no),
1110 # (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')),
1111 # (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))),
1112 # (consts.SE_AFC_CON_FIELD[11], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))),
1113 # (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))),
1114 # (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))),
1115 # (consts.SE_AFC_CON_FIELD[14], account_no),
1116 # (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')),
1117 # (consts.SE_AFC_CON_FIELD[16], bank_name),
1118 # (consts.SE_AFC_CON_FIELD[17], schedule_list_str),
1119 # ]
1120 #
1121 # asp_list = []
1122 # for asp_info in cms_info.get('associatedServices', []):
1123 # asp_list.append(
1124 # (
1125 # asp_info.get('associatedServices', ''),
1126 # asp_info.get('price', 0.0),
1127 # asp_info.get('financed', 0.0)
1128 # )
1129 # )
1130 #
1131 # if len(asp_list) > 0:
1132 # fin_total = 0
1133 # gzs_status = consts.GZS_STATUS[1]
1134 # for asp_name, asp_price, asp_fin in asp_list:
1135 # if gzs_status == consts.GZS_STATUS[1]:
1136 # if consts.GZS_NAME in asp_name:
1137 # gzs_status = consts.GZS_STATUS[0]
1138 # if gzs_status == consts.GZS_STATUS[0]:
1139 # if consts.GZS_NAME not in asp_name:
1140 # gzs_status = consts.GZS_STATUS[2]
1141 # afc_contract_input.extend(
1142 # [
1143 # (consts.SE_AFC_CON_FIELD[18], asp_name),
1144 # (consts.SE_AFC_CON_FIELD[19], str(asp_price)),
1145 # (consts.SE_AFC_CON_FIELD[20], str(asp_fin)),
1146 # ]
1147 # )
1148 # fin_total += asp_fin
1149 # afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], str(fin_total)))
1150 #
1151 # # CMS Vehicle Price / 1.13 * 10 %
1152 # gzs_list = [gzs_status]
1153 # if gzs_status != consts.GZS_STATUS[1]:
1154 # gzs_value = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', 0.0) * 0.1 / 1.13)
1155 # gzs_list.append(gzs_value)
1156 # afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], consts.SPLIT_STR.join(gzs_list)))
1157 #
1158 # # role_name, _, role_id = main_role_info[applicant_type][0]
1159 #
1160 # contract_info[consts.AFC_CONTRACT_EN] = afc_contract_input
1161 # compare_info['contract'] = contract_info
1078 return compare_info, cms_info.get('applicationVersion', 1) 1162 return compare_info, cms_info.get('applicationVersion', 1)
1079 1163
1080 1164
...@@ -1446,28 +1530,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -1446,28 +1530,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
1446 1530
1447 # 身份证、居住证 过期期限特殊处理 1531 # 身份证、居住证 过期期限特殊处理
1448 if special_expiry_date: 1532 if special_expiry_date:
1449 expiry_dates = set() 1533 expiry_dates = dict()
1450 expiry_dates_img_path = set()
1451 key = compare_logic.get('idExpiryDate')[0] 1534 key = compare_logic.get('idExpiryDate')[0]
1452 for ocr_res in ocr_res_list: 1535 for date_tmp_idx, ocr_res in enumerate(ocr_res_list):
1453 if key in ocr_res: 1536 if key in ocr_res:
1454 expiry_dates.add(ocr_res[key]) 1537 expiry_dates[ocr_res[key]] = (ocr_res.get(consts.IMG_PATH_KEY_2, ''), date_tmp_idx)
1455 expiry_dates_img_path.add(ocr_res.get(consts.IMG_PATH_KEY_2, ''))
1456 else: 1538 else:
1457 expiry_dates = set() 1539 expiry_dates = dict()
1458 expiry_dates_img_path = set()
1459 1540
1460 for res_idx in range(length-1, -1, -1): 1541 for res_idx in range(length-1, -1, -1):
1461 if is_find: 1542 if is_find:
1462 break 1543 break
1463 1544
1464 for idx, (name, value) in enumerate(field_list): 1545 for idx, (name, value) in enumerate(field_list):
1546 if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[-1]:
1547 ocr_str = getattr(cp, consts.ZW_METHOD)(
1548 ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''),
1549 ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''),
1550 ocr_res_list[res_idx].get(consts.BHSJ_FIELD, ''),
1551 ocr_res_list[res_idx].get(consts.ZZSSE_FIELD, '')
1552 )
1553 else:
1465 ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0]) 1554 ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0])
1466 if not isinstance(ocr_str, str): 1555 if not isinstance(ocr_str, str):
1467 result = consts.RESULT_N 1556 result = consts.RESULT_N
1468 ocr_str = empty_str 1557 ocr_str = empty_str
1558 no_key = True
1469 else: 1559 else:
1470 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) 1560 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
1561 no_key = False
1471 1562
1472 if idx == 0 and result == consts.RESULT_N and length > 1: 1563 if idx == 0 and result == consts.RESULT_N and length > 1:
1473 break 1564 break
...@@ -1482,31 +1573,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -1482,31 +1573,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
1482 1573
1483 # 过期期限特殊处理 1574 # 过期期限特殊处理
1484 if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N: 1575 if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N:
1485 for expiry_date in expiry_dates: 1576 if no_key:
1577 for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items():
1486 expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2]) 1578 expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2])
1487 if expiry_date_res == consts.RESULT_Y: 1579 if expiry_date_res == consts.RESULT_N:
1488 ocr_str = expiry_date 1580 ocr_str = expiry_date
1489 result = expiry_date_res 1581 img_path = date_img_path
1490 break
1491
1492 if result == consts.RESULT_N:
1493 if consts.IMG_PATH_KEY_2 in ocr_res_list[res_idx]:
1494 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '')
1495 special_expiry_date_slice = True 1582 special_expiry_date_slice = True
1583 section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get(
1584 consts.SECTION_IMG_PATH_KEY_2, '')
1585 section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get(
1586 consts.ALL_POSITION_KEY_2, {})
1587 break
1496 else: 1588 else:
1497 img_path = expiry_dates_img_path.pop() if len(expiry_dates_img_path) > 0 else empty_str 1589 ocr_str = empty_str
1498 else: 1590 result = consts.RESULT_Y
1499 img_path = empty_str 1591 img_path = empty_str
1500 else: 1592 else:
1593 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '')
1594 special_expiry_date_slice = True
1595 else:
1501 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str 1596 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
1502 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 1597 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1503 result_field_list.append((name, value, result, ocr_str, img_path, error_type)) 1598 result_field_list.append((name, value, result, ocr_str, img_path, error_type, compare_logic[name][3]))
1504 else: 1599 else:
1505 no_ocr_result = True 1600 no_ocr_result = True
1506 1601
1507 if not is_find: 1602 if not is_find:
1508 for name, value in field_list: 1603 for name, value in field_list:
1509 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) 1604 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, '{0}未找到'.format(license_en)))
1510 1605
1511 if is_find: 1606 if is_find:
1512 if special_expiry_date_slice: 1607 if special_expiry_date_slice:
...@@ -1539,7 +1634,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -1539,7 +1634,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
1539 if os.path.exists(section_img_path): 1634 if os.path.exists(section_img_path):
1540 failed_field = [] 1635 failed_field = []
1541 base_img_path = empty_str 1636 base_img_path = empty_str
1542 for name, _, result, _, img_path, _ in result_field_list: 1637 for name, _, result, _, img_path, _, _ in result_field_list:
1543 if result == consts.RESULT_N: 1638 if result == consts.RESULT_N:
1544 if special_expiry_date_slice and name == 'idExpiryDate': 1639 if special_expiry_date_slice and name == 'idExpiryDate':
1545 continue 1640 continue
...@@ -1656,7 +1751,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): ...@@ -1656,7 +1751,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
1656 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) 1751 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
1657 img_path = base_img_path if result == consts.RESULT_N else empty_str 1752 img_path = base_img_path if result == consts.RESULT_N else empty_str
1658 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 1753 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1659 result_field_list.append((name, value, result, ocr_str, img_path, error_type)) 1754 result_field_list.append((name, value, result, ocr_str, img_path, error_type, compare_logic[name][3]))
1660 1755
1661 if result == consts.RESULT_N: 1756 if result == consts.RESULT_N:
1662 failed_field.append(name) 1757 failed_field.append(name)
...@@ -1687,7 +1782,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): ...@@ -1687,7 +1782,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
1687 1782
1688 if not is_find: 1783 if not is_find:
1689 for name, value in field_list: 1784 for name, value in field_list:
1690 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) 1785 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, '{0}未找到'.format(license_en)))
1691 1786
1692 return result_field_list, field_img_path_dict 1787 return result_field_list, field_img_path_dict
1693 1788
...@@ -1702,6 +1797,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1702,6 +1797,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1702 failed_count = 0 1797 failed_count = 0
1703 successful_at_this_level = True 1798 successful_at_this_level = True
1704 failure_reason = {} 1799 failure_reason = {}
1800 cn_reason_list = []
1705 1801
1706 for info_key, info_value in compare_info.items(): 1802 for info_key, info_value in compare_info.items():
1707 if info_key in ['individualCusInfo', 'applicantInformation']: 1803 if info_key in ['individualCusInfo', 'applicantInformation']:
...@@ -1716,13 +1812,14 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1716,13 +1812,14 @@ def se_compare_process(compare_info, ocr_res_dict):
1716 strip_list.append((a, b)) 1812 strip_list.append((a, b))
1717 failure_field = [] 1813 failure_field = []
1718 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) 1814 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list)
1719 for name, value, result, ocr_str, img_path, error_type in result_field_list: 1815 for name, value, result, ocr_str, img_path, error_type, cn_reason in result_field_list:
1720 if license_en not in consts.SKIP_CARD or not no_ocr_result: 1816 if license_en not in consts.SKIP_CARD or not no_ocr_result:
1721 total_fields += 1 1817 total_fields += 1
1722 if result == consts.RESULT_N: 1818 if result == consts.RESULT_N:
1723 failed_count += 1 1819 failed_count += 1
1724 successful_at_this_level = False 1820 successful_at_this_level = False
1725 failure_field.append(name) 1821 failure_field.append(name)
1822 cn_reason_list.append(cn_reason)
1726 compare_result.append( 1823 compare_result.append(
1727 { 1824 {
1728 consts.HEAD_LIST[0]: info_key, 1825 consts.HEAD_LIST[0]: info_key,
...@@ -1752,12 +1849,13 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1752,12 +1849,13 @@ def se_compare_process(compare_info, ocr_res_dict):
1752 result_field_list, field_img_path_dict = se_mvc34_compare(license_en, ocr_res_dict, strip_list) 1849 result_field_list, field_img_path_dict = se_mvc34_compare(license_en, ocr_res_dict, strip_list)
1753 else: 1850 else:
1754 result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) 1851 result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list)
1755 for name, value, result, ocr_str, img_path, error_type in result_field_list: 1852 for name, value, result, ocr_str, img_path, error_type, cn_reason in result_field_list:
1756 total_fields += 1 1853 total_fields += 1
1757 if result == consts.RESULT_N: 1854 if result == consts.RESULT_N:
1758 failed_count += 1 1855 failed_count += 1
1759 successful_at_this_level = False 1856 successful_at_this_level = False
1760 failure_field.append(name) 1857 failure_field.append(name)
1858 cn_reason_list.append(cn_reason)
1761 compare_result.append( 1859 compare_result.append(
1762 { 1860 {
1763 consts.HEAD_LIST[0]: info_key, 1861 consts.HEAD_LIST[0]: info_key,
...@@ -1776,6 +1874,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1776,6 +1874,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1776 failure_reason.setdefault(info_key, []).append(';'.join(failure_field)) 1874 failure_reason.setdefault(info_key, []).append(';'.join(failure_field))
1777 if failed_count == 0: 1875 if failed_count == 0:
1778 failure_reason_str = '' 1876 failure_reason_str = ''
1877 cn_failure_reason_str = ''
1779 else: 1878 else:
1780 reason_list = [] 1879 reason_list = []
1781 for key, value in failure_reason.items(): 1880 for key, value in failure_reason.items():
...@@ -1783,7 +1882,8 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1783,7 +1882,8 @@ def se_compare_process(compare_info, ocr_res_dict):
1783 value_str = json.dumps(value) 1882 value_str = json.dumps(value)
1784 reason_list.append('{0}: {1}'.format(key, value_str)) 1883 reason_list.append('{0}: {1}'.format(key, value_str))
1785 failure_reason_str = '、'.join(reason_list) 1884 failure_reason_str = '、'.join(reason_list)
1786 return compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str 1885 cn_failure_reason_str = '、'.join(set(cn_reason_list))
1886 return compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str
1787 1887
1788 1888
1789 def se_result_detect(ocr_res_dict): 1889 def se_result_detect(ocr_res_dict):
...@@ -1807,7 +1907,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res ...@@ -1807,7 +1907,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
1807 else: 1907 else:
1808 compare_info = get_se_compare_info(last_obj, application_entity, detect_list) 1908 compare_info = get_se_compare_info(last_obj, application_entity, detect_list)
1809 application_version = last_obj.application_version 1909 application_version = last_obj.application_version
1810 compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str = se_compare_process( 1910 compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str = se_compare_process(
1811 compare_info, ocr_res_dict) 1911 compare_info, ocr_res_dict)
1812 compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( 1912 compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format(
1813 log_base, application_entity, application_id, ocr_res_id, compare_result)) 1913 log_base, application_entity, application_id, ocr_res_id, compare_result))
...@@ -1872,7 +1972,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res ...@@ -1872,7 +1972,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
1872 "SubtenantId": consts.TENANT_MAP[application_entity], 1972 "SubtenantId": consts.TENANT_MAP[application_entity],
1873 "Data": { 1973 "Data": {
1874 "Result_Message": "Pass" if successful_at_this_level else "Fail", 1974 "Result_Message": "Pass" if successful_at_this_level else "Fail",
1875 "Failure_Reason": failure_reason_str, 1975 "Failure_Reason": cn_failure_reason_str,
1876 "Application_Number": application_id, 1976 "Application_Number": application_id,
1877 "Bank_Statement": "", 1977 "Bank_Statement": "",
1878 "Link_URL": application_link, 1978 "Link_URL": application_link,
...@@ -1916,8 +2016,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True ...@@ -1916,8 +2016,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
1916 # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 2016 # 根据application_id查找OCR累计结果指定license字段,如果没有,结束
1917 if is_ca: 2017 if is_ca:
1918 result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult 2018 result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult
2019 ca_ocr_res_dict = dict()
1919 else: 2020 else:
1920 result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult 2021 result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult
2022 ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult
2023 if ocr_res_id is None:
2024 ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values(consts.IC_OCR_FIELD).first()
2025 else:
2026 ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values(consts.IC_OCR_FIELD).first()
1921 if ocr_res_id is None: 2027 if ocr_res_id is None:
1922 ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() 2028 ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first()
1923 else: 2029 else:
...@@ -1931,6 +2037,12 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True ...@@ -1931,6 +2037,12 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
1931 if is_ca: 2037 if is_ca:
1932 ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) 2038 ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict)
1933 else: 2039 else:
2040 if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(consts.IC_OCR_FIELD), str):
2041 tmp_ca_result = json.loads(ca_ocr_res_dict.get(consts.IC_OCR_FIELD))
2042 if isinstance(ocr_res_dict.get(consts.IC_OCR_FIELD), str):
2043 tmp_se_result = json.loads(ocr_res_dict.get(consts.IC_OCR_FIELD))
2044 tmp_ca_result.extend(tmp_se_result)
2045 ocr_res_dict[consts.IC_OCR_FIELD] = json.dumps(tmp_ca_result)
1934 se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms) 2046 se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms)
1935 2047
1936 2048
......
...@@ -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
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!