mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
V8.0项目初始化
This commit is contained in:
parent
0e8d3a19e7
commit
37339695a6
113
cskefu-auth/pom.xml
Normal file
113
cskefu-auth/pom.xml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?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">
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-auth</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>cskefu-auth</name>
|
||||||
|
<url>https://www.cskefu.com/</url>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<spring-boot.version>2.7.4</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.4</spring-cloud.version>
|
||||||
|
<mybatis-spring.version>2.2.2</mybatis-spring.version>
|
||||||
|
<lombok.version>1.18.6</lombok.version>
|
||||||
|
<mysql-connector.version>8.0.30</mysql-connector.version>
|
||||||
|
<redisson-spring.version>3.17.7</redisson-spring.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-common</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.csp</groupId>
|
||||||
|
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||||
|
<version>1.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${redisson-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>${mysql-connector.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</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>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cskefu.auth;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CskefuAuthApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CskefuAuthApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
29
cskefu-auth/src/main/resources/application-dev.yml
Normal file
29
cskefu-auth/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
# sentinel配置
|
||||||
|
sentinel:
|
||||||
|
eager: true
|
||||||
|
transport:
|
||||||
|
dashboard:
|
||||||
|
127.0.0.1:8848
|
||||||
|
port: 8719
|
||||||
|
heartbeat-interval-ms: 5000
|
||||||
|
nacos:
|
||||||
|
# 注册中心配置
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
namespace: xxxxxxx
|
||||||
|
# # 配置中心
|
||||||
|
# config:
|
||||||
|
# server-addr: 127.0.0.1:8848
|
||||||
|
# file-extension: yaml
|
||||||
|
# namespace: jm-live-dev
|
||||||
|
# shared-configs[0]:
|
||||||
|
# group: sentinel
|
||||||
|
# data-id: sentinel-shared.yaml
|
||||||
|
# refresh: true
|
0
cskefu-auth/src/main/resources/application-pro.yml
Normal file
0
cskefu-auth/src/main/resources/application-pro.yml
Normal file
28
cskefu-auth/src/main/resources/application.yml
Normal file
28
cskefu-auth/src/main/resources/application.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: cskefu
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
datasource:
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
hikari:
|
||||||
|
connection-timeout: 5000
|
||||||
|
minimum-idle: 5
|
||||||
|
maximum-pool-size: 20
|
||||||
|
auto-commit: false
|
||||||
|
idle-timeout: 600000
|
||||||
|
pool-name: DataSourceHikariCP
|
||||||
|
max-lifetime: 1800000
|
||||||
|
connection-test-query: select 1
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
timeout: 5000
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
max-idle: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-wait: -1ms
|
103
cskefu-biz/pom.xml
Normal file
103
cskefu-biz/pom.xml
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?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">
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-biz</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>cskefu-biz</name>
|
||||||
|
<url>https://www.cskefu.com/</url>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<spring-boot.version>2.7.4</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.4</spring-cloud.version>
|
||||||
|
<mybatis-spring.version>2.2.2</mybatis-spring.version>
|
||||||
|
<lombok.version>1.18.6</lombok.version>
|
||||||
|
<mysql-connector.version>8.0.30</mysql-connector.version>
|
||||||
|
<redisson-spring.version>3.17.7</redisson-spring.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-common</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${redisson-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>${mysql-connector.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</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>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cskefu.biz;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CskefuBIZApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CskefuBIZApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.cskefu.biz.swagger;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.*;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableSwagger2
|
||||||
|
public class SwaggerConfiguration {
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi() {
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
.select()
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
.paths(PathSelectors.regex("(?!/error.*).*"))
|
||||||
|
.build()
|
||||||
|
.securityContexts(Arrays.asList(securityContext()))
|
||||||
|
.securitySchemes(Arrays.asList(new ApiKey("token", "token", SecuritySchemeIn.HEADER.name())));
|
||||||
|
}
|
||||||
|
|
||||||
|
private SecurityContext securityContext() {
|
||||||
|
return SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
|
//.forPaths(PathSelectors.regex("/*.*"))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SecurityReference> defaultAuth() {
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
return Collections.singletonList(new SecurityReference("token", authorizationScopes));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiInfo apiInfo() {
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
.title("cskefu Swagger API")
|
||||||
|
.description("春松客服Swagger API")
|
||||||
|
.contact(new Contact("cskefu", "https://www.cskefu.com/", "dev@lists.cskefu.com"))
|
||||||
|
.license("Apache License Version 2.0")
|
||||||
|
.licenseUrl("http://www.apache.org/licenese/LICENSE-2.0")
|
||||||
|
.version("1.0")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
29
cskefu-biz/src/main/resources/application-dev.yml
Normal file
29
cskefu-biz/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
# sentinel配置
|
||||||
|
sentinel:
|
||||||
|
eager: true
|
||||||
|
transport:
|
||||||
|
dashboard:
|
||||||
|
127.0.0.1:8848
|
||||||
|
port: 8719
|
||||||
|
heartbeat-interval-ms: 5000
|
||||||
|
nacos:
|
||||||
|
# 注册中心配置
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
namespace: xxxxxxx
|
||||||
|
# # 配置中心
|
||||||
|
# config:
|
||||||
|
# server-addr: 127.0.0.1:8848
|
||||||
|
# file-extension: yaml
|
||||||
|
# namespace: jm-live-dev
|
||||||
|
# shared-configs[0]:
|
||||||
|
# group: sentinel
|
||||||
|
# data-id: sentinel-shared.yaml
|
||||||
|
# refresh: true
|
0
cskefu-biz/src/main/resources/application-pro.yml
Normal file
0
cskefu-biz/src/main/resources/application-pro.yml
Normal file
28
cskefu-biz/src/main/resources/application.yml
Normal file
28
cskefu-biz/src/main/resources/application.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: cskefu
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
datasource:
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
hikari:
|
||||||
|
connection-timeout: 5000
|
||||||
|
minimum-idle: 5
|
||||||
|
maximum-pool-size: 20
|
||||||
|
auto-commit: false
|
||||||
|
idle-timeout: 600000
|
||||||
|
pool-name: DataSourceHikariCP
|
||||||
|
max-lifetime: 1800000
|
||||||
|
connection-test-query: select 1
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
timeout: 5000
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
max-idle: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-wait: -1ms
|
56
cskefu-common/pom.xml
Normal file
56
cskefu-common/pom.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?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">
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-common</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>cskefu-common</name>
|
||||||
|
<url>https://www.cskefu.com/</url>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<spring-boot.version>2.7.4</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.4</spring-cloud.version>
|
||||||
|
<mybatis-spring.version>2.2.2</mybatis-spring.version>
|
||||||
|
<lombok.version>1.18.6</lombok.version>
|
||||||
|
<mysql-connector.version>8.0.30</mysql-connector.version>
|
||||||
|
<redisson-spring.version>3.17.7</redisson-spring.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.cskefu.common;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class BaseEntity<T> implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6751846719593132836L;
|
||||||
|
private T id;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
private String creator;
|
||||||
|
private String updator;
|
||||||
|
private Boolean deleted;
|
||||||
|
private Integer version;
|
||||||
|
}
|
82
cskefu-common/src/main/java/com/cskefu/common/Result.java
Normal file
82
cskefu-common/src/main/java/com/cskefu/common/Result.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package com.cskefu.common;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class Result<T> {
|
||||||
|
|
||||||
|
public interface View {
|
||||||
|
}
|
||||||
|
|
||||||
|
private final boolean success;
|
||||||
|
private final int code;
|
||||||
|
private final T data;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
Result(boolean success, int code, T data, String message) {
|
||||||
|
this.success = success;
|
||||||
|
this.code = code;
|
||||||
|
this.data = data;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ResultBuilder<T> builder() {
|
||||||
|
return new ResultBuilder<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success() {
|
||||||
|
return Result.<T>builder().code(0).success(true).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success(int code, T data) {
|
||||||
|
return Result.<T>builder().code(code).success(true).data(data).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> error(int code, String i18nMessage) {
|
||||||
|
return Result.<T>builder().code(code).success(false).message(i18nMessage).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Result(success=" + this.success + ", code=" + this.code + ", data=" + this.data + ", message=" + this.message + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ResultBuilder<T> {
|
||||||
|
private boolean success;
|
||||||
|
private int code;
|
||||||
|
private T data;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
ResultBuilder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBuilder<T> success(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBuilder<T> code(int code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBuilder<T> data(T data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBuilder<T> message(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<T> build() {
|
||||||
|
return new Result<>(this.success, this.code, this.data, this.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getClass().getName() + "(success=" + this.success + ", code=" + this.code + ", data=" + this.data + ", message=" + this.message + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
cskefu-gateway/pom.xml
Normal file
60
cskefu-gateway/pom.xml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?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">
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-gateway</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>cskefu-gateway</name>
|
||||||
|
<url>https://www.cskefu.com/</url>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<spring-boot.version>2.7.4</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.4</spring-cloud.version>
|
||||||
|
<mybatis-spring.version>2.2.2</mybatis-spring.version>
|
||||||
|
<lombok.version>1.18.6</lombok.version>
|
||||||
|
<mysql-connector.version>8.0.30</mysql-connector.version>
|
||||||
|
<redisson-spring.version>3.17.7</redisson-spring.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-common</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cskefu.gateway;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CskefuGatewayApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CskefuGatewayApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
29
cskefu-gateway/src/main/resources/application-dev.yml
Normal file
29
cskefu-gateway/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
# sentinel配置
|
||||||
|
sentinel:
|
||||||
|
eager: true
|
||||||
|
transport:
|
||||||
|
dashboard:
|
||||||
|
127.0.0.1:8848
|
||||||
|
port: 8719
|
||||||
|
heartbeat-interval-ms: 5000
|
||||||
|
nacos:
|
||||||
|
# 注册中心配置
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
namespace: xxxxxxx
|
||||||
|
# # 配置中心
|
||||||
|
# config:
|
||||||
|
# server-addr: 127.0.0.1:8848
|
||||||
|
# file-extension: yaml
|
||||||
|
# namespace: jm-live-dev
|
||||||
|
# shared-configs[0]:
|
||||||
|
# group: sentinel
|
||||||
|
# data-id: sentinel-shared.yaml
|
||||||
|
# refresh: true
|
5
cskefu-gateway/src/main/resources/application.yml
Normal file
5
cskefu-gateway/src/main/resources/application.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: cskefu-gateway
|
||||||
|
profiles:
|
||||||
|
active: dev
|
98
cskefu-session/pom.xml
Normal file
98
cskefu-session/pom.xml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?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">
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-session</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>cskefu-session</name>
|
||||||
|
<url>https://www.cskefu.com/</url>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<spring-boot.version>2.7.4</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.4</spring-cloud.version>
|
||||||
|
<mybatis-spring.version>2.2.2</mybatis-spring.version>
|
||||||
|
<lombok.version>1.18.6</lombok.version>
|
||||||
|
<mysql-connector.version>8.0.30</mysql-connector.version>
|
||||||
|
<redisson-spring.version>3.17.7</redisson-spring.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cskefu</groupId>
|
||||||
|
<artifactId>cskefu-common</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${redisson-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>${mysql-connector.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</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>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cskefu.io;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CskefuSessionApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CskefuSessionApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.cskefu.io.swagger;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.*;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableSwagger2
|
||||||
|
public class SwaggerConfiguration {
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi() {
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
.select()
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
.paths(PathSelectors.regex("(?!/error.*).*"))
|
||||||
|
.build()
|
||||||
|
.securityContexts(Arrays.asList(securityContext()))
|
||||||
|
.securitySchemes(Arrays.asList(new ApiKey("token", "token", SecuritySchemeIn.HEADER.name())));
|
||||||
|
}
|
||||||
|
|
||||||
|
private SecurityContext securityContext() {
|
||||||
|
return SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
|
//.forPaths(PathSelectors.regex("/*.*"))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SecurityReference> defaultAuth() {
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
return Collections.singletonList(new SecurityReference("token", authorizationScopes));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiInfo apiInfo() {
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
.title("cskefu Swagger API")
|
||||||
|
.description("春松客服Swagger API")
|
||||||
|
.contact(new Contact("cskefu", "https://www.cskefu.com/", "dev@lists.cskefu.com"))
|
||||||
|
.license("Apache License Version 2.0")
|
||||||
|
.licenseUrl("http://www.apache.org/licenese/LICENSE-2.0")
|
||||||
|
.version("1.0")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
29
cskefu-session/src/main/resources/application-dev.yml
Normal file
29
cskefu-session/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
# sentinel配置
|
||||||
|
sentinel:
|
||||||
|
eager: true
|
||||||
|
transport:
|
||||||
|
dashboard:
|
||||||
|
127.0.0.1:8848
|
||||||
|
port: 8719
|
||||||
|
heartbeat-interval-ms: 5000
|
||||||
|
nacos:
|
||||||
|
# 注册中心配置
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
namespace: xxxxxxx
|
||||||
|
# # 配置中心
|
||||||
|
# config:
|
||||||
|
# server-addr: 127.0.0.1:8848
|
||||||
|
# file-extension: yaml
|
||||||
|
# namespace: jm-live-dev
|
||||||
|
# shared-configs[0]:
|
||||||
|
# group: sentinel
|
||||||
|
# data-id: sentinel-shared.yaml
|
||||||
|
# refresh: true
|
28
cskefu-session/src/main/resources/application.yml
Normal file
28
cskefu-session/src/main/resources/application.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: cskefu
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
datasource:
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
hikari:
|
||||||
|
connection-timeout: 5000
|
||||||
|
minimum-idle: 5
|
||||||
|
maximum-pool-size: 20
|
||||||
|
auto-commit: false
|
||||||
|
idle-timeout: 600000
|
||||||
|
pool-name: DataSourceHikariCP
|
||||||
|
max-lifetime: 1800000
|
||||||
|
connection-test-query: select 1
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
timeout: 5000
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
max-idle: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-wait: -1ms
|
Loading…
x
Reference in New Issue
Block a user