From f2cda17eaf3ac38b1b8ddc67bd3e00cba6887e6d Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Wed, 16 Feb 2022 09:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=90=84=E4=B8=AA?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=87=BD=E6=95=B0=E7=9A=84=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/file_util.py | 66 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/util/file_util.py b/util/file_util.py index 643ca53..89d97e1 100644 --- a/util/file_util.py +++ b/util/file_util.py @@ -131,7 +131,7 @@ def scan_VJ102_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -192,6 +192,10 @@ def scan_VJ102_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_VJ103_dir(collectionCode, path): @@ -210,7 +214,7 @@ def scan_VJ103_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" xmlPath = Config.XML_PATH # 解析出的xml文件保存的路径 @@ -270,6 +274,10 @@ def scan_VJ103_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_GF1_PMS2_dir(collectionCode, path): @@ -286,7 +294,7 @@ def scan_GF1_PMS2_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" xmlPath = Config.XML_PATH # 解析出的xml文件保存的路径 @@ -347,6 +355,10 @@ def scan_GF1_PMS2_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_GF3MDJ_dir(collectionCode, path): @@ -363,7 +375,7 @@ def scan_GF3MDJ_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" xmlPath = Config.XML_PATH # 解析出的xml文件保存的路径 @@ -424,6 +436,10 @@ def scan_GF3MDJ_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_H08_dir(collectionCode, path): @@ -439,7 +455,7 @@ def scan_H08_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -502,6 +518,10 @@ def scan_H08_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_Sentinel1_dir(collectionCode, path): @@ -518,7 +538,7 @@ def scan_Sentinel1_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -582,6 +602,10 @@ def scan_Sentinel1_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_Sentinel2_dir(collectionCode, path): @@ -598,7 +622,7 @@ def scan_Sentinel2_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -661,6 +685,10 @@ def scan_Sentinel2_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_Sentinel3OL_dir(collectionCode, path): @@ -677,7 +705,7 @@ def scan_Sentinel3OL_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -742,6 +770,10 @@ def scan_Sentinel3OL_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_HJ1_dir(collectionCode, path): @@ -759,7 +791,7 @@ def scan_HJ1_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -824,6 +856,10 @@ def scan_HJ1_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_ZY3_dir(collectionCode, path): @@ -841,7 +877,7 @@ def scan_ZY3_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -904,6 +940,10 @@ def scan_ZY3_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 def scan_SNPP_dir(collectionCode, path): @@ -921,7 +961,7 @@ def scan_SNPP_dir(collectionCode, path): task = dms_task_record(token_s, collectionCode) # 如果不是空说明正在进行 if task is not None and len(task) > 0: - return + return 1 file_total_size = "" file_total_name = "" @@ -987,6 +1027,10 @@ def scan_SNPP_dir(collectionCode, path): res = requests.post(url=Config.DATA_END_TASK_URL, params={"taskCode": task_code}, headers=header).json() + if res_data.json()['status'] == 0: + return 0 + else: + return 2 if __name__ == '__main__':