fix bug
Showing
4 changed files
with
28 additions
and
6 deletions
| ... | @@ -1679,7 +1679,7 @@ BL_COMPARE_LOGIC = { | ... | @@ -1679,7 +1679,7 @@ BL_COMPARE_LOGIC = { |
| 1679 | 'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1679 | 'businessLicenseNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1680 | 'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1680 | 'organizationCreditCode': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1681 | 'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), | 1681 | 'taxRegistrationCertificateNo': ('注册号', 'se_common_compare', {}, '营业执照统一社会信用代码与系统不一致'), |
| 1682 | 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True}, '营业执照显示公司成立不满足2年'), | 1682 | 'establishmentDate': ('成立日期', 'se_date_compare', {'ocr_replace': True, 'two_year': True}, '营业执照显示公司成立不满足2年'), |
| 1683 | 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'), | 1683 | 'businessLicenseDueDate': ('营业期限', 'se_date_compare', {'ocr_split': True, 'long': True, 'ocr_replace': True, 'today': True}, '公司营业期限疑似过期'), |
| 1684 | 'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'), | 1684 | 'organizationType': ('企业类型', 'se_type_compare', {}, '营业执照企业类型与系统不一致'), |
| 1685 | 'registeredCapital': ('注册资本', 'se_rmb_compare', {}, '营业执照注册资本与系统不一致'), | 1685 | 'registeredCapital': ('注册资本', 'se_rmb_compare', {}, '营业执照注册资本与系统不一致'), | ... | ... |
| ... | @@ -1656,7 +1656,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1656,7 +1656,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
| 1656 | dszx_amount = '500000' | 1656 | dszx_amount = '500000' |
| 1657 | bd_field_input = [ | 1657 | bd_field_input = [ |
| 1658 | (consts.SE_BD_FIELD[0], hmh_name), | 1658 | (consts.SE_BD_FIELD[0], hmh_name), |
| 1659 | (consts.SE_BD_FIELD[1], hmh_id), | 1659 | # (consts.SE_BD_FIELD[1], hmh_id), |
| 1660 | (consts.SE_BD_FIELD[2], vin_no), | 1660 | (consts.SE_BD_FIELD[2], vin_no), |
| 1661 | (consts.SE_BD_FIELD[3], ssx_amount), | 1661 | (consts.SE_BD_FIELD[3], ssx_amount), |
| 1662 | (consts.SE_BD_FIELD[4], dszx_amount), | 1662 | (consts.SE_BD_FIELD[4], dszx_amount), | ... | ... |
| ... | @@ -285,6 +285,23 @@ class Comparison: | ... | @@ -285,6 +285,23 @@ class Comparison: |
| 285 | else: | 285 | else: |
| 286 | return True | 286 | return True |
| 287 | 287 | ||
| 288 | @staticmethod | ||
| 289 | def is_predate_two_year(ocr_str): | ||
| 290 | dt_array, _ = tslib.array_to_datetime( | ||
| 291 | np.array([ocr_str, ], copy=False, dtype=np.object_), | ||
| 292 | errors="coerce", | ||
| 293 | utc=False, | ||
| 294 | dayfirst=False, | ||
| 295 | yearfirst=False, | ||
| 296 | require_iso8601=True, | ||
| 297 | ) | ||
| 298 | dti = DatetimeIndex(dt_array, tz=None, name=None) | ||
| 299 | ts = dti[0] | ||
| 300 | if isinstance(ts, NaTType) or ts.date() > (datetime.today() - relativedelta(years=2)).date(): | ||
| 301 | return False | ||
| 302 | else: | ||
| 303 | return True | ||
| 304 | |||
| 288 | def se_date_compare(self, input_str, ocr_str, **kwargs): | 305 | def se_date_compare(self, input_str, ocr_str, **kwargs): |
| 289 | if kwargs.get('long', False): | 306 | if kwargs.get('long', False): |
| 290 | if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str or '年—月—日' in ocr_str or '年 月 日' in ocr_str: | 307 | 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: | ... | @@ -303,6 +320,8 @@ class Comparison: |
| 303 | input_str = input_str.replace('-', kwargs.get('input_replace')) | 320 | input_str = input_str.replace('-', kwargs.get('input_replace')) |
| 304 | if kwargs.get('today', False): | 321 | if kwargs.get('today', False): |
| 305 | return self.build_res(self.is_after_today(ocr_str)) | 322 | return self.build_res(self.is_after_today(ocr_str)) |
| 323 | if kwargs.get('two_year', False): | ||
| 324 | return self.build_res(self.is_predate_two_year(ocr_str)) | ||
| 306 | else: | 325 | else: |
| 307 | res = self.build_res(input_str == ocr_str) | 326 | res = self.build_res(input_str == ocr_str) |
| 308 | if res == self.RESULT_Y: | 327 | if res == self.RESULT_Y: |
| ... | @@ -380,10 +399,13 @@ class Comparison: | ... | @@ -380,10 +399,13 @@ class Comparison: |
| 380 | try: | 399 | try: |
| 381 | float_input = float(input_str) | 400 | float_input = float(input_str) |
| 382 | float_ocr = float(ocr_str.replace('元', '').replace(',', '')) | 401 | float_ocr = float(ocr_str.replace('元', '').replace(',', '')) |
| 402 | return self.build_res(float_ocr >= float_input) | ||
| 403 | except Exception as e: | ||
| 404 | try: | ||
| 405 | ocr_lower = rmb_handler.to_rmb_lower(ocr_str.replace('元', '').replace(',', '')) | ||
| 406 | return self.build_res(ocr_lower >= float(input_str)) | ||
| 383 | except Exception as e: | 407 | except Exception as e: |
| 384 | return self.RESULT_N | 408 | return self.RESULT_N |
| 385 | else: | ||
| 386 | return self.build_res(float_ocr >= float_input) | ||
| 387 | 409 | ||
| 388 | def se_amount_compare(self, input_str, ocr_str, **kwargs): | 410 | def se_amount_compare(self, input_str, ocr_str, **kwargs): |
| 389 | if input_str == ocr_str: | 411 | if input_str == ocr_str: |
| ... | @@ -476,7 +498,7 @@ class Comparison: | ... | @@ -476,7 +498,7 @@ class Comparison: |
| 476 | return self.RESULT_N | 498 | return self.RESULT_N |
| 477 | 499 | ||
| 478 | six_month_date = (datetime.today() - relativedelta(months=6)).date() | 500 | six_month_date = (datetime.today() - relativedelta(months=6)).date() |
| 479 | today_date = datetime.today().date() | 501 | today_date = (datetime.today() + relativedelta(days=1)).date() |
| 480 | return self.build_res(six_month_date <= ocr_date <= today_date) | 502 | return self.build_res(six_month_date <= ocr_date <= today_date) |
| 481 | else: | 503 | else: |
| 482 | if input_date == ocr_date or ocr_date == input_date + relativedelta(days=1): | 504 | if input_date == ocr_date or ocr_date == input_date + relativedelta(days=1): | ... | ... |
| ... | @@ -92,7 +92,7 @@ rmb_handler = RMBHandler() | ... | @@ -92,7 +92,7 @@ rmb_handler = RMBHandler() |
| 92 | 92 | ||
| 93 | if __name__ == '__main__': | 93 | if __name__ == '__main__': |
| 94 | test_2 = ['壹万伍仟肆佰壹拾圆叁角伍分肆厘', '捌万陆仟肆佰壹拾圆整', '壹万伍仟肆佰壹拾元贰角捌分肆厘', '拾壹亿壹仟万伍仟肆佰壹拾元贰角捌分肆厘', '拾伍万圆'] | 94 | test_2 = ['壹万伍仟肆佰壹拾圆叁角伍分肆厘', '捌万陆仟肆佰壹拾圆整', '壹万伍仟肆佰壹拾元贰角捌分肆厘', '拾壹亿壹仟万伍仟肆佰壹拾元贰角捌分肆厘', '拾伍万圆'] |
| 95 | test_1 = ['sfdds', '柒佰玖拾万元整', '100万元整', '人民币伍佰万圆整', '人民币壹仟万元', '100万元', '贰佰壹拾捌万圆整', '(人民币)壹仟万元', '壹佰壹拾万圆整', '人民币30.0000万元整', '伍拾万元人民币'] | 95 | test_1 = ['sfdds', '柒佰玖拾万元整', '100万元整', '人民币伍佰万圆整', '人民币壹仟万元', '100万元', '贰佰壹拾捌万圆整', '(人民币)壹仟万元', '壹佰壹拾万圆整', '人民币30.0000万元整', '伍拾万元人民币', '200万'] |
| 96 | input_list = test_1 | 96 | input_list = test_1 |
| 97 | for i in input_list: | 97 | for i in input_list: |
| 98 | print('{0}={1}'.format(i, rmb_handler.to_rmb_lower(i))) | 98 | print('{0}={1}'.format(i, rmb_handler.to_rmb_lower(i))) | ... | ... |
-
Please register or sign in to post a comment