update 文档拆分

This commit is contained in:
赵霄
2023-09-25 14:47:27 +08:00
parent 9b487cecb4
commit 5216e2ea24
2 changed files with 20 additions and 18 deletions
@@ -136,15 +136,17 @@ public class SarFileSplitInfoController extends JeroController<SarFileSplitInfoE
@PostMapping(value = "/add")
// @RequiresPermissions("split:sarFileSplitInfo:add")
public Result<?> add(@RequestBody SarFileSplitInfoEO sarFileSplitInfoEO) {
String id = sarFileSplitInfoEO.getId();
if (StringUtils.isBlank(id)){
throw new JeroBootException("请选择文本!");
}
LambdaQueryWrapper<SarFileSplitInfoEO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarFileSplitInfoEO::getFileId, id);
wrapper.last("limit 1");
SarFileSplitInfoEO splitInfoEO = sarFileSplitInfoService.getOne(wrapper);
sarFileSplitInfoService.add(splitInfoEO);
// String id = sarFileSplitInfoEO.getId();
// if (StringUtils.isBlank(id)){
// throw new JeroBootException("请选择文本!");
// }
// LambdaQueryWrapper<SarFileSplitInfoEO> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SarFileSplitInfoEO::getFileId, id);
// wrapper.last("limit 1");
// SarFileSplitInfoEO splitInfoEO = sarFileSplitInfoService.getOne(wrapper);
sarFileSplitInfoEO.setStartNumber(0);
sarFileSplitInfoEO.setStopNumber(0);
sarFileSplitInfoService.add(sarFileSplitInfoEO);
return Result.OK("添加成功!");
}
@@ -128,13 +128,13 @@ public class FileSpiltService {
// }
//获取文件地址
String connectId = sarFileSplitInfoEO.getConnectId();
String fileName = sarFileSplitInfoEO.getFileName();
if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) {
throw new JeroBootException("当前文件未找到,请重新选择!");
}
String fileId = sarFileSplitInfoEO.getFileId();
// if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) {
// throw new JeroBootException("当前文件未找到,请重新选择!");
// }
LambdaQueryWrapper<OSSFile> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(OSSFile::getConnectId, connectId);
queryWrapper.eq(OSSFile::getFileName, fileName);
// queryWrapper.eq(OSSFile::getConnectId, connectId);
queryWrapper.eq(OSSFile::getId, fileId);
queryWrapper.orderByDesc(OSSFile::getCreateTime);
List<OSSFile> ossFileList = iossFileService.list(queryWrapper);
if (CollectionUtils.isEmpty(ossFileList)) {
@@ -147,9 +147,9 @@ public class FileSpiltService {
throw new JeroBootException("当前文件未找到,请重新选择!");
}
//try (InputStream is = MinioUtil.download(readFilePath);InputStream is1 = MinioUtil.download(readFilePath)) {
readFilePath = "E:\\Data\\Downloads\\wordtest\\GB7258标准修订test - 表格测试 - 副本.docx";
try (InputStream is = new FileInputStream(readFilePath);InputStream is1 = new FileInputStream(readFilePath)) {//需要将文件路更改为word文档所在路径。
try (InputStream is = MinioUtil.download(readFilePath);InputStream is1 = MinioUtil.download(readFilePath)) {
// readFilePath = "E:\\Data\\Downloads\\wordtest\\GB7258标准修订test - 表格测试 - 副本.docx";
// try (InputStream is = new FileInputStream(readFilePath);InputStream is1 = new FileInputStream(readFilePath)) {//需要将文件路更改为word文档所在路径。
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);