From 30df94c05573a426d030510d4dd58ae1d93bfb7a Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 06 Dec 2021 14:03:37 +0800
Subject: [PATCH] 1.资格审查排序

---
 src/main/java/org/springblade/modules/FTP/monitor.java |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/FTP/monitor.java b/src/main/java/org/springblade/modules/FTP/monitor.java
index 53a9fa8..984a8f8 100644
--- a/src/main/java/org/springblade/modules/FTP/monitor.java
+++ b/src/main/java/org/springblade/modules/FTP/monitor.java
@@ -19,7 +19,7 @@
 	//private static String fileName = "nsql.json";
 
 
-	@Scheduled(cron = "*/30 * * * * ?")
+	//@Scheduled(cron = "*/30 * * * * ?")
 	public static boolean isFTPFileExist() {
 
 		FTPClient ftp = new FTPClient();
@@ -53,7 +53,6 @@
 			// 设置编码格式
 
 			ftp.setControlEncoding("GBK");
-
 			// 提取绝对地址的目录以及文件名
 
 			//ftpPath = ftpPath.replace("ftp://" + ftpHost + ":" + ftpPort + "/", "");
@@ -67,17 +66,17 @@
 			//ftp.changeWorkingDirectory(new String(dir.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
 
 			// 检验文件是否存在
+			ftp.changeWorkingDirectory(ftpPath);
 			FTPFile[] files = ftp.listFiles();
-			if (files.length==0){
+			if (files.length == 0) {
 				return false;
-			}
-			else {
-				for (FTPFile file : files){
+			} else {
+				for (FTPFile file : files) {
 					String fileName = file.getName();
 					InputStream is = ftp.retrieveFileStream(new String(fileName.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
-					if (null==is){
+					if (null == is) {
 						return false;
-					}else {
+					} else {
 						String substring1 = fileName.substring(0, 1);
 						if (substring1.equals("w")) {
 							//把文件下载到本地
@@ -107,6 +106,14 @@
 							//删除本地文件
 //						MysqlCenlint.deletes(fileName);
 							MysqlCenlint.deletess(fileName);
+							FtpUtil.deleteFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName);
+							is.close();
+							ftp.completePendingCommand();
+						}
+						else {
+							//把文件下载到本地
+							FtpUtil.downloadFtpFile(ftpHost_dev, ftpUserName, ftpPassword, ftpPort, ftpPath, MinioPath, fileName);
+							//MysqlCenlint.deletess(fileName);
 							FtpUtil.deleteFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName);
 							is.close();
 							ftp.completePendingCommand();
@@ -159,7 +166,6 @@
 
 
 		} catch (Exception e) {
-
 			e.printStackTrace();
 
 		} finally {

--
Gitblit v1.9.3