Merge branch 'feature/CHINARPA-4357' into feature/uat-tmp
Showing
3 changed files
with
16 additions
and
11 deletions
| ... | @@ -1412,9 +1412,9 @@ LEGAL_REP_NAME = '经营者姓名' | ... | @@ -1412,9 +1412,9 @@ LEGAL_REP_NAME = '经营者姓名' |
| 1412 | TCCOR = [ | 1412 | TCCOR = [ |
| 1413 | ('customerChineseName', '企业名称', 'company_compare', {}, 'customerChinessNameResult'), | 1413 | ('customerChineseName', '企业名称', 'company_compare', {}, 'customerChinessNameResult'), |
| 1414 | ('legalRepName', '经营者姓名', 'name_compare', {}, 'legalRepNameResult'), | 1414 | ('legalRepName', '经营者姓名', 'name_compare', {}, 'legalRepNameResult'), |
| 1415 | ('idNum', '注册号', 'common_compare', {}, 'idNumResult'), | 1415 | ('idNum', '统一社会信用代码', 'common_compare', {}, 'idNumResult'), |
| 1416 | ('businessLicenseNo', '注册号', 'common_compare', {}, 'businessLicenseNoResult'), | 1416 | ('businessLicenseNo', '统一社会信用代码', 'common_compare', {}, 'businessLicenseNoResult'), |
| 1417 | ('taxRegistrationCode', '注册号', 'common_compare', {}, 'taxRegistrationCodeResult'), | 1417 | ('taxRegistrationCode', '统一社会信用代码', 'common_compare', {}, 'taxRegistrationCodeResult'), |
| 1418 | ('incorporationDate', '成立日期', 'date_compare', {'ocr_replace': True}, 'incorporationDateResult'), # 2017年07月11日 | 1418 | ('incorporationDate', '成立日期', 'date_compare', {'ocr_replace': True}, 'incorporationDateResult'), # 2017年07月11日 |
| 1419 | # 2017年07月11日至长期 1. OCR识别为长期,向GCAP发送:2099-12-31 00:00:00.0 | 1419 | # 2017年07月11日至长期 1. OCR识别为长期,向GCAP发送:2099-12-31 00:00:00.0 |
| 1420 | ('businessLicenseDueDate', '营业期限', 'date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}, 'businessLicenseDueDateResult'), | 1420 | ('businessLicenseDueDate', '营业期限', 'date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}, 'businessLicenseDueDateResult'), |
| ... | @@ -1862,10 +1862,10 @@ RP_COMPARE_LOGIC = { | ... | @@ -1862,10 +1862,10 @@ RP_COMPARE_LOGIC = { |
| 1862 | BL_COMPARE_LOGIC = { | 1862 | BL_COMPARE_LOGIC = { |
| 1863 | 'companyName': ('企业名称', 'se_company_compare', {}, '营业执照公司名称与系统不一致'), | 1863 | 'companyName': ('企业名称', 'se_company_compare', {}, '营业执照公司名称与系统不一致'), |
| 1864 | 'legalRepName': ('经营者姓名', 'se_name_compare', {}, '营业执照法定代表人与系统不一致'), | 1864 | 'legalRepName': ('经营者姓名', 'se_name_compare', {}, '营业执照法定代表人与系统不一致'), |
| 1865 | 'firstIdNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1865 | 'firstIdNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1866 | 'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1866 | 'businessLicenseNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1867 | 'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1867 | 'organizationCreditCode': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1868 | 'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1868 | 'taxRegistrationCertificateNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1869 | 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True, 'two_year': True}, '营业执照显示公司成立不满足2年'), | 1869 | 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True, 'two_year': True}, '营业执照显示公司成立不满足2年'), |
| 1870 | 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'), | 1870 | 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'), |
| 1871 | 'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'), | 1871 | 'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'), |
| ... | @@ -2306,9 +2306,9 @@ CA_RP_COMPARE_LOGIC = { | ... | @@ -2306,9 +2306,9 @@ CA_RP_COMPARE_LOGIC = { |
| 2306 | CA_BL_COMPARE_LOGIC = { | 2306 | CA_BL_COMPARE_LOGIC = { |
| 2307 | 'companyName': ('企业名称', 'ca_company_compare', {}), | 2307 | 'companyName': ('企业名称', 'ca_company_compare', {}), |
| 2308 | 'customerChineseName': ('经营者姓名', 'ca_name_compare', {}), | 2308 | 'customerChineseName': ('经营者姓名', 'ca_name_compare', {}), |
| 2309 | 'idNum': ('注册号', 'ca_common_compare', {}), | 2309 | 'idNum': ('统一社会信用代码', 'ca_common_compare', {}), |
| 2310 | 'businessLicenseNo': ('注册号', 'ca_common_compare', {}), | 2310 | 'businessLicenseNo': ('统一社会信用代码', 'ca_common_compare', {}), |
| 2311 | 'taxRegistrationCode': ('注册号', 'ca_common_compare', {}), | 2311 | 'taxRegistrationCode': ('统一社会信用代码', 'ca_common_compare', {}), |
| 2312 | 'incorporationDate': ('成立日期', 'ca_date_compare', {'ocr_replace': True}), | 2312 | 'incorporationDate': ('成立日期', 'ca_date_compare', {'ocr_replace': True}), |
| 2313 | 'businessLicenseDueDate': ('营业期限', 'ca_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}), | 2313 | 'businessLicenseDueDate': ('营业期限', 'ca_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}), |
| 2314 | 'registeredCapital': ('注册资本', 'ca_rmb_compare', {}), | 2314 | 'registeredCapital': ('注册资本', 'ca_rmb_compare', {}), | ... | ... |
| ... | @@ -340,6 +340,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -340,6 +340,7 @@ class Command(BaseCommand, LoggerMixin): |
| 340 | if len(true_file_set) == 0 and len(os_error_filename_set) > 0: | 340 | if len(true_file_set) == 0 and len(os_error_filename_set) > 0: |
| 341 | true_file_set.add(os_error_filename_set.pop()) | 341 | true_file_set.add(os_error_filename_set.pop()) |
| 342 | for name in true_file_set: | 342 | for name in true_file_set: |
| 343 | time.sleep(8) | ||
| 343 | is_success = True | 344 | is_success = True |
| 344 | failure_reason = OfflineFailureReason.OS_ERROR.value | 345 | failure_reason = OfflineFailureReason.OS_ERROR.value |
| 345 | start_time = time.time() | 346 | start_time = time.time() | ... | ... |
| ... | @@ -10,6 +10,7 @@ import traceback | ... | @@ -10,6 +10,7 @@ import traceback |
| 10 | from collections import Counter | 10 | from collections import Counter |
| 11 | from datetime import datetime, date | 11 | from datetime import datetime, date |
| 12 | from django import db | 12 | from django import db |
| 13 | from django.db import transaction | ||
| 13 | from django.utils import timezone | 14 | from django.utils import timezone |
| 14 | from django.core.management import BaseCommand | 15 | from django.core.management import BaseCommand |
| 15 | from multiprocessing import Process, Queue, Manager, Lock | 16 | from multiprocessing import Process, Queue, Manager, Lock |
| ... | @@ -2034,7 +2035,9 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -2034,7 +2035,9 @@ class Command(BaseCommand, LoggerMixin): |
| 2034 | result_class = HILOCRResult if is_ca else HILSEOCRResult | 2035 | result_class = HILOCRResult if is_ca else HILSEOCRResult |
| 2035 | else: | 2036 | else: |
| 2036 | result_class = AFCOCRResult if is_ca else AFCSEOCRResult | 2037 | result_class = AFCOCRResult if is_ca else AFCSEOCRResult |
| 2037 | res_obj = result_class.objects.filter(application_id=doc.application_id).first() | 2038 | res_obj = result_class.objects.select_for_update().filter(application_id=doc.application_id).first() |
| 2039 | with transaction.atomic(): | ||
| 2040 | self.online_log.info('{0} [sql lock application_id={1}]'.format(self.log_base, doc.application_id)) | ||
| 2038 | if res_obj is None: | 2041 | if res_obj is None: |
| 2039 | res_obj = result_class() | 2042 | res_obj = result_class() |
| 2040 | res_obj.application_id = doc.application_id | 2043 | res_obj.application_id = doc.application_id |
| ... | @@ -2059,6 +2062,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -2059,6 +2062,7 @@ class Command(BaseCommand, LoggerMixin): |
| 2059 | last_res_str = json.dumps(old_res_list) | 2062 | last_res_str = json.dumps(old_res_list) |
| 2060 | setattr(res_obj, field, last_res_str) | 2063 | setattr(res_obj, field, last_res_str) |
| 2061 | res_obj.save() | 2064 | res_obj.save() |
| 2065 | self.online_log.info('{0} [sql lock release application_id={1}]'.format(self.log_base, doc.application_id)) | ||
| 2062 | except Exception as e: | 2066 | except Exception as e: |
| 2063 | self.online_log.error( | 2067 | self.online_log.error( |
| 2064 | '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format( | 2068 | '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format( | ... | ... |
-
Please register or sign in to post a comment