| | |
| | | FTPClient ftpClient = null; |
| | | try { |
| | | ftpClient = new FTPClient(); |
| | | //设置超时时间 |
| | | ftpClient.setDataTimeout(10000); |
| | | //连接超时为60秒 |
| | | ftpClient.setConnectTimeout(10000); |
| | | ftpClient.connect(ftpHost, ftpPort);// 连接FTP服务器 |
| | | ftpClient.login(ftpUserNameOut, ftpPasswordOut);// 登陆FTP服务器 |
| | | if (!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 执行 对象数据(实操成绩导入反馈) 上传 |
| | | * @param obj 对象信息 |
| | | */ |
| | | public static void objectFileUploadExamScore(Object obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "ne"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "ne"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "ne"+response1+".json", in1); |
| | | MysqlCenlint.deletess("ne"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 返回报名信息结果 |
| | | * @param obj |
| | | */ |