From 5c009d5473581beb112a7edd8f9fe190e803cc13 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 20 Dec 2023 17:55:37 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AEapi?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 1 + .../src/main/java/io/dataease/api/map/GeoApi.java | 7 ++++++- .../src/main/java/io/dataease/api/map/MapApi.java | 6 +++++- .../dataease/api/map/dto/GeometryNodeCreator.java | 8 +++++--- .../java/io/dataease/api/map/vo/AreaNode.java | 9 +++++++++ .../io/dataease/api/system/SysParameterApi.java | 13 +++++++++++++ .../api/system/request/OnlineMapEditor.java | 4 +++- .../io/dataease/api/system/vo/SettingItemVO.java | 10 ++++++---- .../main/java/io/dataease/doc/SwaggerConfig.java | 15 +++++++++++++-- 9 files changed, 61 insertions(+), 12 deletions(-) diff --git a/core/core-backend/src/main/resources/application.yml b/core/core-backend/src/main/resources/application.yml index 75bd7780ec..f838d5d272 100644 --- a/core/core-backend/src/main/resources/application.yml +++ b/core/core-backend/src/main/resources/application.yml @@ -63,3 +63,4 @@ knife4j: enable: true setting: language: zh_cn + enable-swagger-models: false diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/map/GeoApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/map/GeoApi.java index 23a391bf0b..3a1549bca0 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/map/GeoApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/map/GeoApi.java @@ -1,18 +1,23 @@ package io.dataease.api.map; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.api.map.dto.GeometryNodeCreator; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -@Tag(name = "地理信息") +@Tag(name = "系统设置:地理信息") +@ApiSupport(order = 798) public interface GeoApi { + @Operation(summary = "保存地理信息") @PostMapping(value = "/save", consumes = {"multipart/form-data"}) void saveMapGeo(@RequestPart("request") GeometryNodeCreator request, @RequestPart(value = "file") MultipartFile file); + @Operation(summary = "删除地理信息") @PostMapping("/delete/{id}") void deleteGeo(@PathVariable("id") String id); } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/map/MapApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/map/MapApi.java index 604f85a127..97eed6e0cc 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/map/MapApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/map/MapApi.java @@ -1,17 +1,21 @@ package io.dataease.api.map; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.api.map.vo.AreaNode; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.GetMapping; import java.util.List; -@Tag(name = "地图") +@Tag(name = "系统设置:地图区域") +@ApiSupport(order = 797) public interface MapApi { /** * 获取世界树 * @return */ + @Operation(summary = "查询区域树") @GetMapping("/worldTree") AreaNode getWorldTree(); } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/map/dto/GeometryNodeCreator.java b/sdk/api/api-base/src/main/java/io/dataease/api/map/dto/GeometryNodeCreator.java index 945e65a588..b0db945d53 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/map/dto/GeometryNodeCreator.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/map/dto/GeometryNodeCreator.java @@ -1,15 +1,17 @@ package io.dataease.api.map.dto; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; +@Schema(description = "地理信息构造器") @Data public class GeometryNodeCreator implements Serializable { - + @Schema(description = "区域代码") private String code; - + @Schema(description = "区域名称") private String name; - + @Schema(description = "上级区域代码") private String pid; } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/map/vo/AreaNode.java b/sdk/api/api-base/src/main/java/io/dataease/api/map/vo/AreaNode.java index 2750b7e2da..2bf35aeee9 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/map/vo/AreaNode.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/map/vo/AreaNode.java @@ -1,6 +1,7 @@ package io.dataease.api.map.vo; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Data; @@ -8,23 +9,31 @@ import java.io.Serial; import java.io.Serializable; import java.util.List; +@Schema(description = "区域节点") @Data @Builder @JsonInclude(JsonInclude.Include.NON_NULL) public class AreaNode implements Serializable { @Serial private static final long serialVersionUID = -2285934203102231711L; + @Schema(description = "ID") private String id; + @Schema(description = "级别") private String level; + @Schema(description = "名称") private String name; + @Schema(description = "上级ID") private String pid; + @Schema(description = "是否自定义节点") private boolean custom = false; /** * 国家代码 */ + @Schema(description = "国家代码") private String country; /** * 下属区域 */ + @Schema(description = "子集") private List children; } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java index a2234315f5..4691253cea 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java @@ -1,7 +1,12 @@ package io.dataease.api.system; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.api.system.request.OnlineMapEditor; import io.dataease.api.system.vo.SettingItemVO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -9,20 +14,28 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +@Tag(name = "系统设置:系统参数") +@ApiSupport(order = 799) public interface SysParameterApi { + @Operation(summary = "查询单个配置值") + @Parameter(name = "key", description = "配置key", required = true, in = ParameterIn.PATH) @GetMapping("/singleVal/{key}") String singleVal(@PathVariable("key") String key); + @Operation(summary = "保存在线地图") @PostMapping("/saveOnlineMap") void saveOnlineMap(@RequestBody OnlineMapEditor editor); + @Operation(summary = "查询在线地图") @GetMapping("/queryOnlineMap") String queryOnlineMap(); + @Operation(summary = "查询基础设置(非xpack)") @GetMapping("basic/query") List queryBasicSetting(); + @Operation(summary = "保存基础设置(非xpack)") @PostMapping("/basic/save") void saveBasicSetting(@RequestBody List settingItemVOS); diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/system/request/OnlineMapEditor.java b/sdk/api/api-base/src/main/java/io/dataease/api/system/request/OnlineMapEditor.java index 133a662811..27b5adf0c2 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/system/request/OnlineMapEditor.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/system/request/OnlineMapEditor.java @@ -1,11 +1,13 @@ package io.dataease.api.system.request; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; +@Schema(description = "在线地图构造器") @Data public class OnlineMapEditor implements Serializable { - + @Schema(description = "在线地图key", requiredMode = Schema.RequiredMode.REQUIRED) private String key; } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/system/vo/SettingItemVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/system/vo/SettingItemVO.java index c004582577..c907001ce1 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/system/vo/SettingItemVO.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/system/vo/SettingItemVO.java @@ -1,19 +1,21 @@ package io.dataease.api.system.vo; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +@Schema(description = "基础设置参数项") @Data @NoArgsConstructor public class SettingItemVO implements Serializable { - + @Schema(description = "键", requiredMode = Schema.RequiredMode.REQUIRED) private String pkey; - + @Schema(description = "值", requiredMode = Schema.RequiredMode.REQUIRED) private String pval; - + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED) private String type; - + @Schema(description = "顺序", requiredMode = Schema.RequiredMode.REQUIRED) private Integer sort; } diff --git a/sdk/common/src/main/java/io/dataease/doc/SwaggerConfig.java b/sdk/common/src/main/java/io/dataease/doc/SwaggerConfig.java index d2fe097143..52e38fbeee 100644 --- a/sdk/common/src/main/java/io/dataease/doc/SwaggerConfig.java +++ b/sdk/common/src/main/java/io/dataease/doc/SwaggerConfig.java @@ -69,15 +69,26 @@ public class SwaggerConfig { return GroupedOpenApi.builder().group("4-datasource").displayName("数据源管理").packagesToScan("io.dataease.datasource").build(); } + @Bean + public GroupedOpenApi basicSettingApi() { + String[] packageArray = { + "io.dataease.system", + "io.dataease.map", + }; + return GroupedOpenApi.builder().group("5-xpackpermission").displayName("系统设置").packagesToScan(packageArray).build(); + } + @Bean public GroupedOpenApi baseXpackApi() { - return GroupedOpenApi.builder().group("5-xpackbase").displayName("基础xpack").packagesToScan("io.dataease.xpack.base").build(); + return GroupedOpenApi.builder().group("6-xpackbase").displayName("基础xpack").packagesToScan("io.dataease.xpack.base").build(); } @Bean public GroupedOpenApi systemApi() { - return GroupedOpenApi.builder().group("6-xpackpermission").displayName("权限相关xpack").packagesToScan("io.dataease.xpack.permissions").build(); + return GroupedOpenApi.builder().group("7-xpackpermission").displayName("权限相关xpack").packagesToScan("io.dataease.xpack.permissions").build(); } + + }