修改3.x基础框架的配置

This commit is contained in:
黄晓 2022-03-03 19:15:46 +08:00
parent 8a19e1ae5e
commit 107c7fb3c7
8 changed files with 166 additions and 52 deletions

26
increpack.xml Normal file
View File

@ -0,0 +1,26 @@
<increpack>
<!-- 版本服务器接口地址 -->
<increApi>http://172.22.80.91:8086/incre/control/upgradeRecord/getUpgradeByAppIdAndCodeId</increApi>
<!-- 应用ID -->
<appId>7c37692da73159e45f4e0bb79171d2ed</appId>
<!-- 工程ID -->
<codeId>0eb9da6c4f4491f5196186e3b64c31af</codeId>
<!--GIT服务器配置-->
<code>
<method>git</method> <!--托管的服务器方式 git、svn-->
<url>http://47.107.61.133:3000/youfool-project/youfool-prj-springboot-template.git</url>
<!--默认先从increApi获取打包补丁范围可以不填写当请求失败则再使用-->
<fromCommit>200edf923d9b74f023a1da1d4a6c196664fc639c</fromCommit> <!-- 起始的版本号, SHA-1码 -->
<untilCommit>8a19e1ae5ef47fea450a742788f6428750ea9afa</untilCommit> <!-- 截止的版本号, SHA-1码可以不配置默认取至最新版本 -->
</code>
<!-- 本地化配置文件,不用打包,以手工操作的方式进行升级 -->
<exclude>
<fileDir>src\main\resources\properties</fileDir>
<file>src\main\resources\application.yml</file>
</exclude>
<!-- 需要自定义的拷贝的jar文件 -->
<libs>
<jar>rl-common-1.0-SNAPSHOT.jar</jar>
<jar>rl-rpc-service-1.0-SNAPSHOT.jar</jar>
</libs>
</increpack>

88
pom.xml
View File

@ -20,6 +20,7 @@
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<spring.boot.version>2.3.5.RELEASE</spring.boot.version> <spring.boot.version>2.3.5.RELEASE</spring.boot.version>
<skipTests>true</skipTests>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -39,7 +40,7 @@
<dependency> <dependency>
<groupId>com.chinaweal.youfool</groupId> <groupId>com.chinaweal.youfool</groupId>
<artifactId>youfool-framework-springboot</artifactId> <artifactId>youfool-framework-springboot</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.0.2-SNAPSHOT</version>
</dependency> </dependency>
<!--postgresql--> <!--postgresql-->
<dependency> <dependency>
@ -59,29 +60,20 @@
<version>4.12</version> <version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--文件应用启动校验-->
<dependency>
<groupId>com.chinaweal.youfool</groupId>
<artifactId>youfool-increpack-common</artifactId>
<version>1.0.5</version>
</dependency>
<!-- 增量打包辅助工具 -->
<dependency>
<groupId>com.chinaweal.youfool</groupId>
<artifactId>youfool-increpack-maven-plugin</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<!-- 本地开发环境 -->
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<!-- 设置默认激活这个配置 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<!-- 正式环境 -->
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
</profile>
</profiles>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -116,6 +108,58 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!--增量打包工具-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<finalName>${project.artifactId}</finalName>
<descriptors>
<descriptor>target/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.chinaweal.youfool.increpack.maven.IncrePackMain</mainClass>
<arguments>
<argument>${project.artifactId}</argument>
<argument>${project.version}</argument>
</arguments>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</execution>
<execution>
<id>authMac</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.chinaweal.youfool.increpack.common.AuthPackMain</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -0,0 +1,48 @@
package com.chinaweal.youfool.prj.config;
import com.chinaweal.youfool.increpack.common.interceptor.PrjFileCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.File;
import java.util.List;
/**
* Created with IDEA 15.0.2
* 应用启动的文件授权检验
*
* @author Lain
* @date 2020-10-11
* @time 16:47
*/
@Component
public class AuthorityCheck {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Value("${spring.profiles.active}")
private String env;
@PostConstruct
public void doAuthorityCheck() throws Exception {
if ("prod".equalsIgnoreCase(this.env)) {
//当前系统部署路径
ClassLoader classLoader = this.getClass().getClassLoader();
String path = classLoader.getResource("").getPath();
String prjPath = new File(path).getParentFile().getParent();
List<String> resultList = new PrjFileCheck().doPrjFileCheck(prjPath);
if (resultList.size() > 0) {
for (int i = 0; i < resultList.size(); i++) {
String s = resultList.get(i);
log.error("{}.篡改文件:{}", i + 1, s);
}
log.error("因为部分文件的auth不正确应用启动失败请修正授权");
//检验文件不通过,停止程序
Thread.sleep(3600000);
}
}
}
}

View File

@ -1,20 +0,0 @@
package com.chinaweal.youfool.prj.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.stereotype.Component;
/**
* 引入properties常用值
*/
@Component
@Configuration
@PropertySource(value = {"classpath:properties/youfool-prj.properties"}, encoding = "UTF-8")
public class PropertySourceConfig {
@Bean
public PropertySourcesPlaceholderConfigurer propertySources() {
return new PropertySourcesPlaceholderConfigurer();
}
}

View File

@ -1,6 +1,5 @@
package com.chinaweal.youfool.prj.config; package com.chinaweal.youfool.prj.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
@ -16,10 +15,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@Configuration @Configuration
@EnableSwagger2WebMvc @EnableSwagger2WebMvc
public class SwaggerKnife4j { public class SwaggerKnife4j {
@Value("${applicationName}") private final String applicationName = "youfool-prj-springboot-template";
private String applicationName; private final String description = "boot基础的后台模板";
@Value("${description}")
private String description;
@Bean("cms") @Bean("cms")
public Docket cmsApi() { public Docket cmsApi() {

View File

@ -0,0 +1,17 @@
package com.chinaweal.youfool.prj.dev;
import com.chinaweal.youfool.framework.springboot.cms.dev.GenerateDictEnums;
/**
* 常量代码生成器
*/
public class EnumsCodeGen {
public static void main(String[] args) {
GenerateDictEnums generator = new GenerateDictEnums("properties/codeGenerator");
generator.generateEnums();
}
private EnumsCodeGen(){
}
}

View File

@ -1,7 +1,7 @@
package com.chinaweal.youfool.prj.dev; package com.chinaweal.youfool.prj.dev;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CodeGenerator; import com.chinaweal.youfool.framework.springboot.mybatis.plus.FastCodeGenerator;
/** /**
* 根据库表结构生成代码层 * 根据库表结构生成代码层
@ -9,10 +9,11 @@ import com.chinaweal.youfool.framework.springboot.mybatis.plus.CodeGenerator;
public class TableCodeGen { public class TableCodeGen {
public static void main(String[] args) { public static void main(String[] args) {
CodeGenerator codeGenerator = new CodeGenerator("properties/codeGenerator"); FastCodeGenerator fastCodeGenerator = new FastCodeGenerator("properties/codeGenerator");
codeGenerator.generateCode(); fastCodeGenerator.generate();
} }
private TableCodeGen(){
private TableCodeGen() {
} }
} }

View File

@ -20,4 +20,5 @@ author=chinaweal
#controllerPackagePath=/module #controllerPackagePath=/module
#mapper文件存放路径 #mapper文件存放路径
#字典常量生成路径 #字典常量生成路径
constantPackagePath=/rl-common/src/main/java/com/chinaweal/fsrl constantPackagePath=/src/main/java/com/chinaweal/common
enumsPackagePath=/src/main/java/com/chinaweal/common