提交 a9dfb9db authored 作者: Matrix's avatar Matrix

[架构升级]

1. swagger2版本升至 3.0.0(本想引入OPEN API 3标准) 2. spring boot 版本升至 2.2.7 RELEASE 3. 引入knife4j swagger 增加UI页面
上级 75285542
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
......@@ -16,7 +16,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<properties>
<swagger.version>2.9.0</swagger.version>
<swagger.version>3.0.0</swagger.version>
</properties>
<dependencies>
......@@ -27,27 +27,17 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.github.caspar-chen</groupId>
<artifactId>swagger-ui-layer</artifactId>
<version>0.0.4</version>
<version>1.1.3</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
</dependency>
......@@ -79,13 +69,15 @@
<version>4.1.14</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.alibaba</groupId>-->
<!--<artifactId>fastjson</artifactId>-->
<!--<version>1.2.46</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
</project>
</project>
\ No newline at end of file
......@@ -29,7 +29,7 @@ public class Swagger2Config {
return new Docket(DocumentationType.SWAGGER_2)
.produces(Sets.newHashSet("application/json"))
.consumes(Sets.newHashSet("application/json"))
.protocols(Sets.newHashSet("https","http"))
.protocols(Sets.newHashSet("https", "http"))
.apiInfo(apiInfo())
.forCodeGeneration(true)
.useDefaultResponseMessages(true)
......@@ -46,15 +46,14 @@ public class Swagger2Config {
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
// 文档标题
.title("文件传输系统接口文档")
// 文档描述
.description("文件传输系统的接口文档与测试页面")
.termsOfServiceUrl("git地址待更新")
.version("v1")
.contact(new Contact("efs", "git", "ty@example.com"))
.title("装备管理系统接口文档")
.description("装备管理系统接口文档与测试页面")
.termsOfServiceUrl("http://121.36.222.103:8087/")
.version("v1.0")
.contact(new Contact("ty", "example", "example@gmail.com"))
.build();
}
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(Collections.singletonList(new SecurityReference("spring_oauth", scopes())))
......@@ -71,6 +70,7 @@ public class Swagger2Config {
.scopes(Arrays.asList(scopes()))
.build();
}
private AuthorizationScope[] scopes() {
return new AuthorizationScope[]{
new AuthorizationScope("all", "All scope is trusted!")
......
......@@ -57,9 +57,9 @@ import static java.util.stream.Collectors.*;
@RestController
@RequestMapping(value = "/check/confirm")
@AutoDocument
@Api(tags = "核查模块", description = "核查模块")
@Transactional
@Slf4j
@Api(tags = "核查模块", description = "核查模块", position = 1)
public class DeviceCheckController {
@Autowired
......@@ -682,3 +682,7 @@ public class DeviceCheckController {
return originalNode + fatherId + ".";
}
}
......@@ -40,7 +40,7 @@ import static com.tykj.dev.misc.utils.TimestampUtil.localDateToDate;
@AutoDocument
@RestController
@RequestMapping("/check/final")
@Api(tags = "决算模块", description = "决算模块")
@Api(tags = "决算模块", description = "决算模块", position = 2)
public class FinalCheckController {
@Autowired
......@@ -83,7 +83,7 @@ public class FinalCheckController {
@GetMapping("/reports")
@ApiOperation(value = "查询所有决算报告(不附带详情数据)")
public ResponseEntity<ResultObj<Page<FinalReportVo>>> findAllReports(
@RequestParam(required = false, defaultValue = "xw") String keyword,
@RequestParam(required = false, defaultValue = "") String keyword,
@RequestParam(required = false, defaultValue = "1") int page,
@RequestParam(required = false, defaultValue = "10") int size) {
return ResultUtil.success(fcService.findAllWithoutDetail(keyword, --page, size));
......
......@@ -24,6 +24,7 @@ import java.time.LocalDateTime;
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "时间参数")
@JsonPropertyOrder({"startTime","endTime"})
public class TimeParam {
@JsonFormat(pattern = "yyyy-MM-dd")
......
......@@ -29,7 +29,7 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
* @param locations 装备所在地列表
* @return 装备数量
*/
int countByModelAndLocationUnitContains(String model, List<String> locations);
int countByModelAndLocationUnitIn(String model, List<String> locations);
/**
* 根据装备型号与装备所在地(一个地区)查询装备数量
......
......@@ -24,29 +24,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.tykj.dev</groupId>-->
<!--<artifactId>config</artifactId>-->
<!--<version>1.0-SNAPSHOT</version>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>com.tykj.dev</groupId>-->
<!--<artifactId>device</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.tykj.dev</groupId>-->
<!--<artifactId>misc</artifactId>-->
<!--<version>1.0-SNAPSHOT</version>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>com.tykj.dev</groupId>-->
<!--<artifactId>device</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>misc</artifactId>
......
......@@ -107,13 +107,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// .accessDeniedHandler(accessHandler)
.and()
.addFilterAt(new ConcurrentSessionFilter(sessionRegistry(), event -> {
HttpServletResponse resp = event.getResponse();
resp.setContentType("application/json;charset=utf-8");
resp.setStatus(401);
PrintWriter out = resp.getWriter();
out.write(new ObjectMapper().writeValueAsString(ApiResult.build(405,"您已在另一台设备登录,本次登录已下线!")));
out.flush();
out.close();
HttpServletResponse resp = event.getResponse();
resp.setContentType("application/json;charset=utf-8");
resp.setStatus(401);
PrintWriter out = resp.getWriter();
out.write(new ObjectMapper().writeValueAsString(ApiResult.build(405, "您已在另一台设备登录,本次登录已下线!")));
out.flush();
out.close();
}), ConcurrentSessionFilter.class)
.addFilterAt(myFilter(), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(corsFilter(), ChannelProcessingFilter.class)
......@@ -125,9 +125,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
}
@Override
public void configure(WebSecurity web){
public void configure(WebSecurity web) {
//swagger静态资源访问
web.ignoring().antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**","/swagger-resources/configuration/ui","**/swagge‌​r-ui.html","/static/**","/**/index.html","index.html","/js/**","/css/**","/fonds/**","/img/**");
web.ignoring().antMatchers("/v2/api-docs", "/v2/api-docs-ext","/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui/", "/swagger-ui/**","/swagger-ui.html", "/doc.html", "/webjars/**", "/swagger-resources/configuration/ui", "**/swagge‌​r-ui.html", "/static/**", "/**/index.html", "index.html", "/js/**", "/css/**", "/fonds/**", "/img/**");
}
@Bean
......@@ -153,13 +153,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
HttpSessionEventPublisher httpSessionEventPublisher() {
return new HttpSessionEventPublisher();
}
@Bean
public SessionRegistryImpl sessionRegistry(){
public SessionRegistryImpl sessionRegistry() {
return new SessionRegistryImpl();
}
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder(){
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
......
......@@ -12,7 +12,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<version>2.2.7.RELEASE</version>
</parent>
<modules>
<module>dev-socket</module>
......@@ -74,6 +74,11 @@
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>union</artifactId>
......@@ -251,6 +256,11 @@
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论