From 3a5d12b67221a19ff199846c19c4e74b71f3be84 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Sat, 11 Jun 2022 17:15:03 +0800
Subject: [PATCH] 图片,文件上传文件名修改
---
src/main/java/org/springblade/modules/quartz/task/Task.java | 43 +++++++++++++++++++++++++++++++------------
1 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/springblade/modules/quartz/task/Task.java b/src/main/java/org/springblade/modules/quartz/task/Task.java
index e2d9194..004bcd9 100644
--- a/src/main/java/org/springblade/modules/quartz/task/Task.java
+++ b/src/main/java/org/springblade/modules/quartz/task/Task.java
@@ -121,7 +121,6 @@
FTPFile[] files = ftp.listFiles();
if (files.length==0){
- ftp.logout();
return false;
}
else {
@@ -167,13 +166,18 @@
}
}
//关闭流
- ftp.completePendingCommand();
- ftp.logout();
+// ftp.completePendingCommand();
+// ftp.logout();
}
} catch (Exception e) {
System.out.println("ftp连接失败");
e.printStackTrace();
} finally {
+ try {
+ ftp.logout();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
if (ftp.isConnected()) {
try {
ftp.disconnect();
@@ -225,7 +229,7 @@
//文件个数大于10个时开始处理
// if (files.length==0 || files.length<10){
if (files.length==0){
- ftp.logout();
+// ftp.logout();
return false;
}
else {
@@ -270,13 +274,18 @@
}
}
//关闭流
- ftp.completePendingCommand();
- ftp.logout();
+// ftp.completePendingCommand();
+// ftp.logout();
}
} catch (Exception e) {
System.out.println("ftp连接失败");
e.printStackTrace();
} finally {
+ try {
+ ftp.logout();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
if (ftp.isConnected()) {
try {
ftp.disconnect();
@@ -327,7 +336,7 @@
FTPFile[] files = ftp.listFiles();
//文件个数大于10个时开始处理
if (files.length==0){
- ftp.logout();
+
return false;
}
else {
@@ -369,13 +378,18 @@
}
}
//关闭流
- ftp.completePendingCommand();
- ftp.logout();
+// ftp.completePendingCommand();
+// ftp.logout();
}
} catch (Exception e) {
System.out.println("ftp连接失败");
e.printStackTrace();
} finally {
+ try {
+ ftp.logout();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
if (ftp.isConnected()) {
try {
ftp.disconnect();
@@ -524,7 +538,7 @@
FTPFile[] files = ftp.listFiles();
//文件个数大于10个时开始处理
if (files.length==0){
- ftp.logout();
+// ftp.logout();
return false;
}
else {
@@ -562,13 +576,18 @@
}
}
//关闭流
- ftp.completePendingCommand();
- ftp.logout();
+// ftp.completePendingCommand();
+// ftp.logout();
}
} catch (Exception e) {
System.out.println("ftp连接失败");
e.printStackTrace();
} finally {
+ try {
+ ftp.logout();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
if (ftp.isConnected()) {
try {
ftp.disconnect();
--
Gitblit v1.9.3