6be9056c by 周伟奇

fix license report

1 parent bde11ee9
...@@ -82,6 +82,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -82,6 +82,8 @@ class Command(BaseCommand, LoggerMixin):
82 82
83 wb = Workbook() 83 wb = Workbook()
84 for classify, (_, name, _, _, _, _) in consts.LICENSE_ORDER: 84 for classify, (_, name, _, _, _, _) in consts.LICENSE_ORDER:
85 if classify == consts.DL_CLASSIFY or classify == consts.VAT_CLASSIFY:
86 continue
85 ws = wb.create_sheet(name) 87 ws = wb.create_sheet(name)
86 headers = self.header_map.get(classify, []) 88 headers = self.header_map.get(classify, [])
87 for header in headers: 89 for header in headers:
...@@ -96,9 +98,16 @@ class Command(BaseCommand, LoggerMixin): ...@@ -96,9 +98,16 @@ class Command(BaseCommand, LoggerMixin):
96 business_type, doc_id_str = task_str.split(consts.SPLIT_STR) 98 business_type, doc_id_str = task_str.split(consts.SPLIT_STR)
97 doc_id = int(doc_id_str) 99 doc_id = int(doc_id_str)
98 doc_class = HILDoc if business_type == consts.HIL_PREFIX else AFCDoc 100 doc_class = HILDoc if business_type == consts.HIL_PREFIX else AFCDoc
99 application_id = doc_class.objects.filter(id=doc_id).values_list('application_id', flat=True) 101 doc_queryset = doc_class.objects.filter(id=doc_id).values_list('application_id', 'document_scheme')
102 if len(doc_queryset) == 0:
103 continue
104 application_id, document_scheme = doc_queryset[0]
105 if document_scheme != consts.DOC_SCHEME_LIST[1]:
106 continue
100 107
101 for classify, (_, name, field_order, side_diff, _, _) in consts.LICENSE_ORDER: 108 for classify, (_, name, field_order, side_diff, _, _) in consts.LICENSE_ORDER:
109 if classify == consts.DL_CLASSIFY or classify == consts.VAT_CLASSIFY:
110 continue
102 license_list = license_summary.get(classify) 111 license_list = license_summary.get(classify)
103 if not license_list: 112 if not license_list:
104 continue 113 continue
...@@ -119,5 +128,5 @@ class Command(BaseCommand, LoggerMixin): ...@@ -119,5 +128,5 @@ class Command(BaseCommand, LoggerMixin):
119 all_value.append('\n'.join(field_value)) 128 all_value.append('\n'.join(field_value))
120 else: 129 else:
121 all_value.append(field_value) 130 all_value.append(field_value)
122 ws.append((application_id[0], *all_value)) 131 ws.append((application_id, *all_value))
123 wb.save(excel_path) 132 wb.save(excel_path)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!