123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- package com.yihu.wlyy.config;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.web.context.request.async.DeferredResult;
- import springfox.documentation.builders.PathSelectors;
- import springfox.documentation.service.ApiInfo;
- import springfox.documentation.spi.DocumentationType;
- import springfox.documentation.spring.web.plugins.Docket;
- import springfox.documentation.swagger2.annotations.EnableSwagger2;
- import static com.google.common.base.Predicates.or;
- import static springfox.documentation.builders.PathSelectors.regex;
- @EnableSwagger2
- @Configuration
- public class SwaggerConfig {
- private static final String PUBLIC_API = "Default";
- private static final String Doctor_API = "doctor";
- private static final String Patient_API = "patient";
- private static final String Other_API = "other";
- @Bean
- public Docket publicAPI() {
- return new Docket(DocumentationType.SWAGGER_2)
- .groupName(Doctor_API)
- .genericModelSubstitutes(DeferredResult.class)
- .useDefaultResponseMessages(false)
- .forCodeGeneration(true)
- .pathMapping("/")
- .select()
- .paths(PathSelectors.regex("/doctor/.*"))
- .build()
- .apiInfo(publicApiInfo());
- }
- private ApiInfo publicApiInfo() {
- ApiInfo apiInfo = new ApiInfo("三师平台API",
- "向PC端,微信、App等应用提供功能与数据接口。",
- "1.0",
- "No terms of service",
- "admin@jkzl.com",
- "The Apache License, Version 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0.html"
- );
- return apiInfo;
- }
- @Bean
- public Docket patientAPI() {
- return new Docket(DocumentationType.SWAGGER_2)
- .groupName(Patient_API)
- .genericModelSubstitutes(DeferredResult.class)
- .useDefaultResponseMessages(false)
- .forCodeGeneration(true)
- .pathMapping("/")
- .select()
- .paths(PathSelectors.regex("/patient/.*"))
- .build()
- .apiInfo(patientApiInfo());
- }
- private ApiInfo patientApiInfo() {
- ApiInfo apiInfo = new ApiInfo("三师平台API",
- "向PC端,微信、App等应用提供功能与数据接口。",
- "1.0",
- "No terms of service",
- "admin@jkzl.com",
- "The Apache License, Version 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0.html"
- );
- return apiInfo;
- }
- @Bean
- public Docket otherAPI() {
- return new Docket(DocumentationType.SWAGGER_2)
- .groupName(Other_API)
- .genericModelSubstitutes(DeferredResult.class)
- .useDefaultResponseMessages(false)
- .forCodeGeneration(true)
- .pathMapping("/")
- .select()
- .paths(or(
- regex("/third/.*"),
- regex("/statistics/.*"),
- regex("/statistics/province/.*"),
- regex("/job/.*"),
- regex("/family_contract/.*"),
- regex("/hosptail/.*"),
- regex("/manage_util/.*"),
- regex("/common/.*"),
- regex("/hospitals/.*"),
- regex("/upload/.*"),
- regex("/weixin/.*"),
- regex("/wx/.*"),
- regex("/area/.*"),
- regex("/login/.*"),
- regex("/qrcode/.*"),
- regex("/onepay/.*"),
- regex("/wlyy_service/.*"),
- regex("/express/.*")
- ))
- .build()
- .apiInfo(otherApiInfo());
- }
- private ApiInfo otherApiInfo() {
- ApiInfo apiInfo = new ApiInfo("三师平台API",
- "向PC端,微信、App等应用提供功能与数据接口。",
- "1.0",
- "No terms of service",
- "admin@jkzl.com",
- "The Apache License, Version 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0.html"
- );
- return apiInfo;
- }
- }
|