yaoq 2 anni fa
parent
commit
d5af00ca19
9 ha cambiato i file con 299 aggiunte e 2 eliminazioni
  1. +3
    -1
      smtweb-framework/canal/client/canal.example.iml
  2. +6
    -0
      smtweb-framework/canal/client/src/main/resources/client.properties
  3. +108
    -0
      smtweb-framework/canal/file/pom.xml
  4. +13
    -0
      smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileApplication.java
  5. +21
    -0
      smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileConfiguration.java
  6. +41
    -0
      smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileStartedListener.java
  7. +2
    -0
      smtweb-framework/canal/file/src/main/resources/META-INF/spring.factories
  8. +102
    -0
      smtweb-framework/canal/file/src/main/resources/config/application.yaml
  9. +3
    -1
      smtweb-framework/canal/server/canal.deployer.iml

+ 3
- 1
smtweb-framework/canal/client/canal.example.iml Vedi File

@@ -9,7 +9,9 @@
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="canal.example" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


+ 6
- 0
smtweb-framework/canal/client/src/main/resources/client.properties Vedi File

@@ -12,5 +12,11 @@ canal.server.password=
canal.server.filter=scmz\\..*
# 文件存放路径 E:/canalFile
canal.file.path=
# mysql、dmsql、kbsql、oracle
canal.db.type=kbsql
canal.db.driverName=com.kingbase8.Driver
canal.db.jdbcUrl=jdbc:kingbase8://172.28.123.205:54321/HLJTY?useUnicode=true&amp;characterEncoding=utf-8
canal.db.username=system
canal.db.password=system



+ 108
- 0
smtweb-framework/canal/file/pom.xml Vedi File

@@ -0,0 +1,108 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.9</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>cc.smtweb</groupId>
<artifactId>canal.file</artifactId>
<version>1.1.5</version>

<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!--快重启-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 可选 -->
</dependency>


<!--平台-->
<dependency>
<groupId>cc.smtweb</groupId>
<artifactId>sw-system-bpm</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>cc.smtweb</groupId>
<artifactId>sw-framework-core</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>cc.smtweb</groupId>
<artifactId>canal.example</artifactId>
<version>1.1.5</version>
</dependency>

<dependency>
<groupId>cc.smtweb</groupId>
<artifactId>canal.deployer</artifactId>
<version>1.1.5</version>
</dependency>


<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
<version>8.6.0</version>
</dependency>

<dependency>
<groupId>com.dmsql</groupId>
<artifactId>dmsql</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>cc.smtweb</groupId>
<artifactId>canal.deployer</artifactId>
<version>1.1.5</version>
<scope>compile</scope>
</dependency>

</dependencies>

<repositories>
<repository>
<id>nexus-jjkj</id>
<name>Nexus jjkj</name>
<url>http://47.92.149.153:7000/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>

+ 13
- 0
smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileApplication.java Vedi File

@@ -0,0 +1,13 @@
package cc.smtweb.system.canal.file;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class FileApplication {

public static void main(String[] args) {
SpringApplication.run(FileApplication.class, args);
}

}

+ 21
- 0
smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileConfiguration.java Vedi File

@@ -0,0 +1,21 @@
package cc.smtweb.system.canal.file;

import cc.smtweb.framework.core.mvc.config.ControllerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
* @author kevin
*/
@Configuration
@ComponentScan
public class FileConfiguration {
/**
* 配置自定义service扫描路径 {module}/{service}/{method}
*/
@Bean
public ControllerConfig canalConfiguration() {
return new ControllerConfig("canalFile", "cc.smtweb.system.canal.file", null);
}
}

+ 41
- 0
smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/FileStartedListener.java Vedi File

@@ -0,0 +1,41 @@
package cc.smtweb.system.canal.file;

import cc.smtweb.framework.core.annotation.SwStartListener;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.mvc.controller.IStartListener;
import cc.smtweb.framework.core.systask.SysThreadPool;
import cc.smtweb.framework.core.systask.SysThreadWorker;
import cc.smtweb.system.canal.deployer.CanalLauncher;
import lombok.extern.slf4j.Slf4j;

/**
* @Author yaoq
* @Date 2022年09月06日 10:31
* @Description
*/
@Slf4j
@SwStartListener
public class FileStartedListener implements IStartListener {

@Override
public int order() {
return SwConsts.DEFAULT_ORDER + 3;
}


@Override
public void init() {
SwConsts.SysParam.enableCanal = true;
}

@Override
public void run() {
if (!SwConsts.SysParam.enableCanal) return;
SysThreadPool.getInstance().addTask(new SysThreadWorker("canal server") {
@Override
public void localWork() throws Exception {
CanalLauncher.startServer();
}
});
}
}

+ 2
- 0
smtweb-framework/canal/file/src/main/resources/META-INF/spring.factories Vedi File

@@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cc.smtweb.system.canal.file.FileConfiguration

+ 102
- 0
smtweb-framework/canal/file/src/main/resources/config/application.yaml Vedi File

@@ -0,0 +1,102 @@
smtweb:
machine-id: 1
enable-job: false
bpm:
mode: 1
debug: true
code-java-path: 'd:/work/smtweb2/smtweb-framework/canal/file'
db:
type: mysql
default:
rule:
prefix: _smt_
replace: smt_
# 服务模块
devtools:
restart:
enabled: true # 热部署开关
additional-paths: src/main/java #重启目录
server:
port: 8888
servlet:
context-path:
logging:
level:
root: INFO
cc.smtweb: DEBUG
spring:
redis:
host: 127.0.0.1
port: 6379
password:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://139.9.38.43:6032/smt?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://172.28.123.145:4418/smt?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: root
password: Ncmz@2022_jjkj
servlet:
multipart:
max-file-size: 104857600000
max-request-size: 10485760000000
cache:
type: caffeine
cache-names:
- core
- bpm
caffeine:
spec: maximumSize=1024,expireAfterWrite=2h

# canal配置
canal:
file:

# http 规则配置
http-config:
xss: #xss 规则
checkHeader: false #是否进行header校验
checkParameter: true #是否进行parameter校验
logIs: true #是否记录日志
chain: true #是否中断请求
replace: true #是否开启特殊字符替换
checkUrl: true #是否开启特殊url校验
regex:
# 匹配含有字符: alert( )
- .*[A|a][L|l][E|e][R|r][T|t](.*).*
# 匹配含有字符: window.location
- .*[W|w][I|i][N|n][D|d][O|o][W|w].[L|l][O|o][C|c][A|a][T|t][I|i][O|o][N|n].*
# 匹配含有字符:style = x:ex pression ( )
- .*[S|s][T|t][Y|y][L|l][E|e]\\s*=.*[X|x]:[E|e][X|x].*[P|p][R|r][E|e][S|s]{1,2}[I|i][O|o][N|n]\\s*\\(.*\\).*
# 匹配含有字符: document.cookie
- .*[D|d][O|o][C|c][U|u][M|m][E|e][N|n][T|t].[C|c][O|o]{2}[K|k][I|i][E|e].*
# 匹配含有字符: eval( )
- .*[E|e][V|v][A|a][L|l](.*).*
# 匹配含有字符: unescape()
- .*[U|u][N|n][E|e][S|s][C|c][A|a][P|p][E|e](.*).*
# 匹配含有字符: execscript( )
- .*[E|e][X|x][E|e][C|c][S|s][C|c][R|r][I|i][P|p][T|t](.*).*
# 匹配含有字符: msgbox( )
- .*[M|m][S|s][G|g][B|b][O|o][X|x](.*).*
# 匹配含有字符: confirm( )
- .*[C|c][O|o][N|n][F|f][I|i][R|r][M|m](.*).*
# 匹配含有字符: prompt( )
- .*[P|p][R|r][O|o][M|m][P|p][T|t](.*).*
# 匹配含有字符: <script> </script>
- .*<[S|s][C|c][R|r][I|i][P|p][T|t]>.*.*</[S|s][C|c][R|r][I|i][P|p][T|t]>.*
# 匹配含有字符: </script>
- .*</[S|s][C|c][R|r][I|i][P|p][T|t]>.*
# 匹配含有字符: <script>
- .*<[S|s][C|c][R|r][I|i][P|p][T|t]>.*
res: # 响应头规则
configs:
{
Set-Cookie: Secure; HttpOnly,
Referrer-Policy: origin-when-cross-origin,
X-Frame-Options: SAMEORIGIN,
X-XSS-Protection: 1;mode=block ,
X-Download-Options: SAMEORIGIN ,
X-Content-Type-Options: nosniff ,
Content-Security-Policy: default-src 'self'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' http://localhost:7102 https://localhost:7102; style-src 'self' 'unsafe-inline'; connect-src 'self';font-src 'self' data:; ,
Strict-Transport-Security: max-age=31536000;includeSubDomains ,
X-Permitted-Cross-Domain-Policies: master-only
}

+ 3
- 1
smtweb-framework/canal/server/canal.deployer.iml Vedi File

@@ -9,7 +9,9 @@
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="canal.deployer" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


Caricamento…
Annulla
Salva