diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48691d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea/ +*.iml +/target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c0fd488 --- /dev/null +++ b/pom.xml @@ -0,0 +1,243 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.6.RELEASE + + org.example + wechatBusiness + 1.0-SNAPSHOT + + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.aliyun.oss + aliyun-sdk-oss + 2.8.3 + + + org.mybatis.generator + mybatis-generator-core + 1.3.5 + + + org.apache.poi + poi + 4.1.0 + + + org.apache.poi + poi-ooxml + 4.1.0 + + + org.apache.poi + poi-scratchpad + 4.1.0 + + + org.slf4j + slf4j-api + 1.7.13 + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.2.12 + + + com.alibaba + fastjson + 1.2.16 + + + com.nimbusds + nimbus-jose-jwt + 6.0 + + + + org.apache.commons + commons-lang3 + 3.3.2 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.0 + + + com.microsoft.sqlserver + mssql-jdbc + 6.4.0.jre8 + + + + org.apache.commons + commons-lang3 + 3.3.2 + + + io.springfox + springfox-swagger2 + 2.6.1 + + + io.springfox + springfox-swagger-ui + 2.6.1 + + + org.apache.pulsar + pulsar-client + 2.3.2 + + + net.lingala.zip4j + zip4j + 1.3.2 + + + org.springframework + spring-test + 5.1.9.RELEASE + compile + + + org.apache.httpcomponents + httpclient + 4.5 + + + + org.apache.httpcomponents + httpmime + 4.5 + + + dom4j + dom4j + 1.6.1 + + + + + + wechatBusiness + + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.5 + + true + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + com.sincere.report.StudentApplication + true + lib/ + + + ./config/ + + + + config/** + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + package + + copy-dependencies + + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + UTF-8 + + + + + maven-source-plugin + 2.2 + + true + + + + compile + + jar + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/sincere/wechatbusiness/Swagger2.java b/src/main/java/com/sincere/wechatbusiness/Swagger2.java new file mode 100644 index 0000000..88441a7 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/Swagger2.java @@ -0,0 +1,50 @@ +package com.sincere.wechatbusiness; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +@EnableSwagger2 +@Configuration //让Spring来加载该类配置 +public class Swagger2 { + + @Bean + public Docket createRestApi() { + ParameterBuilder ticketPar = new ParameterBuilder(); + List pars = new ArrayList(); + ticketPar.name("X-Authorization").description("user token") + .modelRef(new ModelRef("string")).parameterType("header") + .required(false).build(); //header中的ticket参数非必填,传空也可以 + pars.add(ticketPar.build()); + + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.basePackage("com.sincere.wechatbusiness.controller")) + .paths(PathSelectors.any()) + .build().globalOperationParameters(pars); + + } + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("Spring Boot中使用Swagger2构建RESTful APIs") + .description("接口文档") + .termsOfServiceUrl("") + .version("1.0") + .build(); + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java b/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java new file mode 100644 index 0000000..203e790 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java @@ -0,0 +1,17 @@ +package com.sincere.wechatbusiness; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; + +@EnableCaching +@SpringBootApplication +@MapperScan("com.sincere.report.mapper") +public class WechatBusinessApplication { + + public static void main(String[] args) { + SpringApplication.run(WechatBusinessApplication.class, args); + } + +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml new file mode 100644 index 0000000..760ad98 --- /dev/null +++ b/src/main/resources/application.yaml @@ -0,0 +1,33 @@ +server: + port: 9903 +spring: + application: + name: wechatBusiness + datasource: + username: SZJXTUSER + password: xst200919 + url: jdbc:sqlserver://60.190.202.57:14333;database=wechatbusiness + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + +# cache: +# type: redis +# redis: +# host: 127.0.0.1 +# port: 6379 +# password: +# lettuce: +# pool: +# max-active: 8 +# database: 0 +##mybatis +mybatis: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.sincere.report.model + +logging: + level: + com.sincere.report.mapper: debug \ No newline at end of file diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..89f0a3c --- /dev/null +++ b/src/main/resources/generatorConfig.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..253c1bd --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,60 @@ + + +     +     + +     + + +     +     +         +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n) +             UTF-8 +         +     + +     +     +         +         +             +             ${LOG_HOME}/${PROJECT_NAME}/%d{yyyy-MM-dd HH}.%i.log +             +             30 +             +             100MB +         + +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n +             UTF-8 +         +     +     +         +     + +     +     +     +     +     +     +     + + +     +     +     +     +     +     +         +         +     + + -- libgit2 0.21.0