|
@@ -28,14 +28,15 @@ import java.util.stream.Collectors;
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
@SuppressWarnings({"all"})
|
|
@SuppressWarnings({"all"})
|
|
public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles> {
|
|
public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles> {
|
|
- private final FileUtils fileUtils;
|
|
|
|
|
|
+ private final FileUtils fileUtils;
|
|
private final LoginUtils loginUtils;
|
|
private final LoginUtils loginUtils;
|
|
|
|
+
|
|
//上传文档
|
|
//上传文档
|
|
- public List<Integer> uploadFiles(List<MultipartFile> file){
|
|
|
|
- List<ReportFiles> reportFiles =new ArrayList<>();
|
|
|
|
- file.forEach(item->{
|
|
|
|
|
|
+ public List<Integer> uploadFiles(List<MultipartFile> file) {
|
|
|
|
+ List<ReportFiles> reportFiles = new ArrayList<>();
|
|
|
|
+ file.forEach(item -> {
|
|
UploadFileDTO fileDTO = fileUtils.uploadFile(item);
|
|
UploadFileDTO fileDTO = fileUtils.uploadFile(item);
|
|
- ReportFiles reportFile =new ReportFiles();
|
|
|
|
|
|
+ ReportFiles reportFile = new ReportFiles();
|
|
reportFile.setSize((int) item.getSize());
|
|
reportFile.setSize((int) item.getSize());
|
|
reportFile.setUrl(fileDTO.getPath());
|
|
reportFile.setUrl(fileDTO.getPath());
|
|
reportFile.setFileName(fileDTO.getFileName());
|
|
reportFile.setFileName(fileDTO.getFileName());
|
|
@@ -44,18 +45,19 @@ public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles
|
|
reportFile.setSuffix(fileDTO.getExtName());
|
|
reportFile.setSuffix(fileDTO.getExtName());
|
|
reportFiles.add(reportFile);
|
|
reportFiles.add(reportFile);
|
|
});
|
|
});
|
|
- this.saveBatch(reportFiles);
|
|
|
|
- List<Integer> reportIds= reportFiles.stream().map(ReportFiles::getId).collect(Collectors.toList());
|
|
|
|
|
|
+ this.saveBatch(reportFiles);
|
|
|
|
+ List<Integer> reportIds = reportFiles.stream().map(ReportFiles::getId).collect(Collectors.toList());
|
|
return reportIds;
|
|
return reportIds;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
//上传文档
|
|
//上传文档
|
|
- public List<String> uploadFilesGetName(List<MultipartFile> file){
|
|
|
|
- List<ReportFiles> reportFiles =new ArrayList<>();
|
|
|
|
- file.forEach(item->{
|
|
|
|
|
|
+ public List<String> uploadFilesGetName(List<MultipartFile> file) {
|
|
|
|
+ List<ReportFiles> reportFiles = new ArrayList<>();
|
|
|
|
+ file.forEach(item -> {
|
|
UploadFileDTO fileDTO = fileUtils.uploadFile(item);
|
|
UploadFileDTO fileDTO = fileUtils.uploadFile(item);
|
|
- ReportFiles reportFile =new ReportFiles();
|
|
|
|
|
|
+ ReportFiles reportFile = new ReportFiles();
|
|
reportFile.setSize((int) item.getSize());
|
|
reportFile.setSize((int) item.getSize());
|
|
reportFile.setUrl(fileDTO.getPath());
|
|
reportFile.setUrl(fileDTO.getPath());
|
|
reportFile.setFileName(fileDTO.getFileName());
|
|
reportFile.setFileName(fileDTO.getFileName());
|
|
@@ -65,15 +67,14 @@ public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles
|
|
reportFiles.add(reportFile);
|
|
reportFiles.add(reportFile);
|
|
});
|
|
});
|
|
this.saveBatch(reportFiles);
|
|
this.saveBatch(reportFiles);
|
|
- List<String> urls= reportFiles.stream().map(ReportFiles::getUrl).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> urls = reportFiles.stream().map(ReportFiles::getUrl).collect(Collectors.toList());
|
|
return urls;
|
|
return urls;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//删除文件
|
|
//删除文件
|
|
- public void deleteFiles(List<Integer> fileIds)
|
|
|
|
- {
|
|
|
|
|
|
+ public void deleteFiles(List<Integer> fileIds) {
|
|
this.removeByIds(fileIds);
|
|
this.removeByIds(fileIds);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -88,13 +89,12 @@ public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles
|
|
}
|
|
}
|
|
|
|
|
|
//根据文件Id获得文件
|
|
//根据文件Id获得文件
|
|
- public List<ReportFiles> getFiles(List<Integer> FileIds)
|
|
|
|
- {LambdaQueryWrapper<ReportFiles> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
- queryWrapper.in(ReportFiles::getId,FileIds);
|
|
|
|
- List<ReportFiles> file = this.list(queryWrapper);
|
|
|
|
- return file;
|
|
|
|
|
|
+ public List<ReportFiles> getFiles(List<Integer> FileIds) {
|
|
|
|
+ LambdaQueryWrapper<ReportFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.in(ReportFiles::getId, FileIds);
|
|
|
|
+ List<ReportFiles> file = this.list(queryWrapper);
|
|
|
|
+ return file;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|