| | |
| | | FTPClient ftpClient = null; |
| | | try { |
| | | ftpClient = new FTPClient(); |
| | | //设置传输超时时间为60秒 |
| | | ftpClient.setDataTimeout(10000); |
| | | //连接超时为60秒 |
| | | ftpClient.setConnectTimeout(10000); |
| | | ftpClient.connect(ftpHost, ftpPort);// 连接FTP服务器 |
| | | ftpClient.login(ftpUserName, ftpPassword);// 登陆FTP服务器 |
| | | if (!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { |
| | |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "u"+response1+".json", in1); |
| | | MysqlCenlint.deletess("u"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 考试实操成绩推送内网导入 |
| | | * @param map |
| | | */ |
| | | public static void objectFileUploadExamScore(Map<String, Object> map) { |
| | | String json1 = JSON.toJSONString(map); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "e"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "e"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "e"+response1+".json", in1); |
| | | MysqlCenlint.deletess("e"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 管理员导入保安人员并创建保安证编号 |
| | | * @param map |
| | | */ |
| | | public static void getSecurityPaperAndUserImport(Map<String, Object> map) { |
| | | String json = JSON.toJSONString(map); |
| | | String response = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json, localPath, "p"+response); |
| | | FileInputStream in = null; |
| | | try { |
| | | in = new FileInputStream(new File(localPath + "p"+response+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "p"+response+".json", in); |
| | | MysqlCenlint.deletess("p"+response+".json"); |
| | | } |
| | | } |