代码提交
This commit is contained in:
parent
307a21acac
commit
4dcca439db
@ -66,7 +66,7 @@ public class TsFilesController {
|
|||||||
//分页查询
|
//分页查询
|
||||||
int currentPage = (int) page.getCurrent();
|
int currentPage = (int) page.getCurrent();
|
||||||
// 先尝试从缓存获取 如果搜索条件为空 从Redis获取
|
// 先尝试从缓存获取 如果搜索条件为空 从Redis获取
|
||||||
if(StrUtil.isBlank(fileName)&&StrUtil.isBlank(keywords) &&StrUtil.isBlank(startDate) &&StrUtil.isBlank(endDate)) {
|
if(StrUtil.isBlank(fileName)&&StrUtil.isBlank(keywords) &&StrUtil.isBlank(startDate) &&StrUtil.isBlank(endDate)&& !"00".equals(id)) {
|
||||||
if (!StrUtil.isEmpty(id)) {
|
if (!StrUtil.isEmpty(id)) {
|
||||||
IPage<TsFiles> cachedPage = tsFilesService.getCachedTsFilesPage(taskId, nodeId, currentPage, id);
|
IPage<TsFiles> cachedPage = tsFilesService.getCachedTsFilesPage(taskId, nodeId, currentPage, id);
|
||||||
if (cachedPage != null) {
|
if (cachedPage != null) {
|
||||||
|
@ -268,7 +268,7 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
|
|||||||
tsFilesPage.setRecords(records); // 同步到 tsFilesPage
|
tsFilesPage.setRecords(records); // 同步到 tsFilesPage
|
||||||
int currentPage = (int) page.getCurrent();
|
int currentPage = (int) page.getCurrent();
|
||||||
// 如果是前五页,将结果存入Redis(有效期建议30分钟)如果搜索条件为空 从Redis获取
|
// 如果是前五页,将结果存入Redis(有效期建议30分钟)如果搜索条件为空 从Redis获取
|
||||||
if (StrUtil.isBlank(fileName) && StrUtil.isBlank(keywords) && StrUtil.isBlank(startDate) && StrUtil.isBlank(endDate)) {
|
if (StrUtil.isBlank(fileName) && StrUtil.isBlank(keywords) && StrUtil.isBlank(startDate) && StrUtil.isBlank(endDate) && !"00".equals(id)) {
|
||||||
if (!StrUtil.isEmpty(id)) {
|
if (!StrUtil.isEmpty(id)) {
|
||||||
if (currentPage >= 1 && currentPage <= 5) {
|
if (currentPage >= 1 && currentPage <= 5) {
|
||||||
String redisKey = "tsfiles_" + taskId + "_" + nodeId + "_parentId" + id + "_page_" + currentPage + "";
|
String redisKey = "tsfiles_" + taskId + "_" + nodeId + "_parentId" + id + "_page_" + currentPage + "";
|
||||||
@ -1260,6 +1260,14 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
|
|||||||
sourceDirs.add(workpath); // 修复:使用可变集合
|
sourceDirs.add(workpath); // 修复:使用可变集合
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
LOGGER.info("压缩之前的时候删除Redis");
|
||||||
|
//todo 压缩的时候删除Redis
|
||||||
|
if (!parentId.equals("00")) {
|
||||||
|
for (int page = 1; page <= 5; page++) {
|
||||||
|
String redisKey = "tsfiles_" + filesList.get(0).getTaskId() + "_" + filesList.get(0).getNodeId() + "_parentId" + parentId + "_page_" + page;
|
||||||
|
redisTemplate.delete(redisKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
String finalParentId = ensureFullPathExists(compressedPath, filesList.get(0).getNodeId(), filesList.get(0).getTaskId(), path);
|
String finalParentId = ensureFullPathExists(compressedPath, filesList.get(0).getNodeId(), filesList.get(0).getTaskId(), path);
|
||||||
parentId = finalParentId;
|
parentId = finalParentId;
|
||||||
LOGGER.info("压缩的时候删除Redis");
|
LOGGER.info("压缩的时候删除Redis");
|
||||||
@ -1876,6 +1884,15 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
|
|||||||
// 1. 获取压缩包记录
|
// 1. 获取压缩包记录
|
||||||
TsFiles zipFileRecord = tsFilesMapper.selectById(id);
|
TsFiles zipFileRecord = tsFilesMapper.selectById(id);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
LOGGER.info("解压缩压缩之前的时候删除Redis");
|
||||||
|
//todo 解压缩的时候删除Redis
|
||||||
|
if (!parentId.equals("00")) {
|
||||||
|
for (int page = 1; page <= 5; page++) {
|
||||||
|
String redisKey = "tsfiles_" + zipFileRecord.getTaskId() + "_" + zipFileRecord.getNodeId() + "_parentId" + parentId + "_page_" + page;
|
||||||
|
redisTemplate.delete(redisKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
String finalParentId = ensureFullPathExists(decompressionPath, zipFileRecord.getNodeId(), zipFileRecord.getTaskId(), path);
|
String finalParentId = ensureFullPathExists(decompressionPath, zipFileRecord.getNodeId(), zipFileRecord.getTaskId(), path);
|
||||||
parentId = finalParentId;
|
parentId = finalParentId;
|
||||||
|
|
||||||
@ -4141,9 +4158,9 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
|
|||||||
Path targetPath = targetParentPhysicalPath.resolve(targetFileName);
|
Path targetPath = targetParentPhysicalPath.resolve(targetFileName);
|
||||||
|
|
||||||
// 3. 再次检查自移动
|
// 3. 再次检查自移动
|
||||||
if (sourcePath.equals(targetPath)) {
|
// if (sourcePath.equals(targetPath)) {
|
||||||
throw new IllegalArgumentException("不能复制到自己当前位置");
|
// throw new IllegalArgumentException("不能复制到自己当前位置");
|
||||||
}
|
// }
|
||||||
// 执行物理复制
|
// 执行物理复制
|
||||||
copyPhysicalFile(sourcePath, targetPath, type);
|
copyPhysicalFile(sourcePath, targetPath, type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user