---添加主数据启动子项目
This commit is contained in:
@ -71,6 +71,8 @@ public class DataLogTools {
|
|||||||
|
|
||||||
private static Map<Class<?>,LogTableInfo> annotations = Maps.newHashMap();
|
private static Map<Class<?>,LogTableInfo> annotations = Maps.newHashMap();
|
||||||
|
|
||||||
|
private static Map<String,Class<?>> entitys = Maps.newHashMap();
|
||||||
|
|
||||||
private static Set<String> logTables = null;
|
private static Set<String> logTables = null;
|
||||||
|
|
||||||
private static Object lock = new Object();
|
private static Object lock = new Object();
|
||||||
@ -720,17 +722,26 @@ public class DataLogTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||||
|
* @param clazz
|
||||||
|
* @param dataId
|
||||||
|
* @return List<DataChangeLog> 返回类型
|
||||||
|
*/
|
||||||
|
public static <T>List<DataChangeLog> findLogsByEntityId(Class<?> clazz,@NonNull Long dataId) {
|
||||||
|
LogTableInfo tabInfo = getAnnotation(clazz);
|
||||||
|
String tableName = parseLogTableName(tabInfo);
|
||||||
|
return findLogsByEntityId(tableName, dataId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 根据数据id获取操作日志
|
* @Description: 根据数据id获取操作日志
|
||||||
* @param klass 数据java类型
|
* @param tableName 表名
|
||||||
* @param dataId 数据id
|
* @param dataId 数据id
|
||||||
* @return List<DataChangeLog> 返回类型
|
* @return List<DataChangeLog> 返回类型
|
||||||
*/
|
*/
|
||||||
public static <T>List<DataChangeLog> findLogsByEntityId(Class<T> klass,@NonNull Long dataId) {
|
public static <T>List<DataChangeLog> findLogsByEntityId(String tableName,@NonNull Long dataId) {
|
||||||
LogTableInfo tabInfo = getAnnotation(klass);
|
|
||||||
String tableName = parseLogTableName(tabInfo);
|
|
||||||
if(initTable(tableName)) {
|
if(initTable(tableName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
82
itc-pcitc-mdm/itc-pcitc-mdm-start/pom.xml
Normal file
82
itc-pcitc-mdm/itc-pcitc-mdm-start/pom.xml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.geg</groupId>
|
||||||
|
<artifactId>itc-pcitc-mdm</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>itc-pcitc-mdm-starter</artifactId>
|
||||||
|
<name>itc-pcitc-mdm-starter</name>
|
||||||
|
<description>itc-pcitc-mdm-starter</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<docker-image-name>pcitc/itc-pcitc-mdm</docker-image-name>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.geg</groupId>
|
||||||
|
<artifactId>itc-ms-system-service</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.yml</include>
|
||||||
|
<include>**/*.properties</include>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.yml</include>
|
||||||
|
<include>**/*.properties</include>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
<include>**/*.vm</include>
|
||||||
|
<include>**/*.ftl</include>
|
||||||
|
<include>**/*.jpg</include>
|
||||||
|
<include>**/*.png</include>
|
||||||
|
<include>**/*.xls</include>
|
||||||
|
<include>**/*.xlsx</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
# 应用名称(在 SkyWalking UI 中显示的服务名)
|
||||||
|
agent.service_name=your-springboot-app
|
||||||
|
# SkyWalking OAP 服务地址(默认本地)
|
||||||
|
collector.backend_service=localhost:11800
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#cp /etc/hosts /etc/hosts.temp
|
||||||
|
|
||||||
|
# 初始化环境变量(设置默认值,避免空变量)
|
||||||
|
APP_NAME=${APP_NAME:-"default-springboot-app"} # 默认服务名
|
||||||
|
SKYWALKING_SERVER=${SKYWALKING_SERVER:-"localhost:11800"} # 默认SkyWalking服务地址
|
||||||
|
ENV_APP_PRO_FILE=${ENV_APP_PRO_FILE:-"test"} # 默认环境为test
|
||||||
|
|
||||||
|
# 初始化Java启动参数(包含是否使用-server模式)
|
||||||
|
java_base="java -javaagent:/opt/agent/skywalking-agent.jar -Dskywalking.agent.service_name=$APP_NAME"
|
||||||
|
export java_base="$java_base -Dskywalking.collector.backend_service=$SKYWALKING_SERVER"
|
||||||
|
|
||||||
|
java_start="$java_base -jar"
|
||||||
|
|
||||||
|
# 根据环境变量区分开发/生产环境配置
|
||||||
|
if [ "$ENV_APP_PRO_FILE" = "prod" ]; then
|
||||||
|
# 生产环境JVM参数
|
||||||
|
export JAVA_OPTS="-Xms1024m -Xmx4096m -Xmn512m -Xss512k -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:G1ReservePercent=20"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500 -XX:G1MixedGCCountTarget=10"
|
||||||
|
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -verbose:gc -Xloggc:/var/log/app/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
|
||||||
|
|
||||||
|
# 生产环境使用-server模式
|
||||||
|
java_start="$java_base -jar -server"
|
||||||
|
else
|
||||||
|
# 开发环境JVM参数
|
||||||
|
export JAVA_OPTS="-Xms512m -Xmx2048m -Xmn256m -Xss512k -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+UseParNewGC"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:CMSMaxAbortablePrecleanTime=5000"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -verbose:gc -Xloggc:./logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"
|
||||||
|
# 开发环境开启远程调试
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 公共配置(编码、时区等)
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Duser.language=zh -Duser.country=CN -Duser.timezone=Asia/Shanghai"
|
||||||
|
|
||||||
|
# SpringBoot 环境配置
|
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=$ENV_APP_PRO_FILE"
|
||||||
|
|
||||||
|
# 输出启动参数
|
||||||
|
echo "启动参数:$java_start $JAVA_OPTS $ENV_APP_FILE_PATH"
|
||||||
|
|
||||||
|
# 执行启动命令(用双引号包裹每个变量)
|
||||||
|
exec $java_start $JAVA_OPTS $ENV_APP_FILE_PATH
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.xjrsoft;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
|
|
||||||
|
import com.pictc.utils.SpringTools;
|
||||||
|
import com.xjrsoft.common.annotation.UniqueNameGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 张福财
|
||||||
|
* 主数据服务---开发使用
|
||||||
|
* 使用时集成到其它模块使用,不作为单独的服务
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||||
|
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
|
||||||
|
@EnableFeignClients
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class ITCMdmApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringTools.logStarter(ITCMdmApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
██████╗ ███████╗ ██████╗ ██╗████████╗ ██████╗
|
||||||
|
██╔════╝ ██╔════╝██╔════╝ ██║╚══██╔══╝██╔════╝
|
||||||
|
██║ ███╗█████╗ ██║ ███╗█████╗██║ ██║ ██║
|
||||||
|
██║ ██║██╔══╝ ██║ ██║╚════╝██║ ██║ ██║
|
||||||
|
╚██████╔╝███████╗╚██████╔╝ ██║ ██║ ╚██████╗
|
||||||
|
╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos: #nacos监控
|
||||||
|
config:
|
||||||
|
server-addr: 127.0.0.1:8848 # nacos 配置中心地址
|
||||||
|
namespace: ITC-MS
|
||||||
|
group: DNE
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
extension-configs:
|
||||||
|
- data-id: global-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: discovery-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: datasource-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: seata-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: redis-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: magic-api.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sa-token.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: camunda.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sentinel-local.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
datalog:
|
||||||
|
db:
|
||||||
|
url: jdbc:kingbase8://127.0.0.1:54321/itc?currentSchema=dne_log_sit
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos: #nacos监控
|
||||||
|
config:
|
||||||
|
server-addr: 47.94.165.164:8848 # nacos 配置中心地址
|
||||||
|
namespace: ITC-MS
|
||||||
|
group: DNE
|
||||||
|
username: nacos
|
||||||
|
password: Lng@123
|
||||||
|
extension-configs:
|
||||||
|
- data-id: global-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: discovery-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: datasource-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: seata-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: redis-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: magic-api.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sa-token.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: camunda.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sentinel-dev.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
server:
|
||||||
|
port: 8099
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: demo-service
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos: #nacos监控
|
||||||
|
config:
|
||||||
|
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||||
|
namespace: ITC-MS
|
||||||
|
group: DNE
|
||||||
|
username: nacos
|
||||||
|
password: Yudean@2025
|
||||||
|
file-extension: yml # 默认配置 ${spring.application.name}-${spring.profiles.active}.${file-extension}
|
||||||
|
refresh-enabled: true
|
||||||
|
extension-configs:
|
||||||
|
- data-id: global.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: discovery.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: datasource.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: seata.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: redis.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: magic-api.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sa-token.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: camunda.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
|
|
||||||
|
- data-id: sentinel.yml
|
||||||
|
refresh: true
|
||||||
|
group: DNE
|
||||||
Reference in New Issue
Block a user