diff --git a/.gitignore b/.gitignore
index c5e7300ae5a430e86213f767af68e7e65ec4b3e7..1858967d63d50d343500577ef4f39a129c76386d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@ out/
### VS Code ###
.vscode/
/logs/
+/myhome/
diff --git "a/doc/Dubbo\346\267\273\345\212\240\350\257\264\346\230\216.md" "b/doc/Dubbo\346\267\273\345\212\240\350\257\264\346\230\216.md"
new file mode 100644
index 0000000000000000000000000000000000000000..517acc81fc6dfdb85daa724174367c047c73afca
--- /dev/null
+++ "b/doc/Dubbo\346\267\273\345\212\240\350\257\264\346\230\216.md"
@@ -0,0 +1,35 @@
+1 JiuYuSystemApplication 添加: @DubboComponentScan(basePackages = "org.jeecg.modules.system.service.impl")
+
+2 application-dev.yml:
+dubbo:
+ application:
+ name: jiuyu-boot-base
+ qos-enable: false
+ qos-accept-foreign-ip: false
+ registry:
+ protocol: dubbo
+ address: nacos://localhost:8848
+ username: nacos
+ password: nacos
+ protocol:
+ name: dubbo
+ port: 20885
+ consumer:
+ check: false
+ timeout: 5000
+ retries: 0
+
+3 pom.xml
+
+ org.apache.dubbo
+ dubbo-registry-nacos
+ 3.0.7
+
+
+ org.apache.dubbo
+ dubbo-spring-boot-starter
+ 3.0.7
+
+
+4 : SysBaseApiImpl.java
+@DubboService(interfaceClass = ISysBaseAPI.class)
\ No newline at end of file
diff --git a/jiuyu-boot-base/jiuyu-boot-base-api/pom.xml b/jiuyu-boot-base/jiuyu-boot-base-api/pom.xml
index f53f6648c4ed61b9121753513f792ac235a0c0eb..71c0c8c6fa16987b4bc27529e47a134c3e909b84 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-api/pom.xml
+++ b/jiuyu-boot-base/jiuyu-boot-base-api/pom.xml
@@ -18,7 +18,7 @@
com.jiuyu.boot
- jiuyu-boot-base-core
+ jiuyu-boot-base-tools
3.0
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/pom.xml b/jiuyu-boot-base/jiuyu-boot-base-core/pom.xml
index 06af7c1cf7b9095ac648aa7e3994922ee1428ab8..58a1d310bd84ec86ac09bfe69fa8e2983abce826 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-core/pom.xml
+++ b/jiuyu-boot-base/jiuyu-boot-base-core/pom.xml
@@ -123,12 +123,6 @@
runtime
-
-
- org.springframework.boot
- spring-boot-starter-quartz
-
-
com.auth0
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/AutoLog.java b/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/AutoLog.java
deleted file mode 100644
index 8c6d25f6193e5c9ecf8c1cfa96e20c6aac5492e7..0000000000000000000000000000000000000000
--- a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/AutoLog.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.jeecg.common.aspect.annotation;
-
-import org.jeecg.common.constant.CommonConstant;
-import org.jeecg.common.constant.enums.ModuleType;
-
-import java.lang.annotation.*;
-
-/**
- * 系统日志注解
- *
- * @Author scott
- * @email jeecgos@163.com
- * @Date 2019年1月14日
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface AutoLog {
-
- /**
- * 日志内容
- *
- * @return
- */
- String value() default "";
-
- /**
- * 日志类型
- *
- * @return 0:操作日志;1:登录日志;2:定时任务;
- */
- int logType() default CommonConstant.LOG_TYPE_2;
-
- /**
- * 操作日志类型
- *
- * @return (1查询,2添加,3修改,4删除)
- */
- int operateType() default 0;
-
- /**
- * 模块类型 默认为common
- *
- * @return
- */
- ModuleType module() default ModuleType.COMMON;
-}
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/Dict.java b/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/Dict.java
deleted file mode 100644
index 1e625fc8b4c1f28e8bee554df4983e8a0a30fd78..0000000000000000000000000000000000000000
--- a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/Dict.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.jeecg.common.aspect.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 类描述: 字典注解
- * 作 者: dangzhenghui
- * 日 期: 2019年03月17日-下午9:37:16
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Dict {
- /**
- * 方法描述: 数据code
- * 作 者: dangzhenghui
- * 日 期: 2019年03月17日-下午9:37:16
- *
- * @return 返回类型: String
- */
- String dicCode();
-
- /**
- * 方法描述: 数据Text
- * 作 者: dangzhenghui
- * 日 期: 2019年03月17日-下午9:37:16
- *
- * @return 返回类型: String
- */
- String dicText() default "";
-
- /**
- * 方法描述: 数据字典表
- * 作 者: dangzhenghui
- * 日 期: 2019年03月17日-下午9:37:16
- *
- * @return 返回类型: String
- */
- String dictTable() default "";
-}
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/OnlineAuth.java b/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/OnlineAuth.java
deleted file mode 100644
index b9acb912a03d3e9ac927899e7dfca63e8285373d..0000000000000000000000000000000000000000
--- a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/OnlineAuth.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.jeecg.common.aspect.annotation;
-
-import java.lang.annotation.*;
-
-/**
- * online请求拦截专用注解
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Documented
-public @interface OnlineAuth {
-
- /**
- * 请求关键字,在xxx/code之前的字符串
- *
- * @return
- */
- String value();
-}
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/PermissionData.java b/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/PermissionData.java
deleted file mode 100644
index 2b53e7852792a5e451977b0db9e541c9eaf586db..0000000000000000000000000000000000000000
--- a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/aspect/annotation/PermissionData.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.jeecg.common.aspect.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 数据权限注解
- *
- * @Author taoyan
- * @Date 2019年4月11日
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Documented
-public @interface PermissionData {
- /**
- * 暂时没用
- *
- * @return
- */
- String value() default "";
-
-
- /**
- * 配置菜单的组件路径,用于数据权限
- */
- String pageComponent() default "";
-}
\ No newline at end of file
diff --git a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/constant/enums/CgformEnum.java b/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/constant/enums/CgformEnum.java
deleted file mode 100644
index 963c444fb1bec26c634e6dca93e7d4ca9494efe2..0000000000000000000000000000000000000000
--- a/jiuyu-boot-base/jiuyu-boot-base-core/src/main/java/org/jeecg/common/constant/enums/CgformEnum.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.jeecg.common.constant.enums;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * online表单枚举 代码生成器用到
- */
-public enum CgformEnum {
-
- /**
- * 单表
- */
- ONE(1, "one", "/jeecg/code-template-online", "default.one", "经典风格"),
- /**
- * 多表
- */
- MANY(2, "many", "/jeecg/code-template-online", "default.onetomany", "经典风格"),
- /**
- * 多表
- */
- ERP(2, "erp", "/jeecg/code-template-online", "erp.onetomany", "ERP风格"),
- /**
- * 多表(jvxe风格)
- */
- JVXE_TABLE(2, "jvxe", "/jeecg/code-template-online", "jvxe.onetomany", "JVXE风格"),
- /**
- * 多表(内嵌子表风格)
- */
- INNER_TABLE(2, "innerTable", "/jeecg/code-template-online", "inner-table.onetomany", "内嵌子表风格"),
- /**
- * 多表(tab风格)
- */
- TAB(2, "tab", "/jeecg/code-template-online", "tab.onetomany", "Tab风格"),
- /**
- * 树形列表
- */
- TREE(3, "tree", "/jeecg/code-template-online", "default.tree", "树形列表");
-
- /**
- * 类型 1/单表 2/一对多 3/树
- */
- int type;
- /**
- * 编码标识
- */
- String code;
- /**
- * 代码生成器模板路径
- */
- String templatePath;
- /**
- * 代码生成器模板路径
- */
- String stylePath;
- /**
- * 模板风格名称
- */
- String note;
-
- /**
- * 构造器
- *
- * @param type 类型 1/单表 2/一对多 3/树
- * @param code 模板编码
- * @param templatePath 模板路径
- * @param stylePath 模板子路径
- * @param note
- */
- CgformEnum(int type, String code, String templatePath, String stylePath, String note) {
- this.type = type;
- this.code = code;
- this.templatePath = templatePath;
- this.stylePath = stylePath;
- this.note = note;
- }
-
- /**
- * 根据code获取模板路径
- *
- * @param code
- * @return
- */
- public static String getTemplatePathByConfig(String code) {
- return getCgformEnumByConfig(code).templatePath;
- }
-
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public String getTemplatePath() {
- return templatePath;
- }
-
- public void setTemplatePath(String templatePath) {
- this.templatePath = templatePath;
- }
-
- public String getStylePath() {
- return stylePath;
- }
-
- public void setStylePath(String stylePath) {
- this.stylePath = stylePath;
- }
-
- /**
- * 根据code找枚举
- *
- * @param code
- * @return
- */
- public static CgformEnum getCgformEnumByConfig(String code) {
- for (CgformEnum e : CgformEnum.values()) {
- if (e.code.equals(code)) {
- return e;
- }
- }
- return null;
- }
-
- /**
- * 根据类型找所有
- *
- * @param type
- * @return
- */
- public static List
+
diff --git a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/asptect/PageBeanAspect.java b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/asptect/PageBeanAspect.java
index 37ce4a10729ba8a31278101085c88fe36c0fe19b..e3c1b7711e93b7b883abb08a766db144ce677cfd 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/asptect/PageBeanAspect.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/asptect/PageBeanAspect.java
@@ -20,8 +20,8 @@ import java.lang.reflect.Parameter;
import java.util.List;
import java.util.Map;
-@Aspect
-@Component
+//@Aspect
+//@Component
@Slf4j
public class PageBeanAspect {
@@ -55,6 +55,8 @@ public class PageBeanAspect {
Integer pageNo = Integer.parseInt(paramsMap.getOrDefault("PAGENUM", "1" ) +"");
Integer pageSize = Integer.parseInt(paramsMap.getOrDefault("PAGESIZE" , "10")+"" );
res = getQueryPageBean(paramsMap , map , sqlsr , pageNo, pageSize);
+
+ log.info("pageNo55 = {}" , pageNo);
}else {
res = joinPoint.proceed();
}
@@ -71,8 +73,8 @@ public class PageBeanAspect {
PageBean queryForPage = null;
String ds = map.get("DS")+"";
String dyDBTYPE = map.get("DBTYPE")!=null ? map.get("DBTYPE").toString():null;
- String dbType = null != dyDBTYPE ?dyDBTYPE : paramsMap.getOrDefault("dbType" , "1").toString() ; // 默认oracle
-
+ String dbType = null != dyDBTYPE ?dyDBTYPE : paramsMap.getOrDefault("DBTYPE" , "1").toString() ; // 默认oracle
+ log.info("pageNo444 = {}" , pageNo);
Page pagination = new Page(pageNo,pageSize);
// PageBean queryForPage = null;
diff --git a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/FlowServiceImpl.java b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/FlowServiceImpl.java
index 43282dc126d5af5d408d47aabe14e014734d59f5..26748a36e39afb6c22217fc7d063ed218efe7765 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/FlowServiceImpl.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/FlowServiceImpl.java
@@ -34,7 +34,7 @@ public class FlowServiceImpl {
@Autowired
JdbcTemplate jdbcTemplate ;
- ch.qos.logback.classic.Logger vLogger = loggerContext.getLogger("com.dragonsoft.commonQuery");
+ ch.qos.logback.classic.Logger vLogger = loggerContext.getLogger("com.jiuyu");
ch.qos.logback.classic.Logger vLogger2 = loggerContext.getLogger("org.jeecg");
public Object getCachedResult(String queryKey , String sub_system , Map paraMap , List subFlowList , LinkedList nextStep ){
diff --git a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/PageBeanHander.java b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/PageBeanHander.java
index 8d45fa83d241d4df2745b9d1f3101dc5bee3f28e..743f49cfcd8a41d16cfb7c51c8d4f2a7414647e7 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/PageBeanHander.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/service/impl/PageBeanHander.java
@@ -23,11 +23,12 @@ public class PageBeanHander {
@DynaicParameter
- public PageBean getQueryPageBean(Map paramsMap , Map map , String sqlsr ){
+ public PageBean getQueryPageBean(final Map paramsMap , Map map , String sqlsr ){
// log.info("PageBeanHander .........................");
- Integer pageNo = Integer.parseInt(paramsMap.getOrDefault("PAGENUM", "1" ) +"");
+ Integer pageNo = Integer.parseInt(paramsMap.getOrDefault("PAGENO", "1" ) +"");
Integer pageSize = Integer.parseInt(paramsMap.getOrDefault("PAGESIZE" , "10")+"" );
+
PageBean queryForPage = null;
String ds = map.get("DS")+"";
String dbType = paramsMap.getOrDefault("DBTYPE" , "1")+""; // 默认oracle
diff --git a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/JdbcTemplateSupport.java b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/JdbcTemplateSupport.java
index 7ccc1cb18f75c2e3744cba8f54bc5db0f1892d81..e2653562a4fdd44d8ab58f8ba6c6b5b1be31d888 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/JdbcTemplateSupport.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/JdbcTemplateSupport.java
@@ -19,81 +19,82 @@ import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
@Slf4j
@Component
-public class JdbcTemplateSupport {
+public class JdbcTemplateSupport {
/* @Autowired
private JdbcTemplate jdbcTemplate;*/
- public PageBean queryForPage(String sql, Page pagination, String dbType , JdbcTemplate jdbcTemplate, Map map , Map parameterMap ) throws DataAccessException {
+ public PageBean queryForPage(String sql, Page pagination, String dbType, JdbcTemplate jdbcTemplate, Map map, Map parameterMap) throws DataAccessException {
- if(map == null ){
+ if (map == null) {
map = new HashMap<>();
}
- PageBean result= new PageBean();
+ PageBean result = new PageBean();
long total = pagination.getTotal() == -1 ? 0 : pagination.getTotal();
long start = System.currentTimeMillis();
- if(total == 0 ){
+ if (total == 0) {
//获取记录条数
StringBuffer countSqlSb = new StringBuffer("select ");
- if(null != map && map.containsKey("PAGE_QUERY_MODEL") && null != map.get("PAGE_QUERY_MODEL") && "1".equals(map.get("PAGE_QUERY_MODEL").toString())){
- if("mysql".equals(dbType) || "2".equals(dbType) || (map.containsKey("DBTYPE") && null != map.get("DBTYPE") && "mysql".equals( map.get("DBTYPE").toString()))){
- countSqlSb = convert2Count(sql , pagination.getCount_index_field() , "mysql") ;
- }else if("oracle".equals(dbType) || "1".equals(dbType)){
- countSqlSb = convert2Count(sql , pagination.getCount_index_field() , "oracle") ;
+ if (null != map && map.containsKey("PAGE_QUERY_MODEL") && null != map.get("PAGE_QUERY_MODEL") && "1".equals(map.get("PAGE_QUERY_MODEL").toString())) {
+ if ("mysql".equals(dbType) || "2".equals(dbType) || (map.containsKey("DBTYPE") && null != map.get("DBTYPE") && "mysql".equals(map.get("DBTYPE").toString()))) {
+ countSqlSb = convert2Count(sql, pagination.getCount_index_field(), "mysql");
+ } else if ("oracle".equals(dbType) || "1".equals(dbType)) {
+ countSqlSb = convert2Count(sql, pagination.getCount_index_field(), "oracle");
}
- }else if(null != map && map.containsKey("PAGE_QUERY_MODEL") && null != map.get("PAGE_QUERY_MODEL") && "2".equals(map.get("PAGE_QUERY_MODEL").toString())){
+ } else if (null != map && map.containsKey("PAGE_QUERY_MODEL") && null != map.get("PAGE_QUERY_MODEL") && "2".equals(map.get("PAGE_QUERY_MODEL").toString())) {
// 完全自定义count查询
- countSqlSb = new StringBuffer(EnjoyTemplateUtils.parseTemplateContent(pagination.getCount_index_field() ,parameterMap) );
- }
- else{
- if(null != pagination.getCount_index_field()){
+ countSqlSb = new StringBuffer(EnjoyTemplateUtils.parseTemplateContent(pagination.getCount_index_field(), parameterMap));
+ } else {
+ if (null != pagination.getCount_index_field()) {
countSqlSb.append("count(").append(pagination.getCount_index_field()).append(")");
- }else {
- countSqlSb.append("count(1)") ;
+ } else {
+ countSqlSb.append("count(1)");
}
countSqlSb.append(" as count from ( ").append(sql).append(" ) temp ");
}
- if(log.isDebugEnabled()){
- log.debug("——————分页总数查询SQL: {}",countSqlSb);
+ if (log.isDebugEnabled()) {
+ log.debug("——————分页总数查询SQL: {}", countSqlSb);
}
- List countList= jdbcTemplate.query(countSqlSb.toString(), new RowMapper() {
+ List countList = jdbcTemplate.query(countSqlSb.toString(), new RowMapper() {
public Integer mapRow(ResultSet resultSet, int i) throws SQLException {
return new Integer(resultSet.getInt(1));
}
});
- total = countList.get(0) ;
+ total = countList.get(0);
}
result.setTotal(total);
- result.setSize( new Long(total).intValue());
+ result.setSize(new Long(total).intValue());
result.setPageNum(pagination.getPageNum());
result.setPageSize(pagination.getPageSize());
long count_time = System.currentTimeMillis() - start;
result.setQuery_count_cost_time(count_time);
- long pageCount=result.getTotal()%result.getPageSize();
- int pages = Integer.parseInt(String.valueOf(pageCount==0?(result.getTotal()/result.getPageSize()):(result.getTotal()/result.getPageSize()+1))) ;
+ long pageCount = result.getTotal() % result.getPageSize();
+ int pages = Integer.parseInt(String.valueOf(pageCount == 0 ? (result.getTotal() / result.getPageSize()) : (result.getTotal() / result.getPageSize() + 1)));
result.setPages(pages);
- if("mysql".equalsIgnoreCase(dbType) || "2".equals(dbType) || (map.containsKey("DBTYPE") && null != map.get("DBTYPE") && "mysql".equals( map.get("DBTYPE").toString()))){
- sql+=parseLimit(result);
- }else if("oracle".equalsIgnoreCase(dbType) || "1".equals(dbType)){
- sql = pagingByOracel(sql , result);
- }else{
+ if ("mysql".equalsIgnoreCase(dbType) || "2".equals(dbType) || (map.containsKey("DBTYPE") && null != map.get("DBTYPE") && "mysql".equals(map.get("DBTYPE").toString()))) {
+ sql += parseLimit(result);
+ } else if ("oracle".equalsIgnoreCase(dbType) || "1".equals(dbType)) {
+ sql = pagingByOracel(sql, result);
+ } else {
// throw new RuntimeException("错误的数据库类型dbType = "+ dbType );
- log.warn(" 错误的数据库类型 dbType = {}" , dbType);
+ log.warn(" 错误的数据库类型 dbType = {}", dbType);
}
- if(log.isDebugEnabled()){
- log.debug("——————分页列表查询SQL: {}",sql);
+ if (log.isDebugEnabled()) {
+ log.debug("——————分页列表查询SQL: {}", sql);
}
- List data= jdbcTemplate.queryForList(sql);
+ log.info("——————分页列表查询SQL: {}", sql);
+ List data = jdbcTemplate.queryForList(sql);
result.setList(data);
long list_time = System.currentTimeMillis() - start;
@@ -103,74 +104,74 @@ public class JdbcTemplateSupport {
}
- public PageBean queryForPage(String sql, Page pagination, String dbType , JdbcTemplate jdbcTemplate) throws DataAccessException {
+ public PageBean queryForPage(String sql, Page pagination, String dbType, JdbcTemplate jdbcTemplate) throws DataAccessException {
- return queryForPage(sql , pagination , dbType , jdbcTemplate, null,null) ;
+ return queryForPage(sql, pagination, dbType, jdbcTemplate, null, null);
}
- private String parseLimit(PageBean pagination ){
+ private String parseLimit(PageBean pagination) {
- StringBuffer stringBuffer=new StringBuffer(" ");
+ StringBuffer stringBuffer = new StringBuffer(" ");
stringBuffer.append("limit");
stringBuffer.append(" ");
- if(pagination.getPageNum() == 0) {
+ if (pagination.getPageNum() == 0) {
stringBuffer.append("0");
- }else {
- stringBuffer.append((pagination.getPageNum()-1)*pagination.getPageSize());
+ } else {
+ stringBuffer.append((pagination.getPageNum() - 1) * pagination.getPageSize());
}
stringBuffer.append(",");
stringBuffer.append(pagination.getPageSize());
return stringBuffer.toString();
}
- public String pagingByOracel(String sql,PageBean pagination){
- int start = (pagination.getPageNum()-1)*pagination.getPageSize();
+ public String pagingByOracel(String sql, PageBean pagination) {
+ int start = (pagination.getPageNum() - 1) * pagination.getPageSize();
//当前页最大值
- int end = start+pagination.getPageSize();
- String endSql = "select * from ("+
- "select t.*,rownum row_ from (" +sql + ") t"+
- " where rownum<="+end+
- ") where row_>"+start;
+ int end = start + pagination.getPageSize();
+ String endSql = "select * from (" +
+ "select t.*,rownum row_ from (" + sql + ") t" +
+ " where rownum<=" + end +
+ ") where row_>" + start;
return endSql;
}
- public static StringBuffer convert2Count(String sql_str , String count_index , String dbType ){
- sql_str = formatSimpleSql(sql_str , dbType) ;
+ public static StringBuffer convert2Count(String sql_str, String count_index, String dbType) {
+ sql_str = formatSimpleSql(sql_str, dbType);
String[] strs = sql_str.split("FROM");
StringBuffer sql = new StringBuffer("select ");
- if(null != count_index ){
+ if (null != count_index) {
sql.append("count(").append(count_index).append(")");
- }else {
- sql.append("count(1)") ;
+ } else {
+ sql.append("count(1)");
}
for (int i = 0; i < strs.length; i++) {
- if(i == 0 ){
- // sql.append(" ");
- }else{
- sql.append( strs[i] );
+ if (i == 0) {
+ // sql.append(" ");
+ } else {
+ sql.append(strs[i]);
}
- if(i < strs.length-1){
+ if (i < strs.length - 1) {
sql.append(" from ");
}
}
- return sql ;
+ return sql;
}
- private static String formatSimpleSql(String sql ,String dbType){
+ private static String formatSimpleSql(String sql, String dbType) {
SQLSelectStatement statement = (SQLSelectStatement) parser(sql, dbType);
SQLSelect select = statement.getSelect();
SQLSelectQueryBlock query = (SQLSelectQueryBlock) select.getQuery();
- List selectlist = query.getSelectList();
+ List selectlist = query.getSelectList();
selectlist.clear();
String sql_str = query.toString();
//System.out.println(sql_str);
- return sql_str ;
+ return sql_str;
}
- private static SQLStatement parser(String sql, String dbType) {
+ private static SQLStatement parser(String sql, String dbType) {
List list = SQLUtils.parseStatements(sql, dbType);
if (list.size() > 1) {
throw new RuntimeException(" MultiQueries is not supported,use single query instead (不支持多个SQL ,请检查查询语句是否正确!)");
diff --git a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/PageBean.java b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/PageBean.java
index af89aef61ebbd5514bcc20fd415a9844d8427f04..c76d5971f6b6e2017c07a2ee041bbea4a0fbf173 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/PageBean.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-groovy/src/main/java/com/jiuyu/dynamicApi/utils/PageBean.java
@@ -2,8 +2,10 @@ package com.jiuyu.dynamicApi.utils;
import lombok.Data;
+
import java.io.Serializable;
import java.util.List;
+
@Data
public class PageBean implements Serializable {
@@ -18,7 +20,7 @@ public class PageBean implements Serializable {
private long query_count_cost_time = 0;
private long query_list_cost_time = 0;
- public static int MAX_PAGE_SIZE = 100;
+ public static int MAX_PAGE_SIZE = 5000;
public PageBean() {}
/**
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDataSource.java b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/entity/SysDataSource.java
similarity index 100%
rename from jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDataSource.java
rename to jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/entity/SysDataSource.java
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDataSourceMapper.java b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/mapper/SysDataSourceMapper.java
similarity index 100%
rename from jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDataSourceMapper.java
rename to jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/mapper/SysDataSourceMapper.java
diff --git a/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/mapper/xml/SysDataSourceMapper.xml b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/mapper/xml/SysDataSourceMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e05c9e2c885b905afee05c4524c9bff9f948cc1e
--- /dev/null
+++ b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/mapper/xml/SysDataSourceMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java
similarity index 60%
rename from jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java
rename to jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java
index a52b597d13bf2374cb36193eda39d819ba45670f..be9dbace30a867280284b1c7fb9510de5101ffc0 100644
--- a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/ISysDataSourceService.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.system.vo.DynamicDataSourceModel;
import org.jeecg.modules.system.entity.SysDataSource;
/**
@@ -11,4 +12,7 @@ import org.jeecg.modules.system.entity.SysDataSource;
*/
public interface ISysDataSourceService extends IService {
+ public DynamicDataSourceModel getDynamicDbSourceById(String dbSourceId) ;
+
+ public DynamicDataSourceModel getDynamicDbSourceByCode(String dbSourceCode);
}
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java
similarity index 32%
rename from jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java
rename to jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java
index eabf8c2de2ffda8b1f156d698d55a214b62ae1a4..1c617dc7d35ca21960c9cf5a446227ebf36a25cb 100644
--- a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-modules/src/main/java/org/jeecg/modules/system/service/impl/SysDataSourceServiceImpl.java
@@ -1,9 +1,13 @@
package org.jeecg.modules.system.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.system.vo.DynamicDataSourceModel;
import org.jeecg.modules.system.entity.SysDataSource;
import org.jeecg.modules.system.mapper.SysDataSourceMapper;
import org.jeecg.modules.system.service.ISysDataSourceService;
+import org.jeecg.modules.system.util.SecurityUtil;
import org.springframework.stereotype.Service;
/**
@@ -15,4 +19,24 @@ import org.springframework.stereotype.Service;
@Service
public class SysDataSourceServiceImpl extends ServiceImpl implements ISysDataSourceService {
+ public DynamicDataSourceModel getDynamicDbSourceById(String dbSourceId) {
+ SysDataSource dbSource = getById(dbSourceId);
+ if (dbSource != null && StringUtils.isNotBlank(dbSource.getDbPassword())) {
+ String dbPassword = dbSource.getDbPassword();
+ String decodedStr = SecurityUtil.jiemi(dbPassword);
+ dbSource.setDbPassword(decodedStr);
+ }
+ return new DynamicDataSourceModel(dbSource);
+ }
+
+ public DynamicDataSourceModel getDynamicDbSourceByCode(String dbSourceCode) {
+ SysDataSource dbSource = getOne(new LambdaQueryWrapper().eq(SysDataSource::getCode, dbSourceCode));
+ if (dbSource != null && StringUtils.isNotBlank(dbSource.getDbPassword())) {
+ String dbPassword = dbSource.getDbPassword();
+ String decodedStr = SecurityUtil.jiemi(dbPassword);
+ dbSource.setDbPassword(decodedStr);
+ }
+ return new DynamicDataSourceModel(dbSource);
+ }
+
}
diff --git a/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
index bcef5412bc618eb9f61e5374a05065a6ce645c69..62f1ed0230b229e176119c543acbfef128865e46 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
@@ -4,7 +4,7 @@ import lombok.Data;
import org.springframework.beans.BeanUtils;
@Data
-public class DynamicDataSourceModel {
+public class DynamicDataSourceModel implements java.io.Serializable {
public DynamicDataSourceModel() {
@@ -51,4 +51,20 @@ public class DynamicDataSourceModel {
*/
private String dbPassword;
+ /**
+ * 最大活动连接数
+ */
+
+ private String maxActive ;
+ /**
+ * 最大等待超时的时间
+ */
+
+ private String maxWait ;
+
+ /**
+ * 初始化大小
+ */
+ private String initial_size ;
+
}
\ No newline at end of file
diff --git a/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/ListUtils.java b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/ListUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b16d99c170b2160b2df3444b2288a96491ce911
--- /dev/null
+++ b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/ListUtils.java
@@ -0,0 +1,126 @@
+package org.jeecg.common.util;
+
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 描述:List工具类
+ * @author songfayuan
+ * 2018年7月22日下午2:23:22
+ */
+@Slf4j
+public class ListUtils {
+
+ /**
+ * 描述:list集合深拷贝
+ * @param src
+ * @return
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @author songfayuan
+ * 2018年7月22日下午2:35:23
+ */
+ public static List deepCopy(List src) {
+ try {
+ ByteArrayOutputStream byteout = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(byteout);
+ out.writeObject(src);
+ ByteArrayInputStream bytein = new ByteArrayInputStream(byteout.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bytein);
+ @SuppressWarnings("unchecked")
+ List dest = (List) in.readObject();
+ return dest;
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ return null;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ /**
+ * 描述:对象深拷贝
+ * @param src
+ * @return
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @author songfayuan
+ * 2018年12月14日
+ */
+ public static T objDeepCopy(T src) {
+ try {
+ ByteArrayOutputStream byteout = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(byteout);
+ out.writeObject(src);
+ ByteArrayInputStream bytein = new ByteArrayInputStream(byteout.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bytein);
+ @SuppressWarnings("unchecked")
+ T dest = (T) in.readObject();
+ return dest;
+ } catch (ClassNotFoundException e) {
+ log.error("errMsg = {}", e);
+ return null;
+ } catch (IOException e) {
+ log.error("errMsg = {}", e);
+ return null;
+ }
+ }
+
+ /**
+ * 将一个list均分成n个list,主要通过偏移量来实现的
+ * @author songfayuan
+ * 2018年12月14日
+ */
+ public static List> averageAssign(List source, int n) {
+ List> result = new ArrayList>();
+ int remaider = source.size() % n; //(先计算出余数)
+ int number = source.size() / n; //然后是商
+ int offset = 0;//偏移量
+ for (int i = 0; i < n; i++) {
+ List value = null;
+ if (remaider > 0) {
+ value = source.subList(i * number + offset, (i + 1) * number + offset + 1);
+ remaider--;
+ offset++;
+ } else {
+ value = source.subList(i * number + offset, (i + 1) * number + offset);
+ }
+ result.add(value);
+ }
+ return result;
+ }
+
+ /**
+ * List按指定长度分割
+ * @param list the list to return consecutive sublists of (需要分隔的list)
+ * @param size the desired size of each sublist (the last may be smaller) (分隔的长度)
+ * @author songfayuan
+ * @date 2019-07-07 21:37
+ */
+ public static List> partition(List list, int size){
+ return Lists.partition(list, size); // 使用guava
+ }
+
+ /**
+ * 测试
+ * @param args
+ */
+ public static void main(String[] args) {
+ List bigList = new ArrayList<>();
+ for (int i = 0; i < 101; i++){
+ bigList.add(i);
+ }
+ log.info("bigList长度为:{}", bigList.size());
+ log.info("bigList为:{}", bigList);
+ List> smallists = partition(bigList, 20);
+ log.info("smallists长度为:{}", smallists.size());
+ for (List smallist : smallists) {
+ log.info("拆分结果:{},长度为:{}", smallist, smallist.size());
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/db/DynamicDBUtil.java b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/db/DynamicDBUtil.java
index 2d175a4aedfc315d6d01319a847e50313716a40a..2dce5ee3584e0883e8ea05e8c9a4316546556735 100644
--- a/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/db/DynamicDBUtil.java
+++ b/jiuyu-boot-base/jiuyu-boot-base-tools/src/main/java/org/jeecg/common/util/db/DynamicDBUtil.java
@@ -41,6 +41,10 @@ public class DynamicDBUtil {
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
//dataSource.setValidationQuery("SELECT 1 FROM DUAL");
+ dataSource.setInitialSize(dbSource.getInitial_size() == null ? 15 : Integer.parseInt(dbSource.getInitial_size()));
+ dataSource.setMaxActive(dbSource.getMaxActive() == null ? 30 : Integer.parseInt(dbSource.getMaxActive()));
+
+
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setTestOnReturn(false);
diff --git a/jiuyu-boot-module-system/pom.xml b/jiuyu-boot-module-system/pom.xml
index 8cfbec8c606e0a0b71737a61e78bffc2515c421b..e80acb54be6647eca3be5c4baf6a989e54d5ede2 100644
--- a/jiuyu-boot-module-system/pom.xml
+++ b/jiuyu-boot-module-system/pom.xml
@@ -89,6 +89,14 @@
jiuyu-boot-base-core
3.0
+
+
+ com.jiuyu.boot
+ jiuyu-boot-base-modules
+ 3.0
+
+
+
com.taobao.top
top-api-sdk-dev
@@ -109,7 +117,26 @@
1.2.15
+
+
+ org.springframework.boot
+ spring-boot-starter-quartz
+
+
+
+
+
com.jiuyu.boot
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/JiuYuSystemApplication.java b/jiuyu-boot-module-system/src/main/java/org/jeecg/JiuYuSystemApplication.java
index fb89140eedd19a0b18493c022a9d49aab9ed8ec7..1aa72528fbf9585f5e4d25fabbb8e475acbdd4f6 100644
--- a/jiuyu-boot-module-system/src/main/java/org/jeecg/JiuYuSystemApplication.java
+++ b/jiuyu-boot-module-system/src/main/java/org/jeecg/JiuYuSystemApplication.java
@@ -3,6 +3,7 @@ package org.jeecg;
import lombok.extern.slf4j.Slf4j;
+//import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.jeecg.common.util.oConvertUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
@@ -21,9 +22,11 @@ import java.net.UnknownHostException;
/**
* 单体启动类(采用此类启动为单体模式)
*/
+//@DubboComponentScan(basePackages = "org.jeecg.modules.system.service.impl")
@Slf4j
@SpringBootApplication(scanBasePackages = {"org.jeecg", "com.nbcio"})
@MapperScan("com.nbcio.modules.**.mapper")
+
public class JiuYuSystemApplication extends SpringBootServletInitializer {
@Override
@@ -32,6 +35,7 @@ public class JiuYuSystemApplication extends SpringBootServletInitializer {
}
public static void main(String[] args) throws UnknownHostException {
+ System.setProperty("user.home", "myhome");
ConfigurableApplicationContext application = SpringApplication.run(JiuYuSystemApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDataSourceController.java b/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDataSourceController.java
index cc85f12db87ab8c988030931300f71c76d3bc5a6..73d9d3d3f8f081aa8679f1e16ccfa7b8e2d7b9b6 100644
--- a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDataSourceController.java
+++ b/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDataSourceController.java
@@ -1,10 +1,5 @@
package org.jeecg.modules.system.controller;
-import cn.hutool.core.util.CharsetUtil;
-import cn.hutool.core.util.HexUtil;
-import cn.hutool.crypto.SecureUtil;
-import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
-import cn.hutool.crypto.symmetric.SymmetricCrypto;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
diff --git a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java b/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
index e813270378ec6f1667354aaa296c166dd01541b2..57b4bf446162140b408554d0bcdf7ca0849138ca 100644
--- a/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
+++ b/jiuyu-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
@@ -56,6 +56,7 @@ import java.util.*;
*/
@Slf4j
@Service
+//@DubboService(interfaceClass = ISysBaseAPI.class)
public class SysBaseApiImpl implements ISysBaseAPI {
/**
* 当前系统数据库类型
@@ -94,7 +95,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
private SysPermissionMapper sysPermissionMapper;
@Autowired
private ISysPermissionDataRuleService sysPermissionDataRuleService;
-
+ @Autowired
+ private ISysDataSourceService sysDataSourceService;
@Autowired
private ThirdAppWechatEnterpriseServiceImpl wechatEnterpriseService;
@Autowired
@@ -686,24 +688,28 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Override
public DynamicDataSourceModel getDynamicDbSourceById(String dbSourceId) {
- SysDataSource dbSource = dataSourceService.getById(dbSourceId);
+ /* SysDataSource dbSource = dataSourceService.getById(dbSourceId);
if (dbSource != null && StringUtils.isNotBlank(dbSource.getDbPassword())) {
String dbPassword = dbSource.getDbPassword();
String decodedStr = SecurityUtil.jiemi(dbPassword);
dbSource.setDbPassword(decodedStr);
}
- return new DynamicDataSourceModel(dbSource);
+ return new DynamicDataSourceModel(dbSource);*/
+
+ return sysDataSourceService.getDynamicDbSourceById(dbSourceId);
}
@Override
public DynamicDataSourceModel getDynamicDbSourceByCode(String dbSourceCode) {
- SysDataSource dbSource = dataSourceService.getOne(new LambdaQueryWrapper().eq(SysDataSource::getCode, dbSourceCode));
+ /* SysDataSource dbSource = dataSourceService.getOne(new LambdaQueryWrapper().eq(SysDataSource::getCode, dbSourceCode));
if (dbSource != null && StringUtils.isNotBlank(dbSource.getDbPassword())) {
String dbPassword = dbSource.getDbPassword();
String decodedStr = SecurityUtil.jiemi(dbPassword);
dbSource.setDbPassword(decodedStr);
}
- return new DynamicDataSourceModel(dbSource);
+ return new DynamicDataSourceModel(dbSource);*/
+
+ return sysDataSourceService.getDynamicDbSourceById(dbSourceCode) ;
}
@Override
diff --git a/jiuyu-boot-module-system/src/main/resources/application-dev.yml b/jiuyu-boot-module-system/src/main/resources/application-dev.yml
index 8e36ff9173af965d0b224a888679b0aa1c5273b9..316a135c783b497e15d3dc03b31f227bc5573745 100644
--- a/jiuyu-boot-module-system/src/main/resources/application-dev.yml
+++ b/jiuyu-boot-module-system/src/main/resources/application-dev.yml
@@ -7,7 +7,7 @@ server:
include-stacktrace: ALWAYS
include-message: ALWAYS
servlet:
- context-path: /nbcio-boot
+ context-path: /jiuyu-boot
compression:
enabled: true
min-response-size: 1024
@@ -271,6 +271,13 @@ cas:
logging:
level:
org.jeecg.modules.system.mapper: info
+ springfox:
+ documentation:
+ spring:
+ web:
+ readers:
+ operation:
+ CachingOperationNameGenerator: warn
#swagger
knife4j:
#开启增强配置
@@ -338,4 +345,22 @@ flowable:
annotation-font-name: 宋体
#消息链接基地址
message-base-url: http://localhost:9888/flowable/task/record/index
-
\ No newline at end of file
+
+#dubbo:
+# application:
+# name: jiuyu-boot-base
+# qos-enable: false
+# qos-accept-foreign-ip: false
+# registry:
+# protocol: dubbo
+# address: nacos://localhost:8848
+# username: nacos
+# password: nacos
+# protocol:
+# name: dubbo
+# port: 20885
+# consumer:
+# check: false
+# timeout: 5000
+# retries: 0
+
diff --git a/jiuyu-boot-module-system/src/test/java/org/jeecg/MyTest.java b/jiuyu-boot-module-system/src/test/java/org/jeecg/MyTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ffc19ea07d4a825d70d84ad776db729cc1061b5
--- /dev/null
+++ b/jiuyu-boot-module-system/src/test/java/org/jeecg/MyTest.java
@@ -0,0 +1,24 @@
+package org.jeecg;
+
+import org.jeecg.common.util.db.DynamicDBUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,classes = JiuYuSystemApplication.class)
+public class MyTest {
+
+ @Test
+ public void testSelect() {
+ String countSql = " select * from sys_data_source " ;
+ JdbcTemplate template = new JdbcTemplate( DynamicDBUtil.getDbSourceByDbKey("prod_mysql"));
+ List list = template.queryForList(countSql) ;
+ System.out.println(list.size());
+
+ }
+}
diff --git a/jiuyu-module-demo/jiuyu-boot-module-demo/pom.xml b/jiuyu-module-demo/jiuyu-boot-module-demo/pom.xml
index be1998181bc427dd1f968a91718b58678c55caf6..5f545d3cc8a0a9f8fc879fa007d08792086f395d 100644
--- a/jiuyu-module-demo/jiuyu-boot-module-demo/pom.xml
+++ b/jiuyu-module-demo/jiuyu-boot-module-demo/pom.xml
@@ -28,7 +28,7 @@
com.jiuyu.boot
- jiuyu-boot-module-flowable
+ jiuyu-boot-base-flowable
3.0
com.jiuyu.boot
- jiuyu-boot-module-flowable
+ jiuyu-boot-base-flowable
3.0
diff --git a/jiuyu-module-floweda/flow-eda-logger/src/main/resources/application.yaml b/jiuyu-module-floweda/flow-eda-logger/src/main/resources/application.yaml
index 5a0f229ac0ceeeb81a33288ba12007202dcfc871..b9f1e9742d8e4d28786b46bb8872e8f97555d12a 100644
--- a/jiuyu-module-floweda/flow-eda-logger/src/main/resources/application.yaml
+++ b/jiuyu-module-floweda/flow-eda-logger/src/main/resources/application.yaml
@@ -6,8 +6,8 @@ spring:
rabbitmq:
host: localhost
port: 5672
- username: admin
- password: admin
+ username: guest
+ password: guest
dubbo:
application:
name: flow-eda-logger
diff --git a/jiuyu-module-floweda/flow-eda-runner/pom.xml b/jiuyu-module-floweda/flow-eda-runner/pom.xml
index 573643c6d6366156beada9f69663247b56cebcdc..ab3d8ef3ea828371d486a750e36a3db7244f4e49 100644
--- a/jiuyu-module-floweda/flow-eda-runner/pom.xml
+++ b/jiuyu-module-floweda/flow-eda-runner/pom.xml
@@ -25,6 +25,19 @@
3.0
+
+ com.jiuyu.boot
+ jiuyu-system-local-api
+ 3.0
+
+
+
+ com.jiuyu.boot
+ jiuyu-boot-base-modules
+ 3.0
+
+
+
org.springframework.boot
spring-boot-starter-test
@@ -78,5 +91,12 @@
org.quartz-scheduler
quartz
+
+
+
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/FlowEdaRunnerApplication.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/FlowEdaRunnerApplication.java
index b90108a1740ea95d06c9734f55efe3ef3686955b..86202ef5b9f88ef5f8932a2c7aa52d63125b8422 100644
--- a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/FlowEdaRunnerApplication.java
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/FlowEdaRunnerApplication.java
@@ -4,6 +4,7 @@ import com.flow.eda.runner.node.http.HttpDispatcherServlet;
import com.flow.eda.runner.utils.ApplicationContextUtil;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -23,6 +24,7 @@ import org.springframework.web.servlet.DispatcherServlet;
@SpringBootApplication(exclude = { MongoAutoConfiguration.class , FreeMarkerAutoConfiguration.class , GroovyTemplateAutoConfiguration.class})
@ComponentScan(basePackages = {"com.flow.eda", "com.jiuyu", "org.jeecg"} , excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = {
"org.jeecg.config.shiro.ShiroConfig"})})
+@MapperScan("com.nbcio.modules.**.mapper , org.jeecg.modules.**.mapper")
public class FlowEdaRunnerApplication {
public static void main(String[] args) {
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/data/JiuyuBaseService.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/data/JiuyuBaseService.java
new file mode 100644
index 0000000000000000000000000000000000000000..48edbbd496e7b55e86cd075c37ee3f93a50bdd33
--- /dev/null
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/data/JiuyuBaseService.java
@@ -0,0 +1,22 @@
+package com.flow.eda.runner.data;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.vo.DynamicDataSourceModel;
+import org.jeecg.modules.system.service.ISysDataSourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class JiuyuBaseService {
+
+ /* @DubboReference
+ private ISysBaseAPI sysBaseAPI;*/
+ @Autowired
+ private ISysDataSourceService sysDataSourceService;
+
+ public DynamicDataSourceModel getDynamicDbSourceByCode(String code){
+ DynamicDataSourceModel model = sysDataSourceService.getDynamicDbSourceByCode(code);
+ return model;
+ }
+}
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/NodeTypeEnum.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/NodeTypeEnum.java
index 58237e674921d7e80f45c0d4f9b580388fed0923..f026d31e0374f3a590533b4216f9a36757aeb821 100644
--- a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/NodeTypeEnum.java
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/NodeTypeEnum.java
@@ -2,10 +2,12 @@ package com.flow.eda.runner.node;
import com.flow.eda.common.dubbo.model.FlowData;
import com.flow.eda.common.exception.InternalException;
+import com.flow.eda.runner.node.condition.ConditionDyNode;
import com.flow.eda.runner.node.condition.ConditionNode;
import com.flow.eda.runner.node.delay.DelayNode;
import com.flow.eda.runner.node.email.EmailNode;
import com.flow.eda.runner.node.etl.dataloader.RdbTableInputNode;
+import com.flow.eda.runner.node.etl.dataloader.RdbTableOutputNode;
import com.flow.eda.runner.node.etl.transform.StringTransformNode;
import com.flow.eda.runner.node.http.receive.HttpReceiveNode;
import com.flow.eda.runner.node.http.request.HttpRequestNode;
@@ -45,6 +47,9 @@ public enum NodeTypeEnum {
/** 运算节点 */
CONDITION("condition", ConditionNode.class),
+ //动态判断节点
+ CONDITIONDY("condition_dy", ConditionDyNode.class),
+
SEQUENCE("sequence", SequenceNode.class),
SPLICE("splice", SpliceNode.class),
SPLIT("split", SplitNode.class),
@@ -80,6 +85,9 @@ public enum NodeTypeEnum {
// ETL- 关系型数据库抽取节点
RdbTableInput("rdb_table_input", RdbTableInputNode.class),
+ // ETL- 关系型数据库写入节点
+ RdbTableOutputNode("rdb_table_out", RdbTableOutputNode.class),
+
/** 数据转换 */
TRANSFORM("transfrom_string", StringTransformNode.class),
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/condition/ConditionDyNode.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/condition/ConditionDyNode.java
new file mode 100644
index 0000000000000000000000000000000000000000..81b43e6b883c420f0d4a9ec234c24ec516d7345f
--- /dev/null
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/condition/ConditionDyNode.java
@@ -0,0 +1,108 @@
+package com.flow.eda.runner.node.condition;
+
+import com.flow.eda.runner.node.AbstractNode;
+import com.flow.eda.runner.node.NodeFunction;
+import com.flow.eda.runner.node.NodeVerify;
+import com.flow.eda.runner.utils.NodeParamsUtil;
+import com.flow.eda.runner.utils.PlaceholderUtil;
+import com.jayway.jsonpath.JsonPath;
+import org.bson.Document;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/** 条件节点,可使用多个条件节点进行组合使用,形成与或逻辑 */
+public class ConditionDyNode extends AbstractNode {
+ private String field;
+ private String condition;
+ private String value;
+ private Boolean passed;
+ private NodeParamsUtil nodeParams;
+
+ private String json_params;
+ // 上一步数据
+ Document inputDocment ;
+ public ConditionDyNode(Document params) {
+ super(params);
+ }
+
+ @Override
+ public void run(NodeFunction callback) {
+ if (this.passed) {
+ Document output = this.nodeParams.output(this).get();
+ setStatus(Status.FINISHED);
+ callback.callback(output);
+ }
+ }
+
+ @Override
+ protected void verify(Document params) {
+ this.field = params.getString("field");
+ NodeVerify.notNull(this.field, "field");
+ this.condition = params.getString("condition");
+ NodeVerify.notNull(this.condition, "condition");
+
+ this.value = params.getString("value");
+ NodeVerify.notNull(this.value, "value");
+ // 基于JsonPath 处理
+ this.json_params = params.toJson();
+
+ this.field = JsonPath.read(this.json_params ,this.field)+"";
+ this.value = JsonPath.read(this.json_params ,this.value)+"";
+
+ this.passed = this.dealConditions(this.field);
+
+ if (this.passed) {
+ this.nodeParams = new NodeParamsUtil(params).remove("field", "condition", "value");
+ } else {
+ // 条件未通过时,节点状态置为空
+ setStatus(null);
+ }
+ }
+
+ /** 解析条件表达式,返回条件判断结果 */
+ private boolean meetConditions(Document params) {
+ try {
+ Document result = PlaceholderUtil.parse(params, Collections.singletonList(this.field));
+ return this.dealConditions(result.get(this.field));
+ } catch (Exception ignored) {
+ return false;
+ }
+ }
+
+ /** 处理判断条件 */
+ private boolean dealConditions(Object data) {
+ List list = Arrays.asList("null", "NULL", "Null");
+ String equals = "=";
+ String notEquals = "!=";
+ if (list.contains(this.value)) {
+ if (equals.equals(this.condition)) {
+ return data == null;
+ }
+ if (notEquals.equals(this.condition)) {
+ return data != null;
+ }
+ return false;
+ }
+ if (data == null) {
+ return notEquals.equals(this.condition);
+ }
+ switch (this.condition) {
+ case "=":
+ return this.value.equals(data.toString());
+ case "!=":
+ return !this.value.equals(data.toString());
+ case ">":
+ return Double.parseDouble(data.toString()) > Double.parseDouble(this.value);
+ case "<":
+ return Double.parseDouble(data.toString()) < Double.parseDouble(this.value);
+ case ">=":
+ return Double.parseDouble(data.toString()) >= Double.parseDouble(this.value);
+ case "<=":
+ return Double.parseDouble(data.toString()) <= Double.parseDouble(this.value);
+ default:
+ return false;
+ }
+ }
+}
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataColumnMeta.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataColumnMeta.java
new file mode 100644
index 0000000000000000000000000000000000000000..63d44c7810257431db3daf5d9203bf9809e7f99e
--- /dev/null
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataColumnMeta.java
@@ -0,0 +1,14 @@
+package com.flow.eda.runner.node.etl;
+
+import lombok.Data;
+
+@Data
+public class DataColumnMeta {
+
+ private String dataColumnId;
+ private String columnName;
+ private String columnType;
+ private int precsn;
+ private int dataLength;
+ private String metaColumnId;
+}
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataSetMeta.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataSetMeta.java
new file mode 100644
index 0000000000000000000000000000000000000000..afbdc9a40eaecf97db31206d0eabbb5b3297adee
--- /dev/null
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/DataSetMeta.java
@@ -0,0 +1,16 @@
+package com.flow.eda.runner.node.etl;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class DataSetMeta {
+
+ private Map dataColumnMetas = new LinkedHashMap();
+
+ public int getColumnCount() { return this.dataColumnMetas.size(); }
+
+ public void addColumnMeta(DataColumnMeta columnMeta) { this.dataColumnMetas.put(columnMeta.getColumnName(), columnMeta); }
+
+ public Collection getAllColumn() { return this.dataColumnMetas.values(); }
+}
diff --git a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/dataloader/RdbTableInputNode.java b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/dataloader/RdbTableInputNode.java
index 851f7ef955cb65d7d5f7583f0ca5d7ad3d3870eb..f4dc32367089c05ad98567d9583cd41508e1abbf 100644
--- a/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/dataloader/RdbTableInputNode.java
+++ b/jiuyu-module-floweda/flow-eda-runner/src/main/java/com/flow/eda/runner/node/etl/dataloader/RdbTableInputNode.java
@@ -1,32 +1,64 @@
package com.flow.eda.runner.node.etl.dataloader;
-import com.flow.eda.common.exception.FlowException;
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.fastjson.JSON;
+import com.flow.eda.runner.data.JiuyuBaseService;
import com.flow.eda.runner.node.AbstractNode;
import com.flow.eda.runner.node.NodeFunction;
import com.flow.eda.runner.node.NodeVerify;
+import com.flow.eda.runner.node.etl.DataColumnMeta;
+import com.flow.eda.runner.node.etl.DataSetMeta;
+import com.jiuyu.dynamicApi.service.impl.PageBeanHander;
+import com.jiuyu.dynamicApi.utils.PageBean;
+import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
+import org.jeecg.common.system.vo.DynamicDataSourceModel;
+import org.jeecg.common.util.SpringContextUtils;
+import org.jeecg.common.util.db.DynamicDBUtil;
+import org.springframework.jdbc.core.JdbcTemplate;
import java.sql.*;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.*;
+@Slf4j
public class RdbTableInputNode extends AbstractNode {
+ PageBeanHander pageBeanHander;
- // 数据库类型 mysql , oracle
- private String dbType ;
- private String url;
- private String username;
- private String password;
+ // 数据库类型 mysql=2 , oracle=1
+ private String dbType;
+ private String dbKey;
private String sql;
- // 单次抽取数据量大小
- private String batchSize ;
+ // 总条数
+ private int totalCount;
+
+ // 单个线程处理分页量
+ private int pageSize ;
+ // 当前第几页
+ private int pageNo;
+
+ // 执行线程数
+ private int threadCount;
+ // 总共多少页,每页对应一个线程
+ private int pageCount;
// 增量字段,如 创建时间
private String increaseField;
+ //
+ JdbcTemplate jdbcTemplate;
+ // 动态数据源
+ DruidDataSource ds ;
+ DynamicDataSourceModel dynamicDataSourceModel;
+ // 字段元数据
+ DataSetMeta dataSetMeta;
+
+ Document document ;
+ List