From 9b1c48e0aadf587a104daa144dbb9f070b3d35b2 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Thu, 25 Nov 2021 14:38:02 +0800
Subject: [PATCH] 1.统计

---
 src/main/java/org/springblade/modules/FTP/monitor.java |   48 ++++--------------------------------------------
 1 files changed, 4 insertions(+), 44 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..6f41655 100644
--- a/src/main/java/org/springblade/modules/FTP/monitor.java
+++ b/src/main/java/org/springblade/modules/FTP/monitor.java
@@ -24,7 +24,7 @@
 	public static boolean isFTPFileExist() {
 
 		FTPClient ftp = new FTPClient();
-
+		String fileName = null;
 		try {
 
 //			System.out.println("ftpHost = " + ftpHost);
@@ -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