update classify
Showing
2 changed files
with
4 additions
and
6 deletions
This diff is collapsed.
Click to expand it.
... | @@ -38,7 +38,7 @@ class BSWorkbook(Workbook): | ... | @@ -38,7 +38,7 @@ class BSWorkbook(Workbook): |
38 | for col in range(consts.FIXED_COL_AMOUNT + 1, ws.max_column + 1): | 38 | for col in range(consts.FIXED_COL_AMOUNT + 1, ws.max_column + 1): |
39 | header_value = ws.cell(1, col).value | 39 | header_value = ws.cell(1, col).value |
40 | header_col = consts.HEADERS_MAPPING.get(header_value) | 40 | header_col = consts.HEADERS_MAPPING.get(header_value) |
41 | if header_col is not None: | 41 | if header_col is not None and header_col not in header_col_set: |
42 | letter = get_column_letter(col) | 42 | letter = get_column_letter(col) |
43 | ws.move_range("{0}1:{0}{1}".format(letter, ws.max_row), cols=header_col - col) | 43 | ws.move_range("{0}1:{0}{1}".format(letter, ws.max_row), cols=header_col - col) |
44 | moved_col_set.add(col) | 44 | moved_col_set.add(col) |
... | @@ -63,7 +63,7 @@ class BSWorkbook(Workbook): | ... | @@ -63,7 +63,7 @@ class BSWorkbook(Workbook): |
63 | for header_col in range(1, consts.FIXED_COL_AMOUNT + 1): | 63 | for header_col in range(1, consts.FIXED_COL_AMOUNT + 1): |
64 | if header_col in header_col_set or header_col == consts.RESULT_HEADER_COL: | 64 | if header_col in header_col_set or header_col == consts.RESULT_HEADER_COL: |
65 | continue | 65 | continue |
66 | fix_col = consts.CLASSIFY_LIST[classify][1][header_col - 1] # TODO 合并分类情况 | 66 | fix_col = consts.CLASSIFY_LIST[classify][1][header_col - 1] |
67 | if fix_col is None: | 67 | if fix_col is None: |
68 | continue | 68 | continue |
69 | fix_col = fix_col + consts.FIXED_COL_AMOUNT | 69 | fix_col = fix_col + consts.FIXED_COL_AMOUNT |
... | @@ -250,7 +250,7 @@ class BSWorkbook(Workbook): | ... | @@ -250,7 +250,7 @@ class BSWorkbook(Workbook): |
250 | # 3.4.余额转数值 | 250 | # 3.4.余额转数值 |
251 | try: | 251 | try: |
252 | try: | 252 | try: |
253 | if isinstance(amount_cell.value, str): | 253 | if isinstance(amount_cell.value, str): # TODO 可在转化数字失败后,再替换 |
254 | amount_cell.value = amount_cell.value.translate(consts.TRANS) | 254 | amount_cell.value = amount_cell.value.translate(consts.TRANS) |
255 | amount_cell.value = locale.atof(amount_cell.value) | 255 | amount_cell.value = locale.atof(amount_cell.value) |
256 | except Exception as e: | 256 | except Exception as e: |
... | @@ -337,8 +337,6 @@ class BSWorkbook(Workbook): | ... | @@ -337,8 +337,6 @@ class BSWorkbook(Workbook): |
337 | end_date = max(date_list) if end_date is None else end_date | 337 | end_date = max(date_list) if end_date is None else end_date |
338 | 338 | ||
339 | # 2.元信息提取表 | 339 | # 2.元信息提取表 |
340 | bank_name = consts.CLASSIFY_LIST[summary['classify']][0] | ||
341 | base_sheet_name = '{0}_{1}'.format(bank_name, summary['role']) | ||
342 | ms = self.build_meta_sheet(card, | 340 | ms = self.build_meta_sheet(card, |
343 | summary['classify'], | 341 | summary['classify'], |
344 | summary['confidence'], | 342 | summary['confidence'], |
... | @@ -354,7 +352,7 @@ class BSWorkbook(Workbook): | ... | @@ -354,7 +352,7 @@ class BSWorkbook(Workbook): |
354 | is_reverse = True | 352 | is_reverse = True |
355 | for month_list in month_mapping.values(): | 353 | for month_list in month_mapping.values(): |
356 | month_list.sort(key=lambda x: x[-1], reverse=True) | 354 | month_list.sort(key=lambda x: x[-1], reverse=True) |
357 | self.build_month_sheet(base_sheet_name, month_mapping, ms, is_reverse) | 355 | self.build_month_sheet(card, month_mapping, ms, is_reverse) |
358 | 356 | ||
359 | # 4.删除原表 | 357 | # 4.删除原表 |
360 | for sheet in summary['sheet']: | 358 | for sheet in summary['sheet']: | ... | ... |
-
Please register or sign in to post a comment