fix(schedule): ftp下载前判断文件是否存在
| | |
| | | if (!parentFile.exists()) { |
| | | parentFile.mkdirs(); |
| | | } |
| | | if (isExistSftp(downloadFile)) { |
| | | sftp.get(downloadFile, new FileOutputStream(file)); |
| | | log.info("file:{} is download successful", downloadFile); |
| | | } else { |
| | | log.error("file:{} is not found", downloadFile); |
| | | } |
| | | } |
| | | |
| | | // 判断文件是否存在 |
| | | public boolean isExistSftp(String filePach) { |
| | | try { |
| | | sftp.lstat(filePach); |
| | | } catch (SftpException e) { |
| | | log.info("isExistSftp()==> file:{} is not found", filePach); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载文件 |