查询日志接口修改,通过本地测试

This commit is contained in:
西大锐 2024-01-24 11:36:15 +08:00
parent cf7b66d3d8
commit 9a6f355c02
3 changed files with 17 additions and 9 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* (ExperimentIns)表控制层
@ -114,13 +115,14 @@ public class ExperimentInsController {
/**
* 查询实验实例日志
*
* @param id 主键
* @param req Map类型的请求头
* @return 运行日志
*/
@GetMapping(("/log/{id}"))
public AjaxResult showExperimentInsLog(@PathVariable("id") Integer id){
return AjaxResult.success(this.experimentInsService.showExperimentInsLog(id));
@GetMapping(("/log/"))
@ApiOperation("查询实例日志")
public AjaxResult showExperimentInsLog(@RequestBody Map<String,Object> req){
return AjaxResult.success(this.experimentInsService.showExperimentInsLog(req));
}

View File

@ -5,6 +5,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
import java.util.Map;
/**
* (ExperimentIns)表服务接口
@ -82,6 +83,6 @@ public interface ExperimentInsService {
* @param id 主键
* @return 运行日志
*/
String showExperimentInsLog(Integer id);
String showExperimentInsLog(Map<String, Object> req);
}

View File

@ -348,11 +348,15 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
/**
* 查询实验实例日志
*
* @param id 主键
* @param map Map格式的请求数据
* @return 运行日志
*/
@Override
public String showExperimentInsLog(Integer id) {
public String showExperimentInsLog(Map<String, Object> map) {
//先从map中取出数据
Integer id = (Integer) map.get("id");
String componentId = (String) map.get("component_id");
//先查出实验记录
ExperimentIns experimentIns = this.experimentInsDao.queryById(id);
if (experimentIns == null) {
@ -366,9 +370,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
Map<String,Object> requestData = new HashMap<>();
requestData.put("namespace", namespace);
requestData.put("name", name);
//先写死这两个数据项
requestData.put("workflow-type","workflows");
requestData.put("artifact-name","workflows");
requestData.put("workflow-type","workflows");
requestData.put("artifact-name","main-logs");
requestData.put("component-id",componentId);
// 创建发送数据map将请求数据作为"data"键的值
Map<String,Object> res = new HashMap<>();
res.put("data", requestData);