From b5960d1968e007b91d4d33dd7cbb74f1b566f2c1 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Fri, 24 May 2024 10:20:01 +0800
Subject: [PATCH] 到期时间修改

---
 src/main/java/org/springblade/modules/FTP/monitor.java |   52 ++++++----------------------------------------------
 1 files changed, 6 insertions(+), 46 deletions(-)

diff --git a/src/main/java/org/springblade/modules/FTP/monitor.java b/src/main/java/org/springblade/modules/FTP/monitor.java
index 43c1997..52f72be 100644
--- a/src/main/java/org/springblade/modules/FTP/monitor.java
+++ b/src/main/java/org/springblade/modules/FTP/monitor.java
@@ -20,11 +20,11 @@
 	//private static String fileName = "nsql.json";
 
 
-	@Scheduled(cron = "*/30 * * * * ?")
+//	@Scheduled(cron = "*/30 * * * * ?")
 	public static boolean isFTPFileExist() {
 
 		FTPClient ftp = new FTPClient();
-
+		String fileName = null;
 		try {
 
 //			System.out.println("ftpHost = " + ftpHost);
@@ -36,7 +36,7 @@
 
 			ftp.login(ftpUserName, ftpPassword);
 
-			System.out.println("ftp.getReplyCode() = " + ftp.getReplyCode());
+//			System.out.println("ftp.getReplyCode() = " + ftp.getReplyCode());
 
 			// 检验登陆操作的返回码是否正确
 			if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
@@ -76,7 +76,7 @@
 				return false;
 			} else {
 				for (FTPFile file : files) {
-					String fileName = file.getName();
+					 fileName = file.getName();
 					InputStream is = ftp.retrieveFileStream(new String(fileName.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
 					if (null == is) {
 						return false;
@@ -127,49 +127,9 @@
 				return true;
 			}
 
-
-			//InputStream is = ftp.retrieveFileStream(new String(file.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
-
-//			if (is == null || ftp.getReplyCode() == FTPReply.FILE_UNAVAILABLE) {
-//				return false;
-//
-//			}
-//
-//			if (is != null) {
-//				//把文件下载到本地
-//				FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, localPath, fileName);
-//				//
-//				String s = OutJson.TestJson();
-//				//sql语句
-//				String sql = OutJson.stringReplace(s);
-//				String[] split = sql.split(";");//以逗号分割
-//				for (String sqls : split) {
-//					//判断是否是新增,删除,修改
-//					String substring = sqls.substring(0, 2);
-//					//新增
-//					if (substring.equals("in")) {
-//						//运行sql语句
-//						MysqlCenlint.inster(sqls);
-//					}
-//					//修改
-//					else if (substring.equals("up")) {
-//						MysqlCenlint.update(sqls);
-//					}
-//					//删除
-//					else {
-//						MysqlCenlint.delete(sqls);
-//					}
-//				}
-//				//删除本地文件
-//				MysqlCenlint.delete();
-//				FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "nsql.json");
-//				is.close();
-//				ftp.completePendingCommand();
-//
-//			}
-
-
 		} catch (Exception e) {
+			MysqlCenlint.deletess(fileName);
+			FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName);
 			e.printStackTrace();
 
 		} finally {

--
Gitblit v1.9.3