diff --git a/pom.xml b/pom.xml index a1ac15a2..49fa3b31 100644 --- a/pom.xml +++ b/pom.xml @@ -253,6 +253,9 @@ org.apache.maven.plugins maven-surefire-plugin + + true + diff --git a/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java b/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java index 47d29a91..d62ee1ea 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.conf; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; @@ -13,49 +14,70 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration public class Swagger3Config { + @Value("${swagger-ui.enabled}") + private boolean enable; + @Bean public Docket createRestApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("全部") + .groupName("1. 全部") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } @Bean public Docket createRestGBApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("国标") + .groupName("2. 国标28181") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.gb28181")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } + + @Bean + public Docket createRestONVIFApi() { + return new Docket(DocumentationType.OAS_30) + .apiInfo(apiInfo()) + .groupName("3. ONVIF") + .select() + .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.onvif")) + .paths(PathSelectors.any()) + .build() + .pathMapping("/") + .enable(enable); + } + @Bean public Docket createRestStreamProxyApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("拉流转发") + .groupName("4. 拉流转发") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.streamProxy")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } @Bean public Docket createRestStreamPushApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("推流管理") + .groupName("5. 推流管理") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.streamPush")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } @@ -63,23 +85,25 @@ public class Swagger3Config { public Docket createServerApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("服务管理") + .groupName("6. 服务管理") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.server")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } @Bean public Docket createUserApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) - .groupName("用户管理") + .groupName("7. 用户管理") .select() .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.user")) .paths(PathSelectors.any()) .build() - .pathMapping("/"); + .pathMapping("/") + .enable(enable); } private ApiInfo apiInfo() { diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index c4bd7ca2..fdd81b16 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -152,7 +152,5 @@ user-settings: record-push-live: true # 在线文档: swagger-ui(生产环境建议关闭) -springfox: - documentation: - swagger-ui: - enabled: true \ No newline at end of file +swagger-ui: + enabled: true \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index dd2e0f76..f0cb8f80 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -84,7 +84,5 @@ user-settings: record-push-live: true # 在线文档: swagger-ui(生产环境建议关闭) -springfox: - documentation: - swagger-ui: - enabled: true \ No newline at end of file +swagger-ui: + enabled: true \ No newline at end of file