fix args filter
Showing
2 changed files
with
7 additions
and
8 deletions
... | @@ -269,7 +269,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -269,7 +269,7 @@ class Command(BaseCommand, LoggerMixin): |
269 | loop = asyncio.get_event_loop() | 269 | loop = asyncio.get_event_loop() |
270 | tasks = [self.img_ocr_excel(wb, img_path) for img_path in img_path_list] | 270 | tasks = [self.img_ocr_excel(wb, img_path) for img_path in img_path_list] |
271 | loop.run_until_complete(asyncio.wait(tasks)) | 271 | loop.run_until_complete(asyncio.wait(tasks)) |
272 | loop.close() | 272 | # loop.close() |
273 | wb.save(excel_path) | 273 | wb.save(excel_path) |
274 | # 整合excel文件上传至EDMS | 274 | # 整合excel文件上传至EDMS |
275 | except Exception as e: | 275 | except Exception as e: | ... | ... |
... | @@ -140,19 +140,18 @@ class DocView(GenericView, DocHandler): | ... | @@ -140,19 +140,18 @@ class DocView(GenericView, DocHandler): |
140 | upload_time_end = args.get('upload_time_end') | 140 | upload_time_end = args.get('upload_time_end') |
141 | create_time_start = args.get('create_time_start') | 141 | create_time_start = args.get('create_time_start') |
142 | create_time_end = args.get('create_time_end') | 142 | create_time_end = args.get('create_time_end') |
143 | status_query = Q(status=status) if status else Q() | 143 | status_query = Q(status=status) if status is not None else Q() |
144 | application_id_query = Q(application_id=application_id) if application_id else Q() | 144 | application_id_query = Q(application_id=application_id) if application_id is not None else Q() |
145 | data_source_query = Q(data_source=data_source) if data_source else Q() | 145 | data_source_query = Q(data_source=data_source) if data_source is not None else Q() |
146 | business_type_query = Q(business_type=business_type) if business_type else Q() | 146 | business_type_query = Q(business_type=business_type) if business_type is not None else Q() |
147 | upload_finish_time_query = Q(upload_finish_time__gte=upload_time_start, | 147 | upload_finish_time_query = Q(upload_finish_time__gte=upload_time_start, |
148 | upload_finish_time__lt=upload_time_end + datetime.timedelta(days=1))\ | 148 | upload_finish_time__lt=upload_time_end + datetime.timedelta(days=1))\ |
149 | if upload_time_start and upload_time_end else Q() | 149 | if upload_time_start is not None and upload_time_end is not None else Q() |
150 | create_time_query = Q(create_time__gte=create_time_start, | 150 | create_time_query = Q(create_time__gte=create_time_start, |
151 | create_time__lt=create_time_end + datetime.timedelta(days=1))\ | 151 | create_time__lt=create_time_end + datetime.timedelta(days=1))\ |
152 | if create_time_start and create_time_end else Q() | 152 | if create_time_start is not None and create_time_end is not None else Q() |
153 | query = status_query & application_id_query & data_source_query & business_type_query\ | 153 | query = status_query & application_id_query & data_source_query & business_type_query\ |
154 | & upload_finish_time_query & create_time_query | 154 | & upload_finish_time_query & create_time_query |
155 | print(query) | ||
156 | val_tuple = ('id', 'application_id', 'upload_finish_time', 'create_time', | 155 | val_tuple = ('id', 'application_id', 'upload_finish_time', 'create_time', |
157 | 'business_type', 'data_source', 'status') | 156 | 'business_type', 'data_source', 'status') |
158 | doc_queryset = UploadDocRecords.objects.filter(query).values(*val_tuple).order_by('-upload_finish_time') | 157 | doc_queryset = UploadDocRecords.objects.filter(query).values(*val_tuple).order_by('-upload_finish_time') | ... | ... |
-
Please register or sign in to post a comment