slice1 part2
Showing
10 changed files
with
749 additions
and
63 deletions
| ... | @@ -1449,7 +1449,112 @@ SE_SECOND_ID_FIELD_MAPPING = { | ... | @@ -1449,7 +1449,112 @@ SE_SECOND_ID_FIELD_MAPPING = { |
| 1449 | HEAD_LIST = ['Info', 'Index', 'License', 'Field', 'Input', 'OCR', 'Result', 'Position', 'Image', 'errorType'] | 1449 | HEAD_LIST = ['Info', 'Index', 'License', 'Field', 'Input', 'OCR', 'Result', 'Position', 'Image', 'errorType'] |
| 1450 | 1450 | ||
| 1451 | IMG_PATH_KEY = 'uniq_img_path_key' | 1451 | IMG_PATH_KEY = 'uniq_img_path_key' |
| 1452 | IMG_PATH_KEY_2 = 'uniq_img_path_key_2' | ||
| 1452 | 1453 | ||
| 1453 | INFO_SOURCE = ['POS', 'CMS'] | 1454 | INFO_SOURCE = ['POS', 'CMS'] |
| 1454 | 1455 | ||
| 1456 | # ------------------- | ||
| 1457 | |||
| 1458 | CA_FIRST_ID_FIELD = ['customerChineseName', 'idNum', 'idExpiryDate', 'dateOfBirth'] | ||
| 1459 | |||
| 1460 | CA_FIRST_ID_FIELD_MAPPING = { | ||
| 1461 | 'ITPRC': (ID_EN, CA_FIRST_ID_FIELD), | ||
| 1462 | 'ITPSP': (PP_EN, CA_FIRST_ID_FIELD), | ||
| 1463 | 'ITHKM': (EEP_EN, CA_FIRST_ID_FIELD), | ||
| 1464 | 'ITTID': (EEP_EN, CA_FIRST_ID_FIELD), | ||
| 1465 | 'ITRES': (RP_EN, CA_FIRST_ID_FIELD), | ||
| 1466 | } | ||
| 1467 | |||
| 1468 | CA_SECOND_ID_FIELD = [ | ||
| 1469 | ('customerChineseName', 'customerChineseName'), | ||
| 1470 | ('secondIdNum', 'idNum') | ||
| 1471 | ] | ||
| 1472 | |||
| 1473 | CA_SECOND_ID_FIELD_MAPPING = { | ||
| 1474 | 'ITPRC': (ID_EN, CA_SECOND_ID_FIELD), | ||
| 1475 | 'ITPSP': (PP_EN, CA_SECOND_ID_FIELD), | ||
| 1476 | 'ITHKM': (EEP_EN, CA_SECOND_ID_FIELD), | ||
| 1477 | 'ITTID': (EEP_EN, CA_SECOND_ID_FIELD), | ||
| 1478 | 'ITRES': (RP_EN, CA_SECOND_ID_FIELD), | ||
| 1479 | } | ||
| 1480 | |||
| 1481 | CA_SEP_FIELD = ['companyName', 'customerChineseName', 'registeredCapital', 'selfEmployedSubType'] | ||
| 1482 | |||
| 1483 | CA_CORPORATE_FIELD = [ | ||
| 1484 | ('customerChineseName', 'companyName'), | ||
| 1485 | ('legalRepName', 'customerChineseName'), | ||
| 1486 | ('idNum', 'idNum'), | ||
| 1487 | ('businessLicenseNo', 'businessLicenseNo'), | ||
| 1488 | ('taxRegistrationCode', 'taxRegistrationCode'), | ||
| 1489 | ('incorporationDate', 'incorporationDate'), | ||
| 1490 | ('businessLicenseDueDate', 'businessLicenseDueDate'), | ||
| 1491 | ('capitalRegAmount', 'registeredCapital'), | ||
| 1492 | ] | ||
| 1493 | |||
| 1494 | CA_MVC_FIELD = ['vinNo', 'manufactureDate', 'firstRegistrationDate'] | ||
| 1495 | CA_DL_FIELD = ['vinNo'] | ||
| 1496 | DL_EN = 'Driving Licence' | ||
| 1497 | |||
| 1498 | CA_ID_COMPARE_LOGIC = { | ||
| 1499 | 'customerChineseName': ('姓名', 'ca_name_compare', {}), | ||
| 1500 | 'idNum': ('公民身份号码', 'ca_common_compare', {}), | ||
| 1501 | 'dateOfBirth': ('出生年月', 'ca_date_compare', {'input_replace': ''}), | ||
| 1502 | 'idExpiryDate': ('有效期限', 'ca_date_compare', {'long': True, 'ocr_split': True, 'input_replace': ''}), | ||
| 1503 | } | ||
| 1504 | |||
| 1505 | |||
| 1506 | CA_PP_COMPARE_LOGIC = { | ||
| 1507 | 'customerChineseName': ('英文姓名', 'ca_name_compare', {'is_passport': True}), | ||
| 1508 | 'idNum': ('护照号码', 'ca_common_compare', {}), | ||
| 1509 | 'dateOfBirth': ('出生日期', 'ca_date_compare', {'input_replace': ''}), | ||
| 1510 | 'idExpiryDate': ('有效期至', 'ca_date_compare', {'input_replace': ''}), | ||
| 1511 | } | ||
| 1512 | |||
| 1513 | CA_EEP_COMPARE_LOGIC = { | ||
| 1514 | 'customerChineseName': ('中文名', 'ca_common_compare', {}), | ||
| 1515 | 'idNum': ('证件号码', 'ca_common_compare', {}), | ||
| 1516 | 'dateOfBirth': ('出生日期', 'ca_date_compare', {'input_replace': '.'}), | ||
| 1517 | 'idExpiryDate': ('有效期限', 'ca_date_compare', {'ocr_split': True, 'input_replace': '.'}), | ||
| 1518 | } | ||
| 1519 | |||
| 1520 | CA_RP_COMPARE_LOGIC = { | ||
| 1521 | 'customerChineseName': ('姓名', 'ca_common_compare', {}), | ||
| 1522 | 'idNum': ('公民身份号码', 'ca_common_compare', {}), | ||
| 1523 | 'dateOfBirth': ('出生年月', 'ca_date_compare', {'input_replace': ''}), | ||
| 1524 | 'idExpiryDate': ('有效期限', 'ca_date_compare', {'ocr_split': True, 'input_replace': ''}), | ||
| 1525 | } | ||
| 1526 | |||
| 1527 | CA_BL_COMPARE_LOGIC = { | ||
| 1528 | 'companyName': ('企业名称', 'ca_company_compare', {}), | ||
| 1529 | 'customerChineseName': ('经营者姓名', 'ca_name_compare', {}), | ||
| 1530 | 'idNum': ('注册号', 'ca_common_compare', {}), | ||
| 1531 | 'businessLicenseNo': ('注册号', 'ca_common_compare', {}), | ||
| 1532 | 'taxRegistrationCode': ('注册号', 'ca_common_compare', {}), | ||
| 1533 | 'incorporationDate': ('成立日期', 'ca_date_compare', {'ocr_replace': True}), | ||
| 1534 | 'businessLicenseDueDate': ('营业期限', 'ca_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}), | ||
| 1535 | 'registeredCapital': ('注册资本', 'ca_rmb_compare', {}), | ||
| 1536 | 'selfEmployedSubType': ('企业类型', 'ca_type_compare', {}), | ||
| 1537 | } | ||
| 1538 | |||
| 1539 | CA_MVC_COMPARE_LOGIC = { | ||
| 1540 | 'vinNo': ('9.车辆识别代号/车架号', 'ca_common_compare', {}), | ||
| 1541 | 'manufactureDate': ('32.车辆出厂日期', 'ca_date_compare', {}), | ||
| 1542 | 'firstRegistrationDate': ('3.登记日期', 'ca_date_compare', {}), | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | CA_DL_COMPARE_LOGIC = { | ||
| 1546 | 'vinNo': ('车辆识别代码', 'ca_common_compare', {}), | ||
| 1547 | } | ||
| 1548 | |||
| 1549 | CA_COMPARE_FIELD = { | ||
| 1550 | ID_EN: (IC_OCR_FIELD, CA_ID_COMPARE_LOGIC, True), | ||
| 1551 | PP_EN: (PP_OCR_FIELD, CA_PP_COMPARE_LOGIC, False), | ||
| 1552 | EEP_EN: (EEP_OCR_FIELD, CA_EEP_COMPARE_LOGIC, False), | ||
| 1553 | RP_EN: (RP_OCR_FIELD, CA_RP_COMPARE_LOGIC, True), | ||
| 1554 | |||
| 1555 | BL_EN: (BL_OCR_FIELD, CA_BL_COMPARE_LOGIC, False), | ||
| 1556 | |||
| 1557 | MVC_EN: (MVC_OCR_FIELD, CA_MVC_COMPARE_LOGIC, False), | ||
| 1558 | DL_EN: (DL_OCR_FIELD, CA_DL_COMPARE_LOGIC, False), | ||
| 1559 | } | ||
| 1455 | 1560 | ... | ... |
| ... | @@ -244,7 +244,10 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -244,7 +244,10 @@ class Command(BaseCommand, LoggerMixin): |
| 244 | 244 | ||
| 245 | elif classify == consts.IC_CLASSIFY: # 身份证真伪 | 245 | elif classify == consts.IC_CLASSIFY: # 身份证真伪 |
| 246 | for id_card_dict in license_data: | 246 | for id_card_dict in license_data: |
| 247 | id_card_dict[consts.IMG_PATH_KEY] = img_path | 247 | if '有效期限' in id_card_dict: |
| 248 | id_card_dict[consts.IMG_PATH_KEY_2] = img_path | ||
| 249 | else: | ||
| 250 | id_card_dict[consts.IMG_PATH_KEY] = img_path | ||
| 248 | try: | 251 | try: |
| 249 | base64_img = id_card_dict.pop('base64_img') | 252 | base64_img = id_card_dict.pop('base64_img') |
| 250 | except Exception as e: | 253 | except Exception as e: |
| ... | @@ -1030,7 +1033,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -1030,7 +1033,7 @@ class Command(BaseCommand, LoggerMixin): |
| 1030 | license_list = license_summary.get(classify) | 1033 | license_list = license_summary.get(classify) |
| 1031 | if not license_list: | 1034 | if not license_list: |
| 1032 | continue | 1035 | continue |
| 1033 | if classify == consts.IC_CLASSIFY and ic_merge: # TODO 正反面合并时的img_path处理 | 1036 | if classify == consts.IC_CLASSIFY and ic_merge: |
| 1034 | license_list[0].update(license_list[1]) | 1037 | license_list[0].update(license_list[1]) |
| 1035 | license_list.pop(1) | 1038 | license_list.pop(1) |
| 1036 | elif classify == consts.RP_CLASSIFY and rp_merge: | 1039 | elif classify == consts.RP_CLASSIFY and rp_merge: |
| ... | @@ -1357,9 +1360,9 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -1357,9 +1360,9 @@ class Command(BaseCommand, LoggerMixin): |
| 1357 | 1360 | ||
| 1358 | finally: | 1361 | finally: |
| 1359 | try: | 1362 | try: |
| 1360 | img_save_path = os.path.join(doc_data_path, 'img') | 1363 | # img_save_path = os.path.join(doc_data_path, 'img') |
| 1361 | write_zip_file(img_save_path, os.path.join(doc_data_path, '{0}_img.zip'.format(doc_id_str))) | 1364 | # write_zip_file(img_save_path, os.path.join(doc_data_path, '{0}_img.zip'.format(doc_id_str))) |
| 1362 | shutil.rmtree(img_save_path, ignore_errors=True) | 1365 | # shutil.rmtree(img_save_path, ignore_errors=True) |
| 1363 | pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc_id_str)) | 1366 | pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc_id_str)) |
| 1364 | os.remove(pdf_path) | 1367 | os.remove(pdf_path) |
| 1365 | self.online_log.info('{0} [pdf & img removed] [task={1}]'.format(self.log_base, task_str)) | 1368 | self.online_log.info('{0} [pdf & img removed] [task={1}]'.format(self.log_base, task_str)) | ... | ... |
| ... | @@ -546,7 +546,7 @@ class AFCSECompareResult(models.Model): | ... | @@ -546,7 +546,7 @@ class AFCSECompareResult(models.Model): |
| 546 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | 546 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 547 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | 547 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 548 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") | 548 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") |
| 549 | is_finish = models.BooleanField(default=False, verbose_name="是否完成") | 549 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") |
| 550 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | 550 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") |
| 551 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | 551 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") |
| 552 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | 552 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") |
| ... | @@ -574,7 +574,7 @@ class AFCCACompareResult(models.Model): | ... | @@ -574,7 +574,7 @@ class AFCCACompareResult(models.Model): |
| 574 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | 574 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 575 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | 575 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 576 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") | 576 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") |
| 577 | is_finish = models.BooleanField(default=False, verbose_name="是否完成") | 577 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") |
| 578 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | 578 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") |
| 579 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | 579 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") |
| 580 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | 580 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") |
| ... | @@ -602,7 +602,7 @@ class HILSECompareResult(models.Model): | ... | @@ -602,7 +602,7 @@ class HILSECompareResult(models.Model): |
| 602 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | 602 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 603 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | 603 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 604 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") | 604 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") |
| 605 | is_finish = models.BooleanField(default=False, verbose_name="是否完成") | 605 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") |
| 606 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | 606 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") |
| 607 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | 607 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") |
| 608 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | 608 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") |
| ... | @@ -629,7 +629,7 @@ class HILCACompareResult(models.Model): | ... | @@ -629,7 +629,7 @@ class HILCACompareResult(models.Model): |
| 629 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | 629 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 630 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | 630 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 631 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") | 631 | version = models.CharField(max_length=8, verbose_name="POS/CMS version") |
| 632 | is_finish = models.BooleanField(default=False, verbose_name="是否完成") | 632 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") |
| 633 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | 633 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") |
| 634 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | 634 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") |
| 635 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | 635 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") |
| ... | @@ -652,3 +652,103 @@ class HILCACompareResult(models.Model): | ... | @@ -652,3 +652,103 @@ class HILCACompareResult(models.Model): |
| 652 | db_table = 'hil_ca_compare_result' | 652 | db_table = 'hil_ca_compare_result' |
| 653 | 653 | ||
| 654 | 654 | ||
| 655 | class AFCSECompareResultRecord(models.Model): | ||
| 656 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 657 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
| 658 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 659 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | ||
| 660 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | ||
| 661 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | ||
| 662 | reason2_count = models.SmallIntegerField(default=0, verbose_name="原因2数目") | ||
| 663 | reason3_count = models.SmallIntegerField(default=0, verbose_name="原因3数目") | ||
| 664 | reason4_count = models.SmallIntegerField(default=0, verbose_name="原因4数目") | ||
| 665 | reason5_count = models.SmallIntegerField(default=0, verbose_name="原因5数目") | ||
| 666 | reason6_count = models.SmallIntegerField(default=0, verbose_name="原因6数目") | ||
| 667 | reason7_count = models.SmallIntegerField(default=0, verbose_name="原因7数目") | ||
| 668 | reason8_count = models.SmallIntegerField(default=0, verbose_name="原因8数目") | ||
| 669 | reason9_count = models.SmallIntegerField(default=0, verbose_name="原因9数目") | ||
| 670 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") | ||
| 671 | result = models.TextField(null=True, verbose_name="比对结果") | ||
| 672 | comments = models.TextField(null=True, verbose_name="备注") | ||
| 673 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ||
| 674 | |||
| 675 | class Meta: | ||
| 676 | managed = False | ||
| 677 | db_table = 'afc_se_compare_result_record' | ||
| 678 | |||
| 679 | |||
| 680 | class AFCCACompareResultRecord(models.Model): | ||
| 681 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 682 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
| 683 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 684 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | ||
| 685 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | ||
| 686 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | ||
| 687 | reason2_count = models.SmallIntegerField(default=0, verbose_name="原因2数目") | ||
| 688 | reason3_count = models.SmallIntegerField(default=0, verbose_name="原因3数目") | ||
| 689 | reason4_count = models.SmallIntegerField(default=0, verbose_name="原因4数目") | ||
| 690 | reason5_count = models.SmallIntegerField(default=0, verbose_name="原因5数目") | ||
| 691 | reason6_count = models.SmallIntegerField(default=0, verbose_name="原因6数目") | ||
| 692 | reason7_count = models.SmallIntegerField(default=0, verbose_name="原因7数目") | ||
| 693 | reason8_count = models.SmallIntegerField(default=0, verbose_name="原因8数目") | ||
| 694 | reason9_count = models.SmallIntegerField(default=0, verbose_name="原因9数目") | ||
| 695 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") | ||
| 696 | result = models.TextField(null=True, verbose_name="比对结果") | ||
| 697 | comments = models.TextField(null=True, verbose_name="备注") | ||
| 698 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ||
| 699 | |||
| 700 | class Meta: | ||
| 701 | managed = False | ||
| 702 | db_table = 'afc_ca_compare_result_record' | ||
| 703 | |||
| 704 | |||
| 705 | class HILSECompareResultRecord(models.Model): | ||
| 706 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 707 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
| 708 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 709 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | ||
| 710 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | ||
| 711 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | ||
| 712 | reason2_count = models.SmallIntegerField(default=0, verbose_name="原因2数目") | ||
| 713 | reason3_count = models.SmallIntegerField(default=0, verbose_name="原因3数目") | ||
| 714 | reason4_count = models.SmallIntegerField(default=0, verbose_name="原因4数目") | ||
| 715 | reason5_count = models.SmallIntegerField(default=0, verbose_name="原因5数目") | ||
| 716 | reason6_count = models.SmallIntegerField(default=0, verbose_name="原因6数目") | ||
| 717 | reason7_count = models.SmallIntegerField(default=0, verbose_name="原因7数目") | ||
| 718 | reason8_count = models.SmallIntegerField(default=0, verbose_name="原因8数目") | ||
| 719 | reason9_count = models.SmallIntegerField(default=0, verbose_name="原因9数目") | ||
| 720 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") | ||
| 721 | result = models.TextField(null=True, verbose_name="比对结果") | ||
| 722 | comments = models.TextField(null=True, verbose_name="备注") | ||
| 723 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ||
| 724 | |||
| 725 | class Meta: | ||
| 726 | managed = False | ||
| 727 | db_table = 'hil_se_compare_result_record' | ||
| 728 | |||
| 729 | |||
| 730 | class HILCACompareResultRecord(models.Model): | ||
| 731 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 732 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
| 733 | is_finish = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 734 | compare_count = models.SmallIntegerField(default=0, verbose_name="比对字段总数") | ||
| 735 | failed_count = models.SmallIntegerField(default=0, verbose_name="比对失败数目") | ||
| 736 | reason1_count = models.SmallIntegerField(default=0, verbose_name="原因1数目") | ||
| 737 | reason2_count = models.SmallIntegerField(default=0, verbose_name="原因2数目") | ||
| 738 | reason3_count = models.SmallIntegerField(default=0, verbose_name="原因3数目") | ||
| 739 | reason4_count = models.SmallIntegerField(default=0, verbose_name="原因4数目") | ||
| 740 | reason5_count = models.SmallIntegerField(default=0, verbose_name="原因5数目") | ||
| 741 | reason6_count = models.SmallIntegerField(default=0, verbose_name="原因6数目") | ||
| 742 | reason7_count = models.SmallIntegerField(default=0, verbose_name="原因7数目") | ||
| 743 | reason8_count = models.SmallIntegerField(default=0, verbose_name="原因8数目") | ||
| 744 | reason9_count = models.SmallIntegerField(default=0, verbose_name="原因9数目") | ||
| 745 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") | ||
| 746 | result = models.TextField(null=True, verbose_name="比对结果") | ||
| 747 | comments = models.TextField(null=True, verbose_name="备注") | ||
| 748 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') # 索引 | ||
| 749 | |||
| 750 | class Meta: | ||
| 751 | managed = False | ||
| 752 | db_table = 'hil_ca_compare_result_record' | ||
| 753 | |||
| 754 | ... | ... |
| ... | @@ -30,6 +30,10 @@ from .models import ( | ... | @@ -30,6 +30,10 @@ from .models import ( |
| 30 | AFCSECompareResult, | 30 | AFCSECompareResult, |
| 31 | HILCACompareResult, | 31 | HILCACompareResult, |
| 32 | HILSECompareResult, | 32 | HILSECompareResult, |
| 33 | AFCCACompareResultRecord, | ||
| 34 | AFCSECompareResultRecord, | ||
| 35 | HILCACompareResultRecord, | ||
| 36 | HILSECompareResultRecord, | ||
| 33 | ) | 37 | ) |
| 34 | from .named_enum import ErrorType | 38 | from .named_enum import ErrorType |
| 35 | from .mixins import DocHandler | 39 | from .mixins import DocHandler |
| ... | @@ -295,7 +299,6 @@ application_information = { | ... | @@ -295,7 +299,6 @@ application_information = { |
| 295 | 299 | ||
| 296 | priority_doc_args = { | 300 | priority_doc_args = { |
| 297 | 'APPLICATION_INFORMATION': fields.Nested(application_information, required=True) | 301 | 'APPLICATION_INFORMATION': fields.Nested(application_information, required=True) |
| 298 | |||
| 299 | } | 302 | } |
| 300 | 303 | ||
| 301 | compare_offline_args = { | 304 | compare_offline_args = { |
| ... | @@ -313,6 +316,32 @@ compare_offline_args = { | ... | @@ -313,6 +316,32 @@ compare_offline_args = { |
| 313 | 'workflow_name': fields.Str(required=True, validate=validate.Length(max=1024)), | 316 | 'workflow_name': fields.Str(required=True, validate=validate.Length(max=1024)), |
| 314 | } | 317 | } |
| 315 | 318 | ||
| 319 | result_item_args = { | ||
| 320 | consts.HEAD_LIST[0]: fields.Str(required=True), | ||
| 321 | consts.HEAD_LIST[1]: fields.Str(required=True), | ||
| 322 | consts.HEAD_LIST[2]: fields.Str(required=True), | ||
| 323 | consts.HEAD_LIST[3]: fields.Str(required=True), | ||
| 324 | consts.HEAD_LIST[4]: fields.Str(required=True), | ||
| 325 | consts.HEAD_LIST[5]: fields.Str(required=True), | ||
| 326 | consts.HEAD_LIST[6]: fields.Str(required=True), | ||
| 327 | consts.HEAD_LIST[7]: fields.Str(required=True), | ||
| 328 | consts.HEAD_LIST[8]: fields.List(fields.Str(), required=True), | ||
| 329 | consts.HEAD_LIST[9]: fields.Int(required=True), | ||
| 330 | } | ||
| 331 | |||
| 332 | result_update_args = { | ||
| 333 | 'id': fields.Int(required=True), | ||
| 334 | 'application_id': fields.Str(required=True, validate=validate.Length(max=64)), | ||
| 335 | 'entity': fields.Str(required=True, validate=validate.OneOf(consts.BUSINESS_TYPE_LIST)), | ||
| 336 | 'scheme': fields.Str(required=True, validate=validate.OneOf(consts.DOC_SCHEME_LIST)), | ||
| 337 | 'whole_result': fields.Str(required=True), | ||
| 338 | 'version': fields.Str(required=True), | ||
| 339 | 'source': fields.Str(required=True), | ||
| 340 | 'latest_compared_time': fields.Str(required=True), | ||
| 341 | 'comments': fields.Str(required=True), | ||
| 342 | 'result': fields.List(fields.Nested(result_item_args), required=True, validate=validate.Length(min=1)), | ||
| 343 | } | ||
| 344 | |||
| 316 | 345 | ||
| 317 | class UploadDocView(GenericView, DocHandler): | 346 | class UploadDocView(GenericView, DocHandler): |
| 318 | # permission_classes = [] | 347 | # permission_classes = [] |
| ... | @@ -776,7 +805,7 @@ class CompareResultView(GenericView): | ... | @@ -776,7 +805,7 @@ class CompareResultView(GenericView): |
| 776 | if result_obj is None: | 805 | if result_obj is None: |
| 777 | whole_result = '' | 806 | whole_result = '' |
| 778 | else: | 807 | else: |
| 779 | whole_result = 'Y' if result_obj.is_finish else 'N' | 808 | whole_result = consts.RESULT_Y if result_obj.is_finish else consts.RESULT_N |
| 780 | 809 | ||
| 781 | if result_obj is None or result_obj.comments is None: | 810 | if result_obj is None or result_obj.comments is None: |
| 782 | comments = '' | 811 | comments = '' |
| ... | @@ -786,6 +815,7 @@ class CompareResultView(GenericView): | ... | @@ -786,6 +815,7 @@ class CompareResultView(GenericView): |
| 786 | compare_result = { | 815 | compare_result = { |
| 787 | 'id': 0 if result_obj is None else result_obj.id, | 816 | 'id': 0 if result_obj is None else result_obj.id, |
| 788 | 'application_id': case_id, | 817 | 'application_id': case_id, |
| 818 | 'entity': entity, | ||
| 789 | 'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else consts.DOC_SCHEME_LIST[1], | 819 | 'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else consts.DOC_SCHEME_LIST[1], |
| 790 | 'whole_result': whole_result, | 820 | 'whole_result': whole_result, |
| 791 | 'latest_compared_time': '' if result_obj is None else result_obj.update_time.strftime('%Y-%m-%d %H:%M'), | 821 | 'latest_compared_time': '' if result_obj is None else result_obj.update_time.strftime('%Y-%m-%d %H:%M'), |
| ... | @@ -831,40 +861,79 @@ class CompareResultView(GenericView): | ... | @@ -831,40 +861,79 @@ class CompareResultView(GenericView): |
| 831 | # return HttpResponse(html) | 861 | # return HttpResponse(html) |
| 832 | 862 | ||
| 833 | # 比对结果更新 | 863 | # 比对结果更新 |
| 834 | # @use_args(result_update_args, location='data') | 864 | @use_args(result_update_args, location='data') |
| 835 | def post(self, request): | 865 | def post(self, request, args): |
| 836 | tmp_flag = random.choice([0, 1]) | 866 | result_id = args.get('id') |
| 837 | if tmp_flag == 0: | 867 | case_id = args.get('application_id') |
| 838 | return response.ok() | 868 | update_time = args.get('latest_compared_time') |
| 869 | scheme = args.get('scheme') | ||
| 870 | entity = args.get('entity') | ||
| 871 | whole_result = args.get('whole_result') | ||
| 872 | |||
| 873 | if entity == consts.HIL_PREFIX: | ||
| 874 | result_table = HILCACompareResult if scheme == consts.DOC_SCHEME_LIST[0] else HILSECompareResult | ||
| 875 | record_table = HILCACompareResultRecord if scheme == consts.DOC_SCHEME_LIST[0] else HILSECompareResultRecord | ||
| 839 | else: | 876 | else: |
| 840 | result_id = None | 877 | result_table = AFCCACompareResult if scheme == consts.DOC_SCHEME_LIST[0] else AFCSECompareResult |
| 841 | entity = "AFC" | 878 | record_table = AFCCACompareResultRecord if scheme == consts.DOC_SCHEME_LIST[0] else AFCSECompareResultRecord |
| 842 | scheme = 'SE' | ||
| 843 | case_id = 'CH-S1120929121' | ||
| 844 | 879 | ||
| 845 | if entity == consts.HIL_PREFIX: | 880 | if result_id is not None: |
| 846 | result_table = HILCACompareResult if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else HILSECompareResult | 881 | result_obj = result_table.objects.filter(id=result_id).first() |
| 847 | else: | 882 | else: |
| 848 | result_table = AFCCACompareResult if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else AFCSECompareResult | 883 | result_obj = result_table.objects.filter(application_id=case_id).first() |
| 849 | 884 | ||
| 850 | if result_id is not None: | 885 | if result_obj is None: |
| 851 | result_obj = result_table.objects.filter(id=result_id).first() | 886 | return response.ok() |
| 852 | else: | ||
| 853 | result_obj = result_table.objects.filter(application_id=case_id).first() | ||
| 854 | 887 | ||
| 855 | if result_obj is None: | 888 | result_str = json.dumps(args.get('result', [])) |
| 856 | whole_result = '' | 889 | is_finish = whole_result == consts.RESULT_Y |
| 857 | else: | 890 | compare_count = 0 |
| 858 | whole_result = 'Y' if result_obj.is_finish else 'N' | 891 | failed_count = 0 |
| 892 | reason_dict = {} | ||
| 893 | for result in args.get('result', []): | ||
| 894 | compare_count += 1 | ||
| 895 | if result.get(consts.HEAD_LIST[6]) == consts.RESULT_N: | ||
| 896 | failed_count += 1 | ||
| 897 | error_type = result.get(consts.HEAD_LIST[-1], '') | ||
| 898 | if error_type in reason_dict: | ||
| 899 | reason_dict[error_type] = reason_dict[error_type] + 1 | ||
| 900 | else: | ||
| 901 | reason_dict[error_type] = 1 | ||
| 902 | |||
| 903 | record_table.objects.create( | ||
| 904 | application_id=case_id, | ||
| 905 | is_finish=is_finish, | ||
| 906 | compare_count=compare_count, | ||
| 907 | failed_count=failed_count, | ||
| 908 | reason1_count=reason_dict.get(0, 0), | ||
| 909 | reason2_count=reason_dict.get(1, 0), | ||
| 910 | reason3_count=reason_dict.get(2, 0), | ||
| 911 | reason4_count=reason_dict.get(3, 0), | ||
| 912 | reason5_count=reason_dict.get(4, 0), | ||
| 913 | reason6_count=reason_dict.get(5, 0), | ||
| 914 | reason7_count=reason_dict.get(6, 0), | ||
| 915 | reason8_count=reason_dict.get(7, 0), | ||
| 916 | reason9_count=reason_dict.get(8, 0), | ||
| 917 | reason10_count=reason_dict.get(9, 0), | ||
| 918 | result=result_str, | ||
| 919 | comments=args.get('comments', ''), | ||
| 920 | ) | ||
| 859 | 921 | ||
| 860 | if result_obj is None or result_obj.comments is None: | 922 | if update_time == result_obj.update_time.strftime('%Y-%m-%d %H:%M'): |
| 861 | comments = '' | 923 | result_obj.result = result_str |
| 862 | else: | 924 | result_obj.comments = args.get('comments', '') |
| 863 | comments = result_obj.comments | 925 | result_obj.update_time = result_obj.update_time |
| 926 | result_obj.save() | ||
| 927 | return response.ok() | ||
| 928 | else: | ||
| 929 | whole_result = consts.RESULT_Y if result_obj.is_finish else consts.RESULT_N | ||
| 930 | |||
| 931 | comments = '' if result_obj.comments is None else comments = result_obj.comments | ||
| 864 | 932 | ||
| 865 | compare_result = { | 933 | compare_result = { |
| 866 | 'id': 0 if result_obj is None else result_obj.id, | 934 | 'id': 0 if result_obj is None else result_obj.id, |
| 867 | 'application_id': case_id, | 935 | 'application_id': case_id, |
| 936 | 'entity': entity, | ||
| 868 | 'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else | 937 | 'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else |
| 869 | consts.DOC_SCHEME_LIST[1], | 938 | consts.DOC_SCHEME_LIST[1], |
| 870 | 'whole_result': whole_result, | 939 | 'whole_result': whole_result, | ... | ... |
| ... | @@ -5,6 +5,7 @@ import traceback | ... | @@ -5,6 +5,7 @@ import traceback |
| 5 | from datetime import datetime, timedelta | 5 | from datetime import datetime, timedelta |
| 6 | from collections import OrderedDict | 6 | from collections import OrderedDict |
| 7 | from . import app | 7 | from . import app |
| 8 | from settings import conf | ||
| 8 | from apps.doc.models import ( | 9 | from apps.doc.models import ( |
| 9 | AFCOCRResult, | 10 | AFCOCRResult, |
| 10 | AFCSEOCRResult, | 11 | AFCSEOCRResult, |
| ... | @@ -18,7 +19,9 @@ from apps.doc.models import ( | ... | @@ -18,7 +19,9 @@ from apps.doc.models import ( |
| 18 | HILCompareReport, | 19 | HILCompareReport, |
| 19 | AFCCompareReport, | 20 | AFCCompareReport, |
| 20 | AFCSECompareResult, | 21 | AFCSECompareResult, |
| 22 | AFCCACompareResult, | ||
| 21 | HILSECompareResult, | 23 | HILSECompareResult, |
| 24 | HILCACompareResult, | ||
| 22 | ) | 25 | ) |
| 23 | from apps.doc import consts | 26 | from apps.doc import consts |
| 24 | from apps.doc.ocr.gcap import gcap | 27 | from apps.doc.ocr.gcap import gcap |
| ... | @@ -29,6 +32,7 @@ from common.tools.comparison import cp | ... | @@ -29,6 +32,7 @@ from common.tools.comparison import cp |
| 29 | compare_log = logging.getLogger('compare') | 32 | compare_log = logging.getLogger('compare') |
| 30 | log_base = '[Compare]' | 33 | log_base = '[Compare]' |
| 31 | empty_str = '' | 34 | empty_str = '' |
| 35 | empty_error_type = 1000 | ||
| 32 | 36 | ||
| 33 | 37 | ||
| 34 | def name_check(ocr_res_dict, second_ocr_field, second_compare_list, second_id_num, name): | 38 | def name_check(ocr_res_dict, second_ocr_field, second_compare_list, second_id_num, name): |
| ... | @@ -97,10 +101,11 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, | ... | @@ -97,10 +101,11 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, |
| 97 | else: | 101 | else: |
| 98 | expiry_dates = [] | 102 | expiry_dates = [] |
| 99 | 103 | ||
| 100 | for ocr_res in tmp_list: | 104 | for res_idx in range(length-1, -1, -1): |
| 101 | # for ocr_res in ocr_res_list: | 105 | # for ocr_res in ocr_res_list: |
| 102 | if is_find: | 106 | if is_find: |
| 103 | break | 107 | break |
| 108 | ocr_res = tmp_list[res_idx] | ||
| 104 | for idx, compare_tuple in enumerate(compare_list): | 109 | for idx, compare_tuple in enumerate(compare_list): |
| 105 | input_str = info_dict.get(compare_tuple[0]) | 110 | input_str = info_dict.get(compare_tuple[0]) |
| 106 | ocr_str = ocr_res.get(compare_tuple[1]) | 111 | ocr_str = ocr_res.get(compare_tuple[1]) |
| ... | @@ -160,9 +165,10 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s | ... | @@ -160,9 +165,10 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s |
| 160 | 165 | ||
| 161 | length = len(tmp_list) | 166 | length = len(tmp_list) |
| 162 | 167 | ||
| 163 | for ocr_res in tmp_list: | 168 | for res_idx in range(length-1, -1, -1): |
| 164 | if is_find: | 169 | if is_find: |
| 165 | break | 170 | break |
| 171 | ocr_res = tmp_list[res_idx] | ||
| 166 | for idx, compare_tuple in enumerate(compare_list): | 172 | for idx, compare_tuple in enumerate(compare_list): |
| 167 | input_str = info_dict.get(compare_tuple[0]) | 173 | input_str = info_dict.get(compare_tuple[0]) |
| 168 | ocr_str = ocr_res.get(compare_tuple[1]) | 174 | ocr_str = ocr_res.get(compare_tuple[1]) |
| ... | @@ -196,9 +202,230 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s | ... | @@ -196,9 +202,230 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s |
| 196 | return is_find and key_right, no_match_vino | 202 | return is_find and key_right, no_match_vino |
| 197 | 203 | ||
| 198 | 204 | ||
| 205 | def get_ca_compare_info(last_obj): | ||
| 206 | compare_info = {} | ||
| 207 | individual_info_dict = {} | ||
| 208 | for individual_info in json.loads(last_obj.individual_cus_info): | ||
| 209 | license_dict = {} | ||
| 210 | |||
| 211 | if individual_info['idType'] in consts.CA_FIRST_ID_FIELD_MAPPING: | ||
| 212 | license_en, field_list = consts.CA_FIRST_ID_FIELD_MAPPING[individual_info['idType']] | ||
| 213 | field_input = [] | ||
| 214 | for field in field_list: | ||
| 215 | if field in individual_info: | ||
| 216 | field_input.append((field, individual_info.get(field, ''))) | ||
| 217 | license_dict[license_en] = field_input | ||
| 218 | |||
| 219 | if individual_info.get('secondIdType') in consts.CA_SECOND_ID_FIELD_MAPPING: | ||
| 220 | second_license_en, second_field_list = consts.CA_SECOND_ID_FIELD_MAPPING[individual_info['secondIdType']] | ||
| 221 | if second_license_en not in license_dict: | ||
| 222 | second_field_input = [] | ||
| 223 | for second_field, write_field in second_field_list: | ||
| 224 | if second_field in individual_info: | ||
| 225 | second_field_input.append((write_field, individual_info.get(second_field, ''))) | ||
| 226 | license_dict[second_license_en] = second_field_input | ||
| 227 | |||
| 228 | if individual_info['customerType'] == consts.CUSTOMER_TYPE[5]: | ||
| 229 | sep_field_input = [] | ||
| 230 | for sep_field in consts.CA_SEP_FIELD: | ||
| 231 | if sep_field in individual_info: | ||
| 232 | sep_field_input.append((sep_field, individual_info.get(sep_field, ''))) | ||
| 233 | license_dict[consts.BL_EN] = sep_field_input | ||
| 234 | |||
| 235 | if len(license_dict) > 0: | ||
| 236 | individual_info_dict.setdefault(individual_info['applicantType'], []).append(license_dict) | ||
| 237 | |||
| 238 | compare_info['individualCusInfo'] = individual_info_dict | ||
| 239 | |||
| 240 | if isinstance(last_obj.corporate_cus_info, str): | ||
| 241 | corporate_info_dict = json.loads(last_obj.corporate_cus_info) | ||
| 242 | corporate_info = {} | ||
| 243 | bl_field_input = [] | ||
| 244 | for bl_field, write_field in consts.CA_CORPORATE_FIELD: | ||
| 245 | bl_field_input.append((write_field, corporate_info_dict.get(bl_field, ''))) | ||
| 246 | corporate_info[consts.BL_EN] = bl_field_input | ||
| 247 | |||
| 248 | compare_info['corporateCusInfo'] = corporate_info | ||
| 249 | |||
| 250 | if last_obj.vehicle_status == consts.VEHICLE_STATUS[0] and isinstance(last_obj.usedcar_info, str): | ||
| 251 | usedcar_info_dict = json.loads(last_obj.usedcar_info) | ||
| 252 | usedcar_info = {} | ||
| 253 | |||
| 254 | mvc_field_input = [] | ||
| 255 | for mvc_field in consts.CA_MVC_FIELD: | ||
| 256 | mvc_field_input.append((mvc_field, usedcar_info_dict.get(mvc_field, ''))) | ||
| 257 | usedcar_info[consts.MVC_EN] = mvc_field_input | ||
| 258 | |||
| 259 | dl_field_input = [] | ||
| 260 | for dl_field in consts.CA_DL_FIELD: | ||
| 261 | dl_field_input.append((dl_field, usedcar_info_dict.get(dl_field, ''))) | ||
| 262 | usedcar_info[consts.DL_EN] = dl_field_input | ||
| 263 | |||
| 264 | compare_info['usedCarInfo'] = usedcar_info | ||
| 265 | |||
| 266 | return compare_info | ||
| 267 | |||
| 268 | |||
| 269 | def ca_compare_license(license_en, ocr_res_dict, field_list): | ||
| 270 | ocr_field, compare_logic, special_expiry_date = consts.CA_COMPARE_FIELD[license_en] | ||
| 271 | |||
| 272 | is_find = False | ||
| 273 | result_field_list = [] | ||
| 274 | ocr_res_str = ocr_res_dict.get(ocr_field) | ||
| 275 | if ocr_res_str is not None: | ||
| 276 | ocr_res_list = json.loads(ocr_res_str) | ||
| 277 | length = len(ocr_res_list) | ||
| 278 | |||
| 279 | # 身份证、居住证 过期期限特殊处理 | ||
| 280 | if special_expiry_date: | ||
| 281 | expiry_dates = set() | ||
| 282 | expiry_dates_img_path = set() | ||
| 283 | key = compare_logic.get('idExpiryDate')[0] | ||
| 284 | for ocr_res in ocr_res_list: | ||
| 285 | if key in ocr_res: | ||
| 286 | expiry_dates.add(ocr_res[key]) | ||
| 287 | expiry_dates_img_path.add(ocr_res.get(consts.IMG_PATH_KEY_2, '')) | ||
| 288 | else: | ||
| 289 | expiry_dates = set() | ||
| 290 | expiry_dates_img_path = set() | ||
| 291 | |||
| 292 | for res_idx in range(length-1, -1, -1): | ||
| 293 | if is_find: | ||
| 294 | break | ||
| 295 | |||
| 296 | for idx, (name, value) in enumerate(field_list): | ||
| 297 | ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0]) | ||
| 298 | if not isinstance(ocr_str, str): | ||
| 299 | result = consts.RESULT_N | ||
| 300 | ocr_str = empty_str | ||
| 301 | else: | ||
| 302 | result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) | ||
| 303 | |||
| 304 | if idx == 0 and result == consts.RESULT_N and length > 1: | ||
| 305 | break | ||
| 306 | |||
| 307 | is_find = True | ||
| 308 | |||
| 309 | # 过期期限特殊处理 | ||
| 310 | if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N: | ||
| 311 | for expiry_date in expiry_dates: | ||
| 312 | expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2]) | ||
| 313 | if expiry_date_res == consts.RESULT_Y: | ||
| 314 | ocr_str = expiry_date | ||
| 315 | result = expiry_date_res | ||
| 316 | break | ||
| 317 | |||
| 318 | if result == consts.RESULT_N: | ||
| 319 | next_img_path = expiry_dates_img_path.pop() if len(expiry_dates_img_path) > 0 else empty_str | ||
| 320 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, next_img_path) | ||
| 321 | else: | ||
| 322 | img_path = empty_str | ||
| 323 | else: | ||
| 324 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str | ||
| 325 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | ||
| 326 | result_field_list.append((name, value, result, ocr_str, img_path, error_type)) | ||
| 327 | |||
| 328 | if not is_find: | ||
| 329 | for name, value in field_list: | ||
| 330 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) | ||
| 331 | |||
| 332 | return result_field_list | ||
| 333 | |||
| 334 | |||
| 335 | def ca_compare_process(compare_info, ocr_res_dict): | ||
| 336 | # individualCusInfo | ||
| 337 | # corporateCusInfo | ||
| 338 | # usedCarInfo | ||
| 339 | compare_result = [] | ||
| 340 | total_fields = 0 | ||
| 341 | failed_count = 0 | ||
| 342 | |||
| 343 | for info_key, info_value in compare_info.items(): | ||
| 344 | if info_key == 'individualCusInfo': | ||
| 345 | for idx, license_list in info_value.items(): | ||
| 346 | for license_dict in license_list: | ||
| 347 | for license_en, field_list in license_dict.items(): | ||
| 348 | result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list) | ||
| 349 | for name, value, result, ocr_str, img_path, error_type in result_field_list: | ||
| 350 | total_fields += 1 | ||
| 351 | if result == consts.RESULT_N: | ||
| 352 | failed_count += 1 | ||
| 353 | compare_result.append( | ||
| 354 | { | ||
| 355 | consts.HEAD_LIST[0]: info_key, | ||
| 356 | consts.HEAD_LIST[1]: idx, | ||
| 357 | consts.HEAD_LIST[2]: license_en, | ||
| 358 | consts.HEAD_LIST[3]: name, | ||
| 359 | consts.HEAD_LIST[4]: value, | ||
| 360 | consts.HEAD_LIST[5]: ocr_str, | ||
| 361 | consts.HEAD_LIST[6]: result, | ||
| 362 | consts.HEAD_LIST[7]: empty_str, | ||
| 363 | consts.HEAD_LIST[8]: img_path, | ||
| 364 | consts.HEAD_LIST[9]: error_type, | ||
| 365 | } | ||
| 366 | ) | ||
| 367 | else: | ||
| 368 | for license_en, field_list in info_value.items(): | ||
| 369 | result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list) | ||
| 370 | for name, value, result, ocr_str, img_path, error_type in result_field_list: | ||
| 371 | total_fields += 1 | ||
| 372 | if result == consts.RESULT_N: | ||
| 373 | failed_count += 1 | ||
| 374 | compare_result.append( | ||
| 375 | { | ||
| 376 | consts.HEAD_LIST[0]: info_key, | ||
| 377 | consts.HEAD_LIST[1]: "0", | ||
| 378 | consts.HEAD_LIST[2]: license_en, | ||
| 379 | consts.HEAD_LIST[3]: name, | ||
| 380 | consts.HEAD_LIST[4]: value, | ||
| 381 | consts.HEAD_LIST[5]: ocr_str, | ||
| 382 | consts.HEAD_LIST[6]: result, | ||
| 383 | consts.HEAD_LIST[7]: empty_str, | ||
| 384 | consts.HEAD_LIST[8]: img_path, | ||
| 385 | consts.HEAD_LIST[9]: error_type, | ||
| 386 | } | ||
| 387 | ) | ||
| 388 | return compare_result, total_fields, failed_count | ||
| 389 | |||
| 390 | |||
| 199 | def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict): | 391 | def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict): |
| 200 | start_time = datetime.now() | 392 | start_time = datetime.now() |
| 393 | |||
| 394 | try: | ||
| 395 | # 比对逻辑 | ||
| 396 | compare_info = get_ca_compare_info(last_obj) | ||
| 397 | compare_result, total_fields, failed_count = ca_compare_process(compare_info, ocr_res_dict) | ||
| 398 | compare_log.info('{0} [CA] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | ||
| 399 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | ||
| 400 | except Exception as e: | ||
| 401 | compare_log.error('{0} [CA] [compare error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 402 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 403 | traceback.format_exc())) | ||
| 404 | else: | ||
| 405 | # 将比对结果写入数据库 | ||
| 406 | try: | ||
| 407 | result_table = HILCACompareResult if application_entity == consts.HIL_PREFIX else AFCCACompareResult | ||
| 408 | res_obj = result_table.objects.filter(application_id=application_id).first() | ||
| 409 | if res_obj is None: | ||
| 410 | res_obj = result_table() | ||
| 411 | res_obj.application_id = application_id | ||
| 412 | res_obj.compare_count = total_fields | ||
| 413 | res_obj.failed_count = failed_count | ||
| 414 | res_obj.is_finish = failed_count == 0 | ||
| 415 | res_obj.version = '{0}{1}{2}'.format(consts.INFO_SOURCE[0], consts.SPLIT_STR, last_obj.application_version) | ||
| 416 | # res_obj.reason1_count = reason1_count | ||
| 417 | res_obj.result = json.dumps(compare_result) | ||
| 418 | res_obj.save() | ||
| 419 | compare_log.info('{0} [CA] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
| 420 | log_base, application_entity, application_id, ocr_res_id)) | ||
| 421 | except Exception as e: | ||
| 422 | compare_log.error('{0} [CA] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 423 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 424 | traceback.format_exc())) | ||
| 425 | |||
| 201 | compare_failed = False | 426 | compare_failed = False |
| 427 | application_link = '{0}/showList/showList?entity={1}&scheme={2}&case_id={3}'.format( | ||
| 428 | conf.BASE_URL, application_entity, consts.COMPARE_DOC_SCHEME_LIST[0], application_id) | ||
| 202 | 429 | ||
| 203 | # 比对信息 | 430 | # 比对信息 |
| 204 | try: | 431 | try: |
| ... | @@ -211,7 +438,7 @@ def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -211,7 +438,7 @@ def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
| 211 | 'vehicleStatus': last_obj.vehicle_status, | 438 | 'vehicleStatus': last_obj.vehicle_status, |
| 212 | 'wholeResult': 'N', | 439 | 'wholeResult': 'N', |
| 213 | 'wholeResultMessage': empty_str, | 440 | 'wholeResultMessage': empty_str, |
| 214 | 'applicationLink': r'//china.bmw.corp/WINFS/SF-CN-data/SF3-CN-S/SF3-CN-S-1-New Business/CA/OCR II test', | 441 | 'applicationLink': application_link, |
| 215 | } | 442 | } |
| 216 | }) | 443 | }) |
| 217 | 444 | ||
| ... | @@ -672,7 +899,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -672,7 +899,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
| 672 | break | 899 | break |
| 673 | 900 | ||
| 674 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str | 901 | img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str |
| 675 | error_type = empty_str if result == consts.RESULT_Y else ErrorType.OCR.value | 902 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value |
| 676 | result_field_list.append((name, value, result, ocr_str, img_path, error_type)) | 903 | result_field_list.append((name, value, result, ocr_str, img_path, error_type)) |
| 677 | 904 | ||
| 678 | if not is_find: | 905 | if not is_find: |
| ... | @@ -738,7 +965,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): | ... | @@ -738,7 +965,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): |
| 738 | else: | 965 | else: |
| 739 | result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) | 966 | result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) |
| 740 | img_path = ocr_res.get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str | 967 | img_path = ocr_res.get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str |
| 741 | error_type = empty_str if result == consts.RESULT_Y else ErrorType.OCR.value | 968 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value |
| 742 | result_field_list.append((name, value, result, ocr_str, img_path, error_type)) | 969 | result_field_list.append((name, value, result, ocr_str, img_path, error_type)) |
| 743 | 970 | ||
| 744 | if not is_find: | 971 | if not is_find: |
| ... | @@ -774,16 +1001,16 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -774,16 +1001,16 @@ def se_compare_process(compare_info, ocr_res_dict): |
| 774 | failure_field.append(name) | 1001 | failure_field.append(name) |
| 775 | compare_result.append( | 1002 | compare_result.append( |
| 776 | { | 1003 | { |
| 777 | 'Info': info_key, | 1004 | consts.HEAD_LIST[0]: info_key, |
| 778 | 'Index': idx, | 1005 | consts.HEAD_LIST[1]: idx, |
| 779 | 'License': license_en, | 1006 | consts.HEAD_LIST[2]: license_en, |
| 780 | 'Field': name, | 1007 | consts.HEAD_LIST[3]: name, |
| 781 | 'Input': value, | 1008 | consts.HEAD_LIST[4]: value, |
| 782 | 'OCR': ocr_str, | 1009 | consts.HEAD_LIST[5]: ocr_str, |
| 783 | 'Result': result, | 1010 | consts.HEAD_LIST[6]: result, |
| 784 | 'Position': empty_str, | 1011 | consts.HEAD_LIST[7]: empty_str, |
| 785 | 'Image': img_path, | 1012 | consts.HEAD_LIST[8]: img_path, |
| 786 | 'errorType': error_type, | 1013 | consts.HEAD_LIST[9]: error_type, |
| 787 | } | 1014 | } |
| 788 | ) | 1015 | ) |
| 789 | failure_reason.setdefault(license_en, []).append('/'.join(failure_field)) | 1016 | failure_reason.setdefault(license_en, []).append('/'.join(failure_field)) |
| ... | @@ -802,16 +1029,16 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -802,16 +1029,16 @@ def se_compare_process(compare_info, ocr_res_dict): |
| 802 | failure_field.append(name) | 1029 | failure_field.append(name) |
| 803 | compare_result.append( | 1030 | compare_result.append( |
| 804 | { | 1031 | { |
| 805 | 'Info': info_key, | 1032 | consts.HEAD_LIST[0]: info_key, |
| 806 | 'Index': 0, | 1033 | consts.HEAD_LIST[1]: "0", |
| 807 | 'License': license_en, | 1034 | consts.HEAD_LIST[2]: license_en, |
| 808 | 'Field': name, | 1035 | consts.HEAD_LIST[3]: name, |
| 809 | 'Input': value, | 1036 | consts.HEAD_LIST[4]: value, |
| 810 | 'OCR': ocr_str, | 1037 | consts.HEAD_LIST[5]: ocr_str, |
| 811 | 'Result': result, | 1038 | consts.HEAD_LIST[6]: result, |
| 812 | 'Position': empty_str, | 1039 | consts.HEAD_LIST[7]: empty_str, |
| 813 | 'Image': img_path, | 1040 | consts.HEAD_LIST[8]: img_path, |
| 814 | 'errorType': error_type, | 1041 | consts.HEAD_LIST[9]: error_type, |
| 815 | } | 1042 | } |
| 816 | ) | 1043 | ) |
| 817 | failure_reason.setdefault(license_en, []).append('/'.join(failure_field)) | 1044 | failure_reason.setdefault(license_en, []).append('/'.join(failure_field)) | ... | ... |
| ... | @@ -155,9 +155,30 @@ class Comparison: | ... | @@ -155,9 +155,30 @@ class Comparison: |
| 155 | ocr_s = ocr_str.translate(self.TRANS) | 155 | ocr_s = ocr_str.translate(self.TRANS) |
| 156 | return self.build_res(input_s == ocr_s) | 156 | return self.build_res(input_s == ocr_s) |
| 157 | 157 | ||
| 158 | def ca_name_compare(self, input_str, ocr_str, **kwargs): | ||
| 159 | if kwargs.get('is_passport'): | ||
| 160 | input_tmp = input_str.upper().replace(' ', '') | ||
| 161 | ocr_tmp = ocr_str.upper().replace(' ', '') | ||
| 162 | if input_tmp.find(ocr_tmp) == -1: | ||
| 163 | return self.RESULT_N | ||
| 164 | else: | ||
| 165 | if ocr_str.strip() == '': | ||
| 166 | return self.RESULT_N | ||
| 167 | else: | ||
| 168 | return self.RESULT_Y | ||
| 169 | else: | ||
| 170 | # if re.search(r'[a-zA-Z]]', input_str): | ||
| 171 | # return self.RESULT_NA, ocr_str | ||
| 172 | input_s = input_str.translate(self.TRANS) | ||
| 173 | ocr_s = ocr_str.translate(self.TRANS) | ||
| 174 | return self.build_res(input_s == ocr_s) | ||
| 175 | |||
| 158 | def se_common_compare(self, input_str, ocr_str, **kwargs): | 176 | def se_common_compare(self, input_str, ocr_str, **kwargs): |
| 159 | return self.build_res(input_str == ocr_str) | 177 | return self.build_res(input_str == ocr_str) |
| 160 | 178 | ||
| 179 | def ca_common_compare(self, input_str, ocr_str, **kwargs): | ||
| 180 | return self.build_res(input_str == ocr_str) | ||
| 181 | |||
| 161 | def se_date_compare(self, input_str, ocr_str, **kwargs): | 182 | def se_date_compare(self, input_str, ocr_str, **kwargs): |
| 162 | if kwargs.get('long', False): | 183 | if kwargs.get('long', False): |
| 163 | if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str: | 184 | if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str: |
| ... | @@ -176,6 +197,24 @@ class Comparison: | ... | @@ -176,6 +197,24 @@ class Comparison: |
| 176 | input_str = input_str.replace('-', kwargs.get('input_replace')) | 197 | input_str = input_str.replace('-', kwargs.get('input_replace')) |
| 177 | return self.build_res(input_str == ocr_str) | 198 | return self.build_res(input_str == ocr_str) |
| 178 | 199 | ||
| 200 | def ca_date_compare(self, input_str, ocr_str, **kwargs): | ||
| 201 | if kwargs.get('long', False): | ||
| 202 | if '长期' in ocr_str or '永久' in ocr_str: | ||
| 203 | if input_str in ['2099-12-31', '2099-01-01']: | ||
| 204 | return self.RESULT_Y | ||
| 205 | else: | ||
| 206 | return self.RESULT_N | ||
| 207 | if kwargs.get('ocr_split', False): | ||
| 208 | if '至' in ocr_str: | ||
| 209 | ocr_str = ocr_str.split('至')[-1] | ||
| 210 | elif '-' in ocr_str: | ||
| 211 | ocr_str = ocr_str.split('-')[-1] | ||
| 212 | if kwargs.get('ocr_replace', False): | ||
| 213 | ocr_str = ocr_str.replace('年', '-').replace('月', '-').replace('日', '') | ||
| 214 | if kwargs.get('input_replace') is not None: | ||
| 215 | input_str = input_str.replace('-', kwargs.get('input_replace')) | ||
| 216 | return self.build_res(input_str == ocr_str) | ||
| 217 | |||
| 179 | def se_contain_compare(self, input_str, ocr_str, **kwargs): | 218 | def se_contain_compare(self, input_str, ocr_str, **kwargs): |
| 180 | if ocr_str.find(input_str) == -1: | 219 | if ocr_str.find(input_str) == -1: |
| 181 | return self.RESULT_N | 220 | return self.RESULT_N |
| ... | @@ -220,6 +259,11 @@ class Comparison: | ... | @@ -220,6 +259,11 @@ class Comparison: |
| 220 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() | 259 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() |
| 221 | return self.build_res(input_tmp == ocr_tmp) | 260 | return self.build_res(input_tmp == ocr_tmp) |
| 222 | 261 | ||
| 262 | def ca_company_compare(self, input_str, ocr_str, **kwargs): | ||
| 263 | input_tmp = re.sub(self.re_obj, '', input_str).strip() | ||
| 264 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() | ||
| 265 | return self.build_res(input_tmp == ocr_tmp) | ||
| 266 | |||
| 223 | def se_rmb_compare(self, input_str, ocr_str, **kwargs): | 267 | def se_rmb_compare(self, input_str, ocr_str, **kwargs): |
| 224 | try: | 268 | try: |
| 225 | ocr_lower = rmb_handler.to_rmb_lower(ocr_str) | 269 | ocr_lower = rmb_handler.to_rmb_lower(ocr_str) |
| ... | @@ -231,6 +275,17 @@ class Comparison: | ... | @@ -231,6 +275,17 @@ class Comparison: |
| 231 | else: | 275 | else: |
| 232 | return res | 276 | return res |
| 233 | 277 | ||
| 278 | def ca_rmb_compare(self, input_str, ocr_str, **kwargs): | ||
| 279 | try: | ||
| 280 | ocr_lower = rmb_handler.to_rmb_lower(ocr_str) | ||
| 281 | res = self.build_res(float(input_str) == ocr_lower) | ||
| 282 | # input_rmb_upper = to_rmb_upper(float(input_str)) | ||
| 283 | # res = self.build_res(input_rmb_upper == ocr_str) | ||
| 284 | except Exception as e: | ||
| 285 | return self.RESULT_N | ||
| 286 | else: | ||
| 287 | return res | ||
| 288 | |||
| 234 | def se_type_compare(self, input_str, ocr_str, **kwargs): | 289 | def se_type_compare(self, input_str, ocr_str, **kwargs): |
| 235 | for map_tuple in self.TYPE_MAPPING: | 290 | for map_tuple in self.TYPE_MAPPING: |
| 236 | if re.search(map_tuple[0], ocr_str) is not None: | 291 | if re.search(map_tuple[0], ocr_str) is not None: |
| ... | @@ -240,6 +295,15 @@ class Comparison: | ... | @@ -240,6 +295,15 @@ class Comparison: |
| 240 | compare_str = self.CSOTH | 295 | compare_str = self.CSOTH |
| 241 | return self.build_res(input_str == compare_str) | 296 | return self.build_res(input_str == compare_str) |
| 242 | 297 | ||
| 298 | def ca_type_compare(self, input_str, ocr_str, **kwargs): | ||
| 299 | for map_tuple in self.TYPE_MAPPING: | ||
| 300 | if re.search(map_tuple[0], ocr_str) is not None: | ||
| 301 | compare_str = map_tuple[1] | ||
| 302 | break | ||
| 303 | else: | ||
| 304 | compare_str = self.CSOTH | ||
| 305 | return self.build_res(input_str == compare_str) | ||
| 306 | |||
| 243 | def se_date_compare_2(self, input_str, ocr_str, **kwargs): | 307 | def se_date_compare_2(self, input_str, ocr_str, **kwargs): |
| 244 | try: | 308 | try: |
| 245 | input_date = time.strptime(input_str, "%Y-%m-%d") | 309 | input_date = time.strptime(input_str, "%Y-%m-%d") | ... | ... |
| ... | @@ -3,11 +3,123 @@ import pyodbc | ... | @@ -3,11 +3,123 @@ import pyodbc |
| 3 | hil_sql = """ | 3 | hil_sql = """ |
| 4 | ALTER TABLE hil_ca_compare_result ADD version nvarchar(8), comments nvarchar(max); | 4 | ALTER TABLE hil_ca_compare_result ADD version nvarchar(8), comments nvarchar(max); |
| 5 | ALTER TABLE hil_se_compare_result ADD version nvarchar(8), comments nvarchar(max); | 5 | ALTER TABLE hil_se_compare_result ADD version nvarchar(8), comments nvarchar(max); |
| 6 | |||
| 7 | create table hil_se_compare_result_record | ||
| 8 | ( | ||
| 9 | id int identity primary key, | ||
| 10 | application_id nvarchar(64) not null, | ||
| 11 | is_finish bit default 0 not null, | ||
| 12 | compare_count smallint default 0 not null, | ||
| 13 | failed_count smallint default 0 not null, | ||
| 14 | reason1_count smallint default 0 not null, | ||
| 15 | reason2_count smallint default 0 not null, | ||
| 16 | reason3_count smallint default 0 not null, | ||
| 17 | reason4_count smallint default 0 not null, | ||
| 18 | reason5_count smallint default 0 not null, | ||
| 19 | reason6_count smallint default 0 not null, | ||
| 20 | reason7_count smallint default 0 not null, | ||
| 21 | reason8_count smallint default 0 not null, | ||
| 22 | reason9_count smallint default 0 not null, | ||
| 23 | reason10_count smallint default 0 not null, | ||
| 24 | result nvarchar(max), | ||
| 25 | comments nvarchar(max), | ||
| 26 | create_time datetime not null | ||
| 27 | ); | ||
| 28 | |||
| 29 | create index hil_se_compare_result_record_application_id_index | ||
| 30 | on hil_se_compare_result_record (application_id); | ||
| 31 | |||
| 32 | create index hil_se_compare_result_record_create_time_index | ||
| 33 | on hil_se_compare_result_record (create_time); | ||
| 34 | |||
| 35 | create table hil_ca_compare_result_record | ||
| 36 | ( | ||
| 37 | id int identity primary key, | ||
| 38 | application_id nvarchar(64) not null, | ||
| 39 | is_finish bit default 0 not null, | ||
| 40 | compare_count smallint default 0 not null, | ||
| 41 | failed_count smallint default 0 not null, | ||
| 42 | reason1_count smallint default 0 not null, | ||
| 43 | reason2_count smallint default 0 not null, | ||
| 44 | reason3_count smallint default 0 not null, | ||
| 45 | reason4_count smallint default 0 not null, | ||
| 46 | reason5_count smallint default 0 not null, | ||
| 47 | reason6_count smallint default 0 not null, | ||
| 48 | reason7_count smallint default 0 not null, | ||
| 49 | reason8_count smallint default 0 not null, | ||
| 50 | reason9_count smallint default 0 not null, | ||
| 51 | reason10_count smallint default 0 not null, | ||
| 52 | result nvarchar(max), | ||
| 53 | comments nvarchar(max), | ||
| 54 | create_time datetime not null | ||
| 55 | ); | ||
| 56 | |||
| 57 | create index hil_ca_compare_result_record_application_id_index | ||
| 58 | on hil_ca_compare_result_record (application_id); | ||
| 59 | |||
| 60 | create index hil_ca_compare_result_record_create_time_index | ||
| 61 | on hil_ca_compare_result_record (create_time); | ||
| 6 | """ | 62 | """ |
| 7 | 63 | ||
| 8 | afc_sql = """ | 64 | afc_sql = """ |
| 9 | ALTER TABLE afc_ca_compare_result ADD version nvarchar(8), comments nvarchar(max); | 65 | ALTER TABLE afc_ca_compare_result ADD version nvarchar(8), comments nvarchar(max); |
| 10 | ALTER TABLE afc_se_compare_result ADD version nvarchar(8), comments nvarchar(max); | 66 | ALTER TABLE afc_se_compare_result ADD version nvarchar(8), comments nvarchar(max); |
| 67 | |||
| 68 | create table afc_se_compare_result_record | ||
| 69 | ( | ||
| 70 | id int identity primary key, | ||
| 71 | application_id nvarchar(64) not null, | ||
| 72 | is_finish bit default 0 not null, | ||
| 73 | compare_count smallint default 0 not null, | ||
| 74 | failed_count smallint default 0 not null, | ||
| 75 | reason1_count smallint default 0 not null, | ||
| 76 | reason2_count smallint default 0 not null, | ||
| 77 | reason3_count smallint default 0 not null, | ||
| 78 | reason4_count smallint default 0 not null, | ||
| 79 | reason5_count smallint default 0 not null, | ||
| 80 | reason6_count smallint default 0 not null, | ||
| 81 | reason7_count smallint default 0 not null, | ||
| 82 | reason8_count smallint default 0 not null, | ||
| 83 | reason9_count smallint default 0 not null, | ||
| 84 | reason10_count smallint default 0 not null, | ||
| 85 | result nvarchar(max), | ||
| 86 | comments nvarchar(max), | ||
| 87 | create_time datetime not null | ||
| 88 | ); | ||
| 89 | |||
| 90 | create index afc_se_compare_result_record_application_id_index | ||
| 91 | on afc_se_compare_result_record (application_id); | ||
| 92 | |||
| 93 | create index afc_se_compare_result_record_create_time_index | ||
| 94 | on afc_se_compare_result_record (create_time); | ||
| 95 | |||
| 96 | create table afc_ca_compare_result_record | ||
| 97 | ( | ||
| 98 | id int identity primary key, | ||
| 99 | application_id nvarchar(64) not null, | ||
| 100 | is_finish bit default 0 not null, | ||
| 101 | compare_count smallint default 0 not null, | ||
| 102 | failed_count smallint default 0 not null, | ||
| 103 | reason1_count smallint default 0 not null, | ||
| 104 | reason2_count smallint default 0 not null, | ||
| 105 | reason3_count smallint default 0 not null, | ||
| 106 | reason4_count smallint default 0 not null, | ||
| 107 | reason5_count smallint default 0 not null, | ||
| 108 | reason6_count smallint default 0 not null, | ||
| 109 | reason7_count smallint default 0 not null, | ||
| 110 | reason8_count smallint default 0 not null, | ||
| 111 | reason9_count smallint default 0 not null, | ||
| 112 | reason10_count smallint default 0 not null, | ||
| 113 | result nvarchar(max), | ||
| 114 | comments nvarchar(max), | ||
| 115 | create_time datetime not null | ||
| 116 | ); | ||
| 117 | |||
| 118 | create index afc_ca_compare_result_record_application_id_index | ||
| 119 | on afc_ca_compare_result_record (application_id); | ||
| 120 | |||
| 121 | create index afc_ca_compare_result_record_create_time_index | ||
| 122 | on afc_ca_compare_result_record (create_time); | ||
| 11 | """ | 123 | """ |
| 12 | 124 | ||
| 13 | hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | 125 | hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ... | ... |
| ... | @@ -12,3 +12,5 @@ EDMS_DOWNLOAD_URL = http://sccn0639.bmwgroup.net/FH/FileHold/DocumentRepository/ | ... | @@ -12,3 +12,5 @@ EDMS_DOWNLOAD_URL = http://sccn0639.bmwgroup.net/FH/FileHold/DocumentRepository/ |
| 12 | EDMS_UPLOAD_URL = http://sccn0639.bmwgroup.net/FH/FileHold/DocumentRepository/UploadHandler.ashx | 12 | EDMS_UPLOAD_URL = http://sccn0639.bmwgroup.net/FH/FileHold/DocumentRepository/UploadHandler.ashx |
| 13 | DEALER_CODE = ocr_group | 13 | DEALER_CODE = ocr_group |
| 14 | 14 | ||
| 15 | BASE_URL = https://li19dkocruat02vm.bmwgroup.net | ||
| 16 | ... | ... |
| ... | @@ -10,4 +10,6 @@ IMG_QUEUE_SIZE = 500 | ... | @@ -10,4 +10,6 @@ IMG_QUEUE_SIZE = 500 |
| 10 | 10 | ||
| 11 | EDMS_DOWNLOAD_URL = https://edms-test.bmw.com/FH/FileHold/DocumentRepository/DownloadHandler.ashx | 11 | EDMS_DOWNLOAD_URL = https://edms-test.bmw.com/FH/FileHold/DocumentRepository/DownloadHandler.ashx |
| 12 | EDMS_UPLOAD_URL = https://edms-test.bmw.com/FH/FileHold/DocumentRepository/UploadHandler.ashx | 12 | EDMS_UPLOAD_URL = https://edms-test.bmw.com/FH/FileHold/DocumentRepository/UploadHandler.ashx |
| 13 | DEALER_CODE = ocr_situ_group | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 13 | DEALER_CODE = ocr_situ_group | ||
| 14 | |||
| 15 | BASE_URL = https://staging-bmw-ocr.situdata.com | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,4 +10,6 @@ IMG_QUEUE_SIZE = 500 | ... | @@ -10,4 +10,6 @@ IMG_QUEUE_SIZE = 500 |
| 10 | 10 | ||
| 11 | EDMS_DOWNLOAD_URL = http://sccn0637.bmwgroup.net/FH/FileHold/DocumentRepository/DownloadHandler.ashx | 11 | EDMS_DOWNLOAD_URL = http://sccn0637.bmwgroup.net/FH/FileHold/DocumentRepository/DownloadHandler.ashx |
| 12 | EDMS_UPLOAD_URL = http://sccn0637.bmwgroup.net/FH/FileHold/DocumentRepository/UploadHandler.ashx | 12 | EDMS_UPLOAD_URL = http://sccn0637.bmwgroup.net/FH/FileHold/DocumentRepository/UploadHandler.ashx |
| 13 | DEALER_CODE = ocr_situ_group | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 13 | DEALER_CODE = ocr_situ_group | ||
| 14 | |||
| 15 | BASE_URL = https://li19dkocruat01vm.bmwgroup.net | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment