From 078a5c4ced367fdbd5a16c27c8bada6e44e632d5 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 09 十月 2025 16:00:33 +0800
Subject: [PATCH] 最新版本541200007

---
 server/system_service/src/main/java/com/doumee/core/utils/FtpUtil.java |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/server/system_service/src/main/java/com/doumee/core/utils/FtpUtil.java b/server/system_service/src/main/java/com/doumee/core/utils/FtpUtil.java
index f6dac5f..9c009bb 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/FtpUtil.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/FtpUtil.java
@@ -1,6 +1,7 @@
 package com.doumee.core.utils;
 
 import java.io.*;
+import java.net.MalformedURLException;
 import java.util.Date;
 import java.util.UUID;
 
@@ -51,6 +52,37 @@
 		FtpUtil.password =password;
 		connect();
 	}
+	/**
+	 * 鍒濆鍖杅tp鏈嶅姟鍣�
+	 */
+	public boolean connect() {
+		boolean flag = false;
+		try {
+			System.out.println("connecting...ftp鏈嶅姟鍣�:"+this.hostname+":"+this.port);
+			ftpClient.setRemoteVerificationEnabled(false);
+			ftpClient.connect(hostname, port); //杩炴帴ftp鏈嶅姟鍣�
+			ftpClient.login(username, password); //鐧诲綍ftp鏈嶅姟鍣�
+//            if (FTPReply.isPositiveCompletion(ftpClient.sendCommand("OPTS UTF8", "ON"))) {
+//            	LOCAL_CHARSET = "UTF-8";
+//			}
+			ftpClient.setControlEncoding("GBK");
+			ftpClient.enterLocalPassiveMode();
+			int replyCode = ftpClient.getReplyCode(); //鏄惁鎴愬姛鐧诲綍鏈嶅姟鍣�
+			if(!FTPReply.isPositiveCompletion(replyCode)){
+				log.error("connect failed...ftp鏈嶅姟鍣�:"+this.hostname+":"+this.port+"杩斿洖鐮侊細"+replyCode);
+			}else {
+				flag = true;
+				log.info("connect successful...ftp鏈嶅姟鍣�:"+this.hostname+":"+this.port+"杩斿洖鐮侊細"+replyCode);
+			}
+		}catch (MalformedURLException e) {
+			e.printStackTrace();
+			log.error("connect exception...ftp鏈嶅姟鍣�:"+this.hostname+":"+this.port+	e.getMessage());
+		}catch (IOException e) {
+			e.printStackTrace();
+			log.error("connect exception...ftp鏈嶅姟鍣�:"+this.hostname+":"+this.port+	e.getMessage());
+		}
+		return flag;
+	}
 
 	/** */
 	/**
@@ -60,7 +92,7 @@
 	 * @return 鏄惁杩炴帴鎴愬姛
 	 * @throws IOException
 	 */
-	public boolean connect() throws IOException {
+	public boolean connect2() throws IOException {
 		ftpClient.connect(hostname, port);
 		ftpClient.setControlEncoding("GBK");
 		if (FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) {
@@ -238,7 +270,7 @@
 	public boolean uploadInputstream(InputStream inputStream, String remote)  {
 		// 璁剧疆PassiveMode浼犺緭
 		Date d1 = new Date();
-		log.info("涓婁紶鏂囦欢鎴愬姛=============寮�濮�========="+DateUtil.getPlusTime2(d1));
+		log.error("涓婁紶鏂囦欢鎴愬姛=============寮�濮�========="+DateUtil.getPlusTime2(d1));
 		try {
 			ftpClient.enterLocalPassiveMode();
 			// 璁剧疆浠ヤ簩杩涘埗娴佺殑鏂瑰紡浼犺緭
@@ -263,7 +295,7 @@
 				log.error("涓婁紶鏂囦欢澶辫触======================="+remote);
 			}
 			Date d2= new Date();
-			log.info("涓婁紶鏂囦欢鎴愬姛=============缁撴潫========="+DateUtil.getPlusTime2(d2) +"鑰楁椂绉掞細"+( (d2.getTime()-d1.getTime()) /1000));
+			log.error("涓婁紶鏂囦欢鎴愬姛=============缁撴潫========="+DateUtil.getPlusTime2(d2) +"鑰楁椂姣锛�"+( (d2.getTime()-d1.getTime())  ));
 			return result;
 		}catch (Exception e){
 			e.printStackTrace();

--
Gitblit v1.9.3