From e3997e08bf8c0ed292a552ec4efea39a03cfbc83 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 17 May 2022 09:01:59 +0800
Subject: [PATCH] 定时任务修改
---
src/main/java/org/springblade/modules/FTP/Monitor.java | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/springblade/modules/FTP/Monitor.java b/src/main/java/org/springblade/modules/FTP/Monitor.java
index a5affee..678b00d 100644
--- a/src/main/java/org/springblade/modules/FTP/Monitor.java
+++ b/src/main/java/org/springblade/modules/FTP/Monitor.java
@@ -12,7 +12,6 @@
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.SocketException;
-import java.net.URLEncoder;
import java.util.List;
import static org.springblade.common.config.FtpConfig.*;
@@ -24,7 +23,6 @@
*/
@Component
public class Monitor {
-
/**
@@ -55,9 +53,8 @@
// 设置编码格式
ftp.setControlEncoding("GBK");
- System.out.println("ftpPathIn = " + ftpPathIn);
// 检验文件是否存在
- boolean ftpFile = ftp.changeWorkingDirectory(ftpPathIn);
+ boolean ftpFile = ftp.changeWorkingDirectory(ftpPath);
System.out.println("检验文件是否存在 = " + ftpFile);
FTPFile[] files = ftp.listFiles();
System.out.println("files = " + files);
@@ -76,14 +73,14 @@
if (substring1.equals("n")){
System.out.println("-------接收到内网回传的文件: " + substring1);
//把文件下载到本地
- FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPathIn, localPath, fileName);
+ FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
// 解析数据
String s = OutJson.TestJson(fileName);
//数据处理
Result result = DataHandler.handler(s,uuid);
//删除本地文件
MysqlCenlint.deletess(fileName);
- FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPathIn, fileName);
+ FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPath, fileName);
is.close();
ftp.completePendingCommand();
if (result.getCode()==200) {
@@ -151,7 +148,7 @@
ftp.setControlEncoding("GBK");
// 检验文件是否存在
- ftp.changeWorkingDirectory(ftpPathIn);
+ ftp.changeWorkingDirectory(ftpPath);
FTPFile[] files = ftp.listFiles();
if (files.length==0){
return new Result(400,null,"未读取到文件",null);
@@ -162,7 +159,7 @@
String substring1 = fileName.substring(0, 2);
if (substring1.equals("nl")){
//把文件下载到本地
- FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPathIn, localPath, fileName);
+ FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
// 解析数据
String s = OutJson.TestJson(fileName);
//数据处理
@@ -172,7 +169,7 @@
//删除本地文件
MysqlCenlint.deletess(fileName);
//删除 ftp 文件
- FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPathIn, fileName);
+ FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPath, fileName);
//返回
return result;
}
@@ -226,7 +223,7 @@
ftp.setControlEncoding("GBK");
// 检验文件是否存在
- ftp.changeWorkingDirectory(ftpPathIn);
+ ftp.changeWorkingDirectory(ftpPath);
FTPFile[] files = ftp.listFiles();
if (files.length==0){
return new Result(400,null,"未读取到文件",null);
@@ -237,7 +234,7 @@
String substring1 = fileName.substring(0, 2);
if (substring1.equals("nt")){
//把文件下载到本地
- FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPathIn, localPath, fileName);
+ FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
// 解析数据
String s = OutJson.TestJson(fileName);
//数据处理
@@ -247,7 +244,7 @@
//删除本地文件
MysqlCenlint.deletess(fileName);
//删除 ftp 文件
- FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPathIn, fileName);
+ FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPath, fileName);
//返回
return result;
}
@@ -299,7 +296,7 @@
ftp.setControlEncoding("GBK");
// 检验文件是否存在
- ftp.changeWorkingDirectory(ftpPathIn);
+ ftp.changeWorkingDirectory(ftpPath);
FTPFile[] files = ftp.listFiles();
if (files.length==0){
return false;
@@ -314,7 +311,7 @@
String substring1 = fileName.substring(0, 4);
if (substring1.equals("nsql")) {
//把文件下载到本地
- FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPathIn, localPath, fileName);
+ FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
//
String s = OutJson.TestJson(fileName);
//sql语句
@@ -340,7 +337,7 @@
//删除本地服务器文件
MysqlCenlint.deletess(fileName);
//删除 ftp 服务器文件
- FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPathIn, fileName);
+ FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPath, fileName);
}
//关闭流
is.close();
@@ -393,7 +390,7 @@
ftp.setControlEncoding("GBK");
// 检验文件是否存在
- ftp.changeWorkingDirectory(ftpPathIn);
+ ftp.changeWorkingDirectory(ftpPath);
FTPFile[] files = ftp.listFiles();
if (files.length==0){
return new Result(400,null,"未读取到文件",null);
@@ -404,7 +401,7 @@
String substring1 = fileName.substring(0, 2);
if (substring1.equals("ns")){
//把文件下载到本地
- FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPathIn, localPath, fileName);
+ FtpUtil.downloadFtpFile(ftpHost, ftpUserNameIn, ftpPasswordIn, ftpPort, ftpPath, localPath, fileName);
// 解析数据
String s = OutJson.TestJson(fileName);
//数据处理
@@ -414,7 +411,7 @@
//删除本地文件
MysqlCenlint.deletess(fileName);
//删除 ftp 文件
- FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPathIn, fileName);
+ FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserNameIn, ftpPasswordIn, ftpPath, fileName);
//返回
return result;
}
--
Gitblit v1.9.3