| @@ -1,53 +1,53 @@ | |||
| package com.iformall.config; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.stereotype.Component; | |||
| import springfox.documentation.swagger.web.SwaggerResource; | |||
| import springfox.documentation.swagger.web.SwaggerResourcesProvider; | |||
| import java.util.ArrayList; | |||
| import java.util.HashSet; | |||
| import java.util.List; | |||
| import java.util.Set; | |||
| @Component | |||
| public class ParkingSwaggerResourcesProvider implements SwaggerResourcesProvider { | |||
| /** | |||
| * swagger2 的特定资源地址 | |||
| */ | |||
| private static final String SWAGGER2URL = "/v2/api-docs"; | |||
| /** | |||
| * 本应用名称,下文需要将自己排除掉 | |||
| */ | |||
| @Value("${spring.application.name}") | |||
| private String curApplicationName; | |||
| @Autowired | |||
| private SwaggerProperties swaggerProperties; | |||
| @Override | |||
| public List<SwaggerResource> get() { | |||
| List<SwaggerResource> resources = new ArrayList<>(); | |||
| List<String> routeHosts = new ArrayList<>(); | |||
| Set<String> allUrls = new HashSet<>(); | |||
| routeHosts.forEach(instance -> { | |||
| // /serviceId/v2/api-info,当网关调用这个接口时,会自动寻找对应的服务实例 | |||
| String url = "/" + instance + SWAGGER2URL; | |||
| if (!allUrls.contains(url)) { | |||
| allUrls.add(url); | |||
| SwaggerResource swaggerResource = new SwaggerResource(); | |||
| swaggerResource.setUrl(url); | |||
| //swaggerResource.setLocation(url);location 已过期,直接采用 url 代替 | |||
| swaggerResource.setName(instance); | |||
| resources.add(swaggerResource); | |||
| } | |||
| }); | |||
| return resources; | |||
| } | |||
| } | |||
| //package com.iformall.config; | |||
| // | |||
| //import org.springframework.beans.factory.annotation.Autowired; | |||
| //import org.springframework.beans.factory.annotation.Value; | |||
| //import org.springframework.stereotype.Component; | |||
| //import springfox.documentation.swagger.web.SwaggerResource; | |||
| //import springfox.documentation.swagger.web.SwaggerResourcesProvider; | |||
| // | |||
| //import java.util.ArrayList; | |||
| //import java.util.HashSet; | |||
| //import java.util.List; | |||
| //import java.util.Set; | |||
| // | |||
| //@Component | |||
| //public class ParkingSwaggerResourcesProvider implements SwaggerResourcesProvider { | |||
| // | |||
| // /** | |||
| // * swagger2 的特定资源地址 | |||
| // */ | |||
| // private static final String SWAGGER2URL = "/v2/api-docs"; | |||
| // | |||
| // | |||
| // /** | |||
| // * 本应用名称,下文需要将自己排除掉 | |||
| // */ | |||
| // @Value("${spring.application.name}") | |||
| // private String curApplicationName; | |||
| // | |||
| // @Autowired | |||
| // private SwaggerProperties swaggerProperties; | |||
| // | |||
| // @Override | |||
| // public List<SwaggerResource> get() { | |||
| // List<SwaggerResource> resources = new ArrayList<>(); | |||
| // List<String> routeHosts = new ArrayList<>(); | |||
| // | |||
| // Set<String> allUrls = new HashSet<>(); | |||
| // routeHosts.forEach(instance -> { | |||
| // // /serviceId/v2/api-info,当网关调用这个接口时,会自动寻找对应的服务实例 | |||
| // String url = "/" + instance + SWAGGER2URL; | |||
| // if (!allUrls.contains(url)) { | |||
| // allUrls.add(url); | |||
| // SwaggerResource swaggerResource = new SwaggerResource(); | |||
| // swaggerResource.setUrl(url); | |||
| // //swaggerResource.setLocation(url);location 已过期,直接采用 url 代替 | |||
| // swaggerResource.setName(instance); | |||
| // resources.add(swaggerResource); | |||
| // } | |||
| // }); | |||
| // return resources; | |||
| // } | |||
| // | |||
| //} | |||
| @@ -79,7 +79,7 @@ public class SwaggerConfiguration { | |||
| swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path))); | |||
| return new Docket(DocumentationType.SWAGGER_2) | |||
| .host(swaggerProperties.getHost() + "/B") | |||
| .host(swaggerProperties.getHost()) | |||
| .apiInfo(apiInfo(swaggerProperties)).select() | |||
| .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage())) | |||
| .apis(input -> { | |||
| @@ -92,8 +92,9 @@ public class SwaggerConfiguration { | |||
| Predicates.or(basePath) | |||
| ) | |||
| ) | |||
| .build().groupName("a") | |||
| .pathMapping("/B"); | |||
| .build(); | |||
| // .groupName("a") | |||
| // .pathMapping("/B"); | |||
| } | |||
| private ApiInfo apiInfo(SwaggerProperties swaggerProperties) { | |||
| @@ -1,7 +1,9 @@ | |||
| package com.iformall.controller.datatower; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.service.CockpitScreenService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -14,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| @Api(description = "驾驶舱大屏") | |||
| @Api(tags = "驾驶舱大屏") | |||
| @RestController | |||
| @RequestMapping("cockpitscreen") | |||
| public class CockpitScreenController extends BaseController { | |||
| @@ -22,6 +24,7 @@ public class CockpitScreenController extends BaseController { | |||
| @Autowired | |||
| private CockpitScreenService cockpitScreenService; | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @TenantIgnore | |||
| @ApiOperation("驾驶舱大屏-统计会员性别") | |||
| @GetMapping("/countUserGender") | |||
| @@ -29,6 +32,7 @@ public class CockpitScreenController extends BaseController { | |||
| return new ResultData(cockpitScreenService.countUserGender(getTenantInfo())); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @TenantIgnore | |||
| @ApiOperation("驾驶舱大屏-统计商铺") | |||
| @GetMapping("/countShop") | |||
| @@ -36,6 +40,7 @@ public class CockpitScreenController extends BaseController { | |||
| return new ResultData(cockpitScreenService.countShop(getTenantInfo())); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @TenantIgnore | |||
| @ApiOperation("驾驶舱大屏-统计会员") | |||
| @GetMapping("/countUser") | |||
| @@ -43,6 +48,7 @@ public class CockpitScreenController extends BaseController { | |||
| return new ResultData(cockpitScreenService.countUser(getTenantInfo(), years)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @TenantIgnore | |||
| @ApiOperation("驾驶舱大屏-统计触达用户") | |||
| @GetMapping("/countReachUser") | |||
| @@ -94,7 +94,6 @@ public class HomeController extends BaseController { | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("验证码") | |||
| @GetMapping("/captcha.jpg") | |||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | |||
| @@ -28,7 +28,6 @@ public class BankController extends BaseController{ | |||
| @Autowired | |||
| private WxBankUtilService wxBankUtilService; | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("根据对私银行卡号获取开户银行") | |||
| @GetMapping("/searchBanks") | |||
| public ResultData searchBanks(String accountNumber) { | |||