8 changed files with 485 additions and 0 deletions
-
0mdp-lcode-cloud-bootstrap/README.md
-
57mdp-lcode-cloud-bootstrap/pom.xml
-
19mdp-lcode-cloud-bootstrap/src/main/java/com/mdp/LcodeApplication.java
-
68mdp-lcode-cloud-bootstrap/src/main/java/com/mdp/WebSecurityConfig.java
-
292mdp-lcode-cloud-bootstrap/src/main/resources/application-prod.yml
-
5mdp-lcode-cloud-bootstrap/src/main/resources/application.yml
-
8mdp-lcode-cloud-bootstrap/src/main/resources/locale/message_zh.properties
-
36mdp-lcode-cloud-bootstrap/src/main/resources/logback-spring.xml
@ -0,0 +1,57 @@ |
|||
<?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"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<artifactId>mdp-lcode-cloud-bootstrap</artifactId> |
|||
<packaging>jar</packaging> |
|||
<name>mdp-lcode-cloud-bootstrap cloud启动器</name> |
|||
<parent> |
|||
<groupId>com.mdp</groupId> |
|||
<artifactId>mdp-lcode-backend</artifactId> |
|||
<version>2.0.0-RELEASE</version> |
|||
</parent> |
|||
|
|||
<dependencies> |
|||
<!-- mdp-cloud-starter ,mdp-oauth2-client-cloud 必须放在业务包之上优先加载 --> |
|||
<dependency> |
|||
<groupId>com.mdp</groupId> |
|||
<artifactId>mdp-oauth2-client-cloud</artifactId> |
|||
<version>${mdp.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.mdp</groupId> |
|||
<artifactId>mdp-cloud-starter</artifactId> |
|||
<version>${mdp.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.mdp</groupId> |
|||
<artifactId>mdp-lcode</artifactId> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
|
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-deploy-plugin</artifactId> |
|||
<configuration> |
|||
<skip>true</skip> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- --> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<goals> |
|||
<goal>repackage</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<description>低代码单体应用启动器</description> |
|||
</project> |
|||
@ -0,0 +1,19 @@ |
|||
package com.mdp; |
|||
|
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; |
|||
|
|||
@SpringBootApplication |
|||
@SpringCloudApplication |
|||
@EnableRedisHttpSession |
|||
//@EnableSwagger2 |
|||
public class LcodeApplication { |
|||
|
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(LcodeApplication.class,args); |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
package com.mdp; |
|||
|
|||
|
|||
import com.mdp.safe.client.jwt.JwtAuthenticationConverter; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
|||
import org.springframework.security.config.annotation.web.builders.WebSecurity; |
|||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
|||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
|||
import org.springframework.security.oauth2.jwt.JwtDecoder; |
|||
|
|||
@EnableWebSecurity |
|||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|||
|
|||
@Autowired |
|||
JwtAuthenticationConverter jwtConverter; |
|||
|
|||
@Autowired |
|||
JwtDecoder jwtDecoder; |
|||
|
|||
@Override |
|||
public void configure(WebSecurity web) throws Exception { |
|||
web.ignoring().antMatchers("/webjars/**"); |
|||
} |
|||
|
|||
/** |
|||
* 允许匿名访问所有接口 主要是 oauth 接口 |
|||
* @param http |
|||
* @throws Exception |
|||
*/ |
|||
@Override |
|||
protected void configure(HttpSecurity http) throws Exception { |
|||
http.authorizeRequests().antMatchers("/actuator/**","/**/safe/app/auth**", |
|||
"/**/sys/userTpaInvite/checkInviteId", |
|||
"/**/sys/user/addUserNoAuth", |
|||
"/**/login/token", |
|||
"/**/sys/user/noauth/detail", |
|||
"/**/sys/userFans/fansCpd", |
|||
"/**/sys/userSvr/list", |
|||
"/**/sys/user/crowd/list", |
|||
"/**/sys/branch/add", |
|||
"/**/sys/branch/list", |
|||
"/**/sys/branch/listBranchNoAuth", |
|||
"/**/sys/branch/addBranchNoAuth", |
|||
"/**/sys/dept/listDeptAndChidlDeptByBranchIdNoAuth", |
|||
"/**/sys/dept/addDeptNoAuth", |
|||
"/**/sys/userDept/batchEditNoauth", |
|||
"/**/list/byItemCode", |
|||
"/**/list/byItemIds", |
|||
"/**/sys/userTpa/list", |
|||
"/app/appTpAuth/list", |
|||
"/**/menuModuleBranch/list", |
|||
"/**/item/dicts", |
|||
"/**/list/sysParam", |
|||
"/swagger-ui.html", |
|||
"/webjars/**", |
|||
"/swagger-ui/**", |
|||
"/swagger-resources/**", |
|||
"/v2/*", |
|||
"/csrf", |
|||
"/").permitAll().anyRequest().authenticated(); |
|||
http.oauth2Client().and().logout().disable(); |
|||
http.oauth2Login(); |
|||
http.formLogin().disable(); |
|||
http.oauth2ResourceServer().jwt().decoder(jwtDecoder).jwtAuthenticationConverter(jwtConverter); |
|||
http.csrf().disable(); |
|||
} |
|||
} |
|||
@ -0,0 +1,292 @@ |
|||
server: |
|||
port: 7014 |
|||
servlet: |
|||
context-path: |
|||
session: |
|||
timeout: 43200 |
|||
storeType: none |
|||
tomcat: |
|||
max-swallow-size: -1 |
|||
util: |
|||
http: |
|||
parser: |
|||
HttpParser: requestTargetAllow=|{}[] |
|||
error: |
|||
include-exception: true |
|||
include-stacktrace: ALWAYS |
|||
include-message: ALWAYS |
|||
compression: |
|||
enabled: true |
|||
min-response-size: 1024 |
|||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/* |
|||
|
|||
management: |
|||
endpoints: |
|||
web: |
|||
exposure: |
|||
include: metrics,httptrace |
|||
|
|||
spring: |
|||
cloud: |
|||
consul: |
|||
host: 127.0.0.1 |
|||
port: 8500 |
|||
inetutils: |
|||
preferredNetworks[0]: ^10\. |
|||
preferredNetworks[1]: ^172\. |
|||
discovery: |
|||
prefer-ip-address: true |
|||
healthCheckInterval: 15s |
|||
servlet: |
|||
multipart: |
|||
max-file-size: 10MB |
|||
max-request-size: 10MB |
|||
# 安全模块 |
|||
security: |
|||
oauth2: |
|||
resourceserver: |
|||
jwt: |
|||
jwk-set-uri: ${mdp.oauth2.server.uri}/oauth2/jwks |
|||
client: |
|||
# 下面配置 password 模式 |
|||
registration: |
|||
password-client: |
|||
provider: def-oauth-server |
|||
client-id: ${spring.application.name} |
|||
client-secret: ${spring.application.name}-8888 |
|||
authorization-grant-type: password |
|||
scope: all |
|||
# 下面配置 client_credentials 模式 |
|||
def-client: |
|||
provider: def-oauth-server |
|||
client-id: ${spring.application.name} |
|||
client-secret: ${spring.application.name}-8888 |
|||
authorization-grant-type: client_credentials |
|||
scope: all |
|||
# 下面配置authorization_code模式 |
|||
code-client: |
|||
provider: def-oauth-server |
|||
client-id: ${spring.application.name} |
|||
client-secret: ${spring.application.name}-8888 |
|||
authorization-grant-type: authorization_code |
|||
# 授权码模式下需要配置重定向地址 |
|||
redirect-uri: ${messages.base-uri}/authorized |
|||
scope: all |
|||
provider: |
|||
def-oauth-server: |
|||
# 授权码方式获取code |
|||
authorization-uri: ${mdp.oauth2.server.uri}/oauth2/authorize |
|||
# 获取token接口 |
|||
token-uri: ${mdp.oauth2.server.uri}/oauth2/token |
|||
mail: |
|||
host: smtp.mxhichina.com |
|||
port: 25 |
|||
username: kf@qingqinkj.com |
|||
password: MaiMeng*123 |
|||
default-encoding: UTF-8 |
|||
properties: |
|||
mail: |
|||
smtp: |
|||
auth: true |
|||
starttls: |
|||
enable: true |
|||
required: true |
|||
socketFactoryClass: javax.net.ssl.SSLSocketFactory |
|||
debug: true |
|||
jackson: |
|||
mapper: |
|||
default-view-inclusion: false |
|||
date-format: yyyy-MM-dd HH:mm:ss |
|||
time-zone: GMT+8 |
|||
serialization: |
|||
indent_output: true |
|||
fail_on_empty_beans: false |
|||
deserialization: |
|||
fail_on_unknown_properties: false |
|||
parser: |
|||
allow_unquoted_control_chars: true |
|||
allow_single_quotes: true |
|||
|
|||
mvc: |
|||
date-format: yyyy-MM-dd HH:mm:ss |
|||
## quartz定时任务,采用数据库方式 |
|||
quartz: |
|||
job-store-type: jdbc |
|||
initialize-schema: embedded |
|||
#定时任务启动开关,true-开 false-关 |
|||
auto-startup: false |
|||
#启动时更新己存在的Job |
|||
overwrite-existing-jobs: false |
|||
properties: |
|||
org: |
|||
quartz: |
|||
scheduler: |
|||
instanceName: MyScheduler |
|||
instanceId: AUTO |
|||
jobStore: |
|||
class: org.quartz.impl.jdbcjobstore.JobStoreTX |
|||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate |
|||
tablePrefix: QRTZ_ |
|||
isClustered: true |
|||
misfireThreshold: 60000 |
|||
clusterCheckinInterval: 10000 |
|||
threadPool: |
|||
class: org.quartz.simpl.SimpleThreadPool |
|||
threadCount: 10 |
|||
threadPriority: 5 |
|||
threadsInheritContextClassLoaderOfInitializingThread: true |
|||
jpa: |
|||
open-in-view: false |
|||
activiti: |
|||
check-process-definitions: false |
|||
#启用作业执行器 |
|||
async-executor-activate: false |
|||
#启用异步执行器 |
|||
job-executor-activate: false |
|||
aop: |
|||
proxy-target-class: true |
|||
#配置freemarker |
|||
freemarker: |
|||
# 设置模板后缀名 |
|||
suffix: .ftl |
|||
# 设置文档类型 |
|||
content-type: text/html |
|||
# 设置页面编码格式 |
|||
charset: UTF-8 |
|||
# 设置页面缓存 |
|||
cache: false |
|||
prefer-file-system-access: false |
|||
# 设置ftl文件路径 |
|||
template-loader-path: |
|||
- classpath:/templates |
|||
resource: |
|||
static-locations: classpath:/static/,classpath:/public/ |
|||
autoconfigure: |
|||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure |
|||
datasource: |
|||
primary: master |
|||
strict: false, |
|||
druid: |
|||
stat-view-servlet: |
|||
enabled: true |
|||
loginUsername: root |
|||
loginPassword: 123456 |
|||
allow: |
|||
web-stat-filter: |
|||
enabled: true |
|||
dynamic: |
|||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置) |
|||
# 连接池的配置信息 |
|||
# 初始化大小,最小,最大 |
|||
initial-size: 5 |
|||
min-idle: 5 |
|||
maxActive: 20 |
|||
# 配置获取连接等待超时的时间 |
|||
maxWait: 60000 |
|||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
|||
timeBetweenEvictionRunsMillis: 60000 |
|||
# 配置一个连接在池中最小生存的时间,单位是毫秒 |
|||
minEvictableIdleTimeMillis: 300000 |
|||
validationQuery: SELECT 1 |
|||
testWhileIdle: true |
|||
testOnBorrow: false |
|||
testOnReturn: false |
|||
# 打开PSCache,并且指定每个连接上PSCache的大小 |
|||
poolPreparedStatements: true |
|||
maxPoolPreparedStatementPerConnectionSize: 20 |
|||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 |
|||
filters: stat,wall,slf4j |
|||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录 |
|||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
|||
datasource: |
|||
master: |
|||
# url: jdbc:mysql://124.223.85.6:31605/erp?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&allowMultiQueries=true |
|||
#username: zchcgl |
|||
#password: zchcgl123!@# |
|||
#driver-class-name: com.mysql.cj.jdbc.Driver |
|||
|
|||
url: jdbc:mysql://127.0.0.1:3306/lcode?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=CTT |
|||
username: root |
|||
password: MaiMeng*123 |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
|
|||
|
|||
# 多数据源配置 |
|||
#multi-datasource1: |
|||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai |
|||
#username: root |
|||
#password: root |
|||
#driver-class-name: com.mysql.cj.jdbc.Driver |
|||
mem-ds: |
|||
url: jdbc:mysql://127.0.0.1:3306/lcode?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=CTT |
|||
username: root |
|||
password: 1qaz@WSX |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
mall-ds: |
|||
url: jdbc:mysql://127.0.0.1:3306/lcode?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=CTT |
|||
username: root |
|||
password: 1qaz@WSX |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
arc-ds: |
|||
url: jdbc:mysql://127.0.0.1:3306/lcode?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=CTT |
|||
username: root |
|||
password: 1qaz@WSX |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
#redis 配置 |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
timeout: 300s |
|||
lettuce: |
|||
pool: |
|||
max-active: 8 #最大连接数据库连接数,设 -1 为没有限制 |
|||
max-idle: 20 #最大等待连接中的数量,设 0 为没有限制 |
|||
max-wait: 10000 #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。 |
|||
min-idle: 8 #最小等待连接中的数量,设 0 为没有限制 |
|||
shutdown-timeout: 100ms |
|||
password: MaiMeng*123 |
|||
port: 6379 |
|||
#mybatis plus 设置 |
|||
mybatis-plus: |
|||
mapper-locations: classpath*:/**/**Mapper.xml |
|||
global-config: |
|||
# 关闭MP3.0自带的banner |
|||
banner: false |
|||
db-config: |
|||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)"; |
|||
id-type: ASSIGN_ID |
|||
# 默认数据库表下划线命名 |
|||
table-underline: true |
|||
logic-delete-value: 1 |
|||
logic-not-delete-value: 0 |
|||
configuration: |
|||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 |
|||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
|||
# 返回类型为Map,显示null对应的字段 |
|||
call-setters-on-nulls: true |
|||
|
|||
#Mybatis输出sql日志 |
|||
logging: |
|||
level: |
|||
org.jeecg.modules.system.mapper : info |
|||
|
|||
# mdp平台授权验证服务器访问地址 cloud环境下换成 http://gate,本地调试如果不起验证服务器,可改为 https://www.qingqinkj.com/api/m1/oauth2/oauth2 |
|||
# 客户端必须在数据库表adm.oauth_client_details中配置,否则无法访问 |
|||
mdp: |
|||
api-gate: http://gate |
|||
platform-branch-id: platform-branch-001 |
|||
#配置图片文件上传下载的相关参数 |
|||
arc: |
|||
image-upload-root-path: D:/arcfile/images |
|||
image-download-base-uri: https://127.0.1:7014/ |
|||
file-upload-root-path: D:/arcfile/files |
|||
file-download-base-uri: https://127.0.1:7014/ |
|||
# 站点语言类型cn\en等 |
|||
site-type: cn |
|||
jwt: |
|||
# 如果不对接oauth2授权中心,jwt将有本地系统自行分发自行验证 设为false |
|||
connect-oauth2-server: true |
|||
oauth2: |
|||
server: |
|||
uri: http://oauth2server |
|||
|
|||
@ -0,0 +1,5 @@ |
|||
spring: |
|||
application: |
|||
name: lcode |
|||
profiles: |
|||
active: prod |
|||
@ -0,0 +1,8 @@ |
|||
# 消息转换器,格式为: |
|||
# 技术错误码=业务错误码+消息 |
|||
# 支持动态数据转换.如下面重试次数是通过程序传入的. |
|||
# errcode01=[0760881]您输入的密码不正确,请重新输入,您还可以再试{0}次. |
|||
# |
|||
# |
|||
#tips001=[0760000]网络不给力,请稍后再试. |
|||
t123456162Service27=[0760001]测试错误码转义 |
|||
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0"?> |
|||
<configuration> |
|||
<!-- ch.qos.logback.core.ConsoleAppender 控制台输出 --> |
|||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>[%X{gloNo}][%d{yyyy-MM-dd HH:mm:ss}][%-5level][%logger][%X{reqNo}] -%msg%n</pattern> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<!-- ch.qos.logback.core.rolling.RollingFileAppender 文件日志输出 --> |
|||
<appender name="file" |
|||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<File>logs/mdp_lcode.log</File> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|||
<FileNamePattern>logs/mdp_lcode.%d{yyyy-MM-dd}.%i.log |
|||
</FileNamePattern> |
|||
<MaxHistory>20</MaxHistory> |
|||
<MaxFileSize>100MB</MaxFileSize> |
|||
</rollingPolicy> |
|||
<layout class="ch.qos.logback.classic.PatternLayout"> |
|||
<pattern>[%X{gloNo}][%d{yyyy-MM-dd HH:mm:ss}][%-5level][%logger][%X{reqNo}] -%msg%n</pattern> |
|||
</layout> |
|||
</appender> |
|||
<logger name="java.sql.PreparedStatement" value="DEBUG" /> |
|||
<logger name="java.sql.Connection" value="DEBUG" /> |
|||
<logger name="java.sql.Statement" value="DEBUG" /> |
|||
<logger name="com.ibatis" value="DEBUG" /> |
|||
<logger name="com.ibatis.common.jdbc.SimpleDataSource" value="DEBUG" /> |
|||
<logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG"/> |
|||
<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" value="DEBUG" /> |
|||
<!-- 日志级别 --> |
|||
<root level="debug"> |
|||
<appender-ref ref="file" /> |
|||
<appender-ref ref="console" /> |
|||
</root> |
|||
</configuration> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue