初始化
This commit is contained in:
33
approve/.gitignore
vendored
Normal file
33
approve/.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
127
approve/pom.xml
Normal file
127
approve/pom.xml
Normal file
@@ -0,0 +1,127 @@
|
||||
<?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>com.sdm</groupId>
|
||||
<artifactId>SDM</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>approve</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>approve</name>
|
||||
<description>approve</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>3.3.5</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- 引入模块common -->
|
||||
<dependency>
|
||||
<groupId>com.sdm</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- FTP -->
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.11.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.10.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
</dependency>
|
||||
<!-- Actuator for health checks -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</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>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<!-- <resources>-->
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>src/main/resources</directory>-->
|
||||
<!-- </resource>-->
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>libs</directory>-->
|
||||
<!-- <targetPath>BOOT-INF/lib/</targetPath>-->
|
||||
<!-- <includes>-->
|
||||
<!-- <include>*.jar</include>-->
|
||||
<!-- </includes>-->
|
||||
<!-- </resource>-->
|
||||
<!-- </resources>-->
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.sdm.approve;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"com.sdm.approve","com.sdm.common"})
|
||||
@EnableDiscoveryClient
|
||||
@EnableScheduling
|
||||
public class ApproveApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApproveApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import com.sdm.common.utils.AESUtil;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.core.env.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@Component
|
||||
public class DecryptEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
|
||||
Properties props = new Properties(); // 临时存储需要替换的配置
|
||||
// 假设加密密码前缀为 "ENC(",后缀为 ")"
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
for (PropertySource<?> propertySource : propertySources) {
|
||||
if (propertySource instanceof EnumerablePropertySource) {
|
||||
EnumerablePropertySource<?> enumerablePropertySource = (EnumerablePropertySource<?>) propertySource;
|
||||
String[] propertyNames = enumerablePropertySource.getPropertyNames();
|
||||
// 遍历所有配置key:value
|
||||
for (String propertyName : propertyNames) {
|
||||
String propertyVal = environment.getProperty(propertyName);
|
||||
// 根据自己写的规则来解析那些配置是需要解密的
|
||||
if (propertyVal != null && propertyVal.startsWith("ENC(") && propertyVal.endsWith(")")) {
|
||||
// 解析得到加密的数据
|
||||
String encryptedValue = propertyVal.substring(4, propertyVal.length() - 1);
|
||||
// 调用自定义工具类解密
|
||||
String decryptedValue = null;
|
||||
try {
|
||||
decryptedValue = AESUtil.decode(encryptedValue);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 保存需要替换的配置
|
||||
props.put(propertyName, decryptedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 添加解密后的属性到环境中
|
||||
if (!props.isEmpty()) {
|
||||
PropertiesPropertySource pps = new PropertiesPropertySource("decryptedProperties", props);
|
||||
environment.getPropertySources().addFirst(pps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Protocol;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class OkHttpConfiguration {
|
||||
|
||||
@Bean
|
||||
public OkHttpClient okHttpClient() {
|
||||
return new OkHttpClient.Builder()
|
||||
.sslSocketFactory(sslSocketFactory(), x509TrustManager())
|
||||
//是否开启缓存
|
||||
.retryOnConnectionFailure(true)
|
||||
.connectionPool(pool())
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)
|
||||
.hostnameVerifier((hostname, session) -> true)
|
||||
.protocols(Collections.singletonList(Protocol.HTTP_1_1))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public X509TrustManager x509TrustManager() {
|
||||
return new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return new X509Certificate[0];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SSLSocketFactory sslSocketFactory() {
|
||||
try {
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, new TrustManager[]{x509TrustManager()}, new SecureRandom());
|
||||
return sslContext.getSocketFactory();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConnectionPool pool() {
|
||||
return new ConnectionPool(5000, 300, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean(name = "redisTemplate")
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
RedisSerializer<String> redisSerializer = new StringRedisSerializer();
|
||||
|
||||
template.setConnectionFactory(factory);
|
||||
// key序列化方式
|
||||
template.setKeySerializer(redisSerializer);
|
||||
// value序列化
|
||||
template.setValueSerializer(redisSerializer);
|
||||
// value hashmap序列化
|
||||
template.setHashValueSerializer(redisSerializer);
|
||||
// key haspmap序列化
|
||||
template.setHashKeySerializer(redisSerializer);
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean(name = "bytesRedisTemplate")
|
||||
public RedisTemplate<String, byte[]> bytesRedisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, byte[]> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(connectionFactory);
|
||||
// 设置key和value的序列化规则
|
||||
redisTemplate.setValueSerializer(RedisSerializer.byteArray());
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.afterPropertiesSet();
|
||||
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import com.sdm.approve.filter.AuthFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class RequestConfig {
|
||||
@Bean
|
||||
public AuthFilter authFilter() {
|
||||
return new AuthFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<AuthFilter> registrationBean() {
|
||||
FilterRegistrationBean<AuthFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(authFilter());
|
||||
registration.setName("authFilter");
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setOrder(0);
|
||||
return registration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
/**
|
||||
* 解决多个定时任务单线程有任务不能执行的问题
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ScheduledTaskConfig implements SchedulingConfigurer {
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
||||
taskScheduler.setPoolSize(5);
|
||||
taskScheduler.initialize();
|
||||
taskRegistrar.setTaskScheduler(taskScheduler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.sdm.approve.config;
|
||||
|
||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public OpenAPI openAPI() {
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("SPDM系统-审批模块")
|
||||
.description("SPDM系统-审批模块接口文档")
|
||||
.version("V1"))
|
||||
.externalDocs(new ExternalDocumentation()
|
||||
.description("审批模块")
|
||||
.url("/"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sdm.approve.config.mybatis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Author xuyundi
|
||||
* @Date 2023/7/21
|
||||
* @Note
|
||||
*/
|
||||
@Slf4j
|
||||
public class DBContextHolder {
|
||||
private static final ThreadLocal<DBTypeEnum> contextHolder = new ThreadLocal<>();
|
||||
|
||||
private static final AtomicInteger counter = new AtomicInteger(-1);
|
||||
|
||||
public static void set(DBTypeEnum dbType) {
|
||||
contextHolder.set(dbType);
|
||||
}
|
||||
|
||||
public static DBTypeEnum get() {
|
||||
return contextHolder.get();
|
||||
}
|
||||
|
||||
public static void master() {
|
||||
set(DBTypeEnum.MASTER);
|
||||
log.info("切换到master");
|
||||
}
|
||||
|
||||
public static void slave() {
|
||||
set(DBTypeEnum.SLAVE);
|
||||
log.info("切换到slave");
|
||||
|
||||
// 如果有多个从库,可通过轮询进行切换
|
||||
// int index = counter.getAndIncrement() % 2;
|
||||
// if (counter.get() > 9999) {
|
||||
// counter.set(-1);
|
||||
// }
|
||||
// if (index == 0) {
|
||||
// set(DBTypeEnum.SLAVE1);
|
||||
// log.info("切换到slave1");
|
||||
// }else {
|
||||
// set(DBTypeEnum.SLAVE2);
|
||||
// log.info("切换到slave2");
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sdm.approve.config.mybatis;
|
||||
|
||||
/**
|
||||
* @Author xuyundi
|
||||
* @Date 2023/7/21
|
||||
* @Note
|
||||
*/
|
||||
public enum DBTypeEnum {
|
||||
MASTER, SLAVE
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.sdm.approve.config.mybatis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.executor.keygen.SelectKeyGenerator;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @Author xuyundi
|
||||
* @Date 2023/7/21
|
||||
* @Note
|
||||
*/
|
||||
@Slf4j
|
||||
@Intercepts({
|
||||
@Signature(type = Executor.class, method = "update", args = {
|
||||
MappedStatement.class, Object.class}),
|
||||
@Signature(type = Executor.class, method = "query", args = {
|
||||
MappedStatement.class, Object.class, RowBounds.class,
|
||||
ResultHandler.class})})
|
||||
public class DatabasePlugin implements Interceptor {
|
||||
|
||||
private static final String REGEX = ".*insert\\u0020.*|.*delete\\u0020.*|.*update\\u0020.*";
|
||||
|
||||
private static final Map<String, DBTypeEnum> cacheMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
|
||||
boolean synchronizationActive = TransactionSynchronizationManager.isSynchronizationActive();
|
||||
if (!synchronizationActive) {
|
||||
Object[] objects = invocation.getArgs();
|
||||
MappedStatement ms = (MappedStatement) objects[0];
|
||||
|
||||
DBTypeEnum databaseType = null;
|
||||
|
||||
if ((databaseType = cacheMap.get(ms.getId())) == null) {
|
||||
//读方法
|
||||
if (ms.getSqlCommandType().equals(SqlCommandType.SELECT)) {
|
||||
//!selectKey 为自增id查询主键(SELECT LAST_INSERT_ID() )方法,使用主库
|
||||
if (ms.getId().contains(SelectKeyGenerator.SELECT_KEY_SUFFIX)) {
|
||||
databaseType = DBTypeEnum.MASTER;
|
||||
} else {
|
||||
BoundSql boundSql = ms.getSqlSource().getBoundSql(objects[1]);
|
||||
String sql = boundSql.getSql().toLowerCase(Locale.CHINA).replaceAll("[\\t\\n\\r]", " ");
|
||||
if (sql.matches(REGEX)) {
|
||||
databaseType = DBTypeEnum.MASTER;
|
||||
} else {
|
||||
databaseType = DBTypeEnum.SLAVE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
databaseType = DBTypeEnum.MASTER;
|
||||
}
|
||||
// log.warn("设置方法[{}] use [{}] Strategy, SqlCommandType [{}]..", ms.getId(), databaseType.name(), ms.getSqlCommandType().name());
|
||||
cacheMap.put(ms.getId(), databaseType);
|
||||
}
|
||||
DBContextHolder.set(databaseType);
|
||||
}
|
||||
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
if (target instanceof Executor) {
|
||||
return Plugin.wrap(target, this);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.sdm.approve.config.mybatis;
|
||||
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @Author xuyundi
|
||||
* @Date 2023/7/21
|
||||
* @Note
|
||||
*/
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return DBContextHolder.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.sdm.approve.config.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author xuyundi
|
||||
* @Date 2023/7/21
|
||||
* @Note
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.sdm.approve.dao", sqlSessionFactoryRef = "mybatisSqlSessionFactoryAdaptor")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
|
||||
@Value("${spring.datasource.slave.enable}")
|
||||
private boolean slaveEnable;
|
||||
|
||||
// /**
|
||||
// * mybatis-plus分页插件
|
||||
// */
|
||||
// @Bean
|
||||
// public PaginationInterceptor paginationInterceptor() {
|
||||
// PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
// paginationInterceptor.setDialectType(DBType.MYSQL.getDb());
|
||||
// return paginationInterceptor;
|
||||
// }
|
||||
|
||||
@Bean(name = "masterDataSource")
|
||||
@Qualifier("masterDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.master")
|
||||
public DataSource masterDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name = "slaveDataSource")
|
||||
@Qualifier("slaveDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.slave")
|
||||
public DataSource slaveDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造多数据源连接池
|
||||
* Master 数据源连接池采用 HikariDataSource
|
||||
* Slave 数据源连接池采用 DruidDataSource
|
||||
*
|
||||
* @param master
|
||||
* @param slave
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(@Qualifier("masterDataSource") DataSource master,
|
||||
@Qualifier("slaveDataSource") DataSource slave) {
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DBTypeEnum.MASTER, master);
|
||||
targetDataSources.put(DBTypeEnum.SLAVE, slave);
|
||||
|
||||
DynamicDataSource dataSource = new DynamicDataSource();
|
||||
dataSource.setTargetDataSources(targetDataSources);// 该方法是AbstractRoutingDataSource的方法
|
||||
dataSource.setDefaultTargetDataSource(slave);// 默认的datasource设置为myTestDbDataSourcereturn dataSource;
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@Bean(name = "mybatisSqlSessionFactoryAdaptor")
|
||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(@Qualifier("masterDataSource") DataSource master,
|
||||
@Qualifier("slaveDataSource") DataSource slave) throws IOException {
|
||||
MybatisSqlSessionFactoryBean fb = new MybatisSqlSessionFactoryBean();
|
||||
fb.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/*.xml"));
|
||||
fb.setDataSource(this.dataSource(master, slave));
|
||||
// 设置开启下划线转驼峰
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
fb.setConfiguration(configuration);
|
||||
// 是否启动多数据源配置,目的是方便多环境下在本地环境调试,不影响其他环境
|
||||
if (slaveEnable) {
|
||||
fb.setPlugins(new DatabasePlugin());
|
||||
}
|
||||
return fb;
|
||||
}
|
||||
|
||||
}
|
||||
45
approve/src/main/java/com/sdm/approve/filter/AuthFilter.java
Normal file
45
approve/src/main/java/com/sdm/approve/filter/AuthFilter.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.sdm.approve.filter;
|
||||
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
//import com.sdm.approve.service.UserService;
|
||||
import jakarta.servlet.*;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
@Slf4j
|
||||
public class AuthFilter implements Filter {
|
||||
// @Resource
|
||||
// private UserService userService;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
Filter.super.init(filterConfig);
|
||||
log.info("----------- AuthFilter init ----------");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
if (servletRequest instanceof HttpServletRequest) {
|
||||
HttpServletRequest req = (HttpServletRequest) servletRequest;
|
||||
String jobNumber = StringUtils.isEmpty(req.getHeader("jobNumber")) ? "" : req.getHeader("jobNumber");
|
||||
ThreadLocalContext.getCommonHeader().setJobNumber(jobNumber);
|
||||
ThreadLocalContext.getCommonHeader().setCompany(req.getHeader("company"));
|
||||
ThreadLocalContext.getCommonHeader().setSessionId(req.getHeader("sessionId"));
|
||||
// User user = userService.getUserByIdCode(idCode);
|
||||
// if (user != null) {
|
||||
// ThreadLocalContext.setUserContext(new UserContext(user));
|
||||
// }
|
||||
}
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
Filter.super.destroy();
|
||||
log.info("----------- AuthFilter destroy ----------");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.sdm.approve.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface PerformanceService {
|
||||
|
||||
}
|
||||
1
approve/src/main/resources/META-INF/spring.factories
Normal file
1
approve/src/main/resources/META-INF/spring.factories
Normal file
@@ -0,0 +1 @@
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=com.sdm.approve.config.DecryptEnvironmentPostProcessor
|
||||
102
approve/src/main/resources/application-dev.yml
Normal file
102
approve/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,102 @@
|
||||
server:
|
||||
port: 7103
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: approve
|
||||
datasource:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
master:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
slave:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
enable: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.2.166:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
enabled: true
|
||||
namespace: 3
|
||||
# username: nacos
|
||||
# password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
data:
|
||||
redis:
|
||||
# Redis默认情况下有16个分片(库),这里配置具体使用的分片,默认是0
|
||||
database: 0
|
||||
# redis服务器地址(填写自己的服务器地址)
|
||||
host: 192.168.2.166
|
||||
# redis端口(默认6379)
|
||||
port: 6379
|
||||
#redis连接超时等待,10秒
|
||||
timeout: PT10S
|
||||
# redis访问密码(默认为空)
|
||||
password:
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-active: 50
|
||||
# 连接池中的最大空闲连接 默认 8
|
||||
max-idle: 20
|
||||
# 连接池中的最小空闲连接 默认 0
|
||||
min-idle: 1
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1,这里配置10s
|
||||
max-wait: PT10S
|
||||
# password:
|
||||
# sentinel:
|
||||
# master: mymaster
|
||||
# nodes: 10.18.109.50:26379,10.18.109.51:26379,10.18.109.52:26379
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件的最大值
|
||||
max-file-size: 500MB
|
||||
# 上传文件总的最大值
|
||||
max-request-size: 10240MB
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
auto-mapping-behavior: full
|
||||
# cache-enabled: true
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
global-config:
|
||||
# 逻辑删除配置
|
||||
db-config:
|
||||
# 删除前
|
||||
logic-not-delete-value: 1
|
||||
# 删除后
|
||||
logic-delete-value: 0
|
||||
|
||||
#showSql
|
||||
#logging:
|
||||
# level:
|
||||
# com.sdm.dao: debug
|
||||
|
||||
lombok:
|
||||
anyConstructor:
|
||||
addConstructorProperties: true
|
||||
|
||||
file:
|
||||
rootPath: /data/home/sdm
|
||||
|
||||
#logging:
|
||||
# config: ./config/logback.xml
|
||||
93
approve/src/main/resources/application-local.yml
Normal file
93
approve/src/main/resources/application-local.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
server:
|
||||
port: 7103
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: approve
|
||||
datasource:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
master:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
slave:
|
||||
username: root
|
||||
password: mysql
|
||||
jdbc-url: jdbc:mysql://192.168.2.166:3306/sdm_base_line?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
enable: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.2.166:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
enabled: true
|
||||
namespace: 3
|
||||
# username: nacos
|
||||
# password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
data:
|
||||
redis:
|
||||
# Redis默认情况下有16个分片(库),这里配置具体使用的分片,默认是0
|
||||
database: 0
|
||||
# redis服务器地址(填写自己的服务器地址)
|
||||
host: 192.168.2.166
|
||||
# redis端口(默认6379)
|
||||
port: 6379
|
||||
#redis连接超时等待,10秒
|
||||
timeout: PT10S
|
||||
# redis访问密码(默认为空)
|
||||
password:
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-active: 50
|
||||
# 连接池中的最大空闲连接 默认 8
|
||||
max-idle: 20
|
||||
# 连接池中的最小空闲连接 默认 0
|
||||
min-idle: 1
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1,这里配置10s
|
||||
max-wait: PT10S
|
||||
# password:
|
||||
# sentinel:
|
||||
# master: mymaster
|
||||
# nodes: 10.18.109.50:26379,10.18.109.51:26379,10.18.109.52:26379
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件的最大值
|
||||
max-file-size: 500MB
|
||||
# 上传文件总的最大值
|
||||
max-request-size: 10240MB
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
auto-mapping-behavior: full
|
||||
# cache-enabled: true
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
global-config:
|
||||
# 逻辑删除配置
|
||||
db-config:
|
||||
# 删除前
|
||||
logic-not-delete-value: 1
|
||||
# 删除后
|
||||
logic-delete-value: 0
|
||||
|
||||
#showSql
|
||||
#logging:
|
||||
# level:
|
||||
# com.sdm.dao: debug
|
||||
|
||||
lombok:
|
||||
anyConstructor:
|
||||
addConstructorProperties: true
|
||||
|
||||
file:
|
||||
rootPath: /data/home/sdm
|
||||
|
||||
#logging:
|
||||
# config: ./config/logback.xml
|
||||
123
approve/src/main/resources/application-prod.yml
Normal file
123
approve/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,123 @@
|
||||
server:
|
||||
port: 7107
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: approve
|
||||
datasource:
|
||||
master:
|
||||
username: root
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
jdbc-url: jdbc:mysql://172.27.2.238:3306/spdm_prod?useUnicode=true&characterEncoding=utf-8&useSSL=true&clientCertificateKeyStoreUrl=file:/opt/spdm/mysql_ssl/keystoremysql&clientCertificateKeyStorePassword=guangqi&trustCertificateKeyStoreUrl=file:/opt/spdm/mysql_ssl/truststoremysql&trustCertificateKeyStorePassword=guangqi&serverTimezone=Asia/Shanghai
|
||||
# jdbc-url: jdbc:mysql://10.30.10.210:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
slave:
|
||||
username: root
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
jdbc-url: jdbc:mysql://172.27.2.238:3306/spdm_prod?useUnicode=true&characterEncoding=utf-8&useSSL=true&clientCertificateKeyStoreUrl=file:/opt/spdm/mysql_ssl/keystoremysql&clientCertificateKeyStorePassword=guangqi&trustCertificateKeyStoreUrl=file:/opt/spdm/mysql_ssl/truststoremysql&trustCertificateKeyStorePassword=guangqi&serverTimezone=Asia/Shanghai
|
||||
# jdbc-url: jdbc:mysql://10.30.10.210:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
enable: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 172.27.2.238:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
enabled: true
|
||||
username: nacos
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
namespace: 3
|
||||
data:
|
||||
redis:
|
||||
# Redis默认情况下有16个分片(库),这里配置具体使用的分片,默认是0
|
||||
database: 1
|
||||
# redis服务器地址(填写自己的服务器地址)
|
||||
host: 172.27.2.238
|
||||
# redis端口(默认6379)
|
||||
port: 6379
|
||||
#redis连接超时等待,10秒
|
||||
timeout: PT10S
|
||||
# redis访问密码(默认为空)
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-active: 50
|
||||
# 连接池中的最大空闲连接 默认 8
|
||||
max-idle: 20
|
||||
# 连接池中的最小空闲连接 默认 0
|
||||
min-idle: 1
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1,这里配置10s
|
||||
max-wait: PT10S
|
||||
# password:
|
||||
# sentinel:
|
||||
# master: mymaster
|
||||
# nodes: 10.18.109.50:26379,10.18.109.51:26379,10.18.109.52:26379
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件的最大值
|
||||
max-file-size: 500MB
|
||||
# 上传文件总的最大值
|
||||
max-request-size: 10240MB
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
auto-mapping-behavior: full
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
global-config:
|
||||
# 逻辑删除配置
|
||||
db-config:
|
||||
# 删除前
|
||||
logic-not-delete-value: 1
|
||||
# 删除后
|
||||
logic-delete-value: 0
|
||||
|
||||
#showSql
|
||||
#logging:
|
||||
# level:
|
||||
# com.sdm.dao: debug
|
||||
|
||||
lombok:
|
||||
anyConstructor:
|
||||
addConstructorProperties: true
|
||||
|
||||
file:
|
||||
rootPath: /SPDM/prod_server
|
||||
viewDataPath: /SPDM/simright/viewdata
|
||||
|
||||
hpc:
|
||||
url: http://172.27.3.135/JSONAPI/JSONAPI.ashx
|
||||
# 0单机,1执行和文件传输分开
|
||||
fileType: 0
|
||||
postName: root
|
||||
postCode: '&bwM%Tgsn@cw'
|
||||
postServer: 10.1.3.166
|
||||
#后处理执行模式,0本机,1ssh到其他机器
|
||||
postType: 0
|
||||
#最多同时执行的后处理数量
|
||||
postCount: 2
|
||||
|
||||
idme:
|
||||
tenantId: 700993435561107456
|
||||
# prefixUrl: https://10.30.8.192/rdm_d7cfc15006a04012934fcbb120ef3f18_app/services/
|
||||
prefixUrl: https://idme-runtime.gacrnd.com/rdm_9630dbf335434b5aa5a4a5d9f655876c_app/services/
|
||||
privateKeyStr: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2Lt/AHP9kPCqQuGxpLEfsE9JmwdNe1DyvWQGC8l4oKOIIBuJRJr2DlVcdfIT1KO49mmP4ucS10OoxGgXclW24BBzvGtQFJ6aF9e7pHq3m/lq6zAVTV8smr23XBe6+n8rDaG0IEtFCnsyizA/idzcKs3KSnSXN9AU0fwI+nAJZ8896liK/A5H/YYnVxvJlgy4/fGdHzgEjzFbi54AqfZTfcFbYA5W0S1h6L4TE/BSVV6cgtL3bpIUQuaLKiPP/E//PwNU7aZ11WaopIkXxB15cZ7JOXHpyHs49sdShIDY+75L8QKykWX7xm/Kg+p2y1HmjpK0sYDZwgc2B3D/myTDlAgMBAAECggEAM5JhVIjg4wcFJaKPTdZzJakWzm/f3eBGrXyMqPzjGos4MP2B42cMDsuftYEiQiQsDNQ/qJEt1ioloXC0aBUE0iqX5je5/RuUUCemUeeVYuZt2KMYftdDctgGR/At/VhOlbJh6v8oras2Un9hn8IPmr/hlw9VPE/viUTK5d5T7BJUqYxiakEVYofnUWeOGvQJCsC8HT32kMsl3U3zCtut5t2v4afV+16yB8CasBYpgWZ9TBbh8FldxngEvHTJwNSIEm0KR2puFDIwctEvHxd8bxbNYMYfQL0KBW6f2GZQ061zoOQzwo4ZAH/foVq2WrUPp9KTzhawG8NqLOjpQHodAQKBgQD+T3VBda3gANhX3Ti5cmR+N9nOlYp9xifkaC0kcrFcFIVTbK/f1OobPmUQkXoGKqI+swc6Z3wvmM/BT8qGCLCQIjhL7oiIGks6ALZYFSO4rTaP16qL37utlnp3exinEhnq0Yb8u9VpVjC/5v7uOdKwWd0ZXjvbMudDc9bHukMxXQKBgQC3ZL0kF7hkHiVDud5Dg0NIY1jCc90ENfzj2J6I23jddodYprjVu1POpEvM1jb3rpmbZOYsCJb5En5QePTgsWq1rliPpD67Etsm5g2glJhPmRGcc/9RDr2AOArNip9U+IhICbhonKaWkJaUoKvD7k6WODJG2kAzPqiyrLkabn3dKQKBgF1T5bEvMa86QCsGmZGdBHo5nuosgRWlSfCNtrtgh+xF76PtCCI5rexvmoFZEhH/RWmDJAzv+2gwSVYlJSrJN5q9pDFhiaOBGshfiIuMvn5AuvxQ5lrMscCDr8/3UdXGU9KUMFjByhENO3jBmh7tA4AKipSLu6W26Z4cfd7wYUZVAoGBAJvfPXstxgUiMh4MHkNXj5o5BjnP7GwlztmBRc2gbGwe0A6jNbpDS4n4zow9Dd8aQWh4K8IFUvxDoaSYCdnoMYBVvOPpf3/VGPtI0RBI++O7f+JwHPMyChKuj0//oEjCLGK+EESp0FVscu/EV/lh1N2Myf66hZKIkS277F/wxX1xAoGBAIleLj+Yl4G/QAj4Cp99rEF7LvClooLsSa1s344xe5F6IWdd3jk5UlUywPeLD+x2aiPKYra/4W7msfAwLhhjaADPHtqp4q7Xm60kWkuTfWZe0hRvcH+lnar1gYksJOa2jaosYTAiUR59VOzGaQqgJ6oVHV4PlE5Cv5xO0Rvg2dQe
|
||||
userId: PerformancePlanningV
|
||||
userName: SPDMSystem
|
||||
|
||||
ftp:
|
||||
host: 172.27.3.135
|
||||
port: 6318
|
||||
|
||||
#hpc定时任务开关
|
||||
scheduled:
|
||||
cleanZip: 0 0 4 * * ?
|
||||
getProjectSize: 0 0/30 9-19 * * ?
|
||||
syncHpcTaskStatus: 30 * * * * ?
|
||||
taskResultSync: 0 0/1 * * * ?
|
||||
|
||||
loadcaseNotice: 0 0 9 * * ?
|
||||
updateExeStatus: 0 0 4 * * ?
|
||||
syncUser: 0 0 4 * * ?
|
||||
123
approve/src/main/resources/application-test.yml
Normal file
123
approve/src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,123 @@
|
||||
server:
|
||||
port: 7007
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: approve
|
||||
datasource:
|
||||
master:
|
||||
username: root
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
jdbc-url: jdbc:mysql://172.27.2.235:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
# jdbc-url: jdbc:mysql://10.30.10.210:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
slave:
|
||||
username: root
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
jdbc-url: jdbc:mysql://172.27.2.235:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
# jdbc-url: jdbc:mysql://10.30.10.210:3306/spdm?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
enable: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 172.27.2.238:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
enabled: true
|
||||
username: nacos
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
data:
|
||||
redis:
|
||||
# Redis默认情况下有16个分片(库),这里配置具体使用的分片,默认是0
|
||||
database: 0
|
||||
# redis服务器地址(填写自己的服务器地址)
|
||||
host: 172.27.2.238
|
||||
# redis端口(默认6379)
|
||||
port: 6379
|
||||
#redis连接超时等待,10秒
|
||||
timeout: PT10S
|
||||
# redis访问密码(默认为空)
|
||||
password: ENC(+QKYnI6gAYu1SbLaZQTkZA==)
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-active: 50
|
||||
# 连接池中的最大空闲连接 默认 8
|
||||
max-idle: 20
|
||||
# 连接池中的最小空闲连接 默认 0
|
||||
min-idle: 1
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1,这里配置10s
|
||||
max-wait: PT10S
|
||||
# password:
|
||||
# sentinel:
|
||||
# master: mymaster
|
||||
# nodes: 10.18.109.50:26379,10.18.109.51:26379,10.18.109.52:26379
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件的最大值
|
||||
max-file-size: 500MB
|
||||
# 上传文件总的最大值
|
||||
max-request-size: 10240MB
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
auto-mapping-behavior: full
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
global-config:
|
||||
# 逻辑删除配置
|
||||
db-config:
|
||||
# 删除前
|
||||
logic-not-delete-value: 1
|
||||
# 删除后
|
||||
logic-delete-value: 0
|
||||
|
||||
#showSql
|
||||
#logging:
|
||||
# level:
|
||||
# com.sdm.dao: debug
|
||||
|
||||
lombok:
|
||||
anyConstructor:
|
||||
addConstructorProperties: true
|
||||
|
||||
file:
|
||||
rootPath: /SPDM/server
|
||||
viewDataPath: /SPDM/simright/viewdata
|
||||
|
||||
hpc:
|
||||
url: http://172.27.3.135/JSONAPI/JSONAPI.ashx
|
||||
# 0单机,1执行和文件传输分开
|
||||
fileType: 0
|
||||
postName: root
|
||||
postCode: '&bwM%Tgsn@cw'
|
||||
postServer: 10.1.3.166
|
||||
#后处理执行模式,0本机,1ssh到其他机器
|
||||
postType: 0
|
||||
#最多同时执行的后处理数量
|
||||
postCount: 2
|
||||
|
||||
idme:
|
||||
tenantId: 657153814494711808
|
||||
prefixUrl: https://10.30.8.192/rdm_d7cfc15006a04012934fcbb120ef3f18_app/services/
|
||||
# prefixUrl: https://idme-sit-runtime.gacrnd.com/rdm_d7cfc15006a04012934fcbb120ef3f18_app/services/
|
||||
privateKeyStr: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2Lt/AHP9kPCqQuGxpLEfsE9JmwdNe1DyvWQGC8l4oKOIIBuJRJr2DlVcdfIT1KO49mmP4ucS10OoxGgXclW24BBzvGtQFJ6aF9e7pHq3m/lq6zAVTV8smr23XBe6+n8rDaG0IEtFCnsyizA/idzcKs3KSnSXN9AU0fwI+nAJZ8896liK/A5H/YYnVxvJlgy4/fGdHzgEjzFbi54AqfZTfcFbYA5W0S1h6L4TE/BSVV6cgtL3bpIUQuaLKiPP/E//PwNU7aZ11WaopIkXxB15cZ7JOXHpyHs49sdShIDY+75L8QKykWX7xm/Kg+p2y1HmjpK0sYDZwgc2B3D/myTDlAgMBAAECggEAM5JhVIjg4wcFJaKPTdZzJakWzm/f3eBGrXyMqPzjGos4MP2B42cMDsuftYEiQiQsDNQ/qJEt1ioloXC0aBUE0iqX5je5/RuUUCemUeeVYuZt2KMYftdDctgGR/At/VhOlbJh6v8oras2Un9hn8IPmr/hlw9VPE/viUTK5d5T7BJUqYxiakEVYofnUWeOGvQJCsC8HT32kMsl3U3zCtut5t2v4afV+16yB8CasBYpgWZ9TBbh8FldxngEvHTJwNSIEm0KR2puFDIwctEvHxd8bxbNYMYfQL0KBW6f2GZQ061zoOQzwo4ZAH/foVq2WrUPp9KTzhawG8NqLOjpQHodAQKBgQD+T3VBda3gANhX3Ti5cmR+N9nOlYp9xifkaC0kcrFcFIVTbK/f1OobPmUQkXoGKqI+swc6Z3wvmM/BT8qGCLCQIjhL7oiIGks6ALZYFSO4rTaP16qL37utlnp3exinEhnq0Yb8u9VpVjC/5v7uOdKwWd0ZXjvbMudDc9bHukMxXQKBgQC3ZL0kF7hkHiVDud5Dg0NIY1jCc90ENfzj2J6I23jddodYprjVu1POpEvM1jb3rpmbZOYsCJb5En5QePTgsWq1rliPpD67Etsm5g2glJhPmRGcc/9RDr2AOArNip9U+IhICbhonKaWkJaUoKvD7k6WODJG2kAzPqiyrLkabn3dKQKBgF1T5bEvMa86QCsGmZGdBHo5nuosgRWlSfCNtrtgh+xF76PtCCI5rexvmoFZEhH/RWmDJAzv+2gwSVYlJSrJN5q9pDFhiaOBGshfiIuMvn5AuvxQ5lrMscCDr8/3UdXGU9KUMFjByhENO3jBmh7tA4AKipSLu6W26Z4cfd7wYUZVAoGBAJvfPXstxgUiMh4MHkNXj5o5BjnP7GwlztmBRc2gbGwe0A6jNbpDS4n4zow9Dd8aQWh4K8IFUvxDoaSYCdnoMYBVvOPpf3/VGPtI0RBI++O7f+JwHPMyChKuj0//oEjCLGK+EESp0FVscu/EV/lh1N2Myf66hZKIkS277F/wxX1xAoGBAIleLj+Yl4G/QAj4Cp99rEF7LvClooLsSa1s344xe5F6IWdd3jk5UlUywPeLD+x2aiPKYra/4W7msfAwLhhjaADPHtqp4q7Xm60kWkuTfWZe0hRvcH+lnar1gYksJOa2jaosYTAiUR59VOzGaQqgJ6oVHV4PlE5Cv5xO0Rvg2dQe
|
||||
userId: PerformancePlanningV
|
||||
userName: SPDMDevM
|
||||
|
||||
ftp:
|
||||
host: 172.27.3.135
|
||||
port: 6318
|
||||
|
||||
#hpc定时任务开关
|
||||
scheduled:
|
||||
cleanZip: 0 0 4 * * ?
|
||||
getProjectSize: 0 0/30 9-19 * * ?
|
||||
syncHpcTaskStatus: 30 * * * * ?
|
||||
taskResultSync: 0 0/1 * * * ?
|
||||
|
||||
loadcaseNotice: 0 0 9 * * ?
|
||||
updateExeStatus: 0 0 4 * * ?
|
||||
syncUser: 0 0 4 * * ?
|
||||
3
approve/src/main/resources/application.yml
Normal file
3
approve/src/main/resources/application.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
44
approve/src/main/resources/logback.xml
Normal file
44
approve/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr([%15.15t]){faint} %clr(%logger){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<property name="LOG_HOME" value="/opt/sdm/approve/log" />
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/console.log.%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<TotalSizeCap>500MB</TotalSizeCap>
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
<!--日志文件最大的大小-->
|
||||
<!-- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
|
||||
<!-- <MaxFileSize>10MB</MaxFileSize>-->
|
||||
<!-- </triggeringPolicy>-->
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user