|
|
@ -3,6 +3,7 @@ package com.foreverwin.mesnac.common.ftp;
|
|
|
|
import org.apache.commons.net.ftp.FTPClient;
|
|
|
|
import org.apache.commons.net.ftp.FTPClient;
|
|
|
|
import org.apache.commons.net.ftp.FTPClientConfig;
|
|
|
|
import org.apache.commons.net.ftp.FTPClientConfig;
|
|
|
|
import org.apache.commons.net.ftp.FTPFile;
|
|
|
|
import org.apache.commons.net.ftp.FTPFile;
|
|
|
|
|
|
|
|
import org.apache.commons.net.ftp.FTPReply;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@ -329,5 +330,23 @@ public class CappFtpClient {
|
|
|
|
throw ioe;
|
|
|
|
throw ioe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public FTPClient login() throws IOException{
|
|
|
|
|
|
|
|
this.ftp=new FTPClient();
|
|
|
|
|
|
|
|
this.ftp.connect(address,port);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(FTPReply.isPositiveCompletion(this.ftp.getReplyCode())){
|
|
|
|
|
|
|
|
if(this.ftp.login(userName, password)){
|
|
|
|
|
|
|
|
this.ftp.setControlEncoding("GBK");
|
|
|
|
|
|
|
|
return this.ftp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.ftp.isConnected()){
|
|
|
|
|
|
|
|
this.ftp.disconnect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.ftp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|