refactor(系统设置): 系统设置插件管理接口参数调整
--task=1012390 --user=陈建星 系统设置-系统-插件管理-后台 https://www.tapd.cn/55049933/s/1393426
This commit is contained in:
parent
08edab0974
commit
c63155faaa
|
@ -7,7 +7,6 @@ import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.SessionUtils;
|
import io.metersphere.sdk.util.SessionUtils;
|
||||||
import io.metersphere.system.domain.Plugin;
|
import io.metersphere.system.domain.Plugin;
|
||||||
import io.metersphere.system.dto.PluginDTO;
|
import io.metersphere.system.dto.PluginDTO;
|
||||||
import io.metersphere.system.dto.PluginListDTO;
|
|
||||||
import io.metersphere.system.request.PluginUpdateRequest;
|
import io.metersphere.system.request.PluginUpdateRequest;
|
||||||
import io.metersphere.system.service.PluginService;
|
import io.metersphere.system.service.PluginService;
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
|
@ -37,7 +36,7 @@ public class PluginController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取插件列表")
|
@Operation(summary = "获取插件列表")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_READ)
|
@RequiresPermissions(PermissionConstants.SYSTEM_PLUGIN_READ)
|
||||||
public List<PluginListDTO> list() {
|
public List<PluginDTO> list() {
|
||||||
return pluginService.list();
|
return pluginService.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,15 @@ import java.util.List;
|
||||||
public class PluginDTO extends Plugin implements Serializable {
|
public class PluginDTO extends Plugin implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(title = "插件前端表单配置项列表")
|
||||||
|
private List<PluginDTO.PluginForm> pluginForms;
|
||||||
|
|
||||||
@Schema(title = "关联的组织列表")
|
@Schema(title = "关联的组织列表")
|
||||||
private List<OrganizationOptionDTO> organizations;
|
private List<OrganizationOptionDTO> organizations;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
class PluginForm {
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
package io.metersphere.system.dto;
|
|
||||||
|
|
||||||
import io.metersphere.system.domain.Plugin;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class PluginListDTO extends Plugin implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(title = "插件前端表单配置项列表")
|
|
||||||
private List<PluginForm> pluginForms;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
class PluginForm {
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package io.metersphere.system.dto.request;
|
|
||||||
|
|
||||||
import io.metersphere.sdk.dto.BasePageRequest;
|
|
||||||
import io.metersphere.validation.groups.Created;
|
|
||||||
import io.metersphere.validation.groups.Updated;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
@Data
|
|
||||||
public class PluginQueryRequest extends BasePageRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.id.not_blank}", groups = {Updated.class})
|
|
||||||
@Size(min = 1, max = 50, message = "{plugin.id.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Schema(title = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.name.not_blank}", groups = {Created.class})
|
|
||||||
@Size(min = 1, max = 255, message = "{plugin.name.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(title = "插件ID(名称加版本号)", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.plugin_id.not_blank}", groups = {Created.class})
|
|
||||||
@Size(min = 1, max = 300, message = "{plugin.plugin_id.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
private String pluginId;
|
|
||||||
|
|
||||||
@Schema(title = "文件名", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.file_name.not_blank}", groups = {Created.class})
|
|
||||||
@Size(min = 1, max = 300, message = "{plugin.file_name.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
@Schema(title = "是否是全局插件")
|
|
||||||
private Boolean global;
|
|
||||||
|
|
||||||
@Schema(title = "是否是企业版插件")
|
|
||||||
private Boolean xpack;
|
|
||||||
|
|
||||||
@Schema(title = "插件描述")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Schema(title = "插件使用场景PAI/PLATFORM", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.scenario.not_blank}", groups = {Created.class})
|
|
||||||
@Size(min = 1, max = 50, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
private String scenario;
|
|
||||||
}
|
|
|
@ -1,7 +1,5 @@
|
||||||
package io.metersphere.system.request;
|
package io.metersphere.system.request;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.PluginScenarioType;
|
|
||||||
import io.metersphere.sdk.valid.EnumValue;
|
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
import io.metersphere.validation.groups.Updated;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -33,12 +31,6 @@ public class PluginUpdateRequest {
|
||||||
@Size(min = 1, max = 500, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 500, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(title = "插件使用场景PAI/PLATFORM", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{plugin.scenario.not_blank}", groups = {Created.class})
|
|
||||||
@Size(min = 1, max = 50, message = "{plugin.scenario.length_range}", groups = {Created.class, Updated.class})
|
|
||||||
@EnumValue(enumClass = PluginScenarioType.class, groups = {Created.class, Updated.class})
|
|
||||||
private String scenario;
|
|
||||||
|
|
||||||
@Schema(hidden = true)
|
@Schema(hidden = true)
|
||||||
private String createUser;
|
private String createUser;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package io.metersphere.system.service;
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.PluginScenarioType;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.system.domain.Plugin;
|
import io.metersphere.system.domain.Plugin;
|
||||||
import io.metersphere.system.domain.PluginFrontScript;
|
import io.metersphere.system.domain.PluginFrontScript;
|
||||||
import io.metersphere.system.dto.PluginDTO;
|
import io.metersphere.system.dto.PluginDTO;
|
||||||
import io.metersphere.system.dto.PluginListDTO;
|
|
||||||
import io.metersphere.system.mapper.PluginFrontScriptMapper;
|
import io.metersphere.system.mapper.PluginFrontScriptMapper;
|
||||||
import io.metersphere.system.mapper.PluginMapper;
|
import io.metersphere.system.mapper.PluginMapper;
|
||||||
import io.metersphere.system.request.PluginUpdateRequest;
|
import io.metersphere.system.request.PluginUpdateRequest;
|
||||||
|
@ -31,7 +31,7 @@ public class PluginService {
|
||||||
@Resource
|
@Resource
|
||||||
private PluginFrontScriptMapper pluginFrontScriptMapper;
|
private PluginFrontScriptMapper pluginFrontScriptMapper;
|
||||||
|
|
||||||
public List<PluginListDTO> list() {
|
public List<PluginDTO> list() {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public class PluginService {
|
||||||
plugin.setCreateTime(System.currentTimeMillis());
|
plugin.setCreateTime(System.currentTimeMillis());
|
||||||
plugin.setUpdateTime(System.currentTimeMillis());
|
plugin.setUpdateTime(System.currentTimeMillis());
|
||||||
plugin.setXpack(false);
|
plugin.setXpack(false);
|
||||||
|
plugin.setScenario(PluginScenarioType.PAI.name());
|
||||||
pluginMapper.insert(plugin);
|
pluginMapper.insert(plugin);
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package io.metersphere.system.controller;
|
||||||
|
|
||||||
import base.BaseTest;
|
import base.BaseTest;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.sdk.constants.PluginScenarioType;
|
|
||||||
import io.metersphere.system.domain.Plugin;
|
import io.metersphere.system.domain.Plugin;
|
||||||
import io.metersphere.system.mapper.PluginMapper;
|
import io.metersphere.system.mapper.PluginMapper;
|
||||||
import io.metersphere.system.request.PluginUpdateRequest;
|
import io.metersphere.system.request.PluginUpdateRequest;
|
||||||
|
@ -54,7 +53,6 @@ public class PluginControllerTests extends BaseTest {
|
||||||
PluginUpdateRequest request = new PluginUpdateRequest();
|
PluginUpdateRequest request = new PluginUpdateRequest();
|
||||||
request.setName("test");
|
request.setName("test");
|
||||||
request.setDescription("test desc");
|
request.setDescription("test desc");
|
||||||
request.setScenario(PluginScenarioType.PAI.name());
|
|
||||||
MultiValueMap<String, Object> multiValueMap = getDefaultMultiPartParam(request,
|
MultiValueMap<String, Object> multiValueMap = getDefaultMultiPartParam(request,
|
||||||
new File("src/test/resources/application.properties"));
|
new File("src/test/resources/application.properties"));
|
||||||
MvcResult mvcResult = this.requestMultipartWithOkAndReturn(DEFAULT_ADD, multiValueMap);
|
MvcResult mvcResult = this.requestMultipartWithOkAndReturn(DEFAULT_ADD, multiValueMap);
|
||||||
|
|
Loading…
Reference in New Issue