| | |
| | | import org.apache.commons.net.ftp.FTP; |
| | | import org.apache.commons.net.ftp.FTPClient; |
| | | import org.apache.commons.net.ftp.FTPReply; |
| | | |
| | | import java.io.*; |
| | | import java.net.SocketException; |
| | | import java.util.Date; |
| | | |
| | | import static org.springblade.common.constant.FtpConstant.*; |
| | | import static org.springblade.common.constant.FtpConstant.ftpPassword; |
| | | import static org.springblade.common.config.FtpConfig.*; |
| | | |
| | | /** |
| | | * ftp工具类 |
| | |
| | | public static void sqlFileUpload(String s1){ |
| | | String json1 = JSON.toJSONString(s1); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, "d:/", "w"+response1); |
| | | OutJson.createJsonFile(json1, localPath, "w"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File("D:\\" + "w"+response1+".json")); |
| | | in1 = new FileInputStream(new File(localPath + "w"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/", "w"+response1+".json", in1); |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "w"+response1+".json", in1); |
| | | MysqlCenlint.deletess("w"+response1+".json"); |
| | | } |
| | | |
| | | } |