Parcourir la source

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida il y a 7 ans
Parent
commit
6bb3fa1738

+ 39 - 0
patient-co/patient-co-figure-label/pom.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>patient-co-lib</artifactId>
        <groupId>com.yihu</groupId>
        <version>1.0.0</version>
        <relativePath>../../patient-co-lib/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>patient-co-figure-label</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-swagger-starter</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-docs</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.3.10.RELEASE</version>
        </dependency>
    </dependencies>
</project>

+ 29 - 0
patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/FigureLabelApplication.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.figure.label;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.context.ApplicationContext;
/**
 * Created by chenweida on 2018/3/5.
 */
@SpringBootApplication
@EnableAutoConfiguration(exclude = {
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class,
        RedisRepositoriesAutoConfiguration.class
})
public class FigureLabelApplication {
    public static ApplicationContext ctx = null;
    public static void main(String[] args) {
        ctx = SpringApplication.run(FigureLabelApplication.class, args);
    }
}

+ 92 - 0
patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/config/swagger/SwaggerConfig.java

@ -0,0 +1,92 @@
package com.yihu.wlyy.figure.label.config.swagger;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    private static final String Other_API = "other";
    @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("/.*")
                ))
                .build()
                .apiInfo(otherApiInfo());
    }
    private ApiInfo otherApiInfo() {
        ApiInfo apiInfo = new ApiInfo("居民画像平台API",
                "居民画像平台API",
                "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;
    }
    /**
     * 生成html文章专用
     *
     private static final String Doctor_API = "doctor";
     private static final String Patient_API = "patient";
     private static final String Other_API = "other";
     private static final String GateWay_API = "gateway";
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        String groupName="doctor";
        //String groupName="patient";
        //String groupName="other";
        // String groupName="gateway";
        URL remoteSwaggerFile = new URL("http://127.0.0.1:8080//v2/api-docs?group="+groupName);
        Path outputFile = Paths.get("patient-co/patient-co-wlyy/build/"+groupName);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                .withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 20 - 0
patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/config/war/ServletInitializer.java

@ -0,0 +1,20 @@
package com.yihu.wlyy.figure.label.config.war;//package com.yihu.wlyy.config.war;
import com.yihu.wlyy.figure.label.FigureLabelApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
/**
 *
 */
public class ServletInitializer extends SpringBootServletInitializer {
    public ServletInitializer() {
        super();
        setRegisterErrorPageFilter(false); //报错不跳到错误页
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(FigureLabelApplication.class);
    }
}

+ 2 - 0
patient-co/patient-co-figure-label/src/main/resources/application.yml

@ -0,0 +1,2 @@
server:
  port: 8080

+ 23 - 0
patient-co/patient-co-figure-label/src/main/resources/banner.txt

@ -0,0 +1,23 @@
${AnsiColor.BRIGHT_GREEN}
                                    ////////////////////////////////////////////////////////////////////
                                    //                          _ooOoo_                               //
                                    //                         o8888888o                              //
                                    //                         88" . "88                              //
                                    //                         (| ^_^ |)                              //
                                    //                         O\  =  /O                              //
                                    //                      ____/`---'\____                           //
                                    //                    .'  \\|     |//  `.                         //
                                    //                   /  \\|||  :  |||//  \                        //
                                    //                  /  _||||| -:- |||||-  \                       //
                                    //                  |   | \\\  -  /// |   |                       //
                                    //                  | \_|  ''\---/''  |   |                       //
                                    //                  \  .-\__  `-`  ___/-. /                       //
                                    //                ___`. .'  /--.--\  `. . ___                     //
                                    //              ."" '<  `.___\_<|>_/___.'  >'"".                  //
                                    //            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
                                    //            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
                                    //      ========`-.____`-.___\_____/___.-`____.-'========         //
                                    //                           `=---='                              //
                                    //      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
                                    //            佛祖保佑       永不宕机     永无BUG                 //
                                    ////////////////////////////////////////////////////////////////////

+ 31 - 0
patient-co/patient-co-figure-label/src/main/resources/logback.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <logger name="io.searchbox" level="WARN"/>
    <jmxConfigurator/>
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy/MM/dd-HH:mm:ss} %level [%thread] %caller{1} - %msg%n</pattern>
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/tmp/logs/figure-label</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/tmp/logs/figure-label.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%date{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <root level="INFO">
        <!--<appender-ref ref="console" />-->
        <appender-ref ref="rollingFile"/>
    </root>
</configuration>

+ 0 - 5
patient-co/patient-co-wlyy/pom.xml

@ -117,11 +117,6 @@
        </dependency>
        <!-- spring start -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>