|
@ -6,6 +6,7 @@ package com.inscloudtech.web.controller.system; |
|
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
|
import cn.dev33.satoken.stp.StpUtil; |
|
|
import cn.dev33.satoken.stp.StpUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.inscloudtech.common.annotation.Log; |
|
|
import com.inscloudtech.common.annotation.Log; |
|
@ -32,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 测试报告管理 |
|
|
|
|
|
|
|
|
* 测试任务管理 |
|
|
* |
|
|
* |
|
|
* @author zfcf |
|
|
* @author zfcf |
|
|
* @date 2024-08-28 |
|
|
* @date 2024-08-28 |
|
@ -50,27 +51,48 @@ public class TestReportController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 测试数据-分页查询 |
|
|
|
|
|
|
|
|
* 测试内容/测试模型-分页查询 |
|
|
* @param |
|
|
* @param |
|
|
* @param |
|
|
* @param |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("/page" ) |
|
|
|
|
|
public TableDataInfo<TestReport> page(PageQuery pageQuery, TestReport testReport) { |
|
|
|
|
|
Page page = new Page(); |
|
|
|
|
|
page.setSize(pageQuery.getPageSize()); |
|
|
|
|
|
page.setCurrent(pageQuery.getPageNum()); |
|
|
|
|
|
|
|
|
@GetMapping("/testDataPage" ) |
|
|
|
|
|
public TableDataInfo<TestReport> testDataPage(PageQuery pageQuery, TestReport testReport) { |
|
|
if (!StpUtil.hasRole("admin")) { |
|
|
if (!StpUtil.hasRole("admin")) { |
|
|
testReport.setCreateBy(LoginHelper.getUsername()); |
|
|
testReport.setCreateBy(LoginHelper.getUsername()); |
|
|
} |
|
|
} |
|
|
|
|
|
QueryWrapper<TestReport> query = Wrappers.query(testReport); |
|
|
|
|
|
query.isNotNull("data_atlas"); |
|
|
|
|
|
return getCommonPage(pageQuery,query); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Page result = testReportService.page(page, Wrappers.query(testReport)); |
|
|
|
|
|
|
|
|
TableDataInfo getCommonPage(PageQuery pageQuery,QueryWrapper<TestReport> query){ |
|
|
|
|
|
Page page = new Page(); |
|
|
|
|
|
page.setSize(pageQuery.getPageSize()); |
|
|
|
|
|
page.setCurrent(pageQuery.getPageNum()); |
|
|
|
|
|
Page result = testReportService.page(page, query); |
|
|
TableDataInfo dataInfo = new TableDataInfo(); |
|
|
TableDataInfo dataInfo = new TableDataInfo(); |
|
|
dataInfo.setTotal(result.getTotal()); |
|
|
dataInfo.setTotal(result.getTotal()); |
|
|
dataInfo.setRows(result.getRecords()); |
|
|
dataInfo.setRows(result.getRecords()); |
|
|
return dataInfo; |
|
|
return dataInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 测试App-分页查询 |
|
|
|
|
|
* @param |
|
|
|
|
|
* @param |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@GetMapping("/testAppPage" ) |
|
|
|
|
|
public TableDataInfo<TestReport> testAppPage(PageQuery pageQuery, TestReport testReport) { |
|
|
|
|
|
if (!StpUtil.hasRole("admin")) { |
|
|
|
|
|
testReport.setCreateBy(LoginHelper.getUsername()); |
|
|
|
|
|
} |
|
|
|
|
|
QueryWrapper<TestReport> query = Wrappers.query(testReport); |
|
|
|
|
|
query.isNotNull("app_name"); |
|
|
|
|
|
return getCommonPage(pageQuery,query); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 通过id查询测试报告 |
|
|
* 通过id查询测试报告 |
|
@ -88,7 +110,7 @@ public class TestReportController { |
|
|
* 提交测试报告 |
|
|
* 提交测试报告 |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
@Log(title = "测试报告管理", businessType = BusinessType.INSERT) |
|
|
|
|
|
|
|
|
@Log(title = "测试任务管理", businessType = BusinessType.INSERT) |
|
|
@PostMapping(value = "/add") |
|
|
@PostMapping(value = "/add") |
|
|
public R add(@RequestBody TestReportSubmit vo) { |
|
|
public R add(@RequestBody TestReportSubmit vo) { |
|
|
return R.ok(testReportService.add(vo)); |
|
|
return R.ok(testReportService.add(vo)); |
|
@ -117,53 +139,89 @@ public class TestReportController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 后台管理-上传测试报告文件 |
|
|
|
|
|
|
|
|
* 后台管理-上传测试结果 |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
@Log(title = "测试报告管理", businessType = BusinessType.INSERT) |
|
|
|
|
|
@PostMapping(value = "/uploadReport", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
|
|
|
|
|
|
@Log(title = "测试任务管理", businessType = BusinessType.INSERT) |
|
|
|
|
|
@PostMapping(value = "/uploadResult", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
public R upload( @RequestPart("file") MultipartFile file, |
|
|
public R upload( @RequestPart("file") MultipartFile file, |
|
|
@RequestPart("id") Long id) { |
|
|
|
|
|
|
|
|
@RequestPart("id") String id) { |
|
|
|
|
|
|
|
|
if (id == null) { |
|
|
if (id == null) { |
|
|
return R.fail("测试报告id不能为空!"); |
|
|
|
|
|
|
|
|
return R.fail("测试任务id不能为空!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TestReport testReport = new TestReport(); |
|
|
TestReport testReport = new TestReport(); |
|
|
testReport.setId(id); |
|
|
|
|
|
|
|
|
testReport.setId(Long.parseLong(id)); |
|
|
if(file != null ){ |
|
|
if(file != null ){ |
|
|
SysOssVo toolVo = iSysOssService.upload(file,true); |
|
|
SysOssVo toolVo = iSysOssService.upload(file,true); |
|
|
testReport.setReportPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setReportOssId(toolVo.getOssId()); |
|
|
|
|
|
|
|
|
testReport.setResultPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setResultOssId(toolVo.getOssId()); |
|
|
} |
|
|
} |
|
|
testReportService.save(testReport); |
|
|
|
|
|
|
|
|
testReport.setTestStatus("测试完成"); |
|
|
|
|
|
testReportService.updateById(testReport); |
|
|
return R.ok("操作成功!"); |
|
|
return R.ok("操作成功!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 前端用户-上传测试数据 |
|
|
|
|
|
|
|
|
* 前端用户-上传测试内容/测试模型 |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
@SneakyThrows |
|
|
@SneakyThrows |
|
|
@Log(title = "测试数据管理", businessType = BusinessType.INSERT) |
|
|
@Log(title = "测试数据管理", businessType = BusinessType.INSERT) |
|
|
@PostMapping(value = "/uploadTestData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
@PostMapping(value = "/uploadTestData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
public R uploadTestData( @RequestPart("file") MultipartFile file, |
|
|
public R uploadTestData( @RequestPart("file") MultipartFile file, |
|
|
@RequestPart("reportName") String reportName) { |
|
|
|
|
|
|
|
|
@RequestPart("taskName") String taskName,@RequestPart("companyName") String companyName, |
|
|
|
|
|
@RequestPart("dataAtlas") String dataAtlas,String taskDesc) { |
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(reportName)) { |
|
|
|
|
|
return R.fail("数据名称不能为空!"); |
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(taskName)) { |
|
|
|
|
|
return R.fail("测试任务名称不能为空!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// testReportService.check(reportName); |
|
|
// testReportService.check(reportName); |
|
|
TestReport testReport = new TestReport(); |
|
|
TestReport testReport = new TestReport(); |
|
|
testReport.setReportName(reportName); |
|
|
|
|
|
if(file != null ){ |
|
|
if(file != null ){ |
|
|
SysOssVo toolVo = iSysOssService.upload(file,true); |
|
|
SysOssVo toolVo = iSysOssService.upload(file,true); |
|
|
testReport.setReportPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setReportOssId(toolVo.getOssId()); |
|
|
|
|
|
|
|
|
testReport.setTestDataPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setTestDataOssId(toolVo.getOssId()); |
|
|
|
|
|
}else { |
|
|
|
|
|
return R.fail("测试数据不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
testReport.setTestStatus("测试中"); |
|
|
|
|
|
testReport.setTaskName(taskName); |
|
|
|
|
|
testReport.setCompanyName(companyName); |
|
|
|
|
|
testReport.setDataAtlas(dataAtlas); |
|
|
|
|
|
testReport.setTaskDesc(taskDesc); |
|
|
|
|
|
testReportService.save(testReport); |
|
|
|
|
|
return R.ok("操作成功!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 前端用户-上传测试App |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
@Log(title = "测试数据管理", businessType = BusinessType.INSERT) |
|
|
|
|
|
@PostMapping(value = "/uploadTestApp", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
|
|
|
public R uploadTestApp( @RequestPart("file") MultipartFile file, |
|
|
|
|
|
@RequestPart("taskName") String taskName,String appVersion) { |
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(taskName)) { |
|
|
|
|
|
return R.fail("测试任务名称不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TestReport testReport = new TestReport(); |
|
|
|
|
|
testReport.setTaskName(taskName); |
|
|
|
|
|
if(file != null ){ |
|
|
|
|
|
SysOssVo toolVo = iSysOssService.upload(file,true); |
|
|
|
|
|
testReport.setTestDataPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setTestDataOssId(toolVo.getOssId()); |
|
|
|
|
|
testReport.setAppName(toolVo.getFileName()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
testReport.setTestStatus("测试中"); |
|
|
|
|
|
testReport.setAppVersion(appVersion); |
|
|
testReportService.save(testReport); |
|
|
testReportService.save(testReport); |
|
|
return R.ok("操作成功!"); |
|
|
return R.ok("操作成功!"); |
|
|
} |
|
|
} |
|
|