fix bug

1 parent 0a4214e1 master ... CHINARPA-4562 OCR-recognition-for-FSM-related-documents feature/202506-monixiadan feature/4058 feature/CHINAPRA-4447 feature/CHINARPA-3290-FSM-AUTO feature/CHINARPA-3443 feature/CHINARPA-3523 feature/CHINARPA-3528 feature/CHINARPA-3529 feature/CHINARPA-3577 feature/CHINARPA-3786 feature/CHINARPA-3964 feature/CHINARPA-4137 feature/CHINARPA-4277 feature/CHINARPA-4302/all-pass feature/CHINARPA-4341 feature/CHINARPA-4357 feature/CHINARPA-4358 feature/CHINARPA-4395 feature/CHINARPA-4495 feature/CHINARPA-4546 feature/CHINARPA-4623 feature/CHINARPA-4659 feature/CHINARPA-4660 feature/CHINARPA-4731 feature/CHINARPA-4846 feature/CHINARPA-4941 feature/CHINARPA-4942 feature/CHINARPA-4944 feature/CHINARPA-4962 feature/CHINARPA-5015 feature/CHINARPA-5075 feature/CHINARPA-5092 feature/CHINARPA-5117 feature/CHINARPA-5118 feature/CHINARPA-5131-5234 feature/CHINARPA-5153 feature/CHINARPA-5155 feature/CHINARPA-5296 feature/CHINARPA-5504 feature/CHINARPA-5619 feature/CHINARPA-5620-dzfp feature/CHINARPA_5015_SQL feature/KWOM_July feature/SE feature/SE2 feature/SE3 feature/add_log_20240924 feature/add_try_except feature/admin feature/admin2 feature/auto-flag feature/e-bank feature/enhancement-file-name-change feature/f3 feature/filter-file feature/fix_label_40_dydjhmh feature/fsm-contract feature/fsm-full feature/hotfix_insurance feature/mssql-encrypt feature/new-pwd feature/pdftoimg feature/pentest feature/pres feature/pres-3034 feature/qrs feature/report feature/report2 feature/rpa feature/sc feature/seOct feature/token feature/uat-new feature/uat-tmp feature/uat-tmp-cms-yace feature/uat-tmp-cy feature/uat-tmp-wblog feature/upgrade_cut_img feature/weixin-bs feature/weixin-bs-2 feature/zfb feature/zip feature_add_down_payment feature_add_income_keywords_cy feature_add_insurance_sec_page fix/1118上线问题反馈 fix/1227 fix/2024-05-pen-test fix/20240424 fix/hil_excel_sql fix/id-card fix/new_hil_contract fix/report_ca hotfix/2025-02 hotfix/2025-04 hotfix/2025-06 master-0117 ocr-Pre-Settlement
...@@ -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)))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!