fix直接点击保存并运行按钮无法运行

This commit is contained in:
haifeng414 2020-02-20 12:43:34 +08:00
parent 8239567c9e
commit 7c968eda35
2 changed files with 5 additions and 3 deletions

View File

@ -33,11 +33,11 @@ public class LoadTestController {
} }
@PostMapping(value = "/save", consumes = {"multipart/form-data"}) @PostMapping(value = "/save", consumes = {"multipart/form-data"})
public void save( public String save(
@RequestPart("request") SaveTestPlanRequest request, @RequestPart("request") SaveTestPlanRequest request,
@RequestPart(value = "file") MultipartFile file @RequestPart(value = "file") MultipartFile file
) { ) {
loadTestService.save(request, file); return loadTestService.save(request, file);
} }
@PostMapping(value = "/edit", consumes = {"multipart/form-data"}) @PostMapping(value = "/edit", consumes = {"multipart/form-data"})

View File

@ -73,7 +73,7 @@ public class LoadTestService {
fileService.deleteFileByTestId(request.getId()); fileService.deleteFileByTestId(request.getId());
} }
public void save(SaveTestPlanRequest request, MultipartFile file) { public String save(SaveTestPlanRequest request, MultipartFile file) {
if (file == null) { if (file == null) {
throw new IllegalArgumentException("文件不能为空!"); throw new IllegalArgumentException("文件不能为空!");
} }
@ -86,6 +86,8 @@ public class LoadTestService {
loadTestFile.setTestId(loadTest.getId()); loadTestFile.setTestId(loadTest.getId());
loadTestFile.setFileId(fileMetadata.getId()); loadTestFile.setFileId(fileMetadata.getId());
loadTestFileMapper.insert(loadTestFile); loadTestFileMapper.insert(loadTestFile);
return loadTest.getId();
} }
private LoadTestWithBLOBs saveLoadTest(SaveTestPlanRequest request) { private LoadTestWithBLOBs saveLoadTest(SaveTestPlanRequest request) {