Browse Source

1.patch工程提交

training
zhenghaoyu 1 year ago
parent
commit
b447f09d8b
  1. 19
      blade-service-api/logpm-patch-api/pom.xml
  2. 2
      blade-service-api/pom.xml
  3. 45
      blade-service/logpm-patch/pom.xml
  4. 36
      blade-service/logpm-patch/src/main/java/com/logpm/patch/PatchApplication.java
  5. 39
      blade-service/logpm-patch/src/main/java/com/logpm/patch/config/PatchConfiguration.java
  6. 74
      blade-service/logpm-patch/src/main/java/com/logpm/patch/config/XxlJobConfig.java
  7. 21
      blade-service/logpm-patch/src/main/java/com/logpm/patch/props/PatchProperties.java
  8. 44
      blade-service/logpm-patch/src/main/resources/application-dev.yml
  9. 31
      blade-service/logpm-patch/src/main/resources/application-prod.yml
  10. 31
      blade-service/logpm-patch/src/main/resources/application-test.yml
  11. 41
      blade-service/logpm-patch/src/main/resources/application.yml
  12. 40
      blade-service/logpm-patch/src/main/resources/logback.xml
  13. 3
      blade-service/pom.xml

19
blade-service-api/logpm-patch-api/pom.xml

@ -0,0 +1,19 @@
<?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>org.springblade</groupId>
<artifactId>blade-service-api</artifactId>
<version>3.1.0.RELEASE</version>
</parent>
<groupId>org.springblade</groupId>
<artifactId>logpm-patch-api</artifactId>
<version>3.1.0.RELEASE</version>
<packaging>jar</packaging>
</project>

2
blade-service-api/pom.xml

@ -33,6 +33,8 @@
<module>logpm-statisticsdata-api</module>
<!--老系统数据对接-->
<module>logpm-old-project-api</module>
<!--补丁系统-->
<module>logpm-patch-api</module>
</modules>
<dependencies>

45
blade-service/logpm-patch/pom.xml

@ -0,0 +1,45 @@
<?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>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>3.1.0.RELEASE</version>
</parent>
<artifactId>logpm-patch</artifactId>
<version>${bladex.project.version}</version>
<name>${project.artifactId}</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-auto</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-patch-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<!--Job-->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
</dependencies>
</project>

36
blade-service/logpm-patch/src/main/java/com/logpm/patch/PatchApplication.java

@ -0,0 +1,36 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.patch;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
/**
* Demo启动器
*
* @author Chill
*/
@BladeCloudApplication
public class PatchApplication {
public static void main(String[] args) {
BladeApplication.run(ModuleNameConstant.APPLICATION_PATCH_NAME, PatchApplication.class, args);
}
}

39
blade-service/logpm-patch/src/main/java/com/logpm/patch/config/PatchConfiguration.java

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.patch.config;
import com.logpm.patch.props.PatchProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* 配置feignmybatis包名properties
*
* @author Chill
*/
@Configuration(proxyBeanMethods = false)
@ComponentScan({"org.springblade", "com.logpm"})
@EnableFeignClients({"org.springblade", "com.logpm"})
@MapperScan({"org.springblade.**.mapper.**", "com.logpm.**.mapper.**"})
@EnableConfigurationProperties(PatchProperties.class)
public class PatchConfiguration {
}

74
blade-service/logpm-patch/src/main/java/com/logpm/patch/config/XxlJobConfig.java

@ -0,0 +1,74 @@
package com.logpm.patch.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* xxl-job config
*
* @author xuxueli 2017-04-28
*/
@Configuration(proxyBeanMethods = false)
public class XxlJobConfig {
private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
/**
* 针对多网卡容器内部署等情况可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP
*
* 1引入依赖
* <dependency>
* <groupId>org.springframework.cloud</groupId>
* <artifactId>spring-cloud-commons</artifactId>
* <version>${version}</version>
* </dependency>
*
* 2配置文件或者容器启动变量
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
*
* 3获取IP
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
*/
}

21
blade-service/logpm-patch/src/main/java/com/logpm/patch/props/PatchProperties.java

@ -0,0 +1,21 @@
package com.logpm.patch.props;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "logpm")
public class PatchProperties {
/**
* 名称
*/
private String name;
}

44
blade-service/logpm-patch/src/main/resources/application-dev.yml

@ -0,0 +1,44 @@
#服务器端口
server:
port: 19000
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.patch.master.url}
username: ${blade.datasource.patch.master.username}
password: ${blade.datasource.patch.master.password}
slave:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.patch.slave.url}
username: ${blade.datasource.patch.slave.username}
password: ${blade.datasource.patch.slave.password}

31
blade-service/logpm-patch/src/main/resources/application-prod.yml

@ -0,0 +1,31 @@
#服务器端口
server:
port: 19000
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.prod.url}
# username: ${blade.datasource.prod.username}
# password: ${blade.datasource.prod.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
url: ${blade.datasource.patch.master.url}
username: ${blade.datasource.patch.master.username}
password: ${blade.datasource.patch.master.password}
slave:
url: ${blade.datasource.patch.slave.url}
username: ${blade.datasource.patch.slave.username}
password: ${blade.datasource.patch.slave.password}

31
blade-service/logpm-patch/src/main/resources/application-test.yml

@ -0,0 +1,31 @@
#服务器端口
server:
port: 19000
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.test.url}
# username: ${blade.datasource.test.username}
# password: ${blade.datasource.test.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
druid:
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
url: ${blade.datasource.patch.master.url}
username: ${blade.datasource.patch.master.username}
password: ${blade.datasource.patch.master.password}
slave:
url: ${blade.datasource.patch.slave.url}
username: ${blade.datasource.patch.slave.username}
password: ${blade.datasource.patch.slave.password}

41
blade-service/logpm-patch/src/main/resources/application.yml

@ -0,0 +1,41 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/logpm/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.logpm.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springblade
- com.logpm
#blade配置
blade:
#本地文件上传
file:
remote-mode: true
upload-domain: http://localhost:8999
remote-path: /usr/share/nginx/html
logging:
config: classpath:logback.xml
spring:
main:
allow-circular-references: true
xxl:
job:
accessToken: ''
admin:
addresses: http://127.0.0.1:7009/xxl-job-admin
executor:
appname: logpm-patch-xxljob
ip: 127.0.0.1
logpath: ../data/applogs/logpm-patch-xxljob/jobhandler
logretentiondays: -1
port: 7118

40
blade-service/logpm-patch/src/main/resources/logback.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" debug="false">
<contextName>logback</contextName>
<property name="log.path" value="../data/applogs/ogpm-patch-xxljob/xxl-job-executor-sample-springboot.log"/>
<!-- 彩色日志依赖的渲染类 -->
<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(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>

3
blade-service/pom.xml

@ -38,6 +38,9 @@
<module>logpm-statisticsdata</module>
<!--老系统数据对接-->
<module>logpm-old-project</module>
<!--补丁系统-->
<module>logpm-patch</module>
</modules>
<dependencies>

Loading…
Cancel
Save