智慧保安后台管理-外网
Administrator
2022-06-06 c5d9ce9a0e30612c6a834eb04489bf0f876e2a85
src/main/java/org/springblade/modules/FTP/Monitor.java
@@ -73,9 +73,9 @@
               String fileName = file.getName();
//               System.out.println("fileName = " + fileName);
               InputStream is = ftp.retrieveFileStream(new String(fileName.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
               String substring1 = fileName.substring(0, 1);
               String substring1 = fileName.substring(0, 2);
//               System.out.println("substring1 = " + substring1);
               if (substring1.equals("n")){
               if (substring1.equals("ni")){
                  System.out.println("-------接收到内网回传的文件: " + fileName);
                   //把文件下载到本地
                  FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
@@ -290,7 +290,7 @@
    * 读取内外推送的文件,每30秒读取一次
    * @return
    */
   @Scheduled(cron = "*/30 * * * * ?")
//   @Scheduled(cron = "*/30 * * * * ?")
   public static boolean isFTPFileExist() {
      FTPClient ftp = new FTPClient();
      try {
@@ -331,8 +331,8 @@
               if (null == is) {
                  return false;
               } else {
                  String substring1 = fileName.substring(0, 4);
                  if (substring1.equals("nsql")) {
                  String substring1 = fileName.substring(0, 2);
                  if (substring1.equals("nq")) {
                     //把文件下载到本地
                     FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
                     //
@@ -394,6 +394,10 @@
      FTPClient ftp = new FTPClient();
      boolean flag = false;
      try {
         //设置超时时间
         ftp.setDataTimeout(60000);
         //连接超时为60秒
         ftp.setConnectTimeout(60000);
         //连接
         ftp.connect(ftpHost, ftpPort);
         // 登陆
@@ -452,7 +456,7 @@
         System.out.println("ftp连接失败");
         e.printStackTrace();
      } finally {
         if (ftp != null) {
         if (ftp.isConnected()) {
            try {
               ftp.disconnect();
            } catch (IOException e) {