parent
4c18b8d29a
commit
3707c02df9
|
@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
|
@ -42,8 +43,6 @@ import java.time.temporal.ChronoUnit;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PerformanceTestService {
|
||||
|
@ -381,6 +380,10 @@ public class PerformanceTestService {
|
|||
if (!CollectionUtils.isEmpty(loadTestFiles)) {
|
||||
loadTestFiles.forEach(loadTestFile -> {
|
||||
FileMetadata fileMetadata = fileService.copyFile(loadTestFile.getFileId());
|
||||
if (fileMetadata == null) {
|
||||
// 如果性能测试出现文件变更,这里会有 null
|
||||
return;
|
||||
}
|
||||
loadTestFile.setTestId(copy.getId());
|
||||
loadTestFile.setFileId(fileMetadata.getId());
|
||||
loadTestFileMapper.insert(loadTestFile);
|
||||
|
|
|
@ -60,6 +60,10 @@ public class FileService {
|
|||
FileContentExample example2 = new FileContentExample();
|
||||
example2.createCriteria().andFileIdIn(ids);
|
||||
fileContentMapper.deleteByExample(example2);
|
||||
|
||||
LoadTestFileExample example3 = new LoadTestFileExample();
|
||||
example3.createCriteria().andFileIdIn(ids);
|
||||
loadTestFileMapper.deleteByExample(example3);
|
||||
}
|
||||
|
||||
public FileMetadata saveFile(MultipartFile file) {
|
||||
|
|
Loading…
Reference in New Issue