fix bug
Showing
2 changed files
with
16 additions
and
59 deletions
1 | import copy | ||
2 | |||
1 | PAGE_DEFAULT = 1 | 3 | PAGE_DEFAULT = 1 |
2 | PAGE_SIZE_DEFAULT = 10 | 4 | PAGE_SIZE_DEFAULT = 10 |
3 | 5 | ||
... | @@ -453,63 +455,6 @@ HEADERS_MAPPING.update( | ... | @@ -453,63 +455,6 @@ HEADERS_MAPPING.update( |
453 | 455 | ||
454 | OTHER_TUPLE = (None, None, None, None, None, None, None, None, None, None, None, None, None) | 456 | OTHER_TUPLE = (None, None, None, None, None, None, None, None, None, None, None, None, None) |
455 | 457 | ||
456 | # { | ||
457 | # "0":"其他", | ||
458 | # "1":"普通打印-全表格-中国农业银行", | ||
459 | # "2":"普通打印-全表格-中国银行", | ||
460 | # "3":"普通打印-全表格-北京银行", | ||
461 | # "4":"普通打印-全表格-工商银行", | ||
462 | # "5":"普通打印-全表格-建设银行", | ||
463 | # "6":"普通打印-全表格-微信账单", | ||
464 | # "7":"普通打印-全表格-支付宝账单", | ||
465 | # "8":"普通打印-无格线-中国邮政储蓄银行", | ||
466 | |||
467 | # "9":"普通打印-无格线-交通银行", | ||
468 | # "10":"普通打印-无格线-农业银行整数", | ||
469 | # "11":"普通打印-无格线-农业银行银行活期扩张缩进", | ||
470 | # "12":"普通打印-无格线-招商银行", | ||
471 | # "13":"普通打印-无格线-招行电子账单", | ||
472 | # "14":"普通打印-无格线-民生银行", | ||
473 | |||
474 | # "15":"普通打印-部分格线-横版-中信银行", | ||
475 | # "16":"普通打印-部分格线-竖版-中国农业银行分账户窄页", | ||
476 | # "17":"普通打印-部分格线-竖版-农业银行", | ||
477 | # "18":"普通打印-部分格线-竖版-农业银行银行卡交易明细", | ||
478 | # "19":"普通打印-部分格线-竖版-平安电子账单", | ||
479 | |||
480 | # "20":"针式打印-全格线-建设银行", | ||
481 | # "21":"针式打印-部分格线-竖版-邮储银行账户交易", | ||
482 | # "22":"针式打印-部分格线-邮储银行一本通绿卡" | ||
483 | # } | ||
484 | |||
485 | # CLASSIFY_LIST = [ | ||
486 | # ('其他', OTHER_TUPLE), | ||
487 | # ('农业银行', (1, None, 3, 5, None, 8, 7, 6, None, None, None, None, None)), | ||
488 | # ('中国银行', (1, 2, 4, 5, 6, 9, 10, 11, 12, None, None, None, None)), | ||
489 | # ('北京银行', (1, None, 4, 5, None, 2, 6, 7, None, None, 3, None, None)), | ||
490 | # ('工商银行', (1, None, 9, 10, None, 7, None, None, None, None, None, None, None)), | ||
491 | # ('建设银行', (None, None, None, None, None, 2, None, None, None, None, None, None, None)), | ||
492 | # ('微信', (2, None, 6, None, None, 3, 7, None, None, None, None, None, None)), | ||
493 | # ('支付宝', (2, None, None, 6, None, 3, None, None, None, None, None, 4, 5)), | ||
494 | # | ||
495 | # ('交通银行', (1, None, 5, 6, None, 3, None, None, None, None, 4, None, None)), | ||
496 | # ('农业银行', (1, None, 3, None, None, 2, None, 4, None, None, None, None, None)), | ||
497 | # ('农业银行', (1, 2, None, None, None, None, None, None, None, None, None, None, None)), | ||
498 | # ('招商银行', (1, None, 3, 4, None, 6, None, None, None, None, None, None, None)), | ||
499 | # ('招商银行电子版', (1, None, 3, 4, None, 5, 6, None, None, None, None, None, None)), | ||
500 | # ('民生银行', (None, None, 5, 6, None, None, 7, None, 8, None, None, None, None)), | ||
501 | # | ||
502 | # ('中信银行', (1, None, None, 5, None, 2, 6, 7, 8, None, None, 3, 4)), | ||
503 | # ('农业银行', (1, None, 3, 4, None, 2, None, 5, None, None, None, None, None)), | ||
504 | # ('农业银行', (1, None, 3, 4, None, 2, None, 5, None, None, None, None, None)), | ||
505 | # ('农业银行', (1, None, 3, 4, None, 2, None, 5, None, None, None, None, None)), | ||
506 | # ('平安电子账单', (2, None, 5, 6, None, 4, None, None, None, None, None, None, None)), | ||
507 | # | ||
508 | # ('建设银行', (None, None, None, None, None, None, None, None, None, None, None, None, None)), | ||
509 | # ('邮储银行', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), | ||
510 | # ('邮储银行', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), | ||
511 | # ] | ||
512 | |||
513 | # "4":"普通打印-全表格-中国银行", | 458 | # "4":"普通打印-全表格-中国银行", |
514 | # "5":"普通打印-全表格-农业银行-10列", | 459 | # "5":"普通打印-全表格-农业银行-10列", |
515 | # "6":"普通打印-全表格-农业银行-10列-1", | 460 | # "6":"普通打印-全表格-农业银行-10列-1", |
... | @@ -920,3 +865,11 @@ LICENSE_CLASSIFY_MAPPING = dict(LICENSE_ORDER) | ... | @@ -920,3 +865,11 @@ LICENSE_CLASSIFY_MAPPING = dict(LICENSE_ORDER) |
920 | OTHER_CLASSIFY_SET = {OTHER_CLASSIFY} | 865 | OTHER_CLASSIFY_SET = {OTHER_CLASSIFY} |
921 | LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY} | 866 | LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY} |
922 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, UCI_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} | 867 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, UCI_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} |
868 | |||
869 | WECHART_CLASSIFY = 12 | ||
870 | WECHART_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING) | ||
871 | WECHART_HEADERS_MAPPING.update( | ||
872 | { | ||
873 | '交易时间': DATE_KEY, | ||
874 | } | ||
875 | ) | ... | ... |
... | @@ -30,7 +30,7 @@ class BSWorkbook(Workbook): | ... | @@ -30,7 +30,7 @@ class BSWorkbook(Workbook): |
30 | self.MAX_MEAN = 31 | 30 | self.MAX_MEAN = 31 |
31 | 31 | ||
32 | @staticmethod | 32 | @staticmethod |
33 | def header_collect(ws, sheet_header_info, header_info, max_column_list): | 33 | def header_collect(ws, sheet_header_info, header_info, max_column_list, classify): |
34 | # sheet_header_info = { | 34 | # sheet_header_info = { |
35 | # 'sheet_name': { | 35 | # 'sheet_name': { |
36 | # 'summary_col': 1, | 36 | # 'summary_col': 1, |
... | @@ -65,6 +65,9 @@ class BSWorkbook(Workbook): | ... | @@ -65,6 +65,9 @@ class BSWorkbook(Workbook): |
65 | for first_row in ws.iter_rows(max_row=1, min_row=1, values_only=True): | 65 | for first_row in ws.iter_rows(max_row=1, min_row=1, values_only=True): |
66 | sheet_header_info.setdefault(ws.title, {}).setdefault(consts.HEADER_KEY, first_row) | 66 | sheet_header_info.setdefault(ws.title, {}).setdefault(consts.HEADER_KEY, first_row) |
67 | for idx, header_value in enumerate(first_row): | 67 | for idx, header_value in enumerate(first_row): |
68 | if classify == consts.WECHART_CLASSIFY: | ||
69 | header_col = consts.WECHART_HEADERS_MAPPING.get(header_value) | ||
70 | else: | ||
68 | header_col = consts.HEADERS_MAPPING.get(header_value) | 71 | header_col = consts.HEADERS_MAPPING.get(header_value) |
69 | if header_col is not None: | 72 | if header_col is not None: |
70 | find_count += 1 | 73 | find_count += 1 |
... | @@ -315,6 +318,7 @@ class BSWorkbook(Workbook): | ... | @@ -315,6 +318,7 @@ class BSWorkbook(Workbook): |
315 | for part in parts: | 318 | for part in parts: |
316 | ws = self.get_sheet_by_name(part[0]) | 319 | ws = self.get_sheet_by_name(part[0]) |
317 | for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True): | 320 | for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True): |
321 | if any(row_value): | ||
318 | new_ws.append(row_value) | 322 | new_ws.append(row_value) |
319 | # 3.2.提取信息、高亮 | 323 | # 3.2.提取信息、高亮 |
320 | amount_mapping = {} | 324 | amount_mapping = {} |
... | @@ -439,7 +443,7 @@ class BSWorkbook(Workbook): | ... | @@ -439,7 +443,7 @@ class BSWorkbook(Workbook): |
439 | max_column_list = [] | 443 | max_column_list = [] |
440 | for sheet in summary.get('sheet', []): | 444 | for sheet in summary.get('sheet', []): |
441 | ws = self.get_sheet_by_name(sheet) | 445 | ws = self.get_sheet_by_name(sheet) |
442 | self.header_collect(ws, sheet_header_info, header_info, max_column_list) | 446 | self.header_collect(ws, sheet_header_info, header_info, max_column_list, classify) |
443 | statistics_header_info = self.header_statistics(sheet_header_info, header_info, classify) | 447 | statistics_header_info = self.header_statistics(sheet_header_info, header_info, classify) |
444 | max_column = max(max_column_list) | 448 | max_column = max(max_column_list) |
445 | 449 | ... | ... |
-
Please register or sign in to post a comment