|
@@ -0,0 +1,69 @@
|
|
|
+package com.css.simulation.resource.server.api.controller.job_manage;
|
|
|
+
|
|
|
+import api.common.pojo.common.ResponseBodyVO;
|
|
|
+import api.common.pojo.vo.project.ProjectReportVO;
|
|
|
+import api.common.pojo.vo.project.ProjectResultWithAlgorithmVO;
|
|
|
+import api.common.util.StringUtil;
|
|
|
+import com.css.simulation.resource.server.api.parameter.ProjectParam;
|
|
|
+import com.css.simulation.resource.server.application.job_manage.JobManageApplication;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 供算法平台使用
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/report")
|
|
|
+public class AlgorithmPlatformResultController {
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private JobManageApplication jobManageApplication;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据算法ID获取该算法最新执行的项目的报告
|
|
|
+ * 获取测试报告详情
|
|
|
+ */
|
|
|
+ @RequestMapping("/getSimulationReportById")
|
|
|
+ public ResponseBodyVO<List<ProjectResultWithAlgorithmVO>> getProjectReportByAlgorithmId(@RequestBody ProjectParam projectParam) {
|
|
|
+
|
|
|
+ if (projectParam == null || StringUtil.isEmpty(projectParam.getAlgorithmId())) {
|
|
|
+ return new ResponseBodyVO<>(false, 500, "参数必传!", null);
|
|
|
+ }
|
|
|
+ List<ProjectResultWithAlgorithmVO> result = new ArrayList<>();
|
|
|
+ String algorithmIds = projectParam.getAlgorithmId();
|
|
|
+ String[] algorithmIdArray = algorithmIds.split(",");
|
|
|
+ for (String algorithmId : algorithmIdArray) {
|
|
|
+ result.add(ProjectResultWithAlgorithmVO.builder()
|
|
|
+ .algorithmId(algorithmId)
|
|
|
+ .report(jobManageApplication.getLastProjectReportByAlgorithmId(algorithmId))
|
|
|
+ .videos(jobManageApplication.getLastVideoListByAlgorithmId(algorithmId))
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * (未使用)
|
|
|
+ * 根据算法ID获取该算法最新执行的项目的报告
|
|
|
+ * 获取测试报告详情
|
|
|
+ */
|
|
|
+ @RequestMapping("/getProjectReportByOneAlgorithmId")
|
|
|
+ public ResponseBodyVO<ProjectReportVO> getProjectReportByOneAlgorithmId(@RequestBody ProjectParam projectParam) {
|
|
|
+
|
|
|
+ if (projectParam == null || StringUtil.isEmpty(projectParam.getAlgorithmId())) {
|
|
|
+ return new ResponseBodyVO<>(false, 500, "参数必传!", null);
|
|
|
+ }
|
|
|
+ String algorithmId = projectParam.getAlgorithmId();
|
|
|
+ ProjectReportVO projectReportVO = jobManageApplication.getLastProjectReportByAlgorithmId(algorithmId);
|
|
|
+
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectReportVO);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|