Commit 06acbe5f authored by lidongdai's avatar lidongdai
Browse files

1.0.2文档发布

parent 5a8c8ef9
Loading
Loading
Loading
Loading
+43 −7
Original line number Diff line number Diff line
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>cn.analysys</groupId>
@@ -10,13 +11,10 @@

  <dependencies>


    <dependency>
      <groupId>cn.analysys</groupId>
      <artifactId>escheduler-dao</artifactId>
    </dependency>
    <dependency>
      <groupId>cn.analysys</groupId>
      <artifactId>escheduler-common</artifactId>
      <artifactId>escheduler-server</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
@@ -37,6 +35,33 @@
      </exclusions>
    </dependency>

    <!--<dependency>-->
      <!--<groupId>cn.analysys</groupId>-->
      <!--<artifactId>escheduler-dao</artifactId>-->
    <!--</dependency>-->
    <!--<dependency>-->
      <!--<groupId>cn.analysys</groupId>-->
      <!--<artifactId>escheduler-common</artifactId>-->
      <!--<exclusions>-->
        <!--<exclusion>-->
          <!--<groupId>io.netty</groupId>-->
          <!--<artifactId>netty</artifactId>-->
        <!--</exclusion>-->
        <!--<exclusion>-->
          <!--<groupId>io.netty</groupId>-->
          <!--<artifactId>netty-all</artifactId>-->
        <!--</exclusion>-->
        <!--<exclusion>-->
          <!--<groupId>com.google</groupId>-->
          <!--<artifactId>netty</artifactId>-->
        <!--</exclusion>-->
        <!--<exclusion>-->
          <!--<artifactId>leveldbjni-all</artifactId>-->
          <!--<groupId>org.fusesource.leveldbjni</groupId>-->
        <!--</exclusion>-->
      <!--</exclusions>-->
    <!--</dependency>-->

    <!--springboot-->

    <dependency>
@@ -142,6 +167,17 @@
      <artifactId>quartz-jobs</artifactId>
    </dependency>

    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger2</artifactId>
      <version>2.8.0</version>
    </dependency>

    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>2.8.0</version>
    </dependency>
    <dependency>
      <groupId>cn.analysys</groupId>
      <artifactId>escheduler-rpc</artifactId>
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@ServletComponentScan
+9 −1
Original line number Diff line number Diff line
@@ -33,8 +33,16 @@ public class AppConfiguration implements WebMvcConfigurer {

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN);
    registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html");
  }
//
//  @Override
//  public void addResourceHandlers(ResourceHandlerRegistry registry) {
//    registry.addResourceHandler("swagger-ui.html")
//            .addResourceLocations("classpath:/META-INF/resources/");
//    registry.addResourceHandler("/webjars/**")
//            .addResourceLocations("classpath:/META-INF/resources/webjars/");
//  }

  @Bean
  public LoginHandlerInterceptor loginInterceptor() {
+53 −0
Original line number Diff line number Diff line
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.escheduler.api.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 *
 * swager2 config class <br/>
 *
 */
@Configuration
@EnableSwagger2
public class Swagger2 implements WebMvcConfigurer {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
                .apis(RequestHandlerSelectors.basePackage("cn.escheduler.api.controller")).paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("api docs").description("easy scheduler api docs")
                .termsOfServiceUrl("https://www.analysys.com").version("1.0.0").build();
    }


}
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ import cn.escheduler.api.service.UsersService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -60,6 +63,11 @@ public class LoginController extends BaseController {
     * @param response
     * @return
     */
    @ApiOperation(value="更新用户详细信息", notes="根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "String"),
            @ApiImplicitParam(name = "userPassword", value = "密码", required = true, dataType = "String")
    })
    @RequestMapping(value = "/login")
    public Result login(@RequestParam(value = "userName") String userName,
                        @RequestParam(value = "userPassword") String userPassword,
Loading