| | |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.FTP.MysqlCenlint; |
| | | import org.springblade.modules.FTP.OutJson; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | |
| | | FTPClient ftp = new FTPClient(); |
| | | String fileName = null; |
| | | try { |
| | | //设置超时时间 |
| | | ftp.setDataTimeout(60000); |
| | | //连接超时为60秒 |
| | | ftp.setConnectTimeout(60000); |
| | | |
| | | ftp.connect(ftpHost, ftpPort); |
| | | |
| | |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("o")){ |
| | | //获取对象字符串 |
| | |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("l")){ |
| | | //用户集合数据 |
| | | //用户集合数据,批量导入用户 |
| | | //获取对象字符串 |
| | | String json = OutJson.TestJson(fileName); |
| | | //数据处理 |
| | |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("t")){ |
| | | //培训报名数据 |
| | |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("s")){ |
| | | //获取保安员证编号数据 |
| | |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("u")){ |
| | | //保安员审查 |
| | | //获取对象字符串 |
| | | String json = OutJson.TestJson(fileName); |
| | | //数据处理 |
| | | DataHanlder.handlerUserExamine(json); |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | // ftp.dele(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | } |
| | | // else if(substring1.equals("f")){ |
| | | // //把文件下载到本地(图片文件类),测试内外网使用同一台服务器 |
| | | else if(substring1.equals("f")){ |
| | | //把文件下载到本地(图片文件类),测试内外网使用同一台服务器 |
| | | FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, minioPath, fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | // ftp.dele(fileName); |
| | | } |
| | | // else { |
| | | // //把文件下载到本地(图片文件类),ftp 内外网服务器分开时使用 |
| | | // FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, minioPath, fileName); |
| | | // FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | // } |
| | | else { |
| | | //把文件下载到本地(图片文件类),ftp 内外网服务器分开时使用 |
| | | FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, minioPath, fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | } |
| | | //删除本地文件,ftp 文件没有对应读取的不删除 |
| | | MysqlCenlint.deletess(fileName); |
| | | is.close(); |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | MysqlCenlint.deletess(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | // FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | //如果ftp 没有关闭,则关闭ftp |