| | |
| | | import java.io.*; |
| | | import java.net.SocketException; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | import net.lingala.zip4j.core.ZipFile; |
| | | |
| | | import static org.springblade.common.config.FtpConfig.*; |
| | |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 执行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, "nsql"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nsql"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nsql"+response1+".json", in1); |
| | | // MysqlCenlint.deletess("nsql"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 解压zip 包 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 执行sql 上传 |
| | | * @param obj sql |
| | | */ |
| | | public static void sqlFileUpload(String obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "nsql"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nsql"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nsql"+response1+".json", in1); |
| | | MysqlCenlint.deletess("nsql"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 执行 对象数据(用户,报名对象信息等) 上传 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "n"+response1+".json", in1); |
| | | // MysqlCenlint.deletess("n"+response1+".json"); |
| | | MysqlCenlint.deletess("n"+response1+".json"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 执行 对象数据(用户,报名对象信息等) 上传 |
| | | * @param obj 对象信息 |
| | | */ |
| | | public static void objectFileUploadList(Object obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "nl"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nl"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nl"+response1+".json", in1); |
| | | MysqlCenlint.deletess("nl"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 返回报名信息结果 |
| | | * @param obj |
| | | */ |
| | | public static void objectFileUploadListTrain(Object obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "nt"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nt"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nt"+response1+".json", in1); |
| | | MysqlCenlint.deletess("nt"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 向外网发送保安员证编号位数数据 |
| | | * @param map1 |
| | | */ |
| | | public static void objectFileUploadSecurityNumberCount(Object obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "ns"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "ns"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "ns"+response1+".json", in1); |
| | | MysqlCenlint.deletess("ns"+response1+".json"); |
| | | } |
| | | } |