refactor(接口定义): 去掉引用重名实体类

This commit is contained in:
wxg0103 2023-02-07 11:29:36 +08:00 committed by wxg0103
parent c706b762d7
commit 6808984da6
3 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.PluginConfigDTO; import io.metersphere.dto.PluginConfigDTO;
import io.metersphere.dto.PluginInfoDTO;
import io.metersphere.metadata.service.FileManagerService; import io.metersphere.metadata.service.FileManagerService;
import io.metersphere.metadata.vo.FileRequest; import io.metersphere.metadata.vo.FileRequest;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -189,12 +190,12 @@ public class PluginService {
public PluginConfigDTO getPluginConfig() { public PluginConfigDTO getPluginConfig() {
PluginConfigDTO pluginConfigDTO = new PluginConfigDTO(); PluginConfigDTO pluginConfigDTO = new PluginConfigDTO();
List<Plugin> plugins = this.list(); List<Plugin> plugins = this.list();
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(plugins)) { if (CollectionUtils.isNotEmpty(plugins)) {
plugins = plugins.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> plugins = plugins.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(Plugin::getPluginId))), ArrayList::new)); new TreeSet<>(Comparator.comparing(Plugin::getPluginId))), ArrayList::new));
List<io.metersphere.dto.PluginDTO> plugin = plugins.stream().map( List<PluginInfoDTO> plugin = plugins.stream().map(
item -> { item -> {
io.metersphere.dto.PluginDTO pluginDTO = new io.metersphere.dto.PluginDTO(); PluginInfoDTO pluginDTO = new PluginInfoDTO();
pluginDTO.setPluginId(item.getPluginId()); pluginDTO.setPluginId(item.getPluginId());
pluginDTO.setSourcePath(item.getSourcePath()); pluginDTO.setSourcePath(item.getSourcePath());
return pluginDTO; return pluginDTO;

View File

@ -8,6 +8,6 @@ import java.util.Map;
@Data @Data
public class PluginConfigDTO { public class PluginConfigDTO {
private List<PluginDTO> pluginDTOS; private List<PluginInfoDTO> pluginDTOS;
private Map<String, Object> config; private Map<String, Object> config;
} }

View File

@ -5,7 +5,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@Data @Data
public class PluginDTO implements Serializable { public class PluginInfoDTO implements Serializable {
private String pluginId; private String pluginId;