From 0bea49855d7388a4be61683d98ba577f3bbd575c Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Tue, 23 Jan 2024 14:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E5=9F=BA=E7=A1=80=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ModuleNameConstant.java | 5 ++ blade-service-api/logpm-supervise-api/pom.xml | 18 ++++++ blade-service-api/pom.xml | 2 + blade-service/logpm-supervise/pom.xml | 63 +++++++++++++++++++ .../logpm/supervise/SuperviseApplication.java | 21 +++++++ .../config/SuperviseConfiguration.java | 39 ++++++++++++ .../launcher/BasicLauncherServiceImpl.java | 60 ++++++++++++++++++ .../src/main/resources/application-dev.yml | 45 +++++++++++++ .../src/main/resources/application-prod.yml | 45 +++++++++++++ .../src/main/resources/application-test.yml | 45 +++++++++++++ .../src/main/resources/application.yml | 39 ++++++++++++ .../src/main/resources/logback.xml | 40 ++++++++++++ blade-service/pom.xml | 2 + 13 files changed, 424 insertions(+) create mode 100644 blade-service-api/logpm-supervise-api/pom.xml create mode 100644 blade-service/logpm-supervise/pom.xml create mode 100644 blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java create mode 100644 blade-service/logpm-supervise/src/main/java/com/logpm/supervise/config/SuperviseConfiguration.java create mode 100644 blade-service/logpm-supervise/src/main/java/com/logpm/supervise/launcher/BasicLauncherServiceImpl.java create mode 100644 blade-service/logpm-supervise/src/main/resources/application-dev.yml create mode 100644 blade-service/logpm-supervise/src/main/resources/application-prod.yml create mode 100644 blade-service/logpm-supervise/src/main/resources/application-test.yml create mode 100644 blade-service/logpm-supervise/src/main/resources/application.yml create mode 100644 blade-service/logpm-supervise/src/main/resources/logback.xml diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index 91b0e0ce2..580a59b0f 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -68,4 +68,9 @@ public interface ModuleNameConstant { */ String APPLICATION_PATCH_NAME = "logpm-patch"+DEVAUTH; + /** + * 督察模块 + */ + String APPLICATION_SUPERVISE_NAME = "logpm-supervise"+DEVAUTH; + } diff --git a/blade-service-api/logpm-supervise-api/pom.xml b/blade-service-api/logpm-supervise-api/pom.xml new file mode 100644 index 000000000..e1619d228 --- /dev/null +++ b/blade-service-api/logpm-supervise-api/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + org.springblade + blade-service-api + 3.2.0.RELEASE + + + org.springblade + logpm-supervise-api + 3.2.0.RELEASE + + + diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index d9d8e999f..c9dd22fa4 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -35,6 +35,8 @@ logpm-old-project-api logpm-patch-api + + logpm-supervise-api diff --git a/blade-service/logpm-supervise/pom.xml b/blade-service/logpm-supervise/pom.xml new file mode 100644 index 000000000..c6b0f329e --- /dev/null +++ b/blade-service/logpm-supervise/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + + org.springblade + blade-service + 3.2.0.RELEASE + + + org.springblade + logpm-supervise + 3.2.0.RELEASE + + + + + org.springblade + blade-core-boot + + + org.springblade + blade-starter-swagger + + + org.springblade + blade-starter-excel + + + + org.springblade + blade-core-auto + provided + + + + + + + + com.spotify + dockerfile-maven-plugin + + ${docker.username} + ${docker.password} + ${docker.registry.url}/${docker.namespace}/${project.artifactId} + ${project.version} + true + + target/${project.build.finalName}.jar + + false + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java new file mode 100644 index 000000000..52e2666af --- /dev/null +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java @@ -0,0 +1,21 @@ + +package com.logpm.supervise; + + +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.cloud.client.BladeCloudApplication; +import org.springblade.core.launch.BladeApplication; + +/** + * Basic启动器 + * + * @author lmy + */ +@BladeCloudApplication +public class SuperviseApplication { + + public static void main(String[] args) { + BladeApplication.run(ModuleNameConstant.APPLICATION_SUPERVISE_NAME, SuperviseApplication.class, args); + } +} + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/config/SuperviseConfiguration.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/config/SuperviseConfiguration.java new file mode 100644 index 000000000..d8826a689 --- /dev/null +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/config/SuperviseConfiguration.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.supervise.config; + + +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; + +/** + * 配置feign、mybatis包名、properties + * + * @author chaos + */ +@Configuration(proxyBeanMethods = false) +@ComponentScan({"org.springblade", "com.logpm"}) +@EnableFeignClients({"org.springblade", "com.logpm"}) +@MapperScan({"org.springblade.**.mapper.**", "com.logpm.**.mapper.**"}) +@EnableConfigurationProperties(SuperviseConfiguration.class) +public class SuperviseConfiguration { + + +} diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/launcher/BasicLauncherServiceImpl.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/launcher/BasicLauncherServiceImpl.java new file mode 100644 index 000000000..8e35a941d --- /dev/null +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/launcher/BasicLauncherServiceImpl.java @@ -0,0 +1,60 @@ +/* + * 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.supervise.launcher; + +import org.springblade.core.auto.service.AutoService; +import org.springblade.core.launch.constant.NacosConstant; +import org.springblade.core.launch.service.LauncherService; +import org.springblade.core.launch.utils.PropsUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; + +import java.util.Properties; + +/** + * 启动参数拓展 + * + * @author Chill + */ +@AutoService(LauncherService.class) +public class BasicLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { + Properties props = System.getProperties(); + // 开启多数据源 + PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true"); + // 指定注册配置信息 + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId(appName, profile)); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH); + // 指定注册IP + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1"); + // 指定注册端口 + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200"); + // 自定义命名空间 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE); + // 自定义分组 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP); + } + + @Override + public int getOrder() { + return 20; + } +} diff --git a/blade-service/logpm-supervise/src/main/resources/application-dev.yml b/blade-service/logpm-supervise/src/main/resources/application-dev.yml new file mode 100644 index 000000000..3ff547cac --- /dev/null +++ b/blade-service/logpm-supervise/src/main/resources/application-dev.yml @@ -0,0 +1,45 @@ +#服务器端口 +server: + port: 8300 + +#数据源配置 +#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.basic.master.url} + username: ${blade.datasource.basic.master.username} + password: ${blade.datasource.basic.master.password} + slave: + druid: + #独立校验配置 + validation-query: select 1 + #oracle校验 + #validation-query: select 1 from dual + url: ${blade.datasource.basic.slave.url} + username: ${blade.datasource.basic.slave.username} + password: ${blade.datasource.basic.slave.password} + diff --git a/blade-service/logpm-supervise/src/main/resources/application-prod.yml b/blade-service/logpm-supervise/src/main/resources/application-prod.yml new file mode 100644 index 000000000..3ff547cac --- /dev/null +++ b/blade-service/logpm-supervise/src/main/resources/application-prod.yml @@ -0,0 +1,45 @@ +#服务器端口 +server: + port: 8300 + +#数据源配置 +#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.basic.master.url} + username: ${blade.datasource.basic.master.username} + password: ${blade.datasource.basic.master.password} + slave: + druid: + #独立校验配置 + validation-query: select 1 + #oracle校验 + #validation-query: select 1 from dual + url: ${blade.datasource.basic.slave.url} + username: ${blade.datasource.basic.slave.username} + password: ${blade.datasource.basic.slave.password} + diff --git a/blade-service/logpm-supervise/src/main/resources/application-test.yml b/blade-service/logpm-supervise/src/main/resources/application-test.yml new file mode 100644 index 000000000..3ce9c0d67 --- /dev/null +++ b/blade-service/logpm-supervise/src/main/resources/application-test.yml @@ -0,0 +1,45 @@ +#服务器端口 +server: + port: 6001 + +#数据源配置 +#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.basic.master.url} + username: ${blade.datasource.basic.master.username} + password: ${blade.datasource.basic.master.password} + slave: + druid: + #独立校验配置 + validation-query: select 1 + #oracle校验 + #validation-query: select 1 from dual + url: ${blade.datasource.basic.slave.url} + username: ${blade.datasource.basic.slave.username} + password: ${blade.datasource.basic.slave.password} + diff --git a/blade-service/logpm-supervise/src/main/resources/application.yml b/blade-service/logpm-supervise/src/main/resources/application.yml new file mode 100644 index 000000000..dfd285af5 --- /dev/null +++ b/blade-service/logpm-supervise/src/main/resources/application.yml @@ -0,0 +1,39 @@ +#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 + +#oss配置 +oss: + enabled: true + name: minio + tenant-mode: false + endpoint: http://8.137.14.82:9000 + access-key: minio + secret-key: 123123123 + bucket-name: bladex + +#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 + + diff --git a/blade-service/logpm-supervise/src/main/resources/logback.xml b/blade-service/logpm-supervise/src/main/resources/logback.xml new file mode 100644 index 000000000..7170050de --- /dev/null +++ b/blade-service/logpm-supervise/src/main/resources/logback.xml @@ -0,0 +1,40 @@ + + + + logback + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + utf8 + + + + + ${log.path} + + ${log.path}.%d{yyyy-MM-dd}.zip + + + %date %level [%thread] %logger{36} [%file : %line] %msg%n + + + + + + + + + + diff --git a/blade-service/pom.xml b/blade-service/pom.xml index 7624a7b3a..83162614e 100644 --- a/blade-service/pom.xml +++ b/blade-service/pom.xml @@ -40,6 +40,8 @@ logpm-old-project logpm-patch + + logpm-supervise