14e86b52 by 周伟奇

fix bug

1 parent 0a4214e1
......@@ -1679,7 +1679,7 @@ BL_COMPARE_LOGIC = {
'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'),
'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True}, '营业执照显示公司成立不满足2年'),
'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', {}, '营业执照企业类型与系统不一致'),
'registeredCapital': ('注册资本', 'se_rmb_compare', {}, '营业执照注册资本与系统不一致'),
......
......@@ -1656,7 +1656,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
dszx_amount = '500000'
bd_field_input = [
(consts.SE_BD_FIELD[0], hmh_name),
(consts.SE_BD_FIELD[1], hmh_id),
# (consts.SE_BD_FIELD[1], hmh_id),
(consts.SE_BD_FIELD[2], vin_no),
(consts.SE_BD_FIELD[3], ssx_amount),
(consts.SE_BD_FIELD[4], dszx_amount),
......
......@@ -285,6 +285,23 @@ class Comparison:
else:
return True
@staticmethod
def is_predate_two_year(ocr_str):
dt_array, _ = tslib.array_to_datetime(
np.array([ocr_str, ], copy=False, dtype=np.object_),
errors="coerce",
utc=False,
dayfirst=False,
yearfirst=False,
require_iso8601=True,
)
dti = DatetimeIndex(dt_array, tz=None, name=None)
ts = dti[0]
if isinstance(ts, NaTType) or ts.date() > (datetime.today() - relativedelta(years=2)).date():
return False
else:
return True
def se_date_compare(self, input_str, ocr_str, **kwargs):
if kwargs.get('long', False):
if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str or '年—月—日' in ocr_str or '年 月 日' in ocr_str:
......@@ -303,6 +320,8 @@ class Comparison:
input_str = input_str.replace('-', kwargs.get('input_replace'))
if kwargs.get('today', False):
return self.build_res(self.is_after_today(ocr_str))
if kwargs.get('two_year', False):
return self.build_res(self.is_predate_two_year(ocr_str))
else:
res = self.build_res(input_str == ocr_str)
if res == self.RESULT_Y:
......@@ -380,10 +399,13 @@ class Comparison:
try:
float_input = float(input_str)
float_ocr = float(ocr_str.replace('元', '').replace(',', ''))
except Exception as e:
return self.RESULT_N
else:
return self.build_res(float_ocr >= float_input)
except Exception as e:
try:
ocr_lower = rmb_handler.to_rmb_lower(ocr_str.replace('元', '').replace(',', ''))
return self.build_res(ocr_lower >= float(input_str))
except Exception as e:
return self.RESULT_N
def se_amount_compare(self, input_str, ocr_str, **kwargs):
if input_str == ocr_str:
......@@ -476,7 +498,7 @@ class Comparison:
return self.RESULT_N
six_month_date = (datetime.today() - relativedelta(months=6)).date()
today_date = datetime.today().date()
today_date = (datetime.today() + relativedelta(days=1)).date()
return self.build_res(six_month_date <= ocr_date <= today_date)
else:
if input_date == ocr_date or ocr_date == input_date + relativedelta(days=1):
......
......@@ -92,7 +92,7 @@ rmb_handler = RMBHandler()
if __name__ == '__main__':
test_2 = ['壹万伍仟肆佰壹拾圆叁角伍分肆厘', '捌万陆仟肆佰壹拾圆整', '壹万伍仟肆佰壹拾元贰角捌分肆厘', '拾壹亿壹仟万伍仟肆佰壹拾元贰角捌分肆厘', '拾伍万圆']
test_1 = ['sfdds', '柒佰玖拾万元整', '100万元整', '人民币伍佰万圆整', '人民币壹仟万元', '100万元', '贰佰壹拾捌万圆整', '(人民币)壹仟万元', '壹佰壹拾万圆整', '人民币30.0000万元整', '伍拾万元人民币']
test_1 = ['sfdds', '柒佰玖拾万元整', '100万元整', '人民币伍佰万圆整', '人民币壹仟万元', '100万元', '贰佰壹拾捌万圆整', '(人民币)壹仟万元', '壹佰壹拾万圆整', '人民币30.0000万元整', '伍拾万元人民币', '200万']
input_list = test_1
for i in input_list:
print('{0}={1}'.format(i, rmb_handler.to_rmb_lower(i)))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!