智慧保安后台管理-外网项目备份
zhongrj
2023-09-17 8853292babb2ad94de4a3207966f1e83b767cd2d
src/main/java/org/springblade/modules/FTP/monitor.java
@@ -10,26 +10,26 @@
import java.io.IOException;
import java.io.InputStream;
import static org.springblade.common.constant.FtpConstant.*;
import static org.springblade.common.config.FtpConfig.*;
@Component
public class monitor {
   @Scheduled(cron = "*/30 * * * * ?")
//   @Scheduled(cron = "*/30 * * * * ?")
   public static boolean isFTPFileExist() {
      FTPClient ftp = new FTPClient();
      try {
         // 连接ftp服务器
//         System.out.println("ftpHost = " + ftpHost);
         ftp.connect(ftpHost_dev, ftpPort);
         ftp.connect(ftpHost, ftpPort);
         // 登陆
         ftp.login(ftpUserName, ftpPassword);
         // 检验登陆操作的返回码是否正确
         if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
@@ -75,7 +75,7 @@
               String substring1 = fileName.substring(0, 1);
               if (substring1.equals("n")){
                  //把文件下载到本地
                  FtpUtil.downloadFtpFile(ftpHost_dev, ftpUserName, ftpPassword, ftpPort, ftpPath, localPath, fileName);
                  FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, localPath, fileName);
                  //
                  String s = OutJson.TestJson(fileName);
                  //sql语句
@@ -101,7 +101,7 @@
                  //删除本地文件
                  //MysqlCenlint.deletes(fileName);
                  MysqlCenlint.deletess(fileName);
                  FtpUtil.deleteFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, fileName);
                  FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, fileName);
                  is.close();
                  ftp.completePendingCommand();
               }
@@ -151,7 +151,7 @@
      } catch (Exception e) {
         System.out.println("ftp连接失败");
         e.printStackTrace();
      } finally {