| | |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | |
| | | @Scheduled(cron = "0 0/1 * * * ?") |
| | | public void get() throws IOException { |
| | | System.out.println("同步上传......"); |
| | | log.info("同步上传"); |
| | | List<String> list = FtpApche.downloadList(ftpConfig); |
| | | |
| | | if(list.size() == 0){ |
| | | log.error("no files in ftp"); |
| | | System.out.println("ftp get 0 fileinfo"); |
| | | log.error("同步互联网文件"); |
| | | List<String> list = FtpApche.downloadList(this.ftpConfig); |
| | | if (list.size() == 0) |
| | | return; |
| | | } |
| | | System.out.println("ftp get all fileinfo:" + list.get(0)); |
| | | for (String str : list) { |
| | | String password = str.substring(0, 6); |
| | | String fileName = str.substring(6, str.length()); |
| | |
| | | FtpApche.deleteFile(str); |
| | | buildResultEntity(fileName, fileName.substring(14, fileName.length()), "minio", uploadResult, (MultipartFile)mockMultipartFile, password, fileBytesByName); |
| | | } |
| | | |
| | | } |
| | | |
| | | @NotNull |