fix
This commit is contained in:
@@ -16,7 +16,7 @@ public interface FileRiskConvert {
|
||||
|
||||
FileRisk toEntity(FileRiskDTO dto);
|
||||
|
||||
FileRiskDTO toDto(FileRisk entity);
|
||||
// FileRiskDTO toDto(FileRisk entity);
|
||||
|
||||
FileRisk toEntity(FileRiskCreateDTO dto);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.senmesh.sfile.job;
|
||||
|
||||
import com.senmesh.common.annotation.AlitaStopWatch;
|
||||
import com.senmesh.common.util.MockUtils;
|
||||
import com.senmesh.component.file.config.FileProperties;
|
||||
import com.senmesh.sfile.service.TransferFileMonitorService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -30,9 +31,12 @@ public class TransferFileMonitorJob {
|
||||
public void execute() {
|
||||
try {
|
||||
log.debug("开始扫描传输目录");
|
||||
MockUtils.mockPlatUser();
|
||||
transferFileMonitorService.scanAndProcess();
|
||||
} catch (Exception e) {
|
||||
log.error("传输文件监听处理失败", e);
|
||||
} finally {
|
||||
MockUtils.clearUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.senmesh.sfile.entity.FileRisk;
|
||||
import com.senmesh.sfile.service.FileRiskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -95,7 +96,10 @@ public class FileRiskServiceImpl implements FileRiskService {
|
||||
() -> this.find(queryDTO), () -> {
|
||||
FileRisk fileRisk = FileRiskConvert.INSTANCE.toEntity(createDTO);
|
||||
fileRiskMapper.saveEntity(fileRisk);
|
||||
return FileRiskConvert.INSTANCE.toDto(fileRisk);
|
||||
FileRiskDTO fileRiskDTO = new FileRiskDTO();
|
||||
BeanUtils.copyProperties(fileRisk,
|
||||
fileRiskDTO);
|
||||
return fileRiskDTO;//FileRiskConvert.INSTANCE.toDto(fileRisk);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +191,10 @@ public class TransferFileMonitorServiceImpl implements TransferFileMonitorServic
|
||||
log.debug("元数据中不包含文件信息,跳过(可能还在传输中): {}", fileName);
|
||||
return null;
|
||||
}
|
||||
if (expandUserFile.getFiles().isEmpty()) {
|
||||
log.debug("传输空文件夹: {}", fileName);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
// 3. 创建 userFileId -> fileSize 的映射
|
||||
Map<Long, Long> expectedSizeMap = new HashMap<>();
|
||||
@@ -200,11 +204,6 @@ public class TransferFileMonitorServiceImpl implements TransferFileMonitorServic
|
||||
}
|
||||
}
|
||||
|
||||
if (expectedSizeMap.isEmpty()) {
|
||||
log.debug("元数据中不包含文件大小信息,跳过(可能还在传输中): {}", fileName);
|
||||
return null;
|
||||
}
|
||||
|
||||
log.info("开始校验文件大小: {}", fileName);
|
||||
|
||||
// 4. 遍历 ZIP 中的文件,对比大小
|
||||
@@ -303,8 +302,6 @@ public class TransferFileMonitorServiceImpl implements TransferFileMonitorServic
|
||||
|
||||
UserFileDTO folder = expandUserFile.getFolder();
|
||||
List<UserFileDTO> files = expandUserFile.getFiles();
|
||||
Assert.notNull(folder, "expandUserFile 缺少 folder");
|
||||
Assert.notEmpty(files, "expandUserFile 缺少 files");
|
||||
|
||||
// 2. 确定 rootType 并设置到 folder 中
|
||||
String location = fileProperties.getTransfer().getLocation();
|
||||
@@ -487,8 +484,8 @@ public class TransferFileMonitorServiceImpl implements TransferFileMonitorServic
|
||||
return;
|
||||
}
|
||||
|
||||
Long folderId = Long.parseLong(parts[0]);
|
||||
Long userId = Long.parseLong(parts[1]);
|
||||
Long userId = Long.parseLong(parts[0]);
|
||||
Long folderId = Long.parseLong(parts[1]);
|
||||
|
||||
log.info("解析完成标记文件: folderId={}, userId={}", folderId, userId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user