fix bug

1 parent 939cde2e 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_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
......@@ -896,6 +896,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY}
LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY}
LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, UCI_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY}
MS_CLASSIFY = 21
WECHART_CLASSIFY = 12
WECHART_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
WECHART_HEADERS_MAPPING.update(
......
......@@ -312,14 +312,16 @@ class BSWorkbook(Workbook):
return res_str
@staticmethod
def wechart_func(row_value):
def wechart_func(row_value, pre_col, next_col):
row_value = list(row_value)
if isinstance(row_value[1], str):
cn_chars = re.findall(consts.CN_RE, row_value[1])
if isinstance(row_value[pre_col], str):
cn_chars = re.findall(consts.CN_RE, row_value[pre_col])
cn_str = ''.join(cn_chars)
row_value[1] = re.sub(consts.CN_RE, '', row_value[1])
if isinstance(row_value[2], str):
row_value[2] = '{0}\n{1}'.format(cn_str, row_value[2])
row_value[pre_col] = re.sub(consts.CN_RE, '', row_value[pre_col])
if row_value[next_col] is None:
row_value[next_col] = cn_str
elif isinstance(row_value[next_col], str):
row_value[next_col] = '{0}\n{1}'.format(cn_str, row_value[next_col])
return row_value
def build_month_sheet(self, ms, card, month_mapping, is_reverse, statistics_header_info, max_column, classify):
......@@ -355,7 +357,9 @@ class BSWorkbook(Workbook):
for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True):
if any(row_value):
if classify == consts.WECHART_CLASSIFY:
row_value = self.wechart_func(row_value)
row_value = self.wechart_func(row_value, 1, 2)
elif classify == consts.MS_CLASSIFY:
row_value = self.wechart_func(row_value, 5, 6)
new_ws.append(row_value)
# 3.2.提取信息、高亮
amount_mapping = {}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!