| | |
| | | package org.springblade.modules.FTP; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.net.ftp.FTP; |
| | |
| | | |
| | | 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.ftpPath; |
| | | |
| | | /** |
| | | * ftp工具类 |
| | |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 执行sql 上传 |
| | | * @param s1 sql |
| | | */ |
| | | public static void sqlFileUpload(String s1){ |
| | | String json1 = JSON.toJSONString(s1); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "n"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "n"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "n"+response1+".json", in1); |
| | | } |
| | | |
| | | } |