678b3bd0 by 周伟奇

modify CA yhls sheet

1 parent 903a34ba
...@@ -1145,6 +1145,7 @@ MS_ERROR_COL = (5, 6) ...@@ -1145,6 +1145,7 @@ MS_ERROR_COL = (5, 6)
1145 WECHART_CLASSIFY = 12 1145 WECHART_CLASSIFY = 12
1146 NEW_ZHIFUBAO_CLASSIFY = 48 1146 NEW_ZHIFUBAO_CLASSIFY = 48
1147 ALI_WECHART_CLASSIFY = {12, 13, 48} 1147 ALI_WECHART_CLASSIFY = {12, 13, 48}
1148 JSYH_CLASSIFY = {11, 27, 34}
1148 WECHART_ERROR_COL = (1, 2) 1149 WECHART_ERROR_COL = (1, 2)
1149 SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING) 1150 SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
1150 SPECIAL_HEADERS_MAPPING.update( 1151 SPECIAL_HEADERS_MAPPING.update(
......
...@@ -40,6 +40,18 @@ class BSWorkbook(Workbook): ...@@ -40,6 +40,18 @@ class BSWorkbook(Workbook):
40 self.need_follow = False 40 self.need_follow = False
41 41
42 @staticmethod 42 @staticmethod
43 def date_calibration(date_str):
44 result = True
45 try:
46 if date_str[-2] not in ['20', '21']:
47 result = False
48 if date_str[-5:-3] not in ['03', '06', '09', '12']:
49 result = False
50 except Exception as e:
51 result = False
52 return result
53
54 @staticmethod
43 def replace_newline(queryset_value): 55 def replace_newline(queryset_value):
44 new_set = set() 56 new_set = set()
45 for v in queryset_value: 57 for v in queryset_value:
...@@ -338,7 +350,7 @@ class BSWorkbook(Workbook): ...@@ -338,7 +350,7 @@ class BSWorkbook(Workbook):
338 metadata_rows.append(('Producer', producer)) 350 metadata_rows.append(('Producer', producer))
339 if len(author) > 0: 351 if len(author) > 0:
340 metadata_highlight_row.append(6) 352 metadata_highlight_row.append(6)
341 if 'iText' not in producer and 'Qt' not in producer and 'Haru Free' not in producer: 353 if 'iText' not in producer and 'Qt' not in producer and 'Haru Free' not in producer and 'OpenPDF' not in producer:
342 metadata_highlight_row.append(7) 354 metadata_highlight_row.append(7)
343 metadata_rows.append(self.blank_row) 355 metadata_rows.append(self.blank_row)
344 356
...@@ -496,6 +508,7 @@ class BSWorkbook(Workbook): ...@@ -496,6 +508,7 @@ class BSWorkbook(Workbook):
496 508
497 tmp_ws = self.create_sheet('tmp_ws') 509 tmp_ws = self.create_sheet('tmp_ws')
498 tmp2_ws = self.create_sheet('tmp2_ws') 510 tmp2_ws = self.create_sheet('tmp2_ws')
511 tmp3_ws = self.create_sheet('tmp3_ws')
499 if classify in consts.ALI_WECHART_CLASSIFY: 512 if classify in consts.ALI_WECHART_CLASSIFY:
500 high_light_keyword = self.wechat_keyword 513 high_light_keyword = self.wechat_keyword
501 else: 514 else:
...@@ -629,7 +642,7 @@ class BSWorkbook(Workbook): ...@@ -629,7 +642,7 @@ class BSWorkbook(Workbook):
629 # 关键词1提取 642 # 关键词1提取
630 if summary_cell_value in self.interest_keyword: 643 if summary_cell_value in self.interest_keyword:
631 new_amount_cell_value = None if amount_cell is None else amount_cell.value 644 new_amount_cell_value = None if amount_cell is None else amount_cell.value
632 ms.append((summary_cell_value, date_cell_value, new_amount_cell_value)) 645 tmp3_ws.append((summary_cell_value, date_cell_value, new_amount_cell_value))
633 # 关键词2提取至临时表 646 # 关键词2提取至临时表
634 elif summary_cell_value in self.salary_keyword: 647 elif summary_cell_value in self.salary_keyword:
635 new_amount_cell_value = None if amount_cell is None else amount_cell.value 648 new_amount_cell_value = None if amount_cell is None else amount_cell.value
...@@ -657,6 +670,18 @@ class BSWorkbook(Workbook): ...@@ -657,6 +670,18 @@ class BSWorkbook(Workbook):
657 # if summary_cell_idx is not None: 670 # if summary_cell_idx is not None:
658 # new_ws[row][summary_cell_idx].fill = self.amount_fill 671 # new_ws[row][summary_cell_idx].fill = self.amount_fill
659 672
673 # 关键词1信息提取:结息
674 for row in tmp3_ws.iter_rows(values_only=True):
675 ms.append(row)
676 # 建设银行
677 if classify in consts.JSYH_CLASSIFY:
678 if isinstance(row[1], str) and self.date_calibration(row[1]):
679 pass
680 else:
681 for cell in ms[ms.max_row]:
682 cell.fill = self.amount_fill
683 self.remove(tmp3_ws)
684
660 # 关键词2信息提取 685 # 关键词2信息提取
661 ms.append(self.blank_row) 686 ms.append(self.blank_row)
662 ms.append(self.salary_keyword_header) 687 ms.append(self.salary_keyword_header)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!