eb21c5bc by 周伟奇

fix application_id

1 parent 97994674
1 PAGE_DEFAULT = 1 1 PAGE_DEFAULT = 1
2 PAGE_SIZE_DEFAULT = 10 2 PAGE_SIZE_DEFAULT = 10
3 3
4 FIXED_APPLICATION_ID = '手工单' 4 FIXED_APPLICATION_ID_PREFIX = 'CH-S'
5 5
6 DOC_SCHEME_LIST = ['ACCEPTANCE', 'SETTLEMENT', 'CONTRACT MANAGEMENT'] 6 DOC_SCHEME_LIST = ['ACCEPTANCE', 'SETTLEMENT', 'CONTRACT MANAGEMENT']
7 DATA_SOURCE_LIST = ['POS', 'EAPP', 'ECONTRACT'] 7 DATA_SOURCE_LIST = ['POS', 'EAPP', 'ECONTRACT']
......
...@@ -79,8 +79,9 @@ class Command(BaseCommand, LoggerMixin): ...@@ -79,8 +79,9 @@ class Command(BaseCommand, LoggerMixin):
79 return None, None, None 79 return None, None, None
80 # TODO EDMS下载pdf 80 # TODO EDMS下载pdf
81 doc_data_path = os.path.join(self.data_dir, business_type, str(doc.id)) 81 doc_data_path = os.path.join(self.data_dir, business_type, str(doc.id))
82 os.makedirs(doc_data_path, exist_ok=True)
82 pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc.id)) 83 pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc.id))
83 if doc.application_id != consts.FIXED_APPLICATION_ID: 84 if not doc.application_id.startswith(consts.FIXED_APPLICATION_ID_PREFIX):
84 self.edms.download(pdf_path, doc.metadata_version_id) 85 self.edms.download(pdf_path, doc.metadata_version_id)
85 86
86 excel_path = os.path.join(doc_data_path, '{0}.xls'.format(doc.id)) 87 excel_path = os.path.join(doc_data_path, '{0}.xls'.format(doc.id))
......
...@@ -271,20 +271,20 @@ class DocView(GenericView, DocHandler): ...@@ -271,20 +271,20 @@ class DocView(GenericView, DocHandler):
271 @use_args(upload_pdf_args, location='files') 271 @use_args(upload_pdf_args, location='files')
272 def post(self, request, args): 272 def post(self, request, args):
273 # 1. 上传信息记录 273 # 1. 上传信息记录
274 const_str = consts.FIXED_APPLICATION_ID
275 metadata_version_id = str(int(time.time())) 274 metadata_version_id = str(int(time.time()))
275 application_id = '{0}{1}'.format(consts.FIXED_APPLICATION_ID_PREFIX, metadata_version_id)
276 upload_finish_time = timezone.now() 276 upload_finish_time = timezone.now()
277 document_scheme = random.choice(consts.DOC_SCHEME_LIST) 277 document_scheme = random.choice(consts.DOC_SCHEME_LIST)
278 data_source = random.choice(consts.DATA_SOURCE_LIST) 278 data_source = random.choice(consts.DATA_SOURCE_LIST)
279 business_type = random.choice(consts.BUSINESS_TYPE_LIST) 279 business_type = random.choice(consts.BUSINESS_TYPE_LIST)
280 record = UploadDocRecords.objects.create( 280 record = UploadDocRecords.objects.create(
281 metadata_version_id=metadata_version_id, 281 metadata_version_id=metadata_version_id,
282 application_id=const_str, 282 application_id=application_id,
283 main_applicant=const_str, 283 main_applicant='',
284 co_applicant=const_str, 284 co_applicant='',
285 guarantor_1=const_str, 285 guarantor_1='',
286 guarantor_2=const_str, 286 guarantor_2='',
287 document_name=const_str, 287 document_name=application_id,
288 document_scheme=document_scheme, 288 document_scheme=document_scheme,
289 business_type=business_type, 289 business_type=business_type,
290 data_source=data_source, 290 data_source=data_source,
...@@ -296,12 +296,12 @@ class DocView(GenericView, DocHandler): ...@@ -296,12 +296,12 @@ class DocView(GenericView, DocHandler):
296 doc = doc_class.objects.create( 296 doc = doc_class.objects.create(
297 record_id=record.id, 297 record_id=record.id,
298 metadata_version_id=metadata_version_id, 298 metadata_version_id=metadata_version_id,
299 application_id=const_str, 299 application_id=application_id,
300 main_applicant=const_str, 300 main_applicant='',
301 co_applicant=const_str, 301 co_applicant='',
302 guarantor_1=const_str, 302 guarantor_1='',
303 guarantor_2=const_str, 303 guarantor_2='',
304 document_name=const_str, 304 document_name=application_id,
305 document_scheme=document_scheme, 305 document_scheme=document_scheme,
306 data_source=data_source, 306 data_source=data_source,
307 upload_finish_time=upload_finish_time, 307 upload_finish_time=upload_finish_time,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!