From 6808984da6e77557299910a9e24b761c92363bdc Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 7 Feb 2023 11:29:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):?= =?UTF-8?q?=20=E5=8E=BB=E6=8E=89=E5=BC=95=E7=94=A8=E9=87=8D=E5=90=8D?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/service/PluginService.java | 7 ++++--- .../src/main/java/io/metersphere/dto/PluginConfigDTO.java | 2 +- .../metersphere/dto/{PluginDTO.java => PluginInfoDTO.java} | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) rename framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/{PluginDTO.java => PluginInfoDTO.java} (74%) diff --git a/api-test/backend/src/main/java/io/metersphere/service/PluginService.java b/api-test/backend/src/main/java/io/metersphere/service/PluginService.java index 3ba1952b09..3964c7036b 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/PluginService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/PluginService.java @@ -13,6 +13,7 @@ import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.LogUtil; import io.metersphere.dto.PluginConfigDTO; +import io.metersphere.dto.PluginInfoDTO; import io.metersphere.metadata.service.FileManagerService; import io.metersphere.metadata.vo.FileRequest; import jakarta.annotation.Resource; @@ -189,12 +190,12 @@ public class PluginService { public PluginConfigDTO getPluginConfig() { PluginConfigDTO pluginConfigDTO = new PluginConfigDTO(); List plugins = this.list(); - if (org.apache.commons.collections.CollectionUtils.isNotEmpty(plugins)) { + if (CollectionUtils.isNotEmpty(plugins)) { plugins = plugins.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Plugin::getPluginId))), ArrayList::new)); - List plugin = plugins.stream().map( + List plugin = plugins.stream().map( item -> { - io.metersphere.dto.PluginDTO pluginDTO = new io.metersphere.dto.PluginDTO(); + PluginInfoDTO pluginDTO = new PluginInfoDTO(); pluginDTO.setPluginId(item.getPluginId()); pluginDTO.setSourcePath(item.getSourcePath()); return pluginDTO; diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginConfigDTO.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginConfigDTO.java index 60055d874b..f7122c0c51 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginConfigDTO.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginConfigDTO.java @@ -8,6 +8,6 @@ import java.util.Map; @Data public class PluginConfigDTO { - private List pluginDTOS; + private List pluginDTOS; private Map config; } diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginDTO.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginInfoDTO.java similarity index 74% rename from framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginDTO.java rename to framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginInfoDTO.java index 3aab3f3215..9d20f4fab8 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginDTO.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/PluginInfoDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.io.Serializable; @Data -public class PluginDTO implements Serializable { +public class PluginInfoDTO implements Serializable { private String pluginId;