885bf854 by 冯轩

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

2 parents cb270a88 8c0ddf7e
......@@ -1990,8 +1990,8 @@ BD_COMPARE_LOGIC = {
'机动车损失保险金额': ('机动车损失保险金额', 'se_amount_lte_compare', {}, '保单车损险异常'),
'第三者责任保险金额': ('机动车第三者责任保险金额', 'se_amount_lte_compare', {}, '保单三者险异常'),
'绝对免赔率': ('机动车损失保险绝对免赔率/绝对免赔额', 'se_one_compare', {}, '保单无绝对免赔项'),
'保险起始日期': ('保险起始日期', 'se_bd_date_compare', {'start': True}, '保单起始时间有误'),
'保险截止日期': ('保险截止日期', 'se_bd_date_compare', {}, '保单截止时间有误'),
'保险起始日期': ('保险起始日期', 'se_bd_date_2_compare', {'start': True}, '保单起始时间有误'),
'保险截止日期': ('保险截止日期', 'se_bd_date_2_compare', {}, '保单截止时间有误'),
'保单章': ('保单章', 'se_common_compare', {}, '保单无保单章'),
'第一受益人': ('特别约定第一受益人', 'se_common_compare', {}, '保单第一受益人需人工核查'),
'保险费合计': ('保险费合计', 'se_amount_lte_compare', {}, '保单保费疑似无法覆盖ASP保险融资'),
......
......@@ -1306,13 +1306,13 @@ def get_se_cms_compare_info_auto(application_id, last_obj, application_entity, d
(consts.SE_BD_FIELD[0], [co_name, bo_name] if is_cdfl else [main_name, ]), # 车贷分离
(consts.SE_BD_FIELD[1], [co_id, bo_id] if is_cdfl else [main_id, ]), # 车贷分离
(consts.SE_BD_FIELD[2], vin_no),
(consts.SE_BD_FIELD[3], ssx_amount),
(consts.SE_BD_FIELD[4], dszx_amount),
(consts.SE_BD_FIELD[5], consts.JDMPV_VALUE),
# (consts.SE_BD_FIELD[3], ssx_amount),
# (consts.SE_BD_FIELD[4], dszx_amount),
# (consts.SE_BD_FIELD[5], consts.JDMPV_VALUE),
(consts.SE_BD_FIELD[6], cms_info.get('insuranceDetails', {}).get('startDate', '')),
(consts.SE_BD_FIELD[7], cms_info.get('insuranceDetails', {}).get('endDate', '')),
(consts.SE_BD_FIELD[8], consts.SE_STAMP_VALUE),
(consts.SE_BD_FIELD[9], consts.SE_DYSYR_VALUE),
# (consts.SE_BD_FIELD[9], consts.SE_DYSYR_VALUE),
]
if is_insurance == 1:
bd_field_input.append((consts.SE_BD_FIELD[10], insurance_price))
......@@ -1871,13 +1871,13 @@ def get_se_cms_compare_info(application_id, last_obj, application_entity, detect
(consts.SE_BD_FIELD[0], [co_name, bo_name] if is_cdfl else [main_name, ]), # 车贷分离
(consts.SE_BD_FIELD[1], [co_id, bo_id] if is_cdfl else [main_id, ]), # 车贷分离
(consts.SE_BD_FIELD[2], vin_no),
(consts.SE_BD_FIELD[3], ssx_amount),
(consts.SE_BD_FIELD[4], dszx_amount),
(consts.SE_BD_FIELD[5], consts.JDMPV_VALUE),
# (consts.SE_BD_FIELD[3], ssx_amount),
# (consts.SE_BD_FIELD[4], dszx_amount),
# (consts.SE_BD_FIELD[5], consts.JDMPV_VALUE),
(consts.SE_BD_FIELD[6], cms_info.get('insuranceDetails', {}).get('startDate', '')),
(consts.SE_BD_FIELD[7], cms_info.get('insuranceDetails', {}).get('endDate', '')),
(consts.SE_BD_FIELD[8], consts.SE_STAMP_VALUE),
(consts.SE_BD_FIELD[9], consts.SE_DYSYR_VALUE),
# (consts.SE_BD_FIELD[9], consts.SE_DYSYR_VALUE),
]
if is_insurance == 1:
bd_field_input.append((consts.SE_BD_FIELD[10], insurance_price))
......
......@@ -12,6 +12,7 @@ import logging
compare_log = logging.getLogger('compare')
class Comparison:
def __init__(self):
......@@ -192,7 +193,7 @@ class Comparison:
def se_input_list_compare(self, input_list, ocr_str, **kwargs):
if isinstance(input_list, list) and len(input_list) > 0 and isinstance(ocr_str, str):
ocr_str = ocr_str.translate(self.KH_TRANS)
for input_str in input_list:
input_str = input_str.translate(self.KH_TRANS)
compare_log.info('[se_input_list_compare] [input_str {0}] [ocr_str {1}]'.format(input_str, ocr_str))
......@@ -221,7 +222,7 @@ class Comparison:
for idx in range(len(src_str)):
if src_str[idx].isdigit():
replace_char_list.append(src_str[idx])
elif idx == len(src_str)-3:
elif idx == len(src_str) - 3:
replace_char_list.append('.')
return ''.join(replace_char_list)
......@@ -603,6 +604,30 @@ class Comparison:
except Exception as e:
return self.RESULT_N
def se_bd_date_2_compare(self, input_str, ocr_str, **kwargs):
try:
# Convert strings to date objects
ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d").date()
# Get today's date
today_date = datetime.today().date()
if kwargs.get('start', False):
# Check if dates are equal and within the range of yesterday to today
if ocr_date < today_date:
return self.RESULT_Y
else:
# Check if dates are equal and ocr_date is greater than tomorrow
tomorrow_date = today_date + relativedelta(days=1)
if ocr_date > tomorrow_date:
return self.RESULT_Y
# Default return value if conditions are not met
return self.RESULT_N
except Exception as e:
# Return RESULT_N in case of any exception
return self.RESULT_N
def se_bs_print_date_compare(self, input_str, ocr_str, **kwargs):
try:
input_date = datetime.strptime(input_str, "%Y-%m-%d")
......@@ -661,7 +686,7 @@ class Comparison:
# input_str = input_str.replace('-', '')
return self.is_after_today_pre(ocr_str)
def se_qrs_compare(self, input_str, ocr_str_or_list, **kwargs):
try:
target_count_str, application_id = input_str.split('_')
......@@ -678,5 +703,3 @@ class Comparison:
cp = Comparison()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!