JeecgBoot 3.3.0 版本发布,基于代码生成器的企业级低代码平台

This commit is contained in:
zhangdaiscott
2022-07-20 18:09:53 +08:00
parent 55201e82eb
commit 0cbdc092d1
275 changed files with 7013 additions and 40279 deletions

View File

@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-gateway
EXPOSE 9999
ADD ./target/jeecg-cloud-gateway-3.2.0.jar ./
ADD ./target/jeecg-cloud-gateway-3.3.0.jar ./
CMD sleep 50;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-3.2.0.jar
CMD sleep 50;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-3.3.0.jar

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-cloud-gateway</artifactId>

View File

@ -1,15 +1,24 @@
package org.jeecg;
import org.jeecg.loader.DynamicRouteLoader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import javax.annotation.Resource;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;
/**
* @author jeecg
*/
@ -17,7 +26,6 @@ import javax.annotation.Resource;
@EnableDiscoveryClient
@SpringBootApplication
public class JeecgGatewayApplication implements CommandLineRunner {
@Resource
private DynamicRouteLoader dynamicRouteLoader;
@ -35,4 +43,15 @@ public class JeecgGatewayApplication implements CommandLineRunner {
public void run(String... strings) {
dynamicRouteLoader.refresh(null);
}
/**
* 接口地址通过9999端口直接访问
*
* @param indexHtml
* @return
*/
@Bean
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
}
}

View File

@ -0,0 +1,89 @@
package org.jeecg.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
/**
* @author scott
* @date 2020/05/26
* 路由配置信息
*/
@Configuration
@RefreshScope
public class GatewayRoutersConfig {
/**
* 路由配置方式databaseymlnacos
*/
public String dataType;
public String serverAddr;
public String namespace;
public String dataId;
public String routeGroup;
public String username;
public String password;
@Value("${spring.cloud.nacos.discovery.server-addr}")
public void setServerAddr(String serverAddr) {
this.serverAddr = serverAddr;
}
@Value("${spring.cloud.nacos.discovery.namespace}")
public void setNamespace(String namespace) {
this.namespace = namespace;
}
@Value("${jeecg.route.config.data-id:#{null}}")
public void setRouteDataId(String dataId) {
this.dataId = dataId + ".json";
}
@Value("${jeecg.route.config.group:DEFAULT_GROUP:#{null}}")
public void setRouteGroup(String routeGroup) {
this.routeGroup = routeGroup;
}
@Value("${jeecg.route.config.data-type:#{null}}")
public void setDataType(String dataType) {
this.dataType = dataType;
}
@Value("${spring.cloud.nacos.config.username}")
public void setUsername(String username) {
this.username = username;
}
@Value("${spring.cloud.nacos.config.password}")
public void setPassword(String password) {
this.password = password;
}
public String getDataType() {
return dataType;
}
public String getServerAddr() {
return serverAddr;
}
public String getNamespace() {
return namespace;
}
public String getDataId() {
return dataId;
}
public String getRouteGroup() {
return routeGroup;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}

View File

@ -1,77 +0,0 @@
package org.jeecg.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;
/**
* @author scott
* @date 2020/05/26
* 路由配置信息
*/
@Slf4j
@Configuration
@RefreshScope
public class GatewayRoutersConfiguration {
public static final long DEFAULT_TIMEOUT = 30000;
public static String SERVER_ADDR;
public static String NAMESPACE;
public static String DATA_ID;
public static String ROUTE_GROUP;
public static String USERNAME;
public static String PASSWORD;
@Value("${spring.cloud.nacos.discovery.server-addr}")
public void setServerAddr(String serverAddr) {
SERVER_ADDR = serverAddr;
}
@Value("${spring.cloud.nacos.discovery.namespace}")
public void setNamespace(String namespace) {
NAMESPACE = namespace;
}
@Value("${jeecg.route.config.data-id:#{null}}")
public void setRouteDataId(String dataId) {
DATA_ID = dataId + ".json";
}
@Value("${jeecg.route.config.group:DEFAULT_GROUP:#{null}}")
public void setRouteGroup(String routeGroup) {
ROUTE_GROUP = routeGroup;
}
@Value("${spring.cloud.nacos.config.username}")
public void setUsername(String username) {
USERNAME = username;
}
@Value("${spring.cloud.nacos.config.password}")
public void setPassword(String password) {
PASSWORD = password;
}
/**
* 接口地址通过9999端口直接访问
*
* @param indexHtml
* @return
*/
@Bean
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
}
}

View File

@ -16,12 +16,12 @@ import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.base.BaseMap;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.config.GatewayRoutersConfiguration;
import org.jeecg.config.GatewayRoutersConfig;
import org.jeecg.config.RouterDataType;
import org.jeecg.loader.repository.DynamicRouteService;
import org.jeecg.loader.repository.MyInMemoryRouteDefinitionRepository;
import org.jeecg.loader.vo.MyRouteDefinition;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.cloud.gateway.filter.FilterDefinition;
@ -33,7 +33,6 @@ import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
import javax.annotation.PostConstruct;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@ -50,22 +49,20 @@ import java.util.concurrent.Executor;
*/
@Slf4j
@Component
@DependsOn({"gatewayRoutersConfiguration"})
@RefreshScope
@DependsOn({"gatewayRoutersConfig"})
public class DynamicRouteLoader implements ApplicationEventPublisherAware {
public static final long DEFAULT_TIMEOUT = 30000;
@Autowired
private GatewayRoutersConfig gatewayRoutersConfig;
private MyInMemoryRouteDefinitionRepository repository;
private ApplicationEventPublisher publisher;
private DynamicRouteService dynamicRouteService;
private ConfigService configService;
private RedisUtil redisUtil;
/**
* 路由配置方式database(数据库)yml(配置文件)nacos
*/
@Value("${jeecg.route.config.data-type:database}")
public String dataType;
/**
* 需要拼接key的路由条件
*/
@ -85,12 +82,12 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
public void init(BaseMap baseMap) {
log.info("初始化路由dataType"+ dataType);
if (RouterDataType.nacos.toString().endsWith(dataType)) {
log.info("初始化路由模式dataType"+ gatewayRoutersConfig.getDataType());
if (RouterDataType.nacos.toString().endsWith(gatewayRoutersConfig.getDataType())) {
loadRoutesByNacos();
}
//从数据库加载路由
if (RouterDataType.database.toString().endsWith(dataType)) {
if (RouterDataType.database.toString().endsWith(gatewayRoutersConfig.getDataType())) {
loadRoutesByRedis(baseMap);
}
}
@ -100,7 +97,8 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
* @return
*/
public Mono<Void> refresh(BaseMap baseMap) {
if (!RouterDataType.yml.toString().endsWith(dataType)) {
log.info("初始化路由模式dataType"+ gatewayRoutersConfig.getDataType());
if (!RouterDataType.yml.toString().endsWith(gatewayRoutersConfig.getDataType())) {
this.init(baseMap);
}
return Mono.empty();
@ -119,7 +117,7 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
log.warn("initConfigService fail");
}
try {
String configInfo = configService.getConfig(GatewayRoutersConfiguration.DATA_ID, GatewayRoutersConfiguration.ROUTE_GROUP, GatewayRoutersConfiguration.DEFAULT_TIMEOUT);
String configInfo = configService.getConfig(gatewayRoutersConfig.getDataId(), gatewayRoutersConfig.getRouteGroup(), DEFAULT_TIMEOUT);
if (StringUtils.isNotBlank(configInfo)) {
log.info("获取网关当前配置:\r\n{}", configInfo);
routes = JSON.parseArray(configInfo, RouteDefinition.class);
@ -133,7 +131,7 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
dynamicRouteService.add(definition);
}
this.publisher.publishEvent(new RefreshRoutesEvent(this));
dynamicRouteByNacosListener(GatewayRoutersConfiguration.DATA_ID, GatewayRoutersConfiguration.ROUTE_GROUP);
dynamicRouteByNacosListener(gatewayRoutersConfig.getDataId(), gatewayRoutersConfig.getRouteGroup());
}
@ -340,10 +338,10 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
private ConfigService createConfigService() {
try {
Properties properties = new Properties();
properties.setProperty("serverAddr", GatewayRoutersConfiguration.SERVER_ADDR);
properties.setProperty("namespace", GatewayRoutersConfiguration.NAMESPACE);
properties.setProperty("username",GatewayRoutersConfiguration.USERNAME);
properties.setProperty("password",GatewayRoutersConfiguration.PASSWORD);
properties.setProperty("serverAddr", gatewayRoutersConfig.getServerAddr());
properties.setProperty("namespace", gatewayRoutersConfig.getNamespace());
properties.setProperty("username", gatewayRoutersConfig.getUsername());
properties.setProperty("password", gatewayRoutersConfig.getPassword());
return configService = NacosFactory.createConfigService(properties);
} catch (Exception e) {
log.error("创建ConfigService异常", e);

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-cloud-monitor</artifactId>

View File

@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-nacos
EXPOSE 8848
ADD ./target/jeecg-cloud-nacos-3.2.0.jar ./
ADD ./target/jeecg-cloud-nacos-3.3.0.jar ./
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-3.2.0.jar
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-3.3.0.jar

View File

@ -5,7 +5,6 @@
<artifactId>jeecg-cloud-nacos</artifactId>
<name>jeecg-cloud-nacos</name>
<description>nacos启动模块</description>
<version>3.2.0</version>
<!-- Nacos2不支持springboot2.6.6 -->
<parent>

View File

@ -14,7 +14,7 @@ db:
password:
'0': ${MYSQL-PWD:root}
url:
'0': jdbc:mysql://${MYSQL-HOST:jeecg-boot-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:nacos}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
'0': jdbc:mysql://${MYSQL-HOST:jeecg-boot-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:nacos-os}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
user:
'0': ${MYSQL-USER:root}
management:
@ -51,4 +51,4 @@ nacos:
security:
ignore:
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
standalone: true
standalone: true

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<artifactId>jeecg-cloud-sentinel</artifactId>
<name>jeecg-cloud-sentinel</name>

View File

@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-system
EXPOSE 7001
ADD ./target/jeecg-cloud-system-start-3.2.0.jar ./
ADD ./target/jeecg-cloud-system-start-3.3.0.jar ./
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-3.2.0.jar
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-3.3.0.jar

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-cloud-system-start</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>公共测试模块</description>

View File

@ -0,0 +1,15 @@
//package org.jeecg.modules.test.feign.client;
//
//import org.jeecg.common.api.vo.Result;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//
///**
// * 动态feign接口定义
// */
//public interface JeecgTestClientDyn {
//
// @GetMapping(value = "/test/getMessage")
// Result<String> getMessage(@RequestParam(value = "name",required = false) String name);
//}

View File

@ -3,9 +3,8 @@ package org.jeecg.modules.test.feign.controller;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.test.feign.client.JeecgTestClient;
import org.jeecg.modules.test.feign.client.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.alibaba.csp.sentinel.annotation.SentinelResource;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>消息队列测试模块</description>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test-seata</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>分布式事务测试模块</description>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test-seata</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>分布式事务测试模块</description>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test-seata</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<description>分布式事务测试模块</description>

View File

@ -5,12 +5,11 @@
<parent>
<artifactId>jeecg-cloud-test</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-cloud-test-seata</artifactId>
<packaging>pom</packaging>
<modules>
<module>jeecg-cloud-test-seata-account</module>
<module>jeecg-cloud-test-seata-product</module>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-test</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -10,7 +10,7 @@ WORKDIR /jeecg-cloud-xxljob
EXPOSE 9080
ADD ./target/jeecg-cloud-xxljob-3.2.0.jar ./
ADD ./target/jeecg-cloud-xxljob-3.3.0.jar ./
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-3.2.0.jar
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-3.3.0.jar

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-cloud-module</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-boot-parent</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>