From 012d998141bff38f871e635b59ba772558af6bd7 Mon Sep 17 00:00:00 2001 From: songjun Date: Tue, 17 Oct 2023 18:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...TesterTaskInterfaceRelationController.java | 19 +- .../TesterTaskInterfaceRelationOut.java | 208 ++++++++++++++++++ .../task_interface_relation.html | 50 ++--- 3 files changed, 239 insertions(+), 38 deletions(-) create mode 100644 tester/src/main/java/com/ruoyi/tester/domain/TesterTaskInterfaceRelationOut.java diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java index f3b034d..4493dcb 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java @@ -6,9 +6,7 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; -import com.ruoyi.tester.domain.TesterInterface; -import com.ruoyi.tester.domain.TesterLoginConfig; -import com.ruoyi.tester.domain.TesterTask; +import com.ruoyi.tester.domain.*; import com.ruoyi.tester.executor.expression.ExpressionContainer; import com.ruoyi.tester.service.ITesterInterfaceService; import com.ruoyi.tester.service.ITesterLoginConfigService; @@ -26,7 +24,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.tester.domain.TesterTaskInterfaceRelation; import com.ruoyi.tester.service.ITesterTaskInterfaceRelationService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -61,6 +58,10 @@ public class TesterTaskInterfaceRelationController extends BaseController List expDescList = ExpressionContainer.expressionsDescription(); String expDesc = expDescList.stream().collect(Collectors.joining("\r\n")); mmap.put("expDesc", expDesc); + List taskList = taskService.selectTesterTaskList(new TesterTask()); + mmap.put("taskList", taskList); + List interfaceList = interfaceService.selectTesterInterfaceList(new TesterInterface()); + mmap.put("interfaceList", interfaceList); return prefix + "/task_interface_relation"; } @@ -73,9 +74,17 @@ public class TesterTaskInterfaceRelationController extends BaseController @ResponseBody public TableDataInfo list(TesterTaskInterfaceRelation testerTaskInterfaceRelation) { + List taskList = taskService.selectTesterTaskList(new TesterTask()); + Map taskMap = taskList.stream().collect(Collectors.toMap(TesterTask::getTaskId, Function.identity())); + List interfaceList = interfaceService.selectTesterInterfaceList(new TesterInterface()); + Map interfaceMap = interfaceList.stream().collect(Collectors.toMap(TesterInterface::getInterfaceId, Function.identity())); + startPage(); List list = testerTaskInterfaceRelationService.selectTesterTaskInterfaceRelationList(testerTaskInterfaceRelation); - return getDataTable(list); + TableDataInfo dataTable = getDataTable(list); + List ret = dataTable.getRows().stream().map(x -> new TesterTaskInterfaceRelationOut((TesterTaskInterfaceRelation) x, taskMap, interfaceMap)).collect(Collectors.toList()); + dataTable.setRows(ret); + return dataTable; } /** diff --git a/tester/src/main/java/com/ruoyi/tester/domain/TesterTaskInterfaceRelationOut.java b/tester/src/main/java/com/ruoyi/tester/domain/TesterTaskInterfaceRelationOut.java new file mode 100644 index 0000000..ff3f126 --- /dev/null +++ b/tester/src/main/java/com/ruoyi/tester/domain/TesterTaskInterfaceRelationOut.java @@ -0,0 +1,208 @@ +package com.ruoyi.tester.domain; + +import com.ruoyi.common.annotation.Excel; + +import java.util.Map; + +/** + * @author SongJun + * @description TODO: + * @date 2023/10/17 17:39 + */ +public class TesterTaskInterfaceRelationOut { + /** 关系id */ + private Long relationId; + + /** 任务id */ + private Long taskId; + private String taskName; + + /** 接口id */ + private Long interfaceId; + private String interfaceName; + + /** 描述信息 */ + private String description; + + /** 主机 */ + private String host; + + /** 端口 */ + @Excel(name = "端口") + private Integer port; + + /** 依赖关系id(以逗号分隔) */ + private String dependRelationIds; + + /** 依赖参数 */ + private String dependParam; + + /** content_type */ + private String contentType; + + /** query参数 */ + private String queryParam; + + /** body参数 */ + private String bodyParam; + + /** path参数 */ + private String pathParam; + + /** 登录配置id */ + private Long loginConfigId; + + /** 状态(0正常 1停用) */ + private String status; + + public TesterTaskInterfaceRelationOut(TesterTaskInterfaceRelation item, Map taskMap, Map interfaceMap) { + this.relationId = item.getRelationId(); + this.taskId = item.getTaskId(); + if (taskMap.containsKey(taskId)) { + this.taskName = taskMap.get(taskId).getDesc(); + } + this.interfaceId = item.getInterfaceId(); + if (interfaceMap.containsKey(interfaceId)) { + this.interfaceName = interfaceMap.get(interfaceId).getDesc(); + } + this.description = item.getDescription(); + this.host = item.getHost(); + this.port = item.getPort(); + this.dependRelationIds = item.getDependRelationIds(); + this.dependParam = item.getDependParam(); + this.contentType = item.getContentType(); + this.queryParam = item.getQueryParam(); + this.bodyParam = item.getBodyParam(); + this.pathParam = item.getPathParam(); + this.loginConfigId = item.getLoginConfigId(); + this.status = item.getStatus(); + } + + public Long getRelationId() { + return relationId; + } + + public void setRelationId(Long relationId) { + this.relationId = relationId; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public Long getInterfaceId() { + return interfaceId; + } + + public void setInterfaceId(Long interfaceId) { + this.interfaceId = interfaceId; + } + + public String getInterfaceName() { + return interfaceName; + } + + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getDependRelationIds() { + return dependRelationIds; + } + + public void setDependRelationIds(String dependRelationIds) { + this.dependRelationIds = dependRelationIds; + } + + public String getDependParam() { + return dependParam; + } + + public void setDependParam(String dependParam) { + this.dependParam = dependParam; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getQueryParam() { + return queryParam; + } + + public void setQueryParam(String queryParam) { + this.queryParam = queryParam; + } + + public String getBodyParam() { + return bodyParam; + } + + public void setBodyParam(String bodyParam) { + this.bodyParam = bodyParam; + } + + public String getPathParam() { + return pathParam; + } + + public void setPathParam(String pathParam) { + this.pathParam = pathParam; + } + + public Long getLoginConfigId() { + return loginConfigId; + } + + public void setLoginConfigId(Long loginConfigId) { + this.loginConfigId = loginConfigId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/tester/src/main/resources/templates/tester/task_interface_relation/task_interface_relation.html b/tester/src/main/resources/templates/tester/task_interface_relation/task_interface_relation.html index 9d299be..71ac611 100644 --- a/tester/src/main/resources/templates/tester/task_interface_relation/task_interface_relation.html +++ b/tester/src/main/resources/templates/tester/task_interface_relation/task_interface_relation.html @@ -11,12 +11,18 @@
  • - - + +
  • - - + +
  • @@ -89,25 +95,19 @@ visible: true }, { - field: 'taskId', - title: '任务id' + field: 'taskName', + title: '任务', + visible: true }, { - field: 'interfaceId', - title: '接口id' + field: 'interfaceName', + title: '接口', + visible: true }, { field: 'description', title: '描述信息' }, - { - field: 'host', - title: '主机' - }, - { - field: 'port', - title: '端口' - }, { field: 'dependRelationIds', title: '依赖关系id' @@ -116,22 +116,6 @@ field: 'dependParam', title: '依赖参数' }, - { - field: 'queryParam', - title: 'query参数' - }, - { - field: 'bodyParam', - title: 'body参数' - }, - { - field: 'pathParam', - title: 'path参数' - }, - { - field: 'loginConfigId', - title: '登录配置id' - }, { field: 'status', title: '状态', @@ -154,4 +138,4 @@ }); - \ No newline at end of file + -- Gitee