| | |
| | | private static Logger logger = LoggerFactory.getLogger(FtpUtils.class); |
| | | |
| | | private static final String DEFAULT_CHARSET = "UTF-8"; |
| | | private static final int DEFAULT_TIMEOUT = 60 * 1000; |
| | | private static final int DEFAULT_TIMEOUT = 6000 * 1000; |
| | | private static final String DAILY_FILE_PATH = "get"; |
| | | static FTPClient ftpClient; |
| | | private volatile String ftpBasePath; |
| | |
| | | logger.info("username---"+username+"--host---"+host+"---port---"+port+"-----password-----"+password); |
| | | boolean flag = false; |
| | | try { |
| | | if (ftpClient!=null && !FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { |
| | | ftpClient = new FTPClient(); |
| | | // 连接FTP服务器 |
| | | ftpClient.connect(host, port); |
| | |
| | | disconnect(); |
| | | } else { |
| | | logger.info("FTP连接成功!"); |
| | | flag = true; |
| | | } |
| | | } else { |
| | | logger.info("当前FTP处于连接状态,无线重复连接!"); |
| | | flag = true; |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | logger.info("FTP文件名修改失败---------->>>>>文件名:"+split2[0]); |
| | | } |
| | | input.close(); |
| | | disconnect(); |
| | | //disconnect(); |
| | | return storeFlag; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | logger.error("FTP文件上传失败!", e); |
| | | } finally { |
| | | disconnect(); |
| | | //disconnect(); |
| | | } |
| | | return false; |
| | | } |