Merge branch 'feature/enhancement-file-name-change' into feature/uat-tmp
Showing
3 changed files
with
10 additions
and
5 deletions
| ... | @@ -1908,7 +1908,8 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -1908,7 +1908,8 @@ class Command(BaseCommand, LoggerMixin): |
| 1908 | # 重构Excel文件 | 1908 | # 重构Excel文件 |
| 1909 | # src_excel_path = os.path.join(doc_data_path, 'src.xlsx') | 1909 | # src_excel_path = os.path.join(doc_data_path, 'src.xlsx') |
| 1910 | # wb.save(src_excel_path) | 1910 | # wb.save(src_excel_path) |
| 1911 | count_list = wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme, contract_result, doc.metadata) | 1911 | #need_follow表示在上传edms时文件名是否要添加"关注"两字 |
| 1912 | count_list, need_follow = wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme, contract_result, doc.metadata) | ||
| 1912 | wb.save(excel_path) | 1913 | wb.save(excel_path) |
| 1913 | 1914 | ||
| 1914 | except Exception as e: | 1915 | except Exception as e: |
| ... | @@ -1929,7 +1930,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -1929,7 +1930,7 @@ class Command(BaseCommand, LoggerMixin): |
| 1929 | # 上传至EDMS | 1930 | # 上传至EDMS |
| 1930 | for times in range(consts.RETRY_TIMES): | 1931 | for times in range(consts.RETRY_TIMES): |
| 1931 | try: | 1932 | try: |
| 1932 | self.edms.upload(excel_path, doc, business_type) | 1933 | self.edms.upload(excel_path, doc, business_type, need_follow) |
| 1933 | except Exception as e: | 1934 | except Exception as e: |
| 1934 | self.online_log.warn( | 1935 | self.online_log.warn( |
| 1935 | '{0} [edms upload failed] [times={1}] [task={2}] [error={3}]'.format( | 1936 | '{0} [edms upload failed] [times={1}] [task={2}] [error={3}]'.format( | ... | ... |
| ... | @@ -110,15 +110,16 @@ class ECM: | ... | @@ -110,15 +110,16 @@ class ECM: |
| 110 | return '{0}{1}'.format(self.prefix, name) | 110 | return '{0}{1}'.format(self.prefix, name) |
| 111 | return '{0}{1}'.format(self.prefix, doc_name) | 111 | return '{0}{1}'.format(self.prefix, doc_name) |
| 112 | 112 | ||
| 113 | def upload(self, file_path, doc, business_type): | 113 | def upload(self, file_path, doc, business_type, need_follow): |
| 114 | doc_type, folder_afc, folder_hil = self.doc_type_map.get(doc.document_scheme) | 114 | doc_type, folder_afc, folder_hil = self.doc_type_map.get(doc.document_scheme) |
| 115 | folder = folder_afc if business_type == 'AFC' else folder_hil | 115 | folder = folder_afc if business_type == 'AFC' else folder_hil |
| 116 | object_name = '关注' + self.get_doc_file_name(doc.document_name) if need_follow else self.get_doc_file_name(doc.document_name) | ||
| 116 | args = { | 117 | args = { |
| 117 | "username": self.username, | 118 | "username": self.username, |
| 118 | "password": self.pwd, | 119 | "password": self.pwd, |
| 119 | "docbase": self.doc_base_map.get(business_type), | 120 | "docbase": self.doc_base_map.get(business_type), |
| 120 | "documentType": doc_type, | 121 | "documentType": doc_type, |
| 121 | "object_name": self.get_doc_file_name(doc.document_name), | 122 | "object_name": object_name, |
| 122 | "folder": folder, | 123 | "folder": folder, |
| 123 | "format": "excel12book", | 124 | "format": "excel12book", |
| 124 | "r_content_type": "excel12book", | 125 | "r_content_type": "excel12book", | ... | ... |
| ... | @@ -37,6 +37,7 @@ class BSWorkbook(Workbook): | ... | @@ -37,6 +37,7 @@ class BSWorkbook(Workbook): |
| 37 | # self.bd = Side(style='thin', color="000000") | 37 | # self.bd = Side(style='thin', color="000000") |
| 38 | # self.border = Border(left=self.bd, top=self.bd, right=self.bd, bottom=self.bd) | 38 | # self.border = Border(left=self.bd, top=self.bd, right=self.bd, bottom=self.bd) |
| 39 | self.MAX_MEAN = 31 | 39 | self.MAX_MEAN = 31 |
| 40 | self.need_follow = False | ||
| 40 | 41 | ||
| 41 | @staticmethod | 42 | @staticmethod |
| 42 | def replace_newline(queryset_value): | 43 | def replace_newline(queryset_value): |
| ... | @@ -364,6 +365,8 @@ class BSWorkbook(Workbook): | ... | @@ -364,6 +365,8 @@ class BSWorkbook(Workbook): |
| 364 | self.blank_row, | 365 | self.blank_row, |
| 365 | self.interest_keyword_header] | 366 | self.interest_keyword_header] |
| 366 | ) | 367 | ) |
| 368 | if len(verify_highlight_row) > 0 or len(metadata_highlight_row) > 0: | ||
| 369 | self.need_follow = True | ||
| 367 | return metadata_rows, verify_highlight_row, timedelta, metadata_highlight_row | 370 | return metadata_rows, verify_highlight_row, timedelta, metadata_highlight_row |
| 368 | 371 | ||
| 369 | def build_meta_sheet(self, role_name, card, confidence, code, verify_list, print_time, start_date, end_date, | 372 | def build_meta_sheet(self, role_name, card, confidence, code, verify_list, print_time, start_date, end_date, |
| ... | @@ -911,4 +914,4 @@ class BSWorkbook(Workbook): | ... | @@ -911,4 +914,4 @@ class BSWorkbook(Workbook): |
| 911 | self.contract_rebuild(contract_result, True) | 914 | self.contract_rebuild(contract_result, True) |
| 912 | self.move_res_sheet() | 915 | self.move_res_sheet() |
| 913 | self.remove_base_sheet() | 916 | self.remove_base_sheet() |
| 914 | return count_list | 917 | return count_list, self.need_follow | ... | ... |
-
Please register or sign in to post a comment