9033711e by 冯轩

Merge branch 'feature/CHINARPA-4357' into feature/uat-tmp

2 parents 16eb116a 5218f898
......@@ -1412,9 +1412,9 @@ LEGAL_REP_NAME = '经营者姓名'
TCCOR = [
('customerChineseName', '企业名称', 'company_compare', {}, 'customerChinessNameResult'),
('legalRepName', '经营者姓名', 'name_compare', {}, 'legalRepNameResult'),
('idNum', '注册号', 'common_compare', {}, 'idNumResult'),
('businessLicenseNo', '注册号', 'common_compare', {}, 'businessLicenseNoResult'),
('taxRegistrationCode', '注册号', 'common_compare', {}, 'taxRegistrationCodeResult'),
('idNum', '统一社会信用代码', 'common_compare', {}, 'idNumResult'),
('businessLicenseNo', '统一社会信用代码', 'common_compare', {}, 'businessLicenseNoResult'),
('taxRegistrationCode', '统一社会信用代码', 'common_compare', {}, 'taxRegistrationCodeResult'),
('incorporationDate', '成立日期', 'date_compare', {'ocr_replace': True}, 'incorporationDateResult'), # 2017年07月11日
# 2017年07月11日至长期 1. OCR识别为长期,向GCAP发送:2099-12-31 00:00:00.0
('businessLicenseDueDate', '营业期限', 'date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}, 'businessLicenseDueDateResult'),
......@@ -1862,10 +1862,10 @@ RP_COMPARE_LOGIC = {
BL_COMPARE_LOGIC = {
'companyName': ('企业名称', 'se_company_compare', {}, '营业执照公司名称与系统不一致'),
'legalRepName': ('经营者姓名', 'se_name_compare', {}, '营业执照法定代表人与系统不一致'),
'firstIdNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'firstIdNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'businessLicenseNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'organizationCreditCode': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'taxRegistrationCertificateNo': ('统一社会信用代码', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True, 'two_year': True}, '营业执照显示公司成立不满足2年'),
'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'),
'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'),
......@@ -2306,9 +2306,9 @@ CA_RP_COMPARE_LOGIC = {
CA_BL_COMPARE_LOGIC = {
'companyName': ('企业名称', 'ca_company_compare', {}),
'customerChineseName': ('经营者姓名', 'ca_name_compare', {}),
'idNum': ('注册号', 'ca_common_compare', {}),
'businessLicenseNo': ('注册号', 'ca_common_compare', {}),
'taxRegistrationCode': ('注册号', 'ca_common_compare', {}),
'idNum': ('统一社会信用代码', 'ca_common_compare', {}),
'businessLicenseNo': ('统一社会信用代码', 'ca_common_compare', {}),
'taxRegistrationCode': ('统一社会信用代码', 'ca_common_compare', {}),
'incorporationDate': ('成立日期', 'ca_date_compare', {'ocr_replace': True}),
'businessLicenseDueDate': ('营业期限', 'ca_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True}),
'registeredCapital': ('注册资本', 'ca_rmb_compare', {}),
......
......@@ -340,6 +340,7 @@ class Command(BaseCommand, LoggerMixin):
if len(true_file_set) == 0 and len(os_error_filename_set) > 0:
true_file_set.add(os_error_filename_set.pop())
for name in true_file_set:
time.sleep(8)
is_success = True
failure_reason = OfflineFailureReason.OS_ERROR.value
start_time = time.time()
......
......@@ -10,6 +10,7 @@ import traceback
from collections import Counter
from datetime import datetime, date
from django import db
from django.db import transaction
from django.utils import timezone
from django.core.management import BaseCommand
from multiprocessing import Process, Queue, Manager, Lock
......@@ -2034,7 +2035,9 @@ class Command(BaseCommand, LoggerMixin):
result_class = HILOCRResult if is_ca else HILSEOCRResult
else:
result_class = AFCOCRResult if is_ca else AFCSEOCRResult
res_obj = result_class.objects.filter(application_id=doc.application_id).first()
res_obj = result_class.objects.select_for_update().filter(application_id=doc.application_id).first()
with transaction.atomic():
self.online_log.info('{0} [sql lock application_id={1}]'.format(self.log_base, doc.application_id))
if res_obj is None:
res_obj = result_class()
res_obj.application_id = doc.application_id
......@@ -2059,6 +2062,7 @@ class Command(BaseCommand, LoggerMixin):
last_res_str = json.dumps(old_res_list)
setattr(res_obj, field, last_res_str)
res_obj.save()
self.online_log.info('{0} [sql lock release application_id={1}]'.format(self.log_base, doc.application_id))
except Exception as e:
self.online_log.error(
'{0} [process error (ocr result save)] [task={1}] [error={2}]'.format(
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!