|
@ -3,14 +3,18 @@ package com.inscloudtech.web.controller.system; |
|
|
/***/ |
|
|
/***/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
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; |
|
|
import com.inscloudtech.common.core.domain.PageQuery; |
|
|
import com.inscloudtech.common.core.domain.PageQuery; |
|
|
import com.inscloudtech.common.core.domain.R; |
|
|
import com.inscloudtech.common.core.domain.R; |
|
|
|
|
|
import com.inscloudtech.common.core.domain.model.LoginUser; |
|
|
import com.inscloudtech.common.core.page.TableDataInfo; |
|
|
import com.inscloudtech.common.core.page.TableDataInfo; |
|
|
import com.inscloudtech.common.enums.BusinessType; |
|
|
import com.inscloudtech.common.enums.BusinessType; |
|
|
|
|
|
import com.inscloudtech.common.helper.LoginHelper; |
|
|
import com.inscloudtech.common.utils.file.FileUploadUtils; |
|
|
import com.inscloudtech.common.utils.file.FileUploadUtils; |
|
|
import com.inscloudtech.functional.domain.TestReport; |
|
|
import com.inscloudtech.functional.domain.TestReport; |
|
|
import com.inscloudtech.functional.service.TestReportService; |
|
|
import com.inscloudtech.functional.service.TestReportService; |
|
@ -22,6 +26,9 @@ import org.springframework.http.MediaType; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 测试报告管理 |
|
|
* 测试报告管理 |
|
|
* |
|
|
* |
|
@ -48,6 +55,10 @@ public class TestReportController { |
|
|
Page page = new Page(); |
|
|
Page page = new Page(); |
|
|
page.setSize(pageQuery.getPageSize()); |
|
|
page.setSize(pageQuery.getPageSize()); |
|
|
page.setCurrent(pageQuery.getPageNum()); |
|
|
page.setCurrent(pageQuery.getPageNum()); |
|
|
|
|
|
if (!StpUtil.hasRole("admin")) { |
|
|
|
|
|
testReport.setCreateBy(LoginHelper.getUserId().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Page result = testReportService.page(page, Wrappers.query(testReport)); |
|
|
Page result = testReportService.page(page, Wrappers.query(testReport)); |
|
|
TableDataInfo dataInfo = new TableDataInfo(); |
|
|
TableDataInfo dataInfo = new TableDataInfo(); |
|
|
dataInfo.setTotal(result.getTotal()); |
|
|
dataInfo.setTotal(result.getTotal()); |
|
@ -72,8 +83,8 @@ public class TestReportController { |
|
|
*/ |
|
|
*/ |
|
|
@SneakyThrows |
|
|
@SneakyThrows |
|
|
@Log(title = "测试报告管理", businessType = BusinessType.INSERT) |
|
|
@Log(title = "测试报告管理", businessType = BusinessType.INSERT) |
|
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
|
|
|
public R uploadToolAndTips( @RequestPart("file") MultipartFile file, |
|
|
|
|
|
|
|
|
@PostMapping(value = "/uploadReport", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
|
|
|
public R upload( @RequestPart("file") MultipartFile file, |
|
|
@RequestPart("reportName") String reportName) { |
|
|
@RequestPart("reportName") String reportName) { |
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(reportName)) { |
|
|
if (StrUtil.isEmpty(reportName)) { |
|
@ -88,11 +99,51 @@ public class TestReportController { |
|
|
testReport.setReportPath(toolVo.getOriginalName()); |
|
|
testReport.setReportPath(toolVo.getOriginalName()); |
|
|
testReport.setReportOssId(toolVo.getOssId()); |
|
|
testReport.setReportOssId(toolVo.getOssId()); |
|
|
} |
|
|
} |
|
|
|
|
|
testReport.setUpdateType("报告"); |
|
|
|
|
|
testReportService.save(testReport); |
|
|
|
|
|
return R.ok("操作成功!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 上传测试数据 |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
@Log(title = "测试数据管理", businessType = BusinessType.INSERT) |
|
|
|
|
|
@PostMapping(value = "/uploadTestData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
|
|
|
public R uploadToolAndTips( @RequestPart("file") MultipartFile file, |
|
|
|
|
|
@RequestPart("reportName") String reportName) { |
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(reportName)) { |
|
|
|
|
|
return R.fail("数据名称不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
testReportService.check(reportName); |
|
|
|
|
|
TestReport testReport = new TestReport(); |
|
|
|
|
|
testReport.setReportName(reportName); |
|
|
|
|
|
if(file != null && FileUploadUtils.checkTxtFileValid(file)){ |
|
|
|
|
|
SysOssVo toolVo = iSysOssService.upload(file); |
|
|
|
|
|
testReport.setReportPath(toolVo.getOriginalName()); |
|
|
|
|
|
testReport.setReportOssId(toolVo.getOssId()); |
|
|
|
|
|
} |
|
|
|
|
|
testReport.setUpdateType("测试数据"); |
|
|
testReportService.save(testReport); |
|
|
testReportService.save(testReport); |
|
|
return R.ok("操作成功!"); |
|
|
return R.ok("操作成功!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 下载测试数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param ossId OSS对象ID |
|
|
|
|
|
*/ |
|
|
|
|
|
@SaCheckPermission("system:oss:download") |
|
|
|
|
|
@GetMapping("/downloadTestData/{ossId}") |
|
|
|
|
|
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |
|
|
|
|
|
|
|
|
|
|
|
iSysOssService.downloadWithCreateBy(ossId,LoginHelper.getUserId().toString(),response); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 通过id删除测试报告 |
|
|
* 通过id删除测试报告 |
|
|