Browse Source

Merge branch 'master' into test-track

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
#	jeecg-boot-module-system/src/main/resources/application-dev.yml
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
yumeng 4 years ago
parent
commit
0cf30a0bea
100 changed files with 5980 additions and 2268 deletions
  1. 4 0
      .gitattributes
  2. 61 0
      Dockerfile
  3. 22 121
      README.md
  4. 7 1
      jeecg-boot-base-common/pom.xml
  5. 23 23
      jeecg-boot-base-common/src/main/java/org/jeecg/common/api/vo/Result.java
  6. 18 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/aspect/annotation/OnlineAuth.java
  7. 27 10
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  8. 31 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CacheConstant.java
  9. 156 13
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CommonConstant.java
  10. 14 12
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CommonSendStatus.java
  11. 16 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/DataBaseConstant.java
  12. 25 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/FillRuleConstant.java
  13. 33 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/GeneralConstant.java
  14. 130 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/ProvinceCityArea.java
  15. 56 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/WebsocketConst.java
  16. 481 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/es/JeecgElasticsearchTemplate.java
  17. 98 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/es/QueryStringBuilder.java
  18. 42 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java
  19. 21 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/handler/IFillRuleHandler.java
  20. 0 78
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseApi.java
  21. 0 106
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java
  22. 0 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/base/entity/JeecgEntity.java
  23. 0 222
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/controller/CommonController.java
  24. 44 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/MatchTypeEnum.java
  25. 0 594
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java
  26. 1 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java
  27. 18 20
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java
  28. 174 182
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java
  29. 36 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/ComboModel.java
  30. 3 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictModel.java
  31. 34 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictQuery.java
  32. 52 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
  33. 36 22
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java
  34. 52 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java
  35. 147 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java
  36. 151 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java
  37. 43 47
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java
  38. 15 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserUtils.java
  39. 64 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/CommonUtils.java
  40. 376 60
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  41. 66 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsEnum.java
  42. 57 50
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java
  43. 57 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/FillRuleUtil.java
  44. 29 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/HTMLUtils.java
  45. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/IPUtils.java
  46. 96 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ImportExcelUtil.java
  47. 32 13
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java
  48. 53 35
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  49. 208 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MinioUtil.java
  50. 17 16
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java
  51. 61 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java
  52. 42 41
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java
  53. 238 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ReflectHelper.java
  54. 121 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestDesformUtil.java
  55. 247 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java
  56. 63 67
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java
  57. 69 13
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
  58. 70 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java
  59. 4 4
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/UUIDGenerator.java
  60. 161 152
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
  61. 31 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/DbValidationQueryEnum.java
  62. 167 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/FreemarkerParseFactory.java
  63. 31 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DbValidationQueryEnum.java
  64. 167 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java
  65. 98 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
  66. 12 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java
  67. 28 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
  68. 98 27
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
  69. 8 8
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
  70. 12 41
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
  71. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
  72. 38 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
  73. 66 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
  74. 0 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
  75. 23 27
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
  76. 46 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
  77. 60 14
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
  78. 146 51
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  79. 289 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
  80. 77 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/SecurityTools.java
  81. 9 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java
  82. 11 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java
  83. 10 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java
  84. 9 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java
  85. 10 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java
  86. 1 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java
  87. 0 78
      jeecg-boot-base-common/src/main/java/org/jeecg/modules/system/entity/SysPermissionDataRule.java
  88. 51 0
      jeecg-boot-base-common/src/main/resources/static/pca.json
  89. 4 0
      jeecg-boot-module-system/.gitattributes
  90. 42 19
      jeecg-boot-module-system/pom.xml
  91. 21 17
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  92. 6 7
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGui.java
  93. 30 23
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java
  94. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/config/AutoPoiConfig.java
  95. 38 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/MinioConfig.java
  96. 9 9
      jeecg-boot-module-system/src/main/java/org/jeecg/config/MybatisPlusConfig.java
  97. 0 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java
  98. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RestTemplateConfig.java
  99. 100 6
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  100. 0 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/StaticConfig.java

+ 4 - 0
.gitattributes

@@ -0,0 +1,4 @@
+*.js linguist-language=Java
+*.css linguist-language=Java
+*.html linguist-language=Java
+*.vue linguist-language=Java

+ 61 - 0
Dockerfile

@@ -0,0 +1,61 @@
+#https://blog.csdn.net/sinat_19528249/article/details/99994464
+# Version 0.1
+# 基础镜像
+FROM centos:7
+# 维护者信息
+MAINTAINER kangxiaolin ksf@zgykkj.com
+VOLUME /tmp
+#自动安装依赖
+RUN  cd /etc/yum.repos.d/ \
+    && yum -y install wget \
+    && wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo \
+    && yum clean all \
+    && yum makecache \
+    && yum update -y \
+    &&  yum -y  install nginx  \
+    &&  yum -y  install  java-1.8.0-openjdk java-1.8.0-openjdk-devel  \
+    &&  yum -y  install redis    \
+#这里可以设置 域名
+# 可以送本地加载 使用ADD 也可以直接写
+   && echo "server {  \
+                       listen       81; \
+                       location ^~ /jeecg-boot { \
+                      proxy_pass              http://127.0.0.1:8080/jeecg-boot/; \
+                      proxy_set_header        Host 127.0.0.1; \
+                      proxy_set_header        X-Real-IP \$remote_addr; \
+                      proxy_set_header        X-Forwarded-For \$proxy_add_x_forwarded_for; \
+                  } \
+                  #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 \
+                  location / { \
+                     root   /var/www/html/; \
+                      index  index.html index.htm; \
+                      if (!-e \$request_filename) { \
+                          rewrite ^(.*)\$ /index.html?s=\$1 last; \
+                          break; \
+                      } \
+                  } \
+                  access_log  /var/log/nginx/access.log ; \
+              } " > /etc/nginx/conf.d/default.conf  \
+
+ # 设置启动脚本
+     && touch /etc/init.d/start.sh \
+     && touch jeecgboot.log \
+     && chmod +x /etc/init.d/start.sh \
+     && echo "#!/bin/bash  " >> /etc/init.d/start.sh \
+     && echo "/usr/bin/redis-server  & " >> /etc/init.d/start.sh \
+     && echo "/usr/sbin/nginx  -c /etc/nginx/nginx.conf" >> /etc/init.d/start.sh \
+     && echo " java -jar /jeecgboot.jar   " >> /etc/init.d/start.sh \
+     &&  mkdir  -p  /var/www \
+     &&  mkdir -p /var/www/html
+# 前端迁移到系统文件中 默认是80端口 同级目录下的html地址
+ADD  ant-design-vue-jeecg/dist/ /var/www/html/
+# 拷贝相关的jar包
+ADD jeecg-boot/jeecg-boot-module-system/target/jeecg-boot-module-system-2.2.0.jar jeecgboot.jar
+EXPOSE  80  8080 81
+ENTRYPOINT /bin/sh -c   /etc/init.d/start.sh
+
+#启动脚本
+#docker rmi $(docker images | grep "^<none>" | awk "{print $3}") 删除<none>
+
+#docker build -t jeecgboot:centos .
+#docker run --privileged=true  -itd --name test -v /sys/fs/cgroup:/sys/fs/cgroup:ro  -p 81:81 -p 8080:8080 -p 82:80  jeecgboot:centos

+ 22 - 121
README.md

@@ -1,7 +1,7 @@
 Jeecg-Boot 快速开发平台
 Jeecg-Boot 快速开发平台
 ===============
 ===============
 
 
-当前最新版本: 2.0.2(发布日期:20190708
+当前最新版本: 2.2.0(发布日期:20200506
 
 
 
 
 ## 后端技术架构
 ## 后端技术架构
@@ -33,10 +33,22 @@ Jeecg-Boot 快速开发平台
 
 
 - 缓存:Redis
 - 缓存:Redis
 
 
- 
-## 开发文档
 
 
-- 查询过滤器用法
+## 技术文档
+
+
+- 在线演示 :  [http://boot.jeecg.com](http://boot.jeecg.com)
+
+- 在线文档:  [http://doc.jeecg.com/1273753](http://doc.jeecg.com/1273753)
+
+- 常见问题:  [入门常见问题大全](http://bbs.jeecg.com/forum.php?mod=viewthread&tid=7816&extra=page%3D1)
+
+- QQ交流群 :  ①284271917、②769925425
+
+
+## 专项文档
+
+#### 一、查询过滤器用法
 
 
 ```
 ```
 QueryWrapper<?> queryWrapper = QueryGenerator.initQueryWrapper(?, req.getParameterMap());
 QueryWrapper<?> queryWrapper = QueryGenerator.initQueryWrapper(?, req.getParameterMap());
@@ -77,133 +89,22 @@ QueryWrapper<?> queryWrapper = QueryGenerator.initQueryWrapper(?, req.getParamet
 | 多选字段模糊查询     | 上述4 有一个特例,若某一查询字段前后都带逗号 则会将其视为走这种查询方式 ,该查询方式是将查询条件以逗号分割再遍历数组 将每个元素作like查询 用or拼接,例如 现在name传入值 ,a,b,c, 那么结果sql就是 name like '%a%' or name like '%b%' or name like '%c%' |    |
 | 多选字段模糊查询     | 上述4 有一个特例,若某一查询字段前后都带逗号 则会将其视为走这种查询方式 ,该查询方式是将查询条件以逗号分割再遍历数组 将每个元素作like查询 用or拼接,例如 现在name传入值 ,a,b,c, 那么结果sql就是 name like '%a%' or name like '%b%' or name like '%c%' |    |
 
 
 
 
-- Autopoi使用文档(EXCEL工具类 -  EasyPOI衍变升级重构版本)
+#### 二、AutoPoi(EXCEL工具类-EasyPOI衍变升级重构版本)
  
  
   [在线文档](https://github.com/zhangdaiscott/autopoi)
   [在线文档](https://github.com/zhangdaiscott/autopoi)
   
   
 
 
 
 
+#### 三、代码生成器
 
 
-- **代码生成器**
-
-** 功能说明**:   一键生成的代码(包括:controller、service、dao、mapper、entity、vue)
+> 功能说明:   一键生成的代码(包括:controller、service、dao、mapper、entity、vue)
  
  
- **模板位置**: src/main/resources/jeecg/code-template  
+ - 模板位置: src/main/resources/jeecg/code-template
+ - 技术文档: http://doc.jeecg.com
 
 
-**使用方法**: 
- 
- 【**一对一模板**】  
-  
-**1.**先找到**jeecg-boot/src/resources/jeecg**下的  
-**jeecg_config.properties**和**jeecg_database.properties**两个文件。  
-**jeecg_config.properties:** 用来配置文件生成的路径,  
-    
-**jeecg_database.properties:** 用来配置数据库相关配置.  
-         
-         
-**2.**配置好这些配置之后,我们需要找到**jeecg-boot/src/main/java/org/jeecg/JeecgOneGUI.java**类,也就是启动一对一代码生成器的入口;
-  
-    
-**3.**右键运行该类,紧接着会弹出一个窗口,如下图:  
-        ![](https://static.oschina.net/uploads/img/201904/14222638_Svth.png)  
-          
-          
-**4.**然后根据窗口左侧的提示,在右侧填写对应的信息即可.
-     
- 【**一对多模板**】  
-   
-   
-**1.**先找到**jeecg-boot/src/resources/jeecg**下的
-    
-**jeecg_config.properties**和**jeecg_database.properties**两个文件。  
-  
-**jeecg_config.properties:** 是配置文件生成路径的,  
-  
-  
-**jeecg_database.properties:** 是配置数据库相关配置的文件。  
-       
-       
-**2.**接着我们需要找到**jeecg-boot/src/main/java/org/jeecg/JeecgOneToMainUtil.java**这个类。
-     该类是生成一对多模板的启动入口。  
-       
-       
-**3.**该类中需要三个步骤来配置一对多表的信息。  
-  
-    
-  (1) 第一步: 配置主表信息,代码如下:
-  
-```
-		//第一步:设置主表配置
-		MainTableVo mainTable = new MainTableVo();
-		mainTable.setTableName("jeecg_order_main");//表名
-		mainTable.setEntityName("TestOrderMain");	 //实体名
-		mainTable.setEntityPackage("test2");	 //包名
-		mainTable.setFtlDescription("订单");	 //描述
-		
-```
-  (2) 第二步: 配置子表信息,**有多个则配置多个**, 代码如下: 
-     
-  ①比如: 配置子表 1:
-  
-  ```
-		//第二步:设置子表集合配置
-		List<SubTableVo> subTables = new ArrayList<SubTableVo>();
-		//[1].子表一
-		SubTableVo po = new SubTableVo();
-		po.setTableName("jeecg_order_customer");//表名
-		po.setEntityName("TestOrderCustom");	    //实体名
-		po.setEntityPackage("test2");	        //包名
-		po.setFtlDescription("客户明细");       //描述
-		//子表外键参数配置
-		/*说明: 
-		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
-		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
-		 * c) 多个外键字段,采用逗号分隔;
-		*/
-		po.setForeignKeys(new String[]{"order_id"});
-		subTables.add(po);
-  ```
-  ②比如: 配置子表 2:  
-  
-```
-		//[2].子表二
-		SubTableVo po2 = new SubTableVo();
-		po2.setTableName("jeecg_order_ticket");		//表名
-		po2.setEntityName("TestOrderTicket");			//实体名
-		po2.setEntityPackage("test2"); 				//包名
-		po2.setFtlDescription("产品明细");			//描述
-		//子表外键参数配置
-		/*说明: 
-		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
-		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
-		 * c) 多个外键字段,采用逗号分隔;
-		*/
-		po2.setForeignKeys(new String[]{"order_id"});
-		subTables.add(po2);  
-  ```
-  ③将整合了子表VO的subTables添加到主表对象当中去: 
 
 
-```
-  mainTable.setSubTables(subTables);
-  ```
-  ④需要注意如下代码,该代码的作用是,为子表设置主外键关联,当添加数据时,  
-主表的主键将会添加到子表的"order_id"中:  
-  
-```
-  		po2.setForeignKeys(new String[]{"order_id"});
-  ```
-    
-  (3) 第三步: 启动(run)程序,生成代码, 代码如下:
-  
-  ```
-  		//第三步:一对多(父子表)数据模型,代码生成
-		new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile();
-  ```
- 
-[在线文档](https://github.com/zhangdaiscott/autopoi)  
-  
 
 
-- **编码排重使用示例**   
+#### 四、编码排重使用示例
 
 
 重复校验效果:
 重复校验效果:
 ![输入图片说明](https://static.oschina.net/uploads/img/201904/19191836_eGkQ.png "在这里输入图片标题")
 ![输入图片说明](https://static.oschina.net/uploads/img/201904/19191836_eGkQ.png "在这里输入图片标题")

+ 7 - 1
jeecg-boot-base-common/pom.xml

@@ -4,6 +4,12 @@
     <modelVersion>4.0.0</modelVersion>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>jeecg-boot-base-common</artifactId>
     <artifactId>jeecg-boot-base-common</artifactId>
     <version>2.0.2</version>
     <version>2.0.2</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy</artifactId>
+        </dependency>
+    </dependencies>
     <parent>
     <parent>
         <groupId>org.jeecgframework.boot</groupId>
         <groupId>org.jeecgframework.boot</groupId>
         <artifactId>jeecg-boot-parent</artifactId>
         <artifactId>jeecg-boot-parent</artifactId>
@@ -29,4 +35,4 @@
         </repository>
         </repository>
     </repositories>
     </repositories>
 
 
-</project>
+</project>

+ 23 - 23
jeecg-boot-base-common/src/main/java/org/jeecg/common/api/vo/Result.java

@@ -1,11 +1,11 @@
 package org.jeecg.common.api.vo;
 package org.jeecg.common.api.vo;
 
 
-import java.io.Serializable;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.CommonConstant;
 
 
-import lombok.Data;
+import java.io.Serializable;
 
 
 /**
 /**
  *   接口返回数据格式
  *   接口返回数据格式
@@ -36,7 +36,7 @@ public class Result<T> implements Serializable {
 	 */
 	 */
 	@ApiModelProperty(value = "返回代码")
 	@ApiModelProperty(value = "返回代码")
 	private Integer code = 0;
 	private Integer code = 0;
-	
+
 	/**
 	/**
 	 * 返回数据对象 data
 	 * 返回数据对象 data
 	 */
 	 */
@@ -48,64 +48,64 @@ public class Result<T> implements Serializable {
 	 */
 	 */
 	@ApiModelProperty(value = "时间戳")
 	@ApiModelProperty(value = "时间戳")
 	private long timestamp = System.currentTimeMillis();
 	private long timestamp = System.currentTimeMillis();
+
 	public Result() {
 	public Result() {
-		
-	}
-	
-	public Result<T> error500(String message) {
-		this.message = message;
-		this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
-		this.success = false;
-		return this;
+
 	}
 	}
-	
+
 	public Result<T> success(String message) {
 	public Result<T> success(String message) {
 		this.message = message;
 		this.message = message;
 		this.code = CommonConstant.SC_OK_200;
 		this.code = CommonConstant.SC_OK_200;
 		this.success = true;
 		this.success = true;
 		return this;
 		return this;
 	}
 	}
-	
+
 	public static Result<Object> ok() {
 	public static Result<Object> ok() {
-		Result<Object> r = new Result<Object>();
+		Result<Object> r = new Result<>();
 		r.setSuccess(true);
 		r.setSuccess(true);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setMessage("成功");
 		r.setMessage("成功");
 		return r;
 		return r;
 	}
 	}
-	
+
 	public static Result<Object> ok(String msg) {
 	public static Result<Object> ok(String msg) {
-		Result<Object> r = new Result<Object>();
+		Result<Object> r = new Result<>();
 		r.setSuccess(true);
 		r.setSuccess(true);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setMessage(msg);
 		r.setMessage(msg);
 		return r;
 		return r;
 	}
 	}
-	
+
 	public static Result<Object> ok(Object data) {
 	public static Result<Object> ok(Object data) {
-		Result<Object> r = new Result<Object>();
+		Result<Object> r = new Result<>();
 		r.setSuccess(true);
 		r.setSuccess(true);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setCode(CommonConstant.SC_OK_200);
 		r.setResult(data);
 		r.setResult(data);
 		return r;
 		return r;
 	}
 	}
-	
+
 	public static Result<Object> error(String msg) {
 	public static Result<Object> error(String msg) {
 		return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
 		return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
 	}
 	}
-	
+
 	public static Result<Object> error(int code, String msg) {
 	public static Result<Object> error(int code, String msg) {
-		Result<Object> r = new Result<Object>();
+		Result<Object> r = new Result<>();
 		r.setCode(code);
 		r.setCode(code);
 		r.setMessage(msg);
 		r.setMessage(msg);
 		r.setSuccess(false);
 		r.setSuccess(false);
 		return r;
 		return r;
 	}
 	}
-	
+
+	public Result<T> error500(String message) {
+		this.message = message;
+		this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
+		this.success = false;
+		return this;
+	}
 	/**
 	/**
 	 * 无权限访问返回结果
 	 * 无权限访问返回结果
 	 */
 	 */
 	public static Result<Object> noauth(String msg) {
 	public static Result<Object> noauth(String msg) {
 		return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
 		return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
 	}
 	}
-}
+}

+ 18 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/aspect/annotation/OnlineAuth.java

@@ -0,0 +1,18 @@
+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();
+}

+ 27 - 10
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -6,21 +6,22 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
- *  Created by JQ.bi on 2020.5.30
+ * Created by JQ.bi on 2020.5.30
  */
  */
 public class AccountReportConstants {
 public class AccountReportConstants {
 
 
     /**
     /**
      * 私有构造器
      * 私有构造器
      */
      */
-    private AccountReportConstants(){
+    private AccountReportConstants() {
 
 
     }
     }
 
 
-    /** 单体实例 */
+    /**
+     * 单体实例
+     */
     private static AccountReportConstants instance;
     private static AccountReportConstants instance;
 
 
-
     /**
     /**
      * @return 返回 instance
      * @return 返回 instance
      */
      */
@@ -31,17 +32,33 @@ public class AccountReportConstants {
         return instance;
         return instance;
     }
     }
 
 
-    /** 字典数据 */
-    public static Map<String, Map<String,Object>> dicMap = new HashMap<>();
+    /**
+     * 字典数据
+     */
+    //头条字段映射
+    public static Map<String, Map<String, Object>> dicMapBy = new HashMap<>();
+    //快手字段映射
+    public static Map<String, Map<String, Object>> dicMapKs = new HashMap<>();
+    //头条视频报表字段映射
+    public static Map<String, Map<String, Object>> dicMapByVideo = new HashMap<>();
+    public static Map<String, Map<String, Object>> kuaishouVideoReportMap = new HashMap<>();
+    public static Map<String, Map<String, Object>> kuaishouVideoReportDict = new HashMap<>();
 
 
     /**
     /**
      * 初始化字典
      * 初始化字典
      */
      */
-    public void init(){
+    public void init() {
         //加载json文件
         //加载json文件
-        Object json=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        Object jsonBy = JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        Object jsonKs = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
+        Object KuaiShouVideoJson = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_video_report_filed_mapping.json");
+        Object KuaiShouVideoDictJson = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_video_report_filed_dict.json");
+        Object jsonByVideo = JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
         //json 转为map存为静态常量
         //json 转为map存为静态常量
-        dicMap=JsonResourceUtil.jsonToMap(json);
+        dicMapBy = JsonResourceUtil.jsonToMap(jsonBy);
+        dicMapKs = JsonResourceUtil.jsonToMap(jsonKs);
+        dicMapByVideo = JsonResourceUtil.jsonToMap(jsonByVideo);
+        kuaishouVideoReportMap = JsonResourceUtil.jsonToMap(KuaiShouVideoJson);
+        kuaishouVideoReportDict = JsonResourceUtil.jsonToMap(KuaiShouVideoDictJson);
     }
     }
-
 }
 }

+ 31 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CacheConstant.java

@@ -10,17 +10,43 @@ public interface CacheConstant {
 	/**
 	/**
 	 * 字典信息缓存
 	 * 字典信息缓存
 	 */
 	 */
-    public static final String DICT_CACHE = "dictCache";
+    public static final String SYS_DICT_CACHE = "sys:cache:dict";
+	/**
+	 * 表字典信息缓存
+	 */
+    public static final String SYS_DICT_TABLE_CACHE = "sys:cache:dictTable";
+
+	/**
+	 * 数据权限配置缓存
+	 */
+    public static final String SYS_DATA_PERMISSIONS_CACHE = "sys:cache:permission:datarules";
+
+	/**
+	 * 缓存用户信息
+	 */
+	public static final String SYS_USERS_CACHE = "sys:cache:user";
 
 
 	/**
 	/**
-	 * 权限信息缓存
+	 * 全部部门信息缓存
 	 */
 	 */
-    public static final String PERMISSION_CACHE = "permission";
+	public static final String SYS_DEPARTS_CACHE = "sys:cache:depart:alldata";
+
+	public static final String SYS_TAGINFOS_CACHE = "sys:cache:taginfo:alldata";
+
+	/**
+	 * 全部部门ids缓存
+	 */
+	public static final String SYS_DEPART_IDS_CACHE = "sys:cache:depart:allids";
+
 
 
 	/**
 	/**
-	 * 登录用户规则缓存
+	 * 测试缓存key
 	 */
 	 */
-    public static final String LOGIN_USER_RULES_CACHE = "loginUser_cacheRules";
+	public static final String TEST_DEMO_CACHE = "test:demo";
 
 
+	/**
+	 * 字典信息缓存
+	 */
+	public static final String SYS_DYNAMICDB_CACHE = "sys:cache:dbconnect:dynamic:";
 
 
 }
 }

+ 156 - 13
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CommonConstant.java

@@ -5,17 +5,13 @@ public interface CommonConstant {
 	/**
 	/**
 	 * 正常状态
 	 * 正常状态
 	 */
 	 */
-
 	public static final Integer STATUS_NORMAL = 0;
 	public static final Integer STATUS_NORMAL = 0;
 
 
-
 	/**
 	/**
 	 * 禁用状态
 	 * 禁用状态
 	 */
 	 */
-
 	public static final Integer STATUS_DISABLE = -1;
 	public static final Integer STATUS_DISABLE = -1;
 
 
-
 	/**
 	/**
 	 * 删除标志
 	 * 删除标志
 	 */
 	 */
@@ -24,7 +20,6 @@ public interface CommonConstant {
 	/**
 	/**
 	 * 未删除
 	 * 未删除
 	 */
 	 */
-
 	public static final Integer DEL_FLAG_0 = 0;
 	public static final Integer DEL_FLAG_0 = 0;
 
 
 	/**
 	/**
@@ -32,10 +27,41 @@ public interface CommonConstant {
 	 */
 	 */
 	public static final int LOG_TYPE_1 = 1;
 	public static final int LOG_TYPE_1 = 1;
 
 
+
 	/**
 	/**
 	 * 系统日志类型: 操作
 	 * 系统日志类型: 操作
 	 */
 	 */
 	public static final int LOG_TYPE_2 = 2;
 	public static final int LOG_TYPE_2 = 2;
+
+	/**
+	 * 操作日志类型: 查询
+	 */
+	public static final int OPERATE_TYPE_1 = 1;
+
+	/**
+	 * 操作日志类型: 添加
+	 */
+	public static final int OPERATE_TYPE_2 = 2;
+
+	/**
+	 * 操作日志类型: 更新
+	 */
+	public static final int OPERATE_TYPE_3 = 3;
+
+	/**
+	 * 操作日志类型: 删除
+	 */
+	public static final int OPERATE_TYPE_4 = 4;
+
+	/**
+	 * 操作日志类型: 倒入
+	 */
+	public static final int OPERATE_TYPE_5 = 5;
+
+	/**
+	 * 操作日志类型: 导出
+	 */
+	public static final int OPERATE_TYPE_6 = 6;
 	
 	
 	
 	
 	/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
 	/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
@@ -46,16 +72,20 @@ public interface CommonConstant {
     /**访问权限认证未通过 510*/
     /**访问权限认证未通过 510*/
     public static final Integer SC_JEECG_NO_AUTHZ=510;
     public static final Integer SC_JEECG_NO_AUTHZ=510;
 
 
+    /** 登录用户Shiro权限缓存KEY前缀 */
+    public static String PREFIX_USER_SHIRO_CACHE  = "shiro:cache:org.jeecg.modules.shiro.authc.ShiroRealm.authorizationCache:";
+    /** 登录用户Token令牌缓存KEY前缀 */
+    public static final String PREFIX_USER_TOKEN  = "prefix_user_token_";
+    /** Token缓存时间:3600秒即一小时 */
+    public static final int  TOKEN_EXPIRE_TIME  = 3600;
+
+
     /** 登录用户拥有角色缓存KEY前缀 */
     /** 登录用户拥有角色缓存KEY前缀 */
     public static String LOGIN_USER_CACHERULES_ROLE = "loginUser_cacheRules::Roles_";
     public static String LOGIN_USER_CACHERULES_ROLE = "loginUser_cacheRules::Roles_";
     /** 登录用户拥有权限缓存KEY前缀 */
     /** 登录用户拥有权限缓存KEY前缀 */
     public static String LOGIN_USER_CACHERULES_PERMISSION  = "loginUser_cacheRules::Permissions_";
     public static String LOGIN_USER_CACHERULES_PERMISSION  = "loginUser_cacheRules::Permissions_";
     /** 登录用户令牌缓存KEY前缀 */
     /** 登录用户令牌缓存KEY前缀 */
 
 
-    public static final int TOKEN_EXPIRE_TIME = 3600;
-    
-    public static final String PREFIX_USER_TOKEN  = "PREFIX_USER_TOKEN_";
-    
     /**
     /**
      *  0:一级菜单
      *  0:一级菜单
      */
      */
@@ -103,9 +133,9 @@ public interface CommonConstant {
     /**
     /**
      * 同步工作流引擎1同步0不同步
      * 同步工作流引擎1同步0不同步
      */
      */
-    public static final String ACT_SYNC_0 = "0";
-    public static final String ACT_SYNC_1 = "1";
-    
+    public static final Integer ACT_SYNC_1 = 1;
+    public static final Integer ACT_SYNC_0 = 0;
+
     /**
     /**
      * 消息类型1:通知公告2:系统消息
      * 消息类型1:通知公告2:系统消息
      */
      */
@@ -119,11 +149,124 @@ public interface CommonConstant {
     public static final Integer RULE_FLAG_1 = 1;
     public static final Integer RULE_FLAG_1 = 1;
 
 
     /**
     /**
-     * 是否用户已被冻结 1(解冻)正常 2冻结
+     * 是否用户已被冻结 1正常(解冻) 2冻结
      */
      */
     public static final Integer USER_UNFREEZE = 1;
     public static final Integer USER_UNFREEZE = 1;
     public static final Integer USER_FREEZE = 2;
     public static final Integer USER_FREEZE = 2;
     
     
     /**字典翻译文本后缀*/
     /**字典翻译文本后缀*/
     public static final String DICT_TEXT_SUFFIX = "_dictText";
     public static final String DICT_TEXT_SUFFIX = "_dictText";
+
+    /**
+     * 表单设计器主表类型
+     */
+    public static final Integer DESIGN_FORM_TYPE_MAIN = 1;
+
+    /**
+     * 表单设计器子表表类型
+     */
+    public static final Integer DESIGN_FORM_TYPE_SUB = 2;
+
+    /**
+     * 表单设计器URL授权通过
+     */
+    public static final Integer DESIGN_FORM_URL_STATUS_PASSED = 1;
+
+    /**
+     * 表单设计器URL授权未通过
+     */
+    public static final Integer DESIGN_FORM_URL_STATUS_NOT_PASSED = 2;
+
+    /**
+     * 表单设计器新增 Flag
+     */
+    public static final String DESIGN_FORM_URL_TYPE_ADD = "add";
+    /**
+     * 表单设计器修改 Flag
+     */
+    public static final String DESIGN_FORM_URL_TYPE_EDIT = "edit";
+    /**
+     * 表单设计器详情 Flag
+     */
+    public static final String DESIGN_FORM_URL_TYPE_DETAIL = "detail";
+    /**
+     * 表单设计器复用数据 Flag
+     */
+    public static final String DESIGN_FORM_URL_TYPE_REUSE = "reuse";
+    /**
+     * 表单设计器编辑 Flag (已弃用)
+     */
+    public static final String DESIGN_FORM_URL_TYPE_VIEW = "view";
+
+    /**
+     * online参数值设置(是:Y, 否:N)
+     */
+    public static final String ONLINE_PARAM_VAL_IS_TURE = "Y";
+    public static final String ONLINE_PARAM_VAL_IS_FALSE = "N";
+
+    /**
+     * 文件上传类型(本地:local,Minio:minio,阿里云:alioss)
+     */
+    public static final String UPLOAD_TYPE_LOCAL = "local";
+    public static final String UPLOAD_TYPE_MINIO = "minio";
+    public static final String UPLOAD_TYPE_OSS = "alioss";
+
+    /**
+     * 文档上传自定义桶名称
+     */
+    public static final String UPLOAD_CUSTOM_BUCKET = "eoafile";
+    /**
+     * 文档上传自定义路径
+     */
+    public static final String UPLOAD_CUSTOM_PATH = "eoafile";
+    /**
+     * 文件外链接有效天数
+     */
+    public static final Integer UPLOAD_EFFECTIVE_DAYS = 1;
+
+    /**
+     * 员工身份 (1:普通员工  2:上级)
+     */
+    public static final Integer USER_IDENTITY_1 = 1;
+    public static final Integer USER_IDENTITY_2 = 2;
+
+    /** sys_user 表 username 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username";
+    /** sys_user 表 work_no 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no";
+    /** sys_user 表 phone 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone";
+    /** sys_user 表 email 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email";
+    /** sys_quartz_job 表 job_class_name 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name";
+    /** sys_position 表 code 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_CODE = "uniq_code";
+    /** sys_role 表 code 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code";
+    /** sys_depart 表 code 唯一键索引 */
+    public static final String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code";
+    /**
+     * 在线聊天 是否为默认分组
+     */
+    public static final String IM_DEFAULT_GROUP = "1";
+    /**
+     * 在线聊天 图片文件保存路径
+     */
+    public static final String IM_UPLOAD_CUSTOM_PATH = "imfile";
+    /**
+     * 在线聊天 用户状态
+     */
+    public static final String IM_STATUS_ONLINE = "online";
+
+    /**
+     * 在线聊天 SOCKET消息类型
+     */
+    public static final String IM_SOCKET_TYPE = "chatMessage";
+
+    /**
+     * 考勤补卡业务状态 (1:同意  2:不同意)
+     */
+    public static final String SIGN_PATCH_BIZ_STATUS_1 = "1";
+    public static final String SIGN_PATCH_BIZ_STATUS_2 = "2";
 }
 }

+ 14 - 12
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CommonSendStatus.java

@@ -6,17 +6,19 @@ package org.jeecg.common.constant;
  *
  *
  */
  */
 public interface CommonSendStatus {
 public interface CommonSendStatus {
-    /**
-     * 未发布
-     */
-    public static final String UNPUBLISHED_STATUS_0 = "0";
 
 
-    /**
-     * 已发布
-     */
-    public static final String PUBLISHED_STATUS_1 = "1";
-    /**
-     * 撤销
-     */
-    public static final String REVOKE_STATUS_2 = "2";
+	public static final String UNPUBLISHED_STATUS_0 = "0";	//未发布
+
+	public static final String PUBLISHED_STATUS_1 = "1";		//已发布
+
+	public static final String REVOKE_STATUS_2 = "2";			//撤销
+
+
+
+	/**流程催办——系统通知消息模板*/
+	public static final String TZMB_BPM_CUIBAN = "bpm_cuiban";
+	/**标准模板—系统消息通知*/
+	public static final String TZMB_SYS_TS_NOTE = "sys_ts_note";
+	/**流程超时提醒——系统通知消息模板*/
+	public static final String TZMB_BPM_CHAOSHI_TIP = "bpm_chaoshi_tip";
 }
 }

+ 16 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/DataBaseConstant.java

@@ -3,7 +3,17 @@ package org.jeecg.common.constant;
  * 数据库上下文常量
  * 数据库上下文常量
  */
  */
 public interface DataBaseConstant {
 public interface DataBaseConstant {
-	
+	//*********数据库类型****************************************
+	public static final String DB_TYPE_MYSQL = "MYSQL";
+	public static final String DB_TYPE_ORACLE = "ORACLE";
+	public static final String DB_TYPE_POSTGRESQL = "POSTGRESQL";
+	public static final String DB_TYPE_SQLSERVER = "SQLSERVER";
+
+	// 数据库类型,对应 database_type 字典
+	public static final String DB_TYPE_MYSQL_NUM = "1";
+	public static final String DB_TYPE_ORACLE_NUM = "2";
+	public static final String DB_TYPE_SQLSERVER_NUM = "3";
+	public static final String DB_TYPE_POSTGRESQL_NUM = "4";
 	//*********系统上下文变量****************************************
 	//*********系统上下文变量****************************************
 	/**
 	/**
 	 * 数据-所属机构编码
 	 * 数据-所属机构编码
@@ -12,12 +22,15 @@ public interface DataBaseConstant {
 	/**
 	/**
 	 * 数据-所属机构编码
 	 * 数据-所属机构编码
 	 */
 	 */
+	public static final String SYS_ORG_CODE_TABLE = "sys_org_code";
+	/**
+	 * 数据-所属机构编码
+	 */
 	public static final String SYS_MULTI_ORG_CODE = "sysMultiOrgCode";
 	public static final String SYS_MULTI_ORG_CODE = "sysMultiOrgCode";
-	
 	/**
 	/**
 	 * 数据-所属机构编码
 	 * 数据-所属机构编码
 	 */
 	 */
-	public static final String SYS_ORG_CODE_TABLE = "sys_org_code";
+	public static final String SYS_MULTI_ORG_CODE_TABLE = "sys_multi_org_code";
 	/**
 	/**
 	 * 数据-系统用户编码(对应登录用户账号)
 	 * 数据-系统用户编码(对应登录用户账号)
 	 */
 	 */

+ 25 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/FillRuleConstant.java

@@ -0,0 +1,25 @@
+package org.jeecg.common.constant;
+
+/**
+ * 规则值生成 编码常量类
+ * @author: taoyan
+ * @date: 2020年04月02日
+ */
+public class FillRuleConstant {
+
+    /**
+     * 公文发文编码
+     */
+    public static final String DOC_SEND = "doc_send_code";
+
+    /**
+     * 部门编码
+     */
+    public static final String DEPART = "org_num_role";
+
+    /**
+     * 分类字典编码
+     */
+    public static final String CATEGORY = "category_code_rule";
+
+}

+ 33 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/GeneralConstant.java

@@ -0,0 +1,33 @@
+package org.jeecg.common.constant;
+
+/**
+ * 项目中一般字符串常量
+ *
+ * @ClassName GeneralConstant
+ * @Author ZHAOXA
+ * @date 2020-09-29 10:33
+ */
+public class GeneralConstant {
+
+    /**
+     * code
+     */
+    public static final String CODE = "code";
+    public static final String MESSAGE = "message";
+    public static final String ERR_CODE = "errcode";
+    public static final String DAY_BEGIN = " 00:00:00";
+    public static final String DAY_END = " 23:59:59";
+    public static final String PAGE_NO = "pageNo";
+    public static final String PAGE_SIZE = "pageSize";
+    public static final String API_START_TIME = "starttime";
+    public static final String API_END_TIME = "endtime";
+    public static final String START_TIME = "startTime";
+    public static final String STOP_TIME = "stopTime";
+    public static final String ACCESS_TOKEN = "accessToken";
+    public static final String TYPE = "type";
+    public static final String VALUE = "value";
+
+
+
+
+}

+ 130 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/ProvinceCityArea.java

@@ -0,0 +1,130 @@
+package org.jeecg.common.constant;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+@Component("pca")
+public class ProvinceCityArea {
+
+    @Value("classpath:static/pca.json")
+    private Resource jsonData;
+
+    List<Area> areaList;
+
+    public String getText(String code){
+        this.initAreaList();
+        if(this.areaList!=null || this.areaList.size()>0){
+            List<String> ls = new ArrayList<String>();
+            getAreaByCode(code,ls);
+            return String.join("/",ls);
+        }
+        return "";
+    }
+
+    public String getCode(String text){
+        this.initAreaList();
+        if(areaList!=null || areaList.size()>0){
+            for(int i=areaList.size()-1;i>=0;i--){
+                if(text.indexOf(areaList.get(i).getText())>=0){
+                    return areaList.get(i).getId();
+                }
+            }
+        }
+        return null;
+    }
+
+    public void getAreaByCode(String code,List<String> ls){
+        for(Area area: areaList){
+            if(area.getId().equals(code)){
+                String pid = area.getPid();
+                ls.add(0,area.getText());
+                getAreaByCode(pid,ls);
+            }
+        }
+    }
+
+    private void initAreaList(){
+        if(this.areaList==null || this.areaList.size()==0){
+            this.areaList = new ArrayList<Area>();
+            try {
+                File file = jsonData.getFile();
+                String jsonData = this.jsonRead(file);
+                JSONObject baseJson = JSONObject.parseObject(jsonData);
+                //第一层 省
+                JSONObject provinceJson = baseJson.getJSONObject("86");
+                for(String provinceKey: provinceJson.keySet()){
+                    Area province = new Area(provinceKey,provinceJson.getString(provinceKey),"86");
+                    this.areaList.add(province);
+                    //第二层 市
+                    JSONObject cityJson = baseJson.getJSONObject(provinceKey);
+                    for(String cityKey:cityJson.keySet()){
+                        Area city = new Area(cityKey,cityJson.getString(cityKey),provinceKey);
+                        this.areaList.add(city);
+                        //第三层 区
+                        JSONObject areaJson =  baseJson.getJSONObject(cityKey);
+                        if(areaJson!=null){
+                            for(String areaKey:areaJson.keySet()){
+                                Area area = new Area(areaKey,areaJson.getString(areaKey),cityKey);
+                                this.areaList.add(area);
+                            }
+                        }
+                    }
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+    }
+
+
+    private String jsonRead(File file){
+        Scanner scanner = null;
+        StringBuilder buffer = new StringBuilder();
+        try {
+            scanner = new Scanner(file, "utf-8");
+            while (scanner.hasNextLine()) {
+                buffer.append(scanner.nextLine());
+            }
+        } catch (Exception e) {
+
+        } finally {
+            if (scanner != null) {
+                scanner.close();
+            }
+        }
+        return buffer.toString();
+    }
+
+    class Area{
+        String id;
+        String text;
+        String pid;
+
+        public Area(String id,String text,String pid){
+            this.id = id;
+            this.text = text;
+            this.pid = pid;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getText() {
+            return text;
+        }
+
+        public String getPid() {
+            return pid;
+        }
+    }
+}

+ 56 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/WebsocketConst.java

@@ -0,0 +1,56 @@
+package org.jeecg.common.constant;
+
+/**
+ * @Description: Websocket常量类
+ * @author: taoyan
+ * @date: 2020年03月23日
+ */
+public class WebsocketConst {
+
+
+    /**
+     * 消息json key:cmd
+     */
+    public static final String MSG_CMD = "cmd";
+
+    /**
+     * 消息json key:msgId
+     */
+    public static final String MSG_ID = "msgId";
+
+    /**
+     * 消息json key:msgTxt
+     */
+    public static final String MSG_TXT = "msgTxt";
+
+    /**
+     * 消息json key:userId
+     */
+    public static final String MSG_USER_ID = "userId";
+
+    /**
+     * 消息类型 heartcheck
+     */
+    public static final String CMD_CHECK = "heartcheck";
+
+    /**
+     * 消息类型 user 用户消息
+     */
+    public static final String CMD_USER = "user";
+
+    /**
+     * 消息类型 topic 系统通知
+     */
+    public static final String CMD_TOPIC = "topic";
+
+    /**
+     * 消息类型 email
+     */
+    public static final String CMD_EMAIL = "email";
+
+    /**
+     * 消息类型 meetingsign 会议签到
+     */
+    public static final String CMD_SIGN = "sign";
+
+}

+ 481 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/es/JeecgElasticsearchTemplate.java

@@ -0,0 +1,481 @@
+package org.jeecg.common.es;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.RestUtil;
+import org.jeecg.common.util.oConvertUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+/**
+ * 关于 ElasticSearch 的一些方法(创建索引、添加数据、查询等)
+ *
+ * @author sunjianlei
+ */
+@Slf4j
+@Component
+public class JeecgElasticsearchTemplate {
+    /** es服务地址 */
+    private String baseUrl;
+    private final String FORMAT_JSON = "format=json";
+
+    // ElasticSearch 最大可返回条目数
+    public static final int ES_MAX_SIZE = 10000;
+
+    public JeecgElasticsearchTemplate(@Value("${jeecg.elasticsearch.cluster-nodes}") String baseUrl, @Value("${jeecg.elasticsearch.check-enabled}") boolean checkEnabled) {
+        log.debug("JeecgElasticsearchTemplate BaseURL:" + baseUrl);
+        if (StringUtils.isNotEmpty(baseUrl)) {
+            this.baseUrl = baseUrl;
+            // 验证配置的ES地址是否有效
+            if (checkEnabled) {
+                try {
+                    RestUtil.get(this.getBaseUrl().toString());
+                    log.info("ElasticSearch 服务连接成功");
+                } catch (Exception e) {
+                    log.warn("ElasticSearch 服务连接失败,原因:配置未通过。可能是BaseURL未配置或配置有误,也可能是Elasticsearch服务未启动。接下来将会拒绝执行任何方法!");
+                }
+            }
+        }
+    }
+
+    public StringBuilder getBaseUrl(String indexName, String typeName) {
+        typeName = typeName.trim().toLowerCase();
+        return this.getBaseUrl(indexName).append("/").append(typeName);
+    }
+
+    public StringBuilder getBaseUrl(String indexName) {
+        indexName = indexName.trim().toLowerCase();
+        return this.getBaseUrl().append("/").append(indexName);
+    }
+
+    public StringBuilder getBaseUrl() {
+        return new StringBuilder("http://").append(this.baseUrl);
+    }
+
+    /**
+     * cat 查询ElasticSearch系统数据,返回json
+     */
+    public <T> ResponseEntity<T> _cat(String urlAfter, Class<T> responseType) {
+        String url = this.getBaseUrl().append("/_cat").append(urlAfter).append("?").append(FORMAT_JSON).toString();
+        return RestUtil.request(url, HttpMethod.GET, null, null, null, responseType);
+    }
+
+    /**
+     * 查询所有索引
+     * <p>
+     * 查询地址:GET http://{baseUrl}/_cat/indices
+     */
+    public JSONArray getIndices() {
+        return getIndices(null);
+    }
+
+
+    /**
+     * 查询单个索引
+     * <p>
+     * 查询地址:GET http://{baseUrl}/_cat/indices/{indexName}
+     */
+    public JSONArray getIndices(String indexName) {
+        StringBuilder urlAfter = new StringBuilder("/indices");
+        if (!StringUtils.isEmpty(indexName)) {
+            urlAfter.append("/").append(indexName.trim().toLowerCase());
+        }
+        return _cat(urlAfter.toString(), JSONArray.class).getBody();
+    }
+
+    /**
+     * 索引是否存在
+     */
+    public boolean indexExists(String indexName) {
+        try {
+            JSONArray array = getIndices(indexName);
+            return array != null;
+        } catch (org.springframework.web.client.HttpClientErrorException ex) {
+            if (HttpStatus.NOT_FOUND == ex.getStatusCode()) {
+                return false;
+            } else {
+                throw ex;
+            }
+        }
+    }
+
+    /**
+     * 根据ID获取索引数据,未查询到返回null
+     * <p>
+     * 查询地址:GET http://{baseUrl}/{indexName}/{typeName}/{dataId}
+     *
+     * @param indexName 索引名称
+     * @param typeName  type,一个任意字符串,用于分类
+     * @param dataId    数据id
+     * @return
+     */
+    public JSONObject getDataById(String indexName, String typeName, String dataId) {
+        String url = this.getBaseUrl(indexName, typeName).append("/").append(dataId).toString();
+        log.info("url:" + url);
+        JSONObject result = RestUtil.get(url);
+        boolean found = result.getBoolean("found");
+        if (found) {
+            return result.getJSONObject("_source");
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 创建索引
+     * <p>
+     * 查询地址:PUT http://{baseUrl}/{indexName}
+     */
+    public boolean createIndex(String indexName) {
+        String url = this.getBaseUrl(indexName).toString();
+
+        /* 返回结果 (仅供参考)
+        "createIndex": {
+            "shards_acknowledged": true,
+            "acknowledged": true,
+            "index": "hello_world"
+        }
+        */
+        try {
+            return RestUtil.put(url).getBoolean("acknowledged");
+        } catch (org.springframework.web.client.HttpClientErrorException ex) {
+            if (HttpStatus.BAD_REQUEST == ex.getStatusCode()) {
+                log.warn("索引创建失败:" + indexName + " 已存在,无需再创建");
+            } else {
+                ex.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 删除索引
+     * <p>
+     * 查询地址:DELETE http://{baseUrl}/{indexName}
+     */
+    public boolean removeIndex(String indexName) {
+        String url = this.getBaseUrl(indexName).toString();
+        try {
+            return RestUtil.delete(url).getBoolean("acknowledged");
+        } catch (org.springframework.web.client.HttpClientErrorException ex) {
+            if (HttpStatus.NOT_FOUND == ex.getStatusCode()) {
+                log.warn("索引删除失败:" + indexName + " 不存在,无需删除");
+            } else {
+                ex.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 获取索引字段映射(可获取字段类型)
+     * <p>
+     *
+     * @param indexName 索引名称
+     * @param typeName  分类名称
+     * @return
+     */
+    public JSONObject getIndexMapping(String indexName, String typeName) {
+        String url = this.getBaseUrl(indexName, typeName).append("/_mapping?").append(FORMAT_JSON).toString();
+        log.info("getIndexMapping-url:" + url);
+        /*
+         * 参考返回JSON结构:
+         *
+         *{
+         *    // 索引名称
+         *    "[indexName]": {
+         *        "mappings": {
+         *            // 分类名称
+         *            "[typeName]": {
+         *                "properties": {
+         *                    // 字段名
+         *                    "input_number": {
+         *                        // 字段类型
+         *                        "type": "long"
+         *                    },
+         *                    "input_string": {
+         *                        "type": "text",
+         *                        "fields": {
+         *                            "keyword": {
+         *                                "type": "keyword",
+         *                                "ignore_above": 256
+         *                            }
+         *                        }
+         *                    }
+         *                 }
+         *            }
+         *        }
+         *    }
+         * }
+         */
+        try {
+            return RestUtil.get(url);
+        } catch (org.springframework.web.client.HttpClientErrorException e) {
+            String message = e.getMessage();
+            if (message != null && message.contains("404 Not Found")) {
+                return null;
+            }
+            throw e;
+        }
+    }
+
+    /**
+     * 获取索引字段映射,返回Java实体类
+     *
+     * @param indexName
+     * @param typeName
+     * @return
+     */
+    public <T> Map<String, T> getIndexMappingFormat(String indexName, String typeName, Class<T> clazz) {
+        JSONObject mapping = this.getIndexMapping(indexName, typeName);
+        Map<String, T> map = new HashMap<>();
+        if (mapping == null) {
+            return map;
+        }
+        // 获取字段属性
+        JSONObject properties = mapping.getJSONObject(indexName)
+                .getJSONObject("mappings")
+                .getJSONObject(typeName)
+                .getJSONObject("properties");
+        // 封装成 java类型
+        for (String key : properties.keySet()) {
+            T entity = properties.getJSONObject(key).toJavaObject(clazz);
+            map.put(key, entity);
+        }
+        return map;
+    }
+
+    /**
+     * 保存数据,详见:saveOrUpdate
+     */
+    public boolean save(String indexName, String typeName, String dataId, JSONObject data) {
+        return this.saveOrUpdate(indexName, typeName, dataId, data);
+    }
+
+    /**
+     * 更新数据,详见:saveOrUpdate
+     */
+    public boolean update(String indexName, String typeName, String dataId, JSONObject data) {
+        return this.saveOrUpdate(indexName, typeName, dataId, data);
+    }
+
+    /**
+     * 保存或修改索引数据
+     * <p>
+     * 查询地址:PUT http://{baseUrl}/{indexName}/{typeName}/{dataId}
+     *
+     * @param indexName 索引名称
+     * @param typeName  type,一个任意字符串,用于分类
+     * @param dataId    数据id
+     * @param data      要存储的数据
+     * @return
+     */
+    public boolean saveOrUpdate(String indexName, String typeName, String dataId, JSONObject data) {
+        String url = this.getBaseUrl(indexName, typeName).append("/").append(dataId).append("?refresh=wait_for").toString();
+        /* 返回结果(仅供参考)
+       "createIndexA2": {
+            "result": "created",
+            "_shards": {
+                "total": 2,
+                "successful": 1,
+                "failed": 0
+            },
+            "_seq_no": 0,
+            "_index": "test_index_1",
+            "_type": "test_type_1",
+            "_id": "a2",
+            "_version": 1,
+            "_primary_term": 1
+        }
+         */
+
+        try {
+            // 去掉 data 中为空的值
+            Set<String> keys = data.keySet();
+            List<String> emptyKeys = new ArrayList<>(keys.size());
+            for (String key : keys) {
+                String value = data.getString(key);
+                //1、剔除空值
+                if (oConvertUtils.isEmpty(value) || "[]".equals(value)) {
+                    emptyKeys.add(key);
+                }
+                //2、剔除上传控件值(会导致ES同步失败,报异常failed to parse field [ge_pic] of type [text] )
+                if (oConvertUtils.isNotEmpty(value) && value.indexOf("[{")!=-1) {
+                    emptyKeys.add(key);
+                    log.info("-------剔除上传控件字段------------key: "+ key);
+                }
+            }
+            for (String key : emptyKeys) {
+                data.remove(key);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        try {
+            String result = RestUtil.put(url, data).getString("result");
+            return "created".equals(result) || "updated".equals(result);
+        } catch (Exception e) {
+            log.error(e.getMessage() + "\n-- url: " + url + "\n-- data: " + data.toJSONString());
+            //TODO 打印接口返回异常json
+            return false;
+        }
+    }
+
+    /**
+     * 删除索引数据
+     * <p>
+     * 请求地址:DELETE http://{baseUrl}/{indexName}/{typeName}/{dataId}
+     */
+    public boolean delete(String indexName, String typeName, String dataId) {
+        String url = this.getBaseUrl(indexName, typeName).append("/").append(dataId).toString();
+        /* 返回结果(仅供参考)
+        {
+            "_index": "es_demo",
+            "_type": "docs",
+            "_id": "001",
+            "_version": 3,
+            "result": "deleted",
+            "_shards": {
+                "total": 1,
+                "successful": 1,
+                "failed": 0
+            },
+            "_seq_no": 28,
+            "_primary_term": 18
+        }
+        */
+        try {
+            return "deleted".equals(RestUtil.delete(url).getString("result"));
+        } catch (org.springframework.web.client.HttpClientErrorException ex) {
+            if (HttpStatus.NOT_FOUND == ex.getStatusCode()) {
+                return false;
+            } else {
+                throw ex;
+            }
+        }
+    }
+
+
+    /* = = = 以下关于查询和查询条件的方法 = = =*/
+
+    /**
+     * 查询数据
+     * <p>
+     * 请求地址:POST http://{baseUrl}/{indexName}/{typeName}/_search
+     */
+    public JSONObject search(String indexName, String typeName, JSONObject queryObject) {
+        String url = this.getBaseUrl(indexName, typeName).append("/_search").toString();
+
+        log.info("url:" + url + " ,search: " + queryObject.toJSONString());
+        JSONObject res = RestUtil.post(url, queryObject);
+        log.info("url:" + url + " ,return res: \n" + res.toJSONString());
+        return res;
+    }
+
+    /**
+     * @param _source (源滤波器)指定返回的字段,传null返回所有字段
+     * @param query
+     * @param from    从第几条数据开始
+     * @param size    返回条目数
+     * @return { "query": query }
+     */
+    public JSONObject buildQuery(List<String> _source, JSONObject query, int from, int size) {
+        JSONObject json = new JSONObject();
+        if (_source != null) {
+            json.put("_source", _source);
+        }
+        json.put("query", query);
+        json.put("from", from);
+        json.put("size", size);
+        return json;
+    }
+
+    /**
+     * @return { "bool" : { "must": must, "must_not": mustNot, "should": should } }
+     */
+    public JSONObject buildBoolQuery(JSONArray must, JSONArray mustNot, JSONArray should) {
+        JSONObject bool = new JSONObject();
+        if (must != null) {
+            bool.put("must", must);
+        }
+        if (mustNot != null) {
+            bool.put("must_not", mustNot);
+        }
+        if (should != null) {
+            bool.put("should", should);
+        }
+        JSONObject json = new JSONObject();
+        json.put("bool", bool);
+        return json;
+    }
+
+    /**
+     * @param field 要查询的字段
+     * @param args  查询参数,参考: *哈哈* OR *哒* NOT *呵* OR *啊*
+     * @return
+     */
+    public JSONObject buildQueryString(String field, String... args) {
+        if (field == null) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder(field).append(":(");
+        if (args != null) {
+            for (String arg : args) {
+                sb.append(arg).append(" ");
+            }
+        }
+        sb.append(")");
+        return this.buildQueryString(sb.toString());
+    }
+
+    /**
+     * @return { "query_string": { "query": query }  }
+     */
+    public JSONObject buildQueryString(String query) {
+        JSONObject queryString = new JSONObject();
+        queryString.put("query", query);
+        JSONObject json = new JSONObject();
+        json.put("query_string", queryString);
+        return json;
+    }
+
+    /**
+     * @param field      查询字段
+     * @param min        最小值
+     * @param max        最大值
+     * @param containMin 范围内是否包含最小值
+     * @param containMax 范围内是否包含最大值
+     * @return { "range" : { field : { 『 "gt『e』?containMin" : min 』?min!=null , 『 "lt『e』?containMax" : max 』}} }
+     */
+    public JSONObject buildRangeQuery(String field, Object min, Object max, boolean containMin, boolean containMax) {
+        JSONObject inner = new JSONObject();
+        if (min != null) {
+            if (containMin) {
+                inner.put("gte", min);
+            } else {
+                inner.put("gt", min);
+            }
+        }
+        if (max != null) {
+            if (containMax) {
+                inner.put("lte", max);
+            } else {
+                inner.put("lt", max);
+            }
+        }
+        JSONObject range = new JSONObject();
+        range.put(field, inner);
+        JSONObject json = new JSONObject();
+        json.put("range", range);
+        return json;
+    }
+
+}
+

+ 98 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/es/QueryStringBuilder.java

@@ -0,0 +1,98 @@
+package org.jeecg.common.es;
+
+/**
+ * 用于创建 ElasticSearch 的 queryString
+ *
+ * @author sunjianlei
+ */
+public class QueryStringBuilder {
+
+    StringBuilder builder;
+
+    public QueryStringBuilder(String field, String str, boolean not, boolean addQuot) {
+        builder = this.createBuilder(field, str, not, addQuot);
+    }
+
+    public QueryStringBuilder(String field, String str, boolean not) {
+        builder = this.createBuilder(field, str, not, true);
+    }
+
+    /**
+     * 创建 StringBuilder
+     *
+     * @param field
+     * @param str
+     * @param not     是否是不匹配
+     * @param addQuot 是否添加双引号
+     * @return
+     */
+    public StringBuilder createBuilder(String field, String str, boolean not, boolean addQuot) {
+        StringBuilder sb = new StringBuilder(field).append(":(");
+        if (not) {
+            sb.append(" NOT ");
+        }
+        this.addQuotEffect(sb, str, addQuot);
+        return sb;
+    }
+
+    public QueryStringBuilder and(String str) {
+        return this.and(str, true);
+    }
+
+    public QueryStringBuilder and(String str, boolean addQuot) {
+        builder.append(" AND ");
+        this.addQuot(str, addQuot);
+        return this;
+    }
+
+    public QueryStringBuilder or(String str) {
+        return this.or(str, true);
+    }
+
+    public QueryStringBuilder or(String str, boolean addQuot) {
+        builder.append(" OR ");
+        this.addQuot(str, addQuot);
+        return this;
+    }
+
+    public QueryStringBuilder not(String str) {
+        return this.not(str, true);
+    }
+
+    public QueryStringBuilder not(String str, boolean addQuot) {
+        builder.append(" NOT ");
+        this.addQuot(str, addQuot);
+        return this;
+    }
+
+    /**
+    * 添加双引号(模糊查询,不能加双引号)
+    */
+    private QueryStringBuilder addQuot(String str, boolean addQuot) {
+        return this.addQuotEffect(this.builder, str, addQuot);
+    }
+
+    /**
+     * 是否在两边加上双引号
+     * @param builder
+     * @param str
+     * @param addQuot
+     * @return
+     */
+    private QueryStringBuilder addQuotEffect(StringBuilder builder, String str, boolean addQuot) {
+        if (addQuot) {
+            builder.append('"');
+        }
+        builder.append(str);
+        if (addQuot) {
+            builder.append('"');
+        }
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return builder.append(")").toString();
+    }
+
+}

+ 42 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java

@@ -1,12 +1,16 @@
 package org.jeecg.common.exception;
 package org.jeecg.common.exception;
 
 
+import io.lettuce.core.RedisConnectionException;
 import org.apache.shiro.authz.AuthorizationException;
 import org.apache.shiro.authz.AuthorizationException;
 import org.apache.shiro.authz.UnauthorizedException;
 import org.apache.shiro.authz.UnauthorizedException;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.dao.DuplicateKeyException;
+import org.springframework.data.redis.connection.PoolException;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.multipart.MaxUploadSizeExceededException;
 import org.springframework.web.servlet.NoHandlerFoundException;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
 
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -46,13 +50,12 @@ public class JeecgBootExceptionHandler {
 	public Result<?> handleAuthorizationException(AuthorizationException e){
 	public Result<?> handleAuthorizationException(AuthorizationException e){
 		log.error(e.getMessage(), e);
 		log.error(e.getMessage(), e);
 		return Result.noauth("没有权限,请联系管理员授权");
 		return Result.noauth("没有权限,请联系管理员授权");
-
 	}
 	}
 
 
 	@ExceptionHandler(Exception.class)
 	@ExceptionHandler(Exception.class)
 	public Result<?> handleException(Exception e){
 	public Result<?> handleException(Exception e){
 		log.error(e.getMessage(), e);
 		log.error(e.getMessage(), e);
-		return Result.error(e.getMessage());
+		return Result.error("操作失败,"+e.getMessage());
 	}
 	}
 	
 	
 	/**
 	/**
@@ -61,9 +64,43 @@ public class JeecgBootExceptionHandler {
 	 * @return
 	 * @return
 	 */
 	 */
 	@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
 	@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
-	public Result<?> HttpRequestMethodNotSupportedException(Exception e){
-		log.error(e.getMessage(), e);
-		return Result.error("没有权限,请联系管理员授权");
+	public Result<?> HttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
+		StringBuffer sb = new StringBuffer();
+		sb.append("不支持");
+		sb.append(e.getMethod());
+		sb.append("请求方法,");
+		sb.append("支持以下");
+		String [] methods = e.getSupportedMethods();
+		if(methods!=null){
+			for(String str:methods){
+				sb.append(str);
+				sb.append("、");
+			}
+		}
+		log.error(sb.toString(), e);
+		//return Result.error("没有权限,请联系管理员授权");
+		return Result.error(405,sb.toString());
 	}
 	}
 
 
+	 /**
+	  * spring默认上传大小100MB 超出大小捕获异常MaxUploadSizeExceededException
+	  */
+    @ExceptionHandler(MaxUploadSizeExceededException.class)
+    public Result<?> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
+    	log.error(e.getMessage(), e);
+        return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
+    }
+
+    @ExceptionHandler(DataIntegrityViolationException.class)
+    public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
+    	log.error(e.getMessage(), e);
+        return Result.error("字段太长,超出数据库字段的长度");
+    }
+
+    @ExceptionHandler(PoolException.class)
+    public Result<?> handlePoolException(PoolException e) {
+    	log.error(e.getMessage(), e);
+        return Result.error("Redis 连接异常!");
+    }
+
 }
 }

+ 21 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/handler/IFillRuleHandler.java

@@ -0,0 +1,21 @@
+package org.jeecg.common.handler;
+
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 填值规则接口
+ *
+ * @author Yan_东
+ * 如需使用填值规则功能,规则实现类必须实现此接口
+ */
+public interface IFillRuleHandler {
+
+    /**
+     * @param params 页面配置固定参数
+     * @param formData  动态表单参数
+     * @return
+     */
+    public Object execute(JSONObject params, JSONObject formData);
+
+}
+

+ 0 - 78
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseApi.java

@@ -1,78 +0,0 @@
-package org.jeecg.common.system.api;
-
-import java.sql.SQLException;
-import java.util.List;
-
-import org.jeecg.common.system.vo.DictModel;
-import org.jeecg.common.system.vo.LoginUser;
-
-/**
- * @Description: 底层共通业务API,提供其他独立模块调用
- * @Author: scott
- * @Date:2019-4-20 
- * @Version:V1.0
- */
-public interface ISysBaseApi {
-
-	/**
-	 * 日志添加
-     * @param logContent 内容
-	 * @param logType 日志类型(0:操作日志;1:登录日志;2:定时任务)
-	 * @param operatetype 操作类型(1:添加;2:修改;3:删除;)
-	 */
-    void addLog(String logContent, Integer logType, Integer operatetype);
-	
-	/**
-	  * 根据用户账号查询登录用户信息
-	 * @param username
-	 * @return
-	 */
-	public LoginUser getUserByName(String username);
-	
-	/**
-	 * 通过用户账号查询角色集合
-	 * @param username
-	 * @return
-	 */
-	public List<String> getRolesByUsername(String username);
-
-	/**
-	 * 获取当前数据库类型
-	 * @return
-	 * @throws Exception 
-	 */
-	public String getDatabaseType() throws SQLException;
-	
-	/**
-	  * 获取数据字典
-	 * @param code
-	 * @return
-	 */
-	public List<DictModel> queryDictItemsByCode(String code);
-
-	/** 查询所有的父级字典,按照create_time排序 */
-	public List<DictModel> queryAllDict();
-	/**
-	  * 获取表数据字典
-	 * @param table
-	 * @param text
-	 * @param code
-	 * @return
-	 */
-    List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
-    
-    /**
-   	 * 查询所有部门 作为字典信息 id -->value,departName -->text
-   	 * @return
-   	 */
-   	public List<DictModel> queryAllDepartBackDictModel();
-   	
-	/**
-	 * 发送系统消息
-	 * @param fromUser 发送人(用户登录账户)
-	 * @param toUser  发送给(用户登录账户)
-	 * @param title  消息主题
-	 * @param msgContent  消息内容
-	 */
-	public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent);
-}

+ 0 - 106
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java

@@ -1,106 +0,0 @@
-package org.jeecg.common.system.base.controller;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.shiro.SecurityUtils;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.base.entity.JeecgEntity;
-import org.jeecg.common.system.base.service.JeecgService;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.vo.LoginUser;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * @Description: Controller基类
- * @Author: dangzhenghui@163.com
- * @Date: 2019-4-21 8:13
- * @Version: 1.0
- */
-@Slf4j
-public class JeecgController<T extends JeecgEntity, S extends JeecgService<T>> {
-	@Autowired
-	S service;
-
-	/**
-	 * 导出excel
-	 *
-	 * @param request
-	 * @param response
-	 */
-	protected ModelAndView exportXls(HttpServletRequest request,T object,Class<T> clazz,String title) {
-		//--------------------------------------------------------------------------------
-		//获取当前用户
-		LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
-		//--------------------------------------------------------------------------------
-		// Step.1 组装查询条件
-		QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
-
-		// Step.2 AutoPoi 导出Excel
-		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-		List<T> pageList = service.list(queryWrapper);
-		// 导出文件名称
-        //此处设置的filename无效 ,前端会重更新设置一下
-        mv.addObject(NormalExcelConstants.FILE_NAME, title);
-		mv.addObject(NormalExcelConstants.CLASS, clazz);
-		mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "报表", "导出人:"+sysUser.getRealname(), title + "表"));
-		mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-		return mv;
-	}
-
-	/**
-	 * 通过excel导入数据
-	 *
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	protected Result<?> importExcel(HttpServletRequest request, HttpServletResponse response, Class<T> clazz) {
-		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-		Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-		for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-			ImportParams params = new ImportParams();
-			params.setTitleRows(2);
-			params.setHeadRows(1);
-			params.setNeedSave(true);
-			try {
-				List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params);
-				//update-begin-author:taoyan date:20190528 for:批量插入数据
-				long start = System.currentTimeMillis();
-				service.saveBatch(list);
-				//400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
-				//1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
-				log.info("消耗时间"+(System.currentTimeMillis()-start)+"毫秒");
-				//update-end-author:taoyan date:20190528 for:批量插入数据
-				return Result.ok("文件导入成功!数据行数:" + list.size());
-			} catch (Exception e) {
-				log.error(e.getMessage(), e);
-				return Result.error("文件导入失败:" + e.getMessage());
-			} finally {
-				try {
-					file.getInputStream().close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-		return Result.error("文件导入失败!");
-	}
-}

+ 0 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/base/entity/JeecgEntity.java

@@ -1,7 +1,6 @@
 package org.jeecg.common.system.base.entity;
 package org.jeecg.common.system.base.entity;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
-
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
@@ -23,7 +22,6 @@ import lombok.experimental.Accessors;
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
-
 public class JeecgEntity implements Serializable {
 public class JeecgEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 

+ 0 - 222
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/controller/CommonController.java

@@ -1,222 +0,0 @@
-package org.jeecg.common.system.controller;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jeecg.common.api.vo.Result;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.util.AntPathMatcher;
-import org.springframework.util.FileCopyUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.HandlerMapping;
-import org.springframework.web.servlet.ModelAndView;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * <p>
- * 用户表 前端控制器
- * </p>
- *
- * @Author scott
- * @since 2018-12-20
- */
-@Slf4j
-@RestController
-@RequestMapping("/sys/common")
-public class CommonController {
-
-    @Value(value = "${jeecg.path.upload}")
-    private String uploadpath;
-
-    /**
-     * @return
-     * @Author 政辉
-     */
-    @GetMapping("/403")
-    public Result<?> noauth() {
-        return Result.error("没有权限,请联系管理员授权");
-    }
-
-    @PostMapping(value = "/upload")
-    public Result<?> upload(HttpServletRequest request, HttpServletResponse response) {
-        Result<?> result = new Result<>();
-        try {
-            String ctxPath = uploadpath;
-            String fileName = null;
-            String bizPath = "files";
-            String nowday = new SimpleDateFormat("yyyyMMdd").format(new Date());
-            File file = new File(ctxPath + File.separator + bizPath + File.separator + nowday);
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-            MultipartFile mf = multipartRequest.getFile("file");
-            // 获取文件名
-            String orgName = mf.getOriginalFilename();
-            fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
-            String savePath = file.getPath() + File.separator + fileName;
-            File savefile = new File(savePath);
-            FileCopyUtils.copy(mf.getBytes(), savefile);
-            String dbpath = bizPath + File.separator + nowday + File.separator + fileName;
-            if (dbpath.contains("\\")) {
-                dbpath = dbpath.replace("\\", "/");
-            }
-            result.setMessage(dbpath);
-            result.setSuccess(true);
-        } catch (IOException e) {
-            result.setSuccess(false);
-            result.setMessage(e.getMessage());
-            log.error(e.getMessage(), e);
-        }
-        return result;
-    }
-
-    /**
-     * 预览图片
-     * 请求地址:http://localhost:8080/common/view/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
-     *
-     * @param request
-     * @param response
-     */
-    @GetMapping(value = "/view/**")
-    public void view(HttpServletRequest request, HttpServletResponse response) {
-        // ISO-8859-1 ==> UTF-8 进行编码转换
-        String imgPath = extractPathFromPattern(request);
-        // 其余处理略
-        InputStream inputStream = null;
-        OutputStream outputStream = null;
-        try {
-            imgPath = imgPath.replace("..", "");
-            if (imgPath.endsWith(",")) {
-                imgPath = imgPath.substring(0, imgPath.length() - 1);
-            }
-            response.setContentType("image/jpeg;charset=utf-8");
-            String localPath = uploadpath;
-            String imgurl = localPath + File.separator + imgPath;
-            inputStream = new BufferedInputStream(new FileInputStream(imgurl));
-            outputStream = response.getOutputStream();
-            byte[] buf = new byte[1024];
-            int len;
-            while ((len = inputStream.read(buf)) > 0) {
-                outputStream.write(buf, 0, len);
-            }
-            response.flushBuffer();
-        } catch (IOException e) {
-            log.error("预览图片失败" + e.getMessage());
-        } finally {
-            if (inputStream != null) {
-                try {
-                    inputStream.close();
-                } catch (IOException e) {
-                    log.error(e.getMessage(), e);
-                }
-            }
-            if (outputStream != null) {
-                try {
-                    outputStream.close();
-                } catch (IOException e) {
-                    log.error(e.getMessage(), e);
-                }
-            }
-        }
-
-    }
-
-    /**
-     * 下载文件
-     * 请求地址:http://localhost:8080/common/download/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
-     *
-     * @param request
-     * @param response
-     * @throws Exception
-     */
-    @GetMapping(value = "/download/**")
-    public void download(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // ISO-8859-1 ==> UTF-8 进行编码转换
-        String filePath = extractPathFromPattern(request);
-        // 其余处理略
-        InputStream inputStream = null;
-        OutputStream outputStream = null;
-        try {
-            filePath = filePath.replace("..", "");
-            if (filePath.endsWith(",")) {
-                filePath = filePath.substring(0, filePath.length() - 1);
-            }
-            String localPath = uploadpath;
-            String downloadFilePath = localPath + File.separator + filePath;
-            File file = new File(downloadFilePath);
-            if (file.exists()) {
-                // 设置强制下载不打开      
-                response.setContentType("application/force-download");
-                response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"), "iso-8859-1"));
-                inputStream = new BufferedInputStream(new FileInputStream(file));
-                outputStream = response.getOutputStream();
-                byte[] buf = new byte[1024];
-                int len;
-                while ((len = inputStream.read(buf)) > 0) {
-                    outputStream.write(buf, 0, len);
-                }
-                response.flushBuffer();
-            }
-
-        } catch (Exception e) {
-            log.info("文件下载失败" + e.getMessage());
-        } finally {
-            if (inputStream != null) {
-                try {
-                    inputStream.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            if (outputStream != null) {
-                try {
-                    outputStream.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-
-    }
-
-    /**
-     * @param modelAndView
-     * @return
-     * @功能:pdf预览Iframe
-     */
-    @RequestMapping("/pdf/pdfPreviewIframe")
-    public ModelAndView pdfPreviewIframe(ModelAndView modelAndView) {
-        modelAndView.setViewName("pdfPreviewIframe");
-        return modelAndView;
-    }
-
-    /**
-     * 把指定URL后的字符串全部截断当成参数
-     * 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题
-     *
-     * @param request
-     * @return
-     */
-    private static String extractPathFromPattern(final HttpServletRequest request) {
-        String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
-        String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
-        return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
-    }
-
-}

+ 44 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/MatchTypeEnum.java

@@ -0,0 +1,44 @@
+package org.jeecg.common.system.query;
+
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.oConvertUtils;
+
+/**
+ * 查询链接规则
+ *
+ * @Author Sunjianlei
+ */
+public enum MatchTypeEnum {
+
+    AND("AND"),
+    OR("OR");
+
+    private String value;
+
+    MatchTypeEnum(String value) {
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public static MatchTypeEnum getByValue(Object value) {
+        if (oConvertUtils.isEmpty(value)) {
+            return null;
+        }
+        return getByValue(value.toString());
+    }
+
+    public static MatchTypeEnum getByValue(String value) {
+        if (oConvertUtils.isEmpty(value)) {
+            return null;
+        }
+        for (MatchTypeEnum val : values()) {
+            if (val.getValue().toLowerCase().equals(value.toLowerCase())) {
+                return val;
+            }
+        }
+        return null;
+    }
+}

+ 0 - 594
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java

@@ -1,594 +0,0 @@
-package org.jeecg.common.system.query;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.jeecg.common.constant.CommonConstant;
-import org.jeecg.common.system.util.JeecgDataAutorUtils;
-import org.jeecg.common.system.util.JwtUtil;
-import org.jeecg.common.util.SqlInjectionUtil;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.system.entity.SysPermissionDataRule;
-import org.springframework.util.NumberUtils;
-
-import java.beans.PropertyDescriptor;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.net.URLDecoder;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-@Slf4j
-public class QueryGenerator {
-
-	public static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN";
-
-	private static final String BEGIN = "_begin";
-	private static final String END = "_end";
-	private static final String STAR = "*";
-	private static final String COMMA = ",";
-	private static final String NOT_EQUAL = "!";
-	/**高级查询前端传来的参数名*/
-	private static final String SUPER_QUERY_PARAMS = "superQueryParams";
-
-	/**排序列*/
-	private static final String ORDER_COLUMN = "column";
-	/**排序方式*/
-	private static final String ORDER_TYPE = "order";
-	private static final String ORDER_TYPE_ASC = "ASC";
-
-	/**时间格式化 */
-    private static final ThreadLocal<SimpleDateFormat> LOCAL = new ThreadLocal<SimpleDateFormat>();
-	private static SimpleDateFormat getTime(){
-        SimpleDateFormat time = LOCAL.get();
-		if(time == null){
-			time = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-            LOCAL.set(time);
-		}
-		return time;
-	}
-
-	/**
-	 * 获取查询条件构造器QueryWrapper实例 通用查询条件已被封装完成
-	 * @param searchObj 查询实体
-	 * @param parameterMap request.getParameterMap()
-	 * @return QueryWrapper实例
-	 */
-	public static <T> QueryWrapper<T> initQueryWrapper(T searchObj,Map<String, String[]> parameterMap){
-		long start = System.currentTimeMillis();
-		QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
-		installMplus(queryWrapper, searchObj, parameterMap);
-		log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
-		return queryWrapper;
-	}
-
-	/**
-	 * 组装Mybatis Plus 查询条件
-     * <p>使用此方法 需要有如下几点注意:
-	 * <br>1.使用QueryWrapper 而非LambdaQueryWrapper;
-     * <br>2.实例化QueryWrapper时不可将实体传入参数
-	 * <br>错误示例:如QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>(jeecgDemo);
-	 * <br>正确示例:QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>();
-	 * <br>3.也可以不使用这个方法直接调用 {@link #initQueryWrapper}直接获取实例
-	 */
-	public static void installMplus(QueryWrapper<?> queryWrapper,Object searchObj,Map<String, String[]> parameterMap) {
-
-		/*
-		 * 注意:权限查询由前端配置数据规则 当一个人有多个所属部门时候 可以在规则配置包含条件 orgCode 包含 #{sys_org_code}
-		但是不支持在自定义SQL中写orgCode in #{sys_org_code}
-		当一个人只有一个部门 就直接配置等于条件: orgCode 等于 #{sys_org_code} 或者配置自定义SQL: orgCode = '#{sys_org_code}'
-		*/
-
-		//区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
-		PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(searchObj);
-		Map<String,SysPermissionDataRule> ruleMap = getRuleMap();
-
-		//权限规则自定义SQL表达式
-		for (String c : ruleMap.keySet()) {
-			if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
-				queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));
-			}
-		}
-
-		String name, type;
-		for (int i = 0; i < origDescriptors.length; i++) {
-			//aliasName = origDescriptors[i].getName();  mybatis  不存在实体属性 不用处理别名的情况
-			name = origDescriptors[i].getName();
-			type = origDescriptors[i].getPropertyType().toString();
-			try {
-				if (judgedIsUselessField(name)|| !PropertyUtils.isReadable(searchObj, name)) {
-					continue;
-				}
-
-				//数据权限查询
-				if(ruleMap.containsKey(name)) {
-					addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
-				}
-
-				// 添加 判断是否有区间值
-				String endValue = null,beginValue = null;
-				if (parameterMap != null && parameterMap.containsKey(name + BEGIN)) {
-					beginValue = parameterMap.get(name + BEGIN)[0].trim();
-					addQueryByRule(queryWrapper, name, type, beginValue, QueryRuleEnum.GE);
-
-                }
-				if (parameterMap != null && parameterMap.containsKey(name + END)) {
-					endValue = parameterMap.get(name + END)[0].trim();
-					addQueryByRule(queryWrapper, name, type, endValue, QueryRuleEnum.LE);
-				}
-
-                //判断单值  参数带不同标识字符串 走不同的查询
-				//TODO 这种前后带逗号的支持分割后模糊查询需要否 使多选字段的查询生效
-				Object value = PropertyUtils.getSimpleProperty(searchObj, name);
-				if (null != value && value.toString().startsWith(COMMA) && value.toString().endsWith(COMMA)) {
-					String multiLikeval = value.toString().replace(",,", COMMA);
-					String[] vals = multiLikeval.substring(1, multiLikeval.length()).split(COMMA);
-					final String field = oConvertUtils.camelToUnderline(name);
-					if(vals.length>1) {
-						queryWrapper.and(j -> {
-							j = j.like(field,vals[0]);
-							for (int k=1;k<vals.length;k++) {
-								j = j.or().like(field,vals[k]);
-							}
-							return j;
-						});
-					}else {
-						queryWrapper.and(j -> j.like(field,vals[0]));
-					}
-				}else {
-					//根据参数值带什么关键字符串判断走什么类型的查询
-					QueryRuleEnum rule = convert2Rule(value);
-					value = replaceValue(rule,value);
-					addEasyQuery(queryWrapper, name, rule, value);
-				}
-
-            } catch (Exception e) {
-				log.error(e.getMessage(), e);
-			}
-		}
-        // 排序逻辑 处理
-		doMultiFieldsOrder(queryWrapper, parameterMap);
-
-        //高级查询
-		doSuperQuery(queryWrapper, parameterMap);
-
-    }
-
-    /**
-     * 多字段排序
-     * TODO 需要修改前端
-     */
-	public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
-		String column=null,order=null;
-		if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
-			column = parameterMap.get(ORDER_COLUMN)[0];
-		}
-		if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
-			order = parameterMap.get(ORDER_TYPE)[0];
-		}
-		log.debug("排序规则>>列:"+column+",排序方式:"+order);
-		if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
-			//字典字段,去掉字典翻译文本后缀
-			if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
-				column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
-			}
-			//SQL注入check
-            SqlInjectionUtil.filterContent(column);
-
-			if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
-				queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
-			} else {
-				queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
-			}
-		}
-	}
-
-    /**
-	 * 高级查询
-	 * @param queryWrapper
-	 * @param parameterMap
-	 */
-	public static void doSuperQuery(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
-		if(parameterMap!=null&& parameterMap.containsKey(SUPER_QUERY_PARAMS)){
-			String superQueryParams = parameterMap.get(SUPER_QUERY_PARAMS)[0];
-			// 解码
-			try {
-				superQueryParams = URLDecoder.decode(superQueryParams, "UTF-8");
-			} catch (UnsupportedEncodingException e) {
-				log.error("--高级查询参数转码失败!", e);
-			}
-			List<QueryCondition> conditions = JSON.parseArray(superQueryParams, QueryCondition.class);
-			log.info("---高级查询参数-->"+conditions.toString());
-
-            for (QueryCondition rule : conditions) {
-				if(oConvertUtils.isNotEmpty(rule.getField()) && oConvertUtils.isNotEmpty(rule.getRule()) && oConvertUtils.isNotEmpty(rule.getVal())){
-					addEasyQuery(queryWrapper, rule.getField(), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
-				}
-			}
-		}
-	}
-	/**
-	 * 根据所传的值 转化成对应的比较方式
-	 * 支持><= like in !
-	 * @param value
-	 * @return
-	 */
-	public static QueryRuleEnum convert2Rule(Object value) {
-		// 避免空数据
-		if (value == null) {
-			return null;
-		}
-		String val = (value + "").toString().trim();
-		if (val.length() == 0) {
-			return null;
-		}
-		QueryRuleEnum rule =null;
-		// step 2 .>= =<
-		if (rule == null && val.length() >= 2) {
-			rule = QueryRuleEnum.getByValue(val.substring(0, 2));
-		}
-		// step 1 .> <
-		if (rule == null && val.length() >= 1) {
-			rule = QueryRuleEnum.getByValue(val.substring(0, 1));
-		}
-
-        // step 3 like
-		if (rule == null && val.contains(STAR)) {
-			if (val.startsWith(STAR) && val.endsWith(STAR)) {
-				rule = QueryRuleEnum.LIKE;
-			} else if (val.startsWith(STAR)) {
-				rule = QueryRuleEnum.LEFT_LIKE;
-			} else if(val.endsWith(STAR)){
-				rule = QueryRuleEnum.RIGHT_LIKE;
-			}
-		}
-		// step 4 in
-		if (rule == null && val.contains(COMMA)) {
-			//TODO in 查询这里应该有个bug  如果一字段本身就是多选 此时用in查询 未必能查询出来
-			rule = QueryRuleEnum.IN;
-		}
-        // step 5 !=
-		if(rule == null && val.startsWith(NOT_EQUAL)){
-			rule = QueryRuleEnum.NE;
-		}
-		return rule != null ? rule : QueryRuleEnum.EQ;
-	}
-
-    /**
-	 * 替换掉关键字字符
-     *
-	 * @param rule
-	 * @param value
-	 * @return
-	 */
-	public static Object replaceValue(QueryRuleEnum rule, Object value) {
-		if (rule == null) {
-			return null;
-		}
-		if (! (value instanceof String)){
-			return value;
-		}
-		String val = (value + "").toString().trim();
-		if (rule == QueryRuleEnum.LIKE) {
-			value = val.substring(1, val.length() - 1);
-		} else if (rule == QueryRuleEnum.LEFT_LIKE || rule == QueryRuleEnum.NE) {
-			value = val.substring(1);
-		} else if (rule == QueryRuleEnum.RIGHT_LIKE) {
-			value = val.substring(0, val.length() - 1);
-		} else if (rule == QueryRuleEnum.IN) {
-            value = val.split(COMMA);
-		} else {
-			value = val.replace(rule.getValue(),"");
-		}
-		return value;
-	}
-
-    private static void addQueryByRule(QueryWrapper<?> queryWrapper,String name,String type,String value,QueryRuleEnum rule) throws ParseException {
-		if(!"".equals(value)) {
-			Object temp;
-			switch (type) {
-			case "class java.lang.Integer":
-				temp =  Integer.parseInt(value);
-				break;
-			case "class java.math.BigDecimal":
-				temp =  new BigDecimal(value);
-				break;
-			case "class java.lang.Short":
-				temp =  Short.parseShort(value);
-				break;
-			case "class java.lang.Long":
-				temp =  Long.parseLong(value);
-				break;
-			case "class java.lang.Float":
-				temp =   Float.parseFloat(value);
-				break;
-			case "class java.lang.Double":
-				temp =  Double.parseDouble(value);
-				break;
-			case "class java.util.Date":
-				temp = getDateQueryByRule(value, rule);
-				break;
-			default:
-				temp = value;
-				break;
-			}
-			addEasyQuery(queryWrapper, name, rule, temp);
-		}
-	}
-
-    /**
-	 * 获取日期类型的值
-	 * @param value
-	 * @param rule
-	 * @return
-	 * @throws ParseException
-	 */
-	private static Date getDateQueryByRule(String value,QueryRuleEnum rule) throws ParseException {
-		Date date = null;
-		if(value.length()==10) {
-			if(rule==QueryRuleEnum.GE) {
-				//比较大于
-				date = getTime().parse(value + " 00:00:00");
-			}else if(rule==QueryRuleEnum.LE) {
-				//比较小于
-				date = getTime().parse(value + " 23:59:59");
-			}
-			//TODO 日期类型比较特殊 可能oracle下不一定好使
-		}
-		if(date==null) {
-			date = getTime().parse(value);
-		}
-		return date;
-	}
-
-    /**
-	  * 根据规则走不同的查询
-	 * @param queryWrapper QueryWrapper
-	 * @param name         字段名字
-	 * @param rule         查询规则
-	 * @param value        查询条件值
-	 */
-	private static void addEasyQuery(QueryWrapper<?> queryWrapper, String name, QueryRuleEnum rule, Object value) {
-		if (value == null || rule == null) {
-			return;
-		}
-		name = oConvertUtils.camelToUnderline(name);
-//		log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
-		switch (rule) {
-		case GT:
-			queryWrapper.gt(name, value);
-			break;
-		case GE:
-			queryWrapper.ge(name, value);
-			break;
-		case LT:
-			queryWrapper.lt(name, value);
-			break;
-		case LE:
-			queryWrapper.le(name, value);
-			break;
-		case EQ:
-			queryWrapper.eq(name, value);
-			break;
-		case NE:
-			queryWrapper.ne(name, value);
-			break;
-		case IN:
-			if(value instanceof String) {
-                queryWrapper.in(name, (Object[]) value.toString().split(COMMA));
-			}else if(value instanceof String[]) {
-				queryWrapper.in(name, (Object[]) value);
-			}else {
-				queryWrapper.in(name, value);
-			}
-			break;
-		case LIKE:
-			queryWrapper.like(name, value);
-			break;
-		case LEFT_LIKE:
-			queryWrapper.likeLeft(name, value);
-			break;
-		case RIGHT_LIKE:
-			queryWrapper.likeRight(name, value);
-			break;
-		default:
-			log.info("--查询规则未匹配到---");
-			break;
-		}
-	}
-	/**
-     *
-	 * @param name
-	 * @return
-	 */
-	private static boolean judgedIsUselessField(String name) {
-		return "class".equals(name) || "ids".equals(name)
-				|| "page".equals(name) || "rows".equals(name)
-				|| "sort".equals(name) || "order".equals(name);
-	}
-
-
-    /**
-     *
-	 * @return
-	 */
-	public static Map<String, SysPermissionDataRule> getRuleMap() {
-		Map<String, SysPermissionDataRule> ruleMap = new HashMap<String, SysPermissionDataRule>();
-		List<SysPermissionDataRule> list =JeecgDataAutorUtils.loadDataSearchConditon();
-		if(list != null&&list.size()>0){
-			if(list.get(0)==null){
-				return ruleMap;
-			}
-			for (SysPermissionDataRule rule : list) {
-				String column = rule.getRuleColumn();
-				if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
-					column = SQL_RULES_COLUMN+rule.getId();
-				}
-				ruleMap.put(column, rule);
-			}
-		}
-		return ruleMap;
-	}
-
-    private static void addRuleToQueryWrapper(SysPermissionDataRule dataRule,String name, Class propertyType, QueryWrapper<?> queryWrapper) {
-		QueryRuleEnum rule = QueryRuleEnum.getByValue(dataRule.getRuleConditions());
-		if(rule.equals(QueryRuleEnum.IN) && ! propertyType.equals(String.class)) {
-            String[] values = dataRule.getRuleValue().split(COMMA);
-			Object[] objs = new Object[values.length];
-			for (int i = 0; i < values.length; i++) {
-				objs[i] = NumberUtils.parseNumber(values[i], propertyType);
-			}
-			addEasyQuery(queryWrapper, name, rule, objs);
-		}else {
-			if (propertyType.equals(String.class)) {
-				addEasyQuery(queryWrapper, name, rule, converRuleValue(dataRule.getRuleValue()));
-			} else {
-				addEasyQuery(queryWrapper, name, rule, NumberUtils.parseNumber(dataRule.getRuleValue(), propertyType));
-			}
-		}
-	}
-
-    public static String converRuleValue(String ruleValue) {
-		String value = JwtUtil.getSessionData(ruleValue);
-		if(oConvertUtils.isEmpty(value)) {
-			value = JwtUtil.getUserSystemData(ruleValue,null);
-		}
-		return value!= null ? value : ruleValue;
-	}
-
-    public static String getSqlRuleValue(String sqlRule){
-		try {
-			Set<String> varParams = getSqlRuleParams(sqlRule);
-			for(String var:varParams){
-				String tempValue = converRuleValue(var);
-				sqlRule = sqlRule.replace("#{"+var+"}",tempValue);
-			}
-		} catch (Exception e) {
-			log.error(e.getMessage(), e);
-		}
-		return sqlRule;
-	}
-
-    /**
-	 * 获取sql中的#{key} 这个key组成的set
-	 */
-	public static Set<String> getSqlRuleParams(String sql) {
-		if(oConvertUtils.isEmpty(sql)){
-			return null;
-		}
-		Set<String> varParams = new HashSet<String>();
-		String regex = "\\#\\{\\w+\\}";
-
-        Pattern p = Pattern.compile(regex);
-		Matcher m = p.matcher(sql);
-		while(m.find()){
-			String var = m.group();
-			varParams.add(var.substring(var.indexOf("{")+1,var.indexOf("}")));
-		}
-		return varParams;
-	}
-
-    /**
-     * 获取查询条件
-	 * @param field
-	 * @param alias
-	 * @param value
-	 * @param isString
-	 * @return
-	 */
-	public static String getSingleQueryConditionSql(String field,String alias,Object value,boolean isString) {
-		if (value == null) {
-			return "";
-		}
-		field =  alias+oConvertUtils.camelToUnderline(field);
-		QueryRuleEnum rule = QueryGenerator.convert2Rule(value);
-		String res = "";
-		switch (rule) {
-		case GT:
-			res =field+rule.getValue()+getFieldConditionValue(value, isString);
-			break;
-		case GE:
-			res = field+rule.getValue()+getFieldConditionValue(value, isString);
-			break;
-		case LT:
-			res = field+rule.getValue()+getFieldConditionValue(value, isString);
-			break;
-		case LE:
-			res = field+rule.getValue()+getFieldConditionValue(value, isString);
-			break;
-		case EQ:
-			res = field+rule.getValue()+getFieldConditionValue(value, isString);
-			break;
-		case NE:
-			res = field+" <> "+getFieldConditionValue(value, isString);
-			break;
-		case IN:
-			res = field + " in "+getInConditionValue(value, isString);
-			break;
-		case LIKE:
-			res = field + " like "+getLikeConditionValue(value);
-			break;
-		case LEFT_LIKE:
-			res = field + " like "+getLikeConditionValue(value);
-			break;
-		case RIGHT_LIKE:
-			res = field + " like "+getLikeConditionValue(value);
-			break;
-		default:
-			res = field+" = "+getFieldConditionValue(value, isString);
-			break;
-		}
-		return res;
-	}
-	private static String getFieldConditionValue(Object value,boolean isString) {
-		String str = value.toString().trim();
-		if(str.startsWith("!")) {
-			str = str.substring(1);
-		}else if(str.startsWith(">=")) {
-			str = str.substring(2);
-		}else if(str.startsWith("<=")) {
-			str = str.substring(2);
-		}else if(str.startsWith(">")) {
-			str = str.substring(1);
-		}else if(str.startsWith("<")) {
-			str = str.substring(1);
-		}
-		if(isString) {
-			return " '"+str+"' ";
-		}else {
-			return value.toString();
-		}
-	}
-
-    private static String getInConditionValue(Object value,boolean isString) {
-		if(isString) {
-            String[] temp = value.toString().split(COMMA);
-			String res="";
-			for (String string : temp) {
-				res+=",'"+string+"'";
-			}
-			return "("+res.substring(1)+")";
-		}else {
-			return "("+value.toString()+")";
-		}
-	}
-
-    private static String getLikeConditionValue(Object value) {
-		String str = value.toString().trim();
-		if(str.startsWith("*") && str.endsWith("*")) {
-			return "'%"+str.substring(1,str.length()-1)+"%'";
-		}else if(str.startsWith("*")) {
-			return "'%"+str.substring(1)+"'";
-		}else if(str.endsWith("*")) {
-			return "'"+str.substring(0,str.length()-1)+"%'";
-		}else {
-			return str;
-		}
-	}
-
-
-}

+ 1 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java

@@ -8,9 +8,7 @@ import org.jeecg.common.util.oConvertUtils;
  * @Date 2019年02月14日
  * @Date 2019年02月14日
  */
  */
 public enum QueryRuleEnum {
 public enum QueryRuleEnum {
-    /**
-     * Query 规则 常量
-     */
+
     GT(">","gt","大于"),
     GT(">","gt","大于"),
     GE(">=","ge","大于等于"),
     GE(">=","ge","大于等于"),
     LT("<","lt","小于"),
     LT("<","lt","小于"),

+ 18 - 20
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java

@@ -1,15 +1,14 @@
 package org.jeecg.common.system.util;
 package org.jeecg.common.system.util;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
+import org.jeecg.common.system.vo.SysPermissionDataRuleModel;
 import org.jeecg.common.system.vo.SysUserCacheInfo;
 import org.jeecg.common.system.vo.SysUserCacheInfo;
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.common.util.SpringContextUtils;
-import org.jeecg.modules.system.entity.SysPermissionDataRule;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
 
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
 /**
  * @ClassName: JeecgDataAutorUtils
  * @ClassName: JeecgDataAutorUtils
  * @Description: 数据权限查询规则容器工具类
  * @Description: 数据权限查询规则容器工具类
@@ -29,40 +28,38 @@ public class JeecgDataAutorUtils {
 	 * 往链接请求里面,传入数据查询条件
 	 * 往链接请求里面,传入数据查询条件
 	 * 
 	 * 
 	 * @param request
 	 * @param request
-     * @param dataRules
+	 * @param dataRules
 	 */
 	 */
-	public static synchronized void installDataSearchConditon(HttpServletRequest request, List<SysPermissionDataRule> dataRules) {
+	public static synchronized void installDataSearchConditon(HttpServletRequest request, List<SysPermissionDataRuleModel> dataRules) {
 		@SuppressWarnings("unchecked")
 		@SuppressWarnings("unchecked")
-        // 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
-                List<SysPermissionDataRule> list = (List<SysPermissionDataRule>) loadDataSearchConditon();
+		List<SysPermissionDataRuleModel> list = (List<SysPermissionDataRuleModel>)loadDataSearchConditon();// 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
 		if (list==null) {
 		if (list==null) {
 			// 2.如果不存在,则new一个list
 			// 2.如果不存在,则new一个list
-			list = new ArrayList<SysPermissionDataRule>();
+			list = new ArrayList<SysPermissionDataRuleModel>();
 		}
 		}
-		for (SysPermissionDataRule tsDataRule : dataRules) {
+		for (SysPermissionDataRuleModel tsDataRule : dataRules) {
 			list.add(tsDataRule);
 			list.add(tsDataRule);
 		}
 		}
-        // 3.往list里面增量存指
-        request.setAttribute(MENU_DATA_AUTHOR_RULES, list);
+		request.setAttribute(MENU_DATA_AUTHOR_RULES, list); // 3.往list里面增量存指
 	}
 	}
 
 
 	/**
 	/**
 	 * 获取请求对应的数据权限规则
 	 * 获取请求对应的数据权限规则
-     *
+	 * 
 	 * @return
 	 * @return
 	 */
 	 */
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
-	public static synchronized List<SysPermissionDataRule> loadDataSearchConditon() {
-		return (List<SysPermissionDataRule>) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULES);
+	public static synchronized List<SysPermissionDataRuleModel> loadDataSearchConditon() {
+		return (List<SysPermissionDataRuleModel>) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULES);
 				
 				
 	}
 	}
 
 
 	/**
 	/**
 	 * 获取请求对应的数据权限SQL
 	 * 获取请求对应的数据权限SQL
-     *
+	 * 
 	 * @return
 	 * @return
 	 */
 	 */
-    public static synchronized String loadDataSearchConditonSqlString() {
+	public static synchronized String loadDataSearchConditonSQLString() {
 		return (String) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULE_SQL);
 		return (String) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULE_SQL);
 	}
 	}
 
 
@@ -70,9 +67,10 @@ public class JeecgDataAutorUtils {
 	 * 往链接请求里面,传入数据查询条件
 	 * 往链接请求里面,传入数据查询条件
 	 * 
 	 * 
 	 * @param request
 	 * @param request
+	 * @param sql
 	 */
 	 */
 	public static synchronized void installDataSearchConditon(HttpServletRequest request, String sql) {
 	public static synchronized void installDataSearchConditon(HttpServletRequest request, String sql) {
-        String ruleSql = (String) loadDataSearchConditonSqlString();
+		String ruleSql = (String)loadDataSearchConditonSQLString();
 		if (!StringUtils.hasText(ruleSql)) {
 		if (!StringUtils.hasText(ruleSql)) {
 			request.setAttribute(MENU_DATA_AUTHOR_RULE_SQL,sql);
 			request.setAttribute(MENU_DATA_AUTHOR_RULE_SQL,sql);
 		}
 		}

+ 174 - 182
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java

@@ -6,6 +6,11 @@ import com.auth0.jwt.algorithms.Algorithm;
 import com.auth0.jwt.exceptions.JWTDecodeException;
 import com.auth0.jwt.exceptions.JWTDecodeException;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.google.common.base.Joiner;
 import com.google.common.base.Joiner;
+
+import java.util.Date;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.exception.JeecgBootException;
@@ -14,10 +19,6 @@ import org.jeecg.common.system.vo.SysUserCacheInfo;
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
 
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.Date;
-
 /**
 /**
  * @Author Scott
  * @Author Scott
  * @Date 2018-07-12 14:23
  * @Date 2018-07-12 14:23
@@ -25,182 +26,173 @@ import java.util.Date;
  **/
  **/
 public class JwtUtil {
 public class JwtUtil {
 
 
-    /**
-     * 过期时间30分钟
-     */
-    public static final long EXPIRE_TIME = 30 * 60 * 1000;
-
-    /**
-     * 校验token是否正确
-     *
-     * @param token  密钥
-     * @param secret 用户的密码
-     * @return 是否正确
-     */
-    public static boolean verify(String token, String username, String secret) {
-        try {
-            // 根据密码生成JWT效验器
-            Algorithm algorithm = Algorithm.HMAC256(secret);
-            JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
-            // 效验TOKEN
-            DecodedJWT jwt = verifier.verify(token);
-            return true;
-        } catch (Exception exception) {
-            return false;
-        }
-    }
-
-    /**
-     * 获得token中的信息无需secret解密也能获得
-     *
-     * @return token中包含的用户名
-     */
-    public static String getUsername(String token) {
-        try {
-            DecodedJWT jwt = JWT.decode(token);
-            return jwt.getClaim("username").asString();
-        } catch (JWTDecodeException e) {
-            return null;
-        }
-    }
-
-    /**
-     * 生成签名,5min后过期
-     *
-     * @param username 用户名
-     * @param secret   用户的密码
-     * @return 加密的token
-     */
-    public static String sign(String username, String secret) {
-        Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
-        Algorithm algorithm = Algorithm.HMAC256(secret);
-        // 附带username信息
-        return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
-
-    }
-
-    /**
-     * 根据request中的token获取用户账号
-     *
-     * @param request
-     * @return
-     * @throws JeecgBootException
-     */
-    public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
-        String accessToken = request.getHeader("X-Access-Token");
-        String username = getUsername(accessToken);
-        if (oConvertUtils.isEmpty(username)) {
-            throw new JeecgBootException("未获取到用户");
-        }
-        return username;
-    }
-
-    /**
-     * 从session中获取变量
-     *
-     * @param key
-     * @return
-     */
-    public static String getSessionData(String key) {
-        //${myVar}%
-        //得到${} 后面的值
-        String moshi = "";
-        if (key.indexOf("}") != -1) {
-            moshi = key.substring(key.indexOf("}") + 1);
-        }
-        String returnValue = null;
-        if (key.contains("#{")) {
-            key = key.substring(2, key.indexOf("}"));
-        }
-        if (oConvertUtils.isNotEmpty(key)) {
-            HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
-            returnValue = (String) session.getAttribute(key);
-        }
-        //结果加上${} 后面的值
-        if (returnValue != null) {
-            returnValue = returnValue + moshi;
-        }
-        return returnValue;
-    }
-
-    /**
-     * 从当前用户中获取变量
-     *
-     * @param key
-     * @param user
-     * @return
-     */
-
-    //TODO 急待改造 sckjkdsjsfjdk
-    public static String getUserSystemData(String key, SysUserCacheInfo user) {
-        if (user == null) {
-            user = JeecgDataAutorUtils.loadUserInfo();
-        }
-        //#{sys_user_code}%
-
-        // 获取登录用户信息
-        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-
-        String moshi = "";
-        if (key.indexOf("}") != -1) {
-            moshi = key.substring(key.indexOf("}") + 1);
-        }
-        String returnValue = null;
-        //针对特殊标示处理#{sysOrgCode},判断替换
-        if (key.contains("#{")) {
-            key = key.substring(2, key.indexOf("}"));
-        } else {
-            key = key;
-        }
-        //替换为系统登录用户帐号
-        if (key.equals(DataBaseConstant.SYS_USER_CODE) || key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
-            if (user == null) {
-                returnValue = sysUser.getUsername();
-            } else {
-                returnValue = user.getSysUserCode();
-            }
-        }
-        //替换为系统登录用户真实名字
-        if (key.equals(DataBaseConstant.SYS_USER_NAME) || key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
-            if (user == null) {
-                returnValue = sysUser.getRealname();
-            } else {
-                returnValue = user.getSysUserName();
-            }
-        }
-
-        //替换为系统用户登录所使用的机构编码
-        if (key.equals(DataBaseConstant.SYS_ORG_CODE) || key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
-            if (user == null) {
-                returnValue = sysUser.getOrgCode();
-            } else {
-                returnValue = user.getSysOrgCode();
-            }
-
-        }
-        //替换为系统用户所拥有的所有机构编码
-        if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE) || key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {
-            if (user.isOneDepart()) {
-                returnValue = user.getSysMultiOrgCode().get(0);
-            } else {
-                returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
-            }
-        }
-        //替换为当前系统时间(年月日)
-        if (key.equals(DataBaseConstant.SYS_DATE) || key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
-            returnValue = user.getSysDate();
-        }
-        //替换为当前系统时间(年月日时分秒)
-        if (key.equals(DataBaseConstant.SYS_TIME) || key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
-            returnValue = user.getSysTime();
-        }
-        //流程状态默认值(默认未发起)
-        if (key.equals(DataBaseConstant.BPM_STATUS_TABLE) || key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
-            returnValue = "1";
-        }
-        if (returnValue != null) {
-            returnValue = returnValue + moshi;
-        }
-        return returnValue;
-    }
+	// Token过期时间30分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准)
+	//public static final long EXPIRE_TIME = 30 * 60 * 1000;
+	public static final long EXPIRE_TIME = 8* 60 * 60 * 1000;
+
+	/**
+	 * 校验token是否正确
+	 *
+	 * @param token  密钥
+	 * @param secret 用户的密码
+	 * @return 是否正确
+	 */
+	public static boolean verify(String token, String username, String secret) {
+		try {
+			// 根据密码生成JWT效验器
+			Algorithm algorithm = Algorithm.HMAC256(secret);
+			JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
+			// 效验TOKEN
+			DecodedJWT jwt = verifier.verify(token);
+			return true;
+		} catch (Exception exception) {
+			return false;
+		}
+	}
+
+	/**
+	 * 获得token中的信息无需secret解密也能获得
+	 *
+	 * @return token中包含的用户名
+	 */
+	public static String getUsername(String token) {
+		try {
+			DecodedJWT jwt = JWT.decode(token);
+			return jwt.getClaim("username").asString();
+		} catch (JWTDecodeException e) {
+			return null;
+		}
+	}
+
+	/**
+	 * 生成签名,5min后过期
+	 *
+	 * @param username 用户名
+	 * @param secret   用户的密码
+	 * @return 加密的token
+	 */
+	public static String sign(String username, String secret) {
+		Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
+		Algorithm algorithm = Algorithm.HMAC256(secret);
+		// 附带username信息
+		return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
+
+	}
+
+	/**
+	 * 根据request中的token获取用户账号
+	 *
+	 * @param request
+	 * @return
+	 * @throws JeecgBootException
+	 */
+	public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
+		String accessToken = request.getHeader("X-Access-Token");
+		String username = getUsername(accessToken);
+		if (oConvertUtils.isEmpty(username)) {
+			throw new JeecgBootException("未获取到用户");
+		}
+		return username;
+	}
+
+	/**
+	  *  从session中获取变量
+	 * @param key
+	 * @return
+	 */
+	public static String getSessionData(String key) {
+		//${myVar}%
+		//得到${} 后面的值
+		String moshi = "";
+		if(key.indexOf("}")!=-1){
+			 moshi = key.substring(key.indexOf("}")+1);
+		}
+		String returnValue = null;
+		if (key.contains("#{")) {
+			key = key.substring(2,key.indexOf("}"));
+		}
+		if (oConvertUtils.isNotEmpty(key)) {
+			HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
+			returnValue = (String) session.getAttribute(key);
+		}
+		//结果加上${} 后面的值
+		if(returnValue!=null){returnValue = returnValue + moshi;}
+		return returnValue;
+	}
+
+	/**
+	  * 从当前用户中获取变量
+	 * @param key
+	 * @param user
+	 * @return
+	 */
+	//TODO 急待改造 sckjkdsjsfjdk
+	public static String getUserSystemData(String key,SysUserCacheInfo user) {
+		if(user==null) {
+			user = JeecgDataAutorUtils.loadUserInfo();
+		}
+		//#{sys_user_code}%
+
+		// 获取登录用户信息
+		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+		String moshi = "";
+		if(key.indexOf("}")!=-1){
+			 moshi = key.substring(key.indexOf("}")+1);
+		}
+		String returnValue = null;
+		//针对特殊标示处理#{sysOrgCode},判断替换
+		if (key.contains("#{")) {
+			key = key.substring(2,key.indexOf("}"));
+		} else {
+			key = key;
+		}
+		//替换为系统登录用户帐号
+		if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
+			if(user==null) {
+				returnValue = sysUser.getUsername();
+			}else {
+				returnValue = user.getSysUserCode();
+			}
+		}
+		//替换为系统登录用户真实名字
+		else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
+			if(user==null) {
+				returnValue = sysUser.getRealname();
+			}else {
+				returnValue = user.getSysUserName();
+			}
+		}
+
+		//替换为系统用户登录所使用的机构编码
+		else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
+			if(user==null) {
+				returnValue = sysUser.getOrgCode();
+			}else {
+				returnValue = user.getSysOrgCode();
+			}
+		}
+		//替换为系统用户所拥有的所有机构编码
+		else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
+			if(user.isOneDepart()) {
+				returnValue = user.getSysMultiOrgCode().get(0);
+			}else {
+				returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
+			}
+		}
+		//替换为当前系统时间(年月日)
+		else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) {
+			returnValue = user.getSysDate();
+		}
+		//替换为当前系统时间(年月日时分秒)
+		else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) {
+			returnValue = user.getSysTime();
+		}
+		//流程状态默认值(默认未发起)
+		else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) {
+			returnValue = "1";
+		}
+		if(returnValue!=null){returnValue = returnValue + moshi;}
+		return returnValue;
+	}
 }
 }

+ 36 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/ComboModel.java

@@ -0,0 +1,36 @@
+package org.jeecg.common.system.vo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ComboModel implements Serializable {
+    private String id;
+    private String title;
+    /**文档管理 表单table默认选中*/
+    private boolean checked;
+    /**文档管理 表单table 用户账号*/
+    private String username;
+    /**文档管理 表单table 用户邮箱*/
+    private String email;
+    /**文档管理 表单table 角色编码*/
+    private String roleCode;
+
+    public ComboModel(){
+
+    };
+
+    public ComboModel(String id,String title,boolean checked,String username){
+        this.id = id;
+        this.title = title;
+        this.checked = false;
+        this.username = username;
+    };
+}

+ 3 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictModel.java

@@ -2,6 +2,8 @@ package org.jeecg.common.system.vo;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
@@ -9,10 +11,10 @@ import lombok.experimental.Accessors;
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class DictModel implements Serializable{
 public class DictModel implements Serializable{
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
-
 	public DictModel() {
 	public DictModel() {
 	}
 	}
 	
 	

+ 34 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictQuery.java

@@ -0,0 +1,34 @@
+package org.jeecg.common.system.vo;
+
+import lombok.Data;
+
+/**
+ * 字典查询参数实体
+ */
+@Data
+public class DictQuery {
+    /**
+     * 表名
+     */
+    private String table;
+    /**
+     * 存储列
+     */
+    private String code;
+
+    /**
+     * 显示列
+     */
+    private String text;
+
+    /**
+     * 关键字查询
+     */
+    private String keyword;
+
+    /**
+     * 存储列的值 用于回显查询
+     */
+    private String codeValue;
+
+}

+ 52 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java

@@ -0,0 +1,52 @@
+package org.jeecg.common.system.vo;
+
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+
+@Data
+public class DynamicDataSourceModel {
+
+    public DynamicDataSourceModel() {
+
+    }
+
+    public DynamicDataSourceModel(Object dbSource) {
+        if (dbSource != null) {
+            BeanUtils.copyProperties(dbSource, this);
+        }
+    }
+
+    /**
+     * id
+     */
+    private java.lang.String id;
+    /**
+     * 数据源编码
+     */
+    private java.lang.String code;
+    /**
+     * 数据库类型
+     */
+    private java.lang.String dbType;
+    /**
+     * 驱动类
+     */
+    private java.lang.String dbDriver;
+    /**
+     * 数据源地址
+     */
+    private java.lang.String dbUrl;
+    /**
+     * 数据库名称
+     */
+    private java.lang.String dbName;
+    /**
+     * 用户名
+     */
+    private java.lang.String dbUsername;
+    /**
+     * 密码
+     */
+    private java.lang.String dbPassword;
+
+}

+ 36 - 22
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java

@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -19,8 +20,8 @@ import java.util.Date;
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
-public class LoginUser {
-
+public class LoginUser implements Serializable {
+	private static final long serialVersionUID = 1L;
 	/**
 	/**
 	 * 登录人id
 	 * 登录人id
 	 */
 	 */
@@ -36,6 +37,11 @@ public class LoginUser {
 	 */
 	 */
 	private String realname;
 	private String realname;
 
 
+	/**
+	 * 登录人密码
+	 */
+	private String password;
+
      /**
      /**
       * 当前登录部门code
       * 当前登录部门code
       */
       */
@@ -72,27 +78,35 @@ public class LoginUser {
 	 */
 	 */
 	private Integer status;
 	private Integer status;
 
 
-	private String delFlag;
+	private Integer delFlag;
 	/**
 	/**
      * 同步工作流引擎1同步0不同步
      * 同步工作流引擎1同步0不同步
      */
      */
-    private String activitiSync;
-
-	@Override
-	public String toString() {
-		return "LoginUser{" +
-				"id='" + id + '\'' +
-				", username='" + username + '\'' +
-				", realname='" + realname + '\'' +
-				", orgCode='" + orgCode + '\'' +
-				", avatar='" + avatar + '\'' +
-				", birthday=" + birthday +
-				", sex=" + sex +
-				", email='" + email + '\'' +
-				", phone='" + phone + '\'' +
-				", status=" + status +
-				", delFlag='" + delFlag + '\'' +
-				", activitiSync='" + activitiSync + '\'' +
-				'}';
-	}
+    private Integer activitiSync;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 *  身份(1 普通员工 2 上级)
+	 */
+	private Integer userIdentity;
+
+	/**
+	 * 管理部门ids
+	 */
+	private String departIds;
+
+	/**
+	 * 职务,关联职务表
+	 */
+	private String post;
+
+	/**
+	 * 座机号
+	 */
+	private String telephone;
+
 }
 }

+ 52 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java

@@ -0,0 +1,52 @@
+package org.jeecg.common.system.vo;
+
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Author qinfeng
+ * @Date 2020/2/19 12:01
+ * @Description:
+ * @Version 1.0
+ */
+public class SysCategoryModel {
+    /**主键*/
+    private java.lang.String id;
+    /**父级节点*/
+    private java.lang.String pid;
+    /**类型名称*/
+    private java.lang.String name;
+    /**类型编码*/
+    private java.lang.String code;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getPid() {
+        return pid;
+    }
+
+    public void setPid(String pid) {
+        this.pid = pid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+}

+ 147 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java

@@ -0,0 +1,147 @@
+package org.jeecg.common.system.vo;
+
+/**
+ * lvdandan 部门机构model
+ */
+public class SysDepartModel {
+    /**ID*/
+    private String id;
+    /**父机构ID*/
+    private String parentId;
+    /**机构/部门名称*/
+    private String departName;
+    /**英文名*/
+    private String departNameEn;
+    /**缩写*/
+    private String departNameAbbr;
+    /**排序*/
+    private Integer departOrder;
+    /**描述*/
+    private String description;
+    /**机构类别 1组织机构,2岗位*/
+    private String orgCategory;
+    /**机构类型*/
+    private String orgType;
+    /**机构编码*/
+    private String orgCode;
+    /**手机号*/
+    private String mobile;
+    /**传真*/
+    private String fax;
+    /**地址*/
+    private String address;
+    /**备注*/
+    private String memo;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getDepartName() {
+        return departName;
+    }
+
+    public void setDepartName(String departName) {
+        this.departName = departName;
+    }
+
+    public String getDepartNameEn() {
+        return departNameEn;
+    }
+
+    public void setDepartNameEn(String departNameEn) {
+        this.departNameEn = departNameEn;
+    }
+
+    public String getDepartNameAbbr() {
+        return departNameAbbr;
+    }
+
+    public void setDepartNameAbbr(String departNameAbbr) {
+        this.departNameAbbr = departNameAbbr;
+    }
+
+    public Integer getDepartOrder() {
+        return departOrder;
+    }
+
+    public void setDepartOrder(Integer departOrder) {
+        this.departOrder = departOrder;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getOrgCategory() {
+        return orgCategory;
+    }
+
+    public void setOrgCategory(String orgCategory) {
+        this.orgCategory = orgCategory;
+    }
+
+    public String getOrgType() {
+        return orgType;
+    }
+
+    public void setOrgType(String orgType) {
+        this.orgType = orgType;
+    }
+
+    public String getOrgCode() {
+        return orgCode;
+    }
+
+    public void setOrgCode(String orgCode) {
+        this.orgCode = orgCode;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getFax() {
+        return fax;
+    }
+
+    public void setFax(String fax) {
+        this.fax = fax;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getMemo() {
+        return memo;
+    }
+
+    public void setMemo(String memo) {
+        this.memo = memo;
+    }
+}

+ 151 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java

@@ -0,0 +1,151 @@
+package org.jeecg.common.system.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 菜单权限规则表
+ * </p>
+ *
+ * @Author huangzhilin
+ * @since 2019-03-29
+ */
+public class SysPermissionDataRuleModel {
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 对应的菜单id
+     */
+    private String permissionId;
+
+    /**
+     * 规则名称
+     */
+    private String ruleName;
+
+    /**
+     * 字段
+     */
+    private String ruleColumn;
+
+    /**
+     * 条件
+     */
+    private String ruleConditions;
+
+    /**
+     * 规则值
+     */
+    private String ruleValue;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    private String updateBy;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getPermissionId() {
+        return permissionId;
+    }
+
+    public void setPermissionId(String permissionId) {
+        this.permissionId = permissionId;
+    }
+
+    public String getRuleName() {
+        return ruleName;
+    }
+
+    public void setRuleName(String ruleName) {
+        this.ruleName = ruleName;
+    }
+
+    public String getRuleColumn() {
+        return ruleColumn;
+    }
+
+    public void setRuleColumn(String ruleColumn) {
+        this.ruleColumn = ruleColumn;
+    }
+
+    public String getRuleConditions() {
+        return ruleConditions;
+    }
+
+    public void setRuleConditions(String ruleConditions) {
+        this.ruleConditions = ruleConditions;
+    }
+
+    public String getRuleValue() {
+        return ruleValue;
+    }
+
+    public void setRuleValue(String ruleValue) {
+        this.ruleValue = ruleValue;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+}

+ 43 - 47
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java

@@ -1,71 +1,67 @@
 package org.jeecg.common.system.vo;
 package org.jeecg.common.system.vo;
 
 
-import org.jeecg.common.util.DateUtils;
-
 import java.util.List;
 import java.util.List;
 
 
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
+import org.jeecg.common.util.DateUtils;
+
 public class SysUserCacheInfo {
 public class SysUserCacheInfo {
 
 
-    private String sysUserCode;
+	private String sysUserCode;
 
 
-    private String sysUserName;
+	private String sysUserName;
 
 
-    private String sysOrgCode;
+	private String sysOrgCode;
 
 
-    private List<String> sysMultiOrgCode;
+	private List<String> sysMultiOrgCode;
 
 
-    private boolean oneDepart;
+	private boolean oneDepart;
 
 
-    public boolean isOneDepart() {
-        return oneDepart;
-    }
+	public boolean isOneDepart() {
+		return oneDepart;
+	}
 
 
-    public void setOneDepart(boolean oneDepart) {
-        this.oneDepart = oneDepart;
-    }
+	public void setOneDepart(boolean oneDepart) {
+		this.oneDepart = oneDepart;
+	}
 
 
-    public String getSysDate() {
-        return DateUtils.formatDate();
-    }
+	public String getSysDate() {
+		return DateUtils.formatDate();
+	}
 
 
-    public String getSysTime() {
-        return DateUtils.now();
-    }
+	public String getSysTime() {
+		return DateUtils.now();
+	}
 
 
-    public String getSysUserCode() {
-        return sysUserCode;
-    }
+	public String getSysUserCode() {
+		return sysUserCode;
+	}
 
 
-    public void setSysUserCode(String sysUserCode) {
-        this.sysUserCode = sysUserCode;
-    }
+	public void setSysUserCode(String sysUserCode) {
+		this.sysUserCode = sysUserCode;
+	}
 
 
-    public String getSysUserName() {
-        return sysUserName;
-    }
+	public String getSysUserName() {
+		return sysUserName;
+	}
 
 
-    public void setSysUserName(String sysUserName) {
-        this.sysUserName = sysUserName;
-    }
+	public void setSysUserName(String sysUserName) {
+		this.sysUserName = sysUserName;
+	}
 
 
-    public String getSysOrgCode() {
-        return sysOrgCode;
-    }
+	public String getSysOrgCode() {
+		return sysOrgCode;
+	}
 
 
-    public void setSysOrgCode(String sysOrgCode) {
-        this.sysOrgCode = sysOrgCode;
-    }
+	public void setSysOrgCode(String sysOrgCode) {
+		this.sysOrgCode = sysOrgCode;
+	}
 
 
-    public List<String> getSysMultiOrgCode() {
-        return sysMultiOrgCode;
-    }
+	public List<String> getSysMultiOrgCode() {
+		return sysMultiOrgCode;
+	}
 
 
-    public void setSysMultiOrgCode(List<String> sysMultiOrgCode) {
-        this.sysMultiOrgCode = sysMultiOrgCode;
-    }
+	public void setSysMultiOrgCode(List<String> sysMultiOrgCode) {
+		this.sysMultiOrgCode = sysMultiOrgCode;
+	}
 
 
 }
 }

+ 15 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserUtils.java

@@ -14,10 +14,8 @@ import javax.servlet.http.HttpServletRequest;
  */
  */
 public class BrowserUtils {
 public class BrowserUtils {
 
 
-    /**
-     * 判断是否是IE
-     */
-    public static boolean isIe(HttpServletRequest request) {
+	// 判断是否是IE
+	public static boolean isIE(HttpServletRequest request) {
 		return (request.getHeader("USER-AGENT").toLowerCase().indexOf("msie") > 0 || request
 		return (request.getHeader("USER-AGENT").toLowerCase().indexOf("msie") > 0 || request
 				.getHeader("USER-AGENT").toLowerCase().indexOf("rv:11.0") > 0) ? true
 				.getHeader("USER-AGENT").toLowerCase().indexOf("rv:11.0") > 0) ? true
 				: false;
 				: false;
@@ -29,7 +27,7 @@ public class BrowserUtils {
 	 * @param request
 	 * @param request
 	 * @return
 	 * @return
 	 */
 	 */
-    public static Double getIeVersion(HttpServletRequest request) {
+	public static Double getIEversion(HttpServletRequest request) {
 		Double version = 0.0;
 		Double version = 0.0;
 		if (getBrowserType(request, IE11)) {
 		if (getBrowserType(request, IE11)) {
 			version = 11.0;
 			version = 11.0;
@@ -193,4 +191,16 @@ public class BrowserUtils {
 		return browserLangCode;
 		return browserLangCode;
 	}
 	}
 
 
+    /** 判断请求是否来自电脑端 */
+    public static boolean isDesktop(HttpServletRequest request) {
+        return !isMobile(request);
+    }
+
+    /** 判断请求是否来自移动端 */
+    public static boolean isMobile(HttpServletRequest request) {
+        String ua = request.getHeader("User-Agent").toLowerCase();
+        Pattern pattern = Pattern.compile("(phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|fennec|wosbrowser|browserng|webos|symbian|windows phone)");
+        return pattern.matcher(ua).find();
+    }
+
 }
 }

+ 64 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/CommonUtils.java

@@ -0,0 +1,64 @@
+package org.jeecg.common.util;
+
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.util.oss.OssBootUtil;
+import org.jeecgframework.poi.util.PoiPublicUtil;
+import org.springframework.util.FileCopyUtils;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+
+public class CommonUtils {
+
+    public static String uploadOnlineImage(byte[] data,String basePath,String bizPath,String uploadType){
+        String dbPath = null;
+        String fileName = "image" + Math.round(Math.random() * 100000000000L);
+        fileName += "." + PoiPublicUtil.getFileExtendName(data);
+        try {
+            if(CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
+                File file = new File(basePath + File.separator + bizPath + File.separator );
+                if (!file.exists()) {
+                    file.mkdirs();// 创建文件根目录
+                }
+                String savePath = file.getPath() + File.separator + fileName;
+                File savefile = new File(savePath);
+                FileCopyUtils.copy(data, savefile);
+                dbPath = bizPath + File.separator + fileName;
+            }else {
+                InputStream in = new ByteArrayInputStream(data);
+                String relativePath = bizPath+"/"+fileName;
+                if(CommonConstant.UPLOAD_TYPE_MINIO.equals(uploadType)){
+                    dbPath = MinioUtil.upload(in,relativePath);
+                }else if(CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)){
+                    dbPath = OssBootUtil.upload(in,relativePath);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dbPath;
+    }
+
+    /**
+     * 判断文件名是否带盘符,重新处理
+     * @param fileName
+     * @return
+     */
+    public static String getFileName(String fileName){
+        //判断是否带有盘符信息
+        // Check for Unix-style path
+        int unixSep = fileName.lastIndexOf('/');
+        // Check for Windows-style path
+        int winSep = fileName.lastIndexOf('\\');
+        // Cut off at latest possible point
+        int pos = (winSep > unixSep ? winSep : unixSep);
+        if (pos != -1)  {
+            // Any sort of path separator found...
+            fileName = fileName.substring(pos + 1);
+        }
+        //替换上传文件名字的特殊字符
+        fileName = fileName.replace("=","").replace(",","").replace("&","");
+        return fileName;
+    }
+}

+ 376 - 60
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -23,19 +23,75 @@ public class DateUtils extends PropertyEditorSupport {
 
 
     private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
     private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
 
 
-    /**
-     * 以毫秒表示的时间
-     */
+    public static ThreadLocal<SimpleDateFormat> date_sdf = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyy-MM-dd");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> yyyyMMdd = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyyMMdd");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> date_sdf_wz = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyy年MM月dd日");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> time_sdf = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> yyyymmddhhmmss = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyyMMddHHmmss");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> short_time_sdf = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("HH:mm");
+        }
+    };
+    public static ThreadLocal<SimpleDateFormat> datetimeFormat = new ThreadLocal<SimpleDateFormat>() {
+        @Override
+        protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        }
+    };
+
+    // 以毫秒表示的时间
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000L;
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000L;
     private static final long HOUR_IN_MILLIS = 3600 * 1000L;
     private static final long HOUR_IN_MILLIS = 3600 * 1000L;
     private static final long MINUTE_IN_MILLIS = 60 * 1000L;
     private static final long MINUTE_IN_MILLIS = 60 * 1000L;
     private static final long SECOND_IN_MILLIS = 1000L;
     private static final long SECOND_IN_MILLIS = 1000L;
-
-
-    public static String getNowHour(Date date){
+    /**
+     * 格式常量
+     */
+    public final static String SHORT_FORMAT = "yyyyMMdd";
+    public final static String LONG_FORMAT = "yyyyMMddHHmmss";
+    public final static String YEARHOUR_FORMAT = "yyyyMMddHH";
+    public final static String WEB_FORMAT = "yyyy-MM-dd";
+    public final static String TIME_FORMAT = "HHmmss";
+    public final static String COLON_TIME_FORMAT = "HH:mm:ss";
+    public final static String CHINESEDT_FORMAT = "yyyy年MM月dd日";
+    public final static String NEW_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    public final static String WEB_FORMAT_ALL = "yyyy MM dd HH mm ss";
+    public final static String SECOND_FORMAT = "yyyy-MM-dd HH";
+    public final static String GREGORIAN_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+    public final static String NOMS_GREGORIAN_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
+    public static String getNowHour(Date date) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         return simpleDateFormat.format(date);
         return simpleDateFormat.format(date);
     }
     }
+
     public static Date getNowDate() throws ParseException {
     public static Date getNowDate() throws ParseException {
         SimpleDateFormat dsdf = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat dsdf = new SimpleDateFormat("yyyy-MM-dd");
         String nowDate = getNowDate("yyyy-MM-dd");
         String nowDate = getNowDate("yyyy-MM-dd");
@@ -59,6 +115,13 @@ public class DateUtils extends PropertyEditorSupport {
         return dsdf.format(parse);
         return dsdf.format(parse);
     }
     }
 
 
+    public static Integer getNowHour() throws ParseException {
+        Calendar cal = Calendar.getInstance();
+        Date date = new Date();
+        cal.setTime(date);
+        return cal.get(Calendar.HOUR_OF_DAY);
+    }
+
     public static Integer getHour(String dateStr) throws ParseException {
     public static Integer getHour(String dateStr) throws ParseException {
         DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Calendar cal = Calendar.getInstance();
         Calendar cal = Calendar.getInstance();
@@ -67,6 +130,29 @@ public class DateUtils extends PropertyEditorSupport {
         return cal.get(Calendar.HOUR_OF_DAY);
         return cal.get(Calendar.HOUR_OF_DAY);
     }
     }
 
 
+    public static String getEndTime(String time) throws ParseException {
+        SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date parse = smf.parse(time);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(parse);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.add(Calendar.DAY_OF_MONTH, 1);
+        calendar.add(Calendar.SECOND, -1);
+        Date end = calendar.getTime();
+        String format = smf.format(end);
+        return format;
+    }
+
+
+
+
+    // 指定模式的时间格式
+    private static SimpleDateFormat getSDFormat(String pattern) {
+        return new SimpleDateFormat(pattern);
+    }
+
     /**
     /**
      * 指定模式的时间格式
      * 指定模式的时间格式
      *
      *
@@ -78,6 +164,41 @@ public class DateUtils extends PropertyEditorSupport {
     }
     }
 
 
     /**
     /**
+     * 日期转换为字符串
+     *
+     * @return 字符串
+     */
+    public static String date2Str() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        return format.format(new Date());
+    }
+
+    public static List<Map<String, String>> getDateDayRange(String startDate, String endDate) throws ParseException {
+        List<Map<String, String>> list = new ArrayList<>();
+        String splitDate = DateUtils.addDay(endDate, -1);
+        splitDate = DateUtils.addDay(splitDate, 1);
+        if (DateUtils.compareDate(startDate, splitDate) >= 0) {
+            Map<String, String> map = new HashMap<String, String>();
+            map.put("startDate", startDate);
+            map.put("endDate", endDate);
+            list.add(map);
+        } else {
+            while (DateUtils.compareDate(startDate, splitDate) < 0 || DateUtils.compareDate(startDate, endDate) <= 0) {
+                Map<String, String> map = new HashMap<>();
+                map.put("startDate", splitDate);
+                map.put("endDate", endDate);
+                list.add(map);
+                splitDate = DateUtils.addDay(splitDate, -1);
+                endDate = DateUtils.addDay(endDate, -1);
+                if (DateUtils.compareDate(startDate, splitDate) > 0) {
+                    splitDate = startDate;
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
      * 当前日历,这里用中国时间表示
      * 当前日历,这里用中国时间表示
      *
      *
      * @return 以当地时区表示的系统当前日历
      * @return 以当地时区表示的系统当前日历
@@ -118,6 +239,46 @@ public class DateUtils extends PropertyEditorSupport {
         }
         }
         return null;
         return null;
     }
     }
+
+    /**
+     * 当前日期
+     *
+     * @param l
+     * @return 系统当前时间
+     */
+    public static Date getDate(long l) {
+        return new Date();
+    }
+
+
+    public static String getStartTime(Date date) {
+        Calendar dateStart = Calendar.getInstance();
+        dateStart.setTime(date);
+        dateStart.set(Calendar.HOUR_OF_DAY, 0);
+        dateStart.set(Calendar.MINUTE, 0);
+        dateStart.set(Calendar.SECOND, 0);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(dateStart.getTime());
+    }
+
+    /**
+     * 日期转换为字符串
+     *
+     * @param date_sdf 日期格式
+     * @return 字符串
+     */
+    public static String date2Str(SimpleDateFormat date_sdf) {
+        Date date = getDate();
+        if (null == date) {
+            return null;
+        }
+        return date_sdf.format(date);
+    }
+
+    public static Date getDate() {
+        return new Date();
+    }
+
     /**
     /**
      * 格式化时间
      * 格式化时间
      *
      *
@@ -183,8 +344,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 当前时间的标准形式字符串
      * @return 当前时间的标准形式字符串
      */
      */
     public static String now() {
     public static String now() {
-        SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        return datetimeFormat.format(getCalendar().getTime());
+        return datetimeFormat.get().format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -269,8 +429,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“年-月-日“格式显示
      * @return 默认日期按“年-月-日“格式显示
      */
      */
     public static String formatDate() {
     public static String formatDate() {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        return format.format(getCalendar().getTime());
+        return date_sdf.get().format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -279,8 +438,18 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
      * @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
      */
      */
     public static String formatDateTime() {
     public static String formatDateTime() {
-        SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        return datetimeFormat.format(getCalendar().getTime());
+        return datetimeFormat.get().format(getCalendar().getTime());
+    }
+
+    public static String formatDateTime(Long time) {
+        return datetimeFormat.get().format(time);
+    }
+
+    /**
+     * 获取时间字符串
+     */
+    public static String getDataString(SimpleDateFormat formatstr) {
+        return formatstr.format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -290,8 +459,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日“格式显示
      * @return 指定日期按“年-月-日“格式显示
      */
      */
     public static String formatDate(Calendar cal) {
     public static String formatDate(Calendar cal) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        return format.format(cal.getTime());
+        return date_sdf.get().format(cal.getTime());
     }
     }
 
 
     /**
     /**
@@ -301,8 +469,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日“格式显示
      * @return 指定日期按“年-月-日“格式显示
      */
      */
     public static String formatDate(Date date) {
     public static String formatDate(Date date) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        return format.format(date);
+        return date_sdf.get().format(date);
     }
     }
 
 
     /**
     /**
@@ -312,8 +479,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“年-月-日“格式显示
      * @return 指定毫秒数表示日期按“年-月-日“格式显示
      */
      */
     public static String formatDate(long millis) {
     public static String formatDate(long millis) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-        return format.format(new Date(millis));
+        return date_sdf.get().format(new Date(millis));
     }
     }
 
 
     /**
     /**
@@ -323,7 +489,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按指定格式显示
      * @return 默认日期按指定格式显示
      */
      */
     public static String formatDate(String pattern) {
     public static String formatDate(String pattern) {
-        return getDateFormat(pattern).format(getCalendar().getTime());
+        return getSDFormat(pattern).format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -334,7 +500,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按指定格式显示
      * @return 指定日期按指定格式显示
      */
      */
     public static String formatDate(Calendar cal, String pattern) {
     public static String formatDate(Calendar cal, String pattern) {
-        return getDateFormat(pattern).format(cal.getTime());
+        return getSDFormat(pattern).format(cal.getTime());
     }
     }
 
 
     /**
     /**
@@ -345,7 +511,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按指定格式显示
      * @return 指定日期按指定格式显示
      */
      */
     public static String formatDate(Date date, String pattern) {
     public static String formatDate(Date date, String pattern) {
-        return getDateFormat(pattern).format(date);
+        return getSDFormat(pattern).format(date);
     }
     }
 
 
     // ////////////////////////////////////////////////////////////////////////////
     // ////////////////////////////////////////////////////////////////////////////
@@ -359,8 +525,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“年-月-日 时:分“格式显示
      * @return 默认日期按“年-月-日 时:分“格式显示
      */
      */
     public static String formatTime() {
     public static String formatTime() {
-        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        return timeSdf.format(getCalendar().getTime());
+        return time_sdf.get().format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -370,8 +535,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
      * @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
      */
      */
     public static String formatTime(long millis) {
     public static String formatTime(long millis) {
-        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        return timeSdf.format(new Date(millis));
+        return time_sdf.get().format(new Date(millis));
     }
     }
 
 
     /**
     /**
@@ -381,8 +545,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日 时:分“格式显示
      * @return 指定日期按“年-月-日 时:分“格式显示
      */
      */
     public static String formatTime(Calendar cal) {
     public static String formatTime(Calendar cal) {
-        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        return timeSdf.format(cal.getTime());
+        return time_sdf.get().format(cal.getTime());
     }
     }
 
 
     /**
     /**
@@ -392,8 +555,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日 时:分“格式显示
      * @return 指定日期按“年-月-日 时:分“格式显示
      */
      */
     public static String formatTime(Date date) {
     public static String formatTime(Date date) {
-        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        return timeSdf.format(date);
+        return time_sdf.get().format(date);
     }
     }
 
 
     // ////////////////////////////////////////////////////////////////////////////
     // ////////////////////////////////////////////////////////////////////////////
@@ -407,8 +569,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“时:分“格式显示
      * @return 默认日期按“时:分“格式显示
      */
      */
     public static String formatShortTime() {
     public static String formatShortTime() {
-        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
-        return shortTimeSdf.format(getCalendar().getTime());
+        return short_time_sdf.get().format(getCalendar().getTime());
     }
     }
 
 
     /**
     /**
@@ -418,8 +579,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“时:分“格式显示
      * @return 指定毫秒数表示日期按“时:分“格式显示
      */
      */
     public static String formatShortTime(long millis) {
     public static String formatShortTime(long millis) {
-        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
-        return shortTimeSdf.format(new Date(millis));
+        return short_time_sdf.get().format(new Date(millis));
     }
     }
 
 
     /**
     /**
@@ -477,7 +637,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 如果转换成功则返回转换后的日期
      * @return 如果转换成功则返回转换后的日期
      * @throws
      * @throws
      */
      */
-    public static Calendar parseCalendar(String src, String pattern){
+    public static Calendar parseCalendar(String src, String pattern) {
 
 
         Date date = parseDate(src, pattern);
         Date date = parseDate(src, pattern);
         Calendar cal = Calendar.getInstance();
         Calendar cal = Calendar.getInstance();
@@ -596,6 +756,110 @@ public class DateUtils extends PropertyEditorSupport {
         return dateFormat.format(getDate);
         return dateFormat.format(getDate);
     }
     }
 
 
+    public static Date stampToTime(Long ms) throws ParseException {
+        long msl = ms * 1000;
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date temp = null;
+        if (ms != null) {
+            try {
+                String str = sdf.format(msl);
+                temp = sdf.parse(str);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        return temp;
+    }
+
+    private static Calendar zeroFromHour(long milliseconds) {
+        Calendar calendar = Calendar.getInstance(); // 获得一个日历
+
+        calendar.setTimeInMillis(completMilliseconds(milliseconds));
+        zeroFromHour(calendar);
+        return calendar;
+    }
+
+    private static long completMilliseconds(long milliseconds) {
+        String milStr = Long.toString(milliseconds);
+        if (milStr.length() == 10) {
+            milliseconds = milliseconds * 1000;
+        }
+        return milliseconds;
+    }
+
+    private static void zeroFromHour(Calendar calendar) {
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+    }
+
+
+    public static String getWhatDay(long timeStamp) {
+        Calendar cal = zeroFromHour(timeStamp);
+        String whatDay = "";
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
+            whatDay = "星期六";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            whatDay = "星期日";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
+            whatDay = "星期一";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
+            whatDay = "星期二";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
+            whatDay = "星期三";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
+            whatDay = "星期四";
+        }
+        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
+            whatDay = "星期五";
+        }
+        return whatDay;
+    }
+
+    /* //日期转换为时间戳 */
+    public static long timeToStamp(String timers) {
+        Date d = new Date();
+        long timeStemp = 0;
+        try {
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            d = sf.parse(timers);// 日期转换为时间戳
+        } catch (ParseException e) {
+
+            e.printStackTrace();
+        }
+        timeStemp = d.getTime();
+        return timeStemp / 1000;
+    }
+
+
+    public static int getdaysOfTwoDate(String minDate, String date) {
+        Date bigDate = parseDate(date, "yyyy-MM-dd");
+        Date smallDate = parseDate(minDate, "yyyy-MM-dd");
+        int days = (int) ((bigDate.getTime() - smallDate.getTime()) / (1000 * 3600 * 24));
+        return days + 1;
+    }
+
+
+    /**
+     * 当前时间前推
+     *
+     * @param endDate
+     * @param i
+     * @return
+     */
+    public static Date addTime(Date endDate, int i) {
+        Long time = Long.valueOf(i * 1000 * 60);
+        Long time1 = endDate.getTime() - time;
+        return new Date(time1);
+    }
+
+
     /**
     /**
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
      * HH:mm:ss“ * @param text String类型的时间值
      * HH:mm:ss“ * @param text String类型的时间值
@@ -642,31 +906,6 @@ public class DateUtils extends PropertyEditorSupport {
         }
         }
     }
     }
 
 
-    public static List<Map<String, String>> getDateDayRange(String startDate, String endDate) throws ParseException {
-        List<Map<String, String>> list = new ArrayList<>();
-        String splitDate = DateUtils.addDay(endDate, -1);
-        splitDate = DateUtils.addDay(splitDate, 1);
-        if (DateUtils.compareDate(startDate, splitDate) >= 0) {
-            Map<String, String> map = new HashMap<>();
-            map.put("startDate", startDate);
-            map.put("endDate", endDate);
-            list.add(map);
-        } else {
-            while (DateUtils.compareDate(startDate, splitDate) < 0 || DateUtils.compareDate(startDate, endDate) <= 0) {
-                Map<String, String> map = new HashMap<>();
-                map.put("startDate", splitDate);
-                map.put("endDate", endDate);
-                list.add(map);
-                splitDate = DateUtils.addDay(splitDate, -1);
-                endDate = DateUtils.addDay(endDate, -1);
-                if (DateUtils.compareDate(startDate, splitDate) > 0) {
-                    splitDate = startDate;
-                }
-            }
-        }
-        return list;
-    }
-
     public static List<Map<String, String>> getDateWeekRange(String startDate, String endDate) throws ParseException {
     public static List<Map<String, String>> getDateWeekRange(String startDate, String endDate) throws ParseException {
         List<Map<String, String>> list = new ArrayList<>();
         List<Map<String, String>> list = new ArrayList<>();
         String splitDate = DateUtils.addWeek(endDate, -1);
         String splitDate = DateUtils.addWeek(endDate, -1);
@@ -1265,7 +1504,7 @@ public class DateUtils extends PropertyEditorSupport {
      *
      *
      * @return
      * @return
      */
      */
-    public static boolean isMoreSixMonth(String startDate, String endDate) {
+    public static boolean isMoreSixMonth(String startDate, String endDate) throws ParseException {
         Calendar c = Calendar.getInstance();
         Calendar c = Calendar.getInstance();
         c.setTime(Objects.requireNonNull(parseDate(startDate, SystemDateConstant.yyyy_MM_dd)));
         c.setTime(Objects.requireNonNull(parseDate(startDate, SystemDateConstant.yyyy_MM_dd)));
         long time1 = c.getTimeInMillis();
         long time1 = c.getTimeInMillis();
@@ -1294,6 +1533,83 @@ public class DateUtils extends PropertyEditorSupport {
         return lDate;
         return lDate;
     }
     }
 
 
+    /**
+     * 以time为节点,获取前几天的日期 yyyy-MM-dd
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String getLastDay(String time, int days) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        Date date = null;
+        try {
+            date = sdf.parse(time);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        calendar.setTime(date);
+        int day = calendar.get(Calendar.DATE);
+        //                      此处修改为+1则是获取后一天
+        calendar.set(Calendar.DATE, day - days);
+
+        String lastDay = sdf.format(calendar.getTime());
+        return lastDay;
+    }
+
+    /**
+     * 获取当月1号零时零分的时间
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String initDateByMonth() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sdf.format(calendar.getTime());
+    }
+
+    /**
+     * 获取两个日期之间的所有日期集合
+     * @author ZHAOXA
+     * @param
+     * @return java.util.List<java.lang.String>
+     * @throws
+     */
+    public static List<String> getDays(String startTime, String endTime) {
+        // 返回的日期集合
+        List<String> days = new ArrayList<String>();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date start = dateFormat.parse(startTime);
+            Date end = dateFormat.parse(endTime);
+
+            Calendar tempStart = Calendar.getInstance();
+            tempStart.setTime(start);
+
+            Calendar tempEnd = Calendar.getInstance();
+            tempEnd.setTime(end);
+            tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
+            while (tempStart.before(tempEnd)) {
+                days.add(dateFormat.format(tempStart.getTime()));
+                tempStart.add(Calendar.DAY_OF_YEAR, 1);
+            }
+
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        return days;
+    }
 }
 }
 
 
 
 

+ 66 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsEnum.java

@@ -0,0 +1,66 @@
+package org.jeecg.common.util;
+
+import org.apache.commons.lang.StringUtils;
+
+public enum DySmsEnum {
+	
+	LOGIN_TEMPLATE_CODE("SMS_175435174","JEECG","code"),
+	FORGET_PASSWORD_TEMPLATE_CODE("SMS_175435174","JEECG","code"),
+	REGISTER_TEMPLATE_CODE("SMS_175430166","JEECG","code");
+	
+	/**
+	 * 短信模板编码
+	 */
+	private String templateCode;
+	/**
+	 * 签名
+	 */
+	private String signName;
+	/**
+	 * 短信模板必需的数据名称,多个key以逗号分隔,此处配置作为校验
+	 */
+	private String keys;
+	
+	private DySmsEnum(String templateCode,String signName,String keys) {
+		this.templateCode = templateCode;
+		this.signName = signName;
+		this.keys = keys;
+	}
+	
+	public String getTemplateCode() {
+		return templateCode;
+	}
+	
+	public void setTemplateCode(String templateCode) {
+		this.templateCode = templateCode;
+	}
+	
+	public String getSignName() {
+		return signName;
+	}
+	
+	public void setSignName(String signName) {
+		this.signName = signName;
+	}
+	
+	public String getKeys() {
+		return keys;
+	}
+
+	public void setKeys(String keys) {
+		this.keys = keys;
+	}
+
+	public static DySmsEnum toEnum(String templateCode) {
+		if(StringUtils.isEmpty(templateCode)){
+			return null;
+		}
+		for(DySmsEnum item : DySmsEnum.values()) {
+			if(item.getTemplateCode().equals(templateCode)) {
+				return item;
+			}
+		}
+		return null;
+	}
+}
+

+ 57 - 50
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java

@@ -2,6 +2,8 @@ package org.jeecg.common.util;
 
 
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
+
+import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.DefaultAcsClient;
 import com.aliyuncs.DefaultAcsClient;
 import com.aliyuncs.IAcsClient;
 import com.aliyuncs.IAcsClient;
 import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
 import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
@@ -17,75 +19,64 @@ import com.aliyuncs.profile.IClientProfile;
  * 工程依赖了2个jar包(存放在工程的libs目录下)
  * 工程依赖了2个jar包(存放在工程的libs目录下)
  * 1:aliyun-java-sdk-core.jar
  * 1:aliyun-java-sdk-core.jar
  * 2:aliyun-java-sdk-dysmsapi.jar
  * 2:aliyun-java-sdk-dysmsapi.jar
- * <p>
+ *
  * 备注:Demo工程编码采用UTF-8
  * 备注:Demo工程编码采用UTF-8
  * 国际短信发送请勿参照此DEMO
  * 国际短信发送请勿参照此DEMO
  */
  */
 public class DySmsHelper {
 public class DySmsHelper {
+	
+	private final static Logger logger=LoggerFactory.getLogger(DySmsHelper.class);
 
 
-    private final static Logger logger = LoggerFactory.getLogger(DySmsHelper.class);
-
-    /**
-     * 产品名称:云通信短信API产品,开发者无需替换
-     */
-    static final String PRODUCT = "Dysmsapi";
-    /**
-     * 产品域名,开发者无需替换
-     */
-    static final String DOMAIN = "dysmsapi.aliyuncs.com";
-
-    /**
-     * TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
-     *
-     * @return
-     */
-
-    static final String ACCESS_KEY_ID = "?";
-    static final String ACCESS_KEY_SECRET = "?";
+    //产品名称:云通信短信API产品,开发者无需替换
+    static final String product = "Dysmsapi";
+    //产品域名,开发者无需替换
+    static final String domain = "dysmsapi.aliyuncs.com";
 
 
-    /**
-     * 登陆时采用的短信发送模板编码
-     */
-    public static final String LOGIN_TEMPLATE_CODE = "SMS_167040816";
+    // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
+    static  String accessKeyId;
+    static  String accessKeySecret;
 
 
-    /**
-     * 忘记密码时采用的短信发送模板编码
-     */
-    public static final String FORGET_PASSWORD_TEMPLATE_CODE = "SMS_167040816";
-
-
-    /**
-     * 注册时采用的短信发送模板编码
-     */
-    public static final String REGISTER_TEMPLATE_CODE = "SMS_144146309";
+    public static void setAccessKeyId(String accessKeyId) {
+        DySmsHelper.accessKeyId = accessKeyId;
+    }
 
 
-    /**
-     * 必填:短信签名-可在短信控制台中找到
-     */
-    public static final String SIGN_NAME = "JEECG";
+    public static void setAccessKeySecret(String accessKeySecret) {
+        DySmsHelper.accessKeySecret = accessKeySecret;
+    }
 
 
+    public static String getAccessKeyId() {
+        return accessKeyId;
+    }
 
 
-    public static boolean sendSms(String phone, String code, String templateCode) throws ClientException {
-        //可自助调整超时时间
+    public static String getAccessKeySecret() {
+        return accessKeySecret;
+    }
+    
+    
+    public static boolean sendSms(String phone,JSONObject templateParamJson,DySmsEnum dySmsEnum) throws ClientException {
+    	//可自助调整超时时间
         System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
         System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
         System.setProperty("sun.net.client.defaultReadTimeout", "10000");
         System.setProperty("sun.net.client.defaultReadTimeout", "10000");
-
+        
         //初始化acsClient,暂不支持region化
         //初始化acsClient,暂不支持region化
-        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY_ID, ACCESS_KEY_SECRET);
-        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
+        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
         IAcsClient acsClient = new DefaultAcsClient(profile);
         IAcsClient acsClient = new DefaultAcsClient(profile);
-
+        
+        //验证json参数
+        validateParam(templateParamJson,dySmsEnum);
+        
         //组装请求对象-具体描述见控制台-文档部分内容
         //组装请求对象-具体描述见控制台-文档部分内容
         SendSmsRequest request = new SendSmsRequest();
         SendSmsRequest request = new SendSmsRequest();
         //必填:待发送手机号
         //必填:待发送手机号
         request.setPhoneNumbers(phone);
         request.setPhoneNumbers(phone);
         //必填:短信签名-可在短信控制台中找到
         //必填:短信签名-可在短信控制台中找到
-        request.setSignName(SIGN_NAME);
+        request.setSignName(dySmsEnum.getSignName());
         //必填:短信模板-可在短信控制台中找到
         //必填:短信模板-可在短信控制台中找到
-        request.setTemplateCode("SMS_167040816");
+        request.setTemplateCode(dySmsEnum.getTemplateCode());
         //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
         //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
-        request.setTemplateParam("{\"code\":\"" + code + "\"}");
-
+        request.setTemplateParam(templateParamJson.toJSONString());
+        
         //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
         //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
         //request.setSmsUpExtendCode("90997");
         //request.setSmsUpExtendCode("90997");
 
 
@@ -93,17 +84,33 @@ public class DySmsHelper {
         //request.setOutId("yourOutId");
         //request.setOutId("yourOutId");
 
 
         boolean result = false;
         boolean result = false;
+
         //hint 此处可能会抛出异常,注意catch
         //hint 此处可能会抛出异常,注意catch
         SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
         SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
         logger.info("短信接口返回的数据----------------");
         logger.info("短信接口返回的数据----------------");
-        logger.info("{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
+        logger.info("{Code:" + sendSmsResponse.getCode()+",Message:" + sendSmsResponse.getMessage()+",RequestId:"+ sendSmsResponse.getRequestId()+",BizId:"+sendSmsResponse.getBizId()+"}");
         if ("OK".equals(sendSmsResponse.getCode())) {
         if ("OK".equals(sendSmsResponse.getCode())) {
             result = true;
             result = true;
         }
         }
         return result;
         return result;
+        
+    }
+    
+    private static void validateParam(JSONObject templateParamJson,DySmsEnum dySmsEnum) {
+    	String keys = dySmsEnum.getKeys();
+    	String [] keyArr = keys.split(",");
+    	for(String item :keyArr) {
+    		if(!templateParamJson.containsKey(item)) {
+    			throw new RuntimeException("模板缺少参数:"+item);
+    		}
+    	}
     }
     }
+    
 
 
     public static void main(String[] args) throws ClientException, InterruptedException {
     public static void main(String[] args) throws ClientException, InterruptedException {
-        sendSms("13800138000", "123456", FORGET_PASSWORD_TEMPLATE_CODE);
+    	JSONObject obj = new JSONObject();
+    	obj.put("code", "1234");
+    	sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
+    	
     }
     }
 }
 }

+ 57 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/FillRuleUtil.java

@@ -0,0 +1,57 @@
+package org.jeecg.common.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.handler.IFillRuleHandler;
+
+
+/**
+ * 规则值自动生成工具类
+ *
+ * @author qinfeng
+ * @举例: 自动生成订单号;自动生成当前日期
+ */
+@Slf4j
+public class FillRuleUtil {
+
+    /**
+     * @param ruleCode ruleCode
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static Object executeRule(String ruleCode, JSONObject formData) {
+        if (!StringUtils.isEmpty(ruleCode)) {
+            try {
+                // 获取 Service
+                ServiceImpl impl = (ServiceImpl) SpringContextUtils.getBean("sysFillRuleServiceImpl");
+                // 根据 ruleCode 查询出实体
+                QueryWrapper queryWrapper = new QueryWrapper();
+                queryWrapper.eq("rule_code", ruleCode);
+                JSONObject entity = JSON.parseObject(JSON.toJSONString(impl.getOne(queryWrapper)));
+                if (entity == null) {
+                    log.warn("填值规则:" + ruleCode + " 不存在");
+                    return null;
+                }
+                // 获取必要的参数
+                String ruleClass = entity.getString("ruleClass");
+                JSONObject params = entity.getJSONObject("ruleParams");
+                if (params == null) {
+                    params = new JSONObject();
+                }
+                if (formData == null) {
+                    formData = new JSONObject();
+                }
+                // 通过反射执行配置的类里的方法
+                IFillRuleHandler ruleHandler = (IFillRuleHandler) Class.forName(ruleClass).newInstance();
+                return ruleHandler.execute(params, formData);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 29 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/HTMLUtils.java

@@ -0,0 +1,29 @@
+package org.jeecg.common.util;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.util.HtmlUtils;
+
+/**
+ * HTML 工具类
+ */
+public class HTMLUtils {
+
+    /**
+     * 获取HTML内的文本,不包含标签
+     *
+     * @param html HTML 代码
+     */
+    public static String getInnerText(String html) {
+        if (StringUtils.isNotBlank(html)) {
+            //去掉 html 的标签
+            String content = html.replaceAll("</?[^>]+>", "");
+            // 将多个空格合并成一个空格
+            content = content.replaceAll("(&nbsp;)+", "&nbsp;");
+            // 反向转义字符
+            content = HtmlUtils.htmlUnescape(content);
+            return content.trim();
+        }
+        return "";
+    }
+
+}

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/IPUtils.java

@@ -1,11 +1,11 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import javax.servlet.http.HttpServletRequest;
 
 
-import com.alibaba.druid.util.StringUtils;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
-import javax.servlet.http.HttpServletRequest;
 /**
 /**
  * IP地址
  * IP地址
  * 
  * 

+ 96 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ImportExcelUtil.java

@@ -0,0 +1,96 @@
+package org.jeecg.common.util;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 导出返回信息
+ */
+@Slf4j
+public class ImportExcelUtil {
+
+    public static Result<?> imporReturnRes(int errorLines,int successLines,List<String> errorMessage) throws IOException {
+        if (errorLines == 0) {
+            return Result.ok("共" + successLines + "行数据全部导入成功!");
+        } else {
+            JSONObject result = new JSONObject(5);
+            int totalCount = successLines + errorLines;
+            result.put("totalCount", totalCount);
+            result.put("errorCount", errorLines);
+            result.put("successCount", successLines);
+            result.put("msg", "总上传行数:" + totalCount + ",已导入行数:" + successLines + ",错误行数:" + errorLines);
+            String fileUrl = PmsUtil.saveErrorTxtByList(errorMessage, "userImportExcelErrorLog");
+            int lastIndex = fileUrl.lastIndexOf(File.separator);
+            String fileName = fileUrl.substring(lastIndex + 1);
+            result.put("fileUrl", "/sys/common/static/" + fileUrl);
+            result.put("fileName", fileName);
+            Result res = Result.ok(result);
+            res.setCode(201);
+            res.setMessage("文件导入成功,但有错误。");
+            return res;
+        }
+    }
+
+    public static List<String> importDateSave(List<Object> list, Class serviceClass,List<String> errorMessage,String errorFlag)  {
+        IService bean =(IService) SpringContextUtils.getBean(serviceClass);
+        for (int i = 0; i < list.size(); i++) {
+            try {
+                boolean save = bean.save(list.get(i));
+                if(!save){
+                    throw new Exception(errorFlag);
+                }
+            } catch (Exception e) {
+                String message = e.getMessage();
+                int lineNumber = i + 1;
+                // 通过索引名判断出错信息
+                if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
+                    errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。");
+                } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) {
+                    errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。");
+                }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) {
+                    errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。");
+                }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) {
+                    errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。");
+                }else {
+                    errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
+                    log.error(e.getMessage(), e);
+                }
+            }
+        }
+        return errorMessage;
+    }
+
+    public static List<String> importDateSaveOne(Object obj, Class serviceClass,List<String> errorMessage,int i,String errorFlag)  {
+        IService bean =(IService) SpringContextUtils.getBean(serviceClass);
+        try {
+            boolean save = bean.save(obj);
+            if(!save){
+                throw new Exception(errorFlag);
+            }
+        } catch (Exception e) {
+            String message = e.getMessage();
+            int lineNumber = i + 1;
+            // 通过索引名判断出错信息
+            if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
+                errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。");
+            } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) {
+                errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。");
+            }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) {
+                errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。");
+            }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) {
+                errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。");
+            }else {
+                errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
+                log.error(e.getMessage(), e);
+            }
+        }
+        return errorMessage;
+    }
+}

+ 32 - 13
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java

@@ -49,25 +49,46 @@ public class JsonResourceUtil {
         return json;
         return json;
     }
     }
 
 
+    //json文件转化为JSONArray
+    public static JSONArray getJsonArrFromResource(String filename) {
+        JSONArray json = null;
+        if (!filename.contains(".json")) {
+            filename += ".json";
+        }
+        try {
+            ClassPathResource classPathResource = new ClassPathResource(filename);
+            if (classPathResource.exists()) {
+                InputStream inputStream = classPathResource.getInputStream();
+                String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+                json = JSON.parseArray(content);
+            } else {
+                logger.info("file not exist!");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.info("readFileToString" + e.getMessage());
+        }
+        return json;
+    }
+
     public static Map<String, Map<String, Object>> jsonToMap(Object jsonObj) {
     public static Map<String, Map<String, Object>> jsonToMap(Object jsonObj) {
         JSONObject jsonObject = JSONObject.parseObject(jsonObj.toString());
         JSONObject jsonObject = JSONObject.parseObject(jsonObj.toString());
         Map<String, Map<String, Object>> mapMap = new HashMap<>();
         Map<String, Map<String, Object>> mapMap = new HashMap<>();
-        jsonObject.forEach((key, value) -> {
-            mapMap.put(key, JSONObject.parseObject(value.toString()));
-        });
+        jsonObject.forEach((key, value) -> mapMap.put(key, JSONObject.parseObject(value.toString())));
         return mapMap;
         return mapMap;
     }
     }
 
 
     /**
     /**
      * 拼接字段
      * 拼接字段
      */
      */
-    public static String joinFiled(JSONArray array) {
+    public static String joinFiled(Map<String, Map<String,Object>> mapMap,JSONArray array) {
         StringBuilder sb = new StringBuilder();
         StringBuilder sb = new StringBuilder();
         array.forEach(it -> {
         array.forEach(it -> {
-            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+            if (mapMap.get(it.toString()).isEmpty()) {
                 sb.append(it).append(",");
                 sb.append(it).append(",");
             } else {
             } else {
-                sb.append(AccountReportConstants.dicMap.get(it.toString()).get("filed")).append(",");
+                sb.append(mapMap.get(it.toString()).get("filed")).append(",");
             }
             }
         });
         });
         return sb.deleteCharAt(sb.length() - 1).toString();
         return sb.deleteCharAt(sb.length() - 1).toString();
@@ -76,13 +97,13 @@ public class JsonResourceUtil {
     /**
     /**
      * 拼接title
      * 拼接title
      */
      */
-    public static List<String> joinTitle(JSONArray array) {
+    public static List<String> joinTitle(Map<String, Map<String,Object>> mapMap,JSONArray array) {
         List<String> titles = new ArrayList<>(20);
         List<String> titles = new ArrayList<>(20);
         array.forEach(it -> {
         array.forEach(it -> {
-            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+            if (mapMap.get(it.toString()).isEmpty()) {
                 titles.add(it.toString());
                 titles.add(it.toString());
             } else {
             } else {
-                titles.add(AccountReportConstants.dicMap.get(it.toString()).get("comment").toString());
+                titles.add(mapMap.get(it.toString()).get("comment").toString());
             }
             }
         });
         });
         return titles;
         return titles;
@@ -91,11 +112,9 @@ public class JsonResourceUtil {
     /**
     /**
      * 拼接字段
      * 拼接字段
      */
      */
-    public static String joinAllFiled() {
+    public static String joinAllFiled(Map<String, Map<String,Object>> mapMap) {
         StringBuilder sb = new StringBuilder();
         StringBuilder sb = new StringBuilder();
-        AccountReportConstants.dicMap.forEach((k, v) -> {
-            sb.append(v.get("filed")).append(",");
-        });
+        mapMap.forEach((k, v) -> sb.append(v.get("filed")).append(","));
         return sb.deleteCharAt(sb.length() - 1).toString();
         return sb.deleteCharAt(sb.length() - 1).toString();
     }
     }
 }
 }

+ 53 - 35
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java

@@ -1,40 +1,40 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.FileInputStream;
 import java.security.MessageDigest;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchAlgorithmException;
 
 
 public class MD5Util {
 public class MD5Util {
+	private static ThreadLocal<MessageDigest> MD5 = new ThreadLocal<MessageDigest>() {
+		@Override
+		protected MessageDigest initialValue() {
+			try {
+				return MessageDigest.getInstance("MD5");
+			} catch (NoSuchAlgorithmException e) {
+				throw new IllegalStateException("No md5 algorithm found");
+			}
+		}
+	};
+	public static String toHexStr(byte[] bytes) {
+		int j = bytes.length;
+		char[] str = new char[j * 2];
+		int k = 0;
+		for (int i = 0; i < j; i++) {
+			byte byte0 = bytes[i];
+			str[k++] = HEX_DIGITS_CHAR[byte0 >>> 4 & 0xf];
+			str[k++] = HEX_DIGITS_CHAR[byte0 & 0xf];
+		}
+		return String.valueOf(str);
+	}
+	public static String getMd5(String url) {
+		MessageDigest md5 = MD5.get();
+		md5.reset();
+		return toHexStr(md5.digest(url.getBytes()));
+	}
 
 
-    private static ThreadLocal<MessageDigest> MD5 = new ThreadLocal<MessageDigest>() {
-        @Override
-        protected MessageDigest initialValue() {
-            try {
-                return MessageDigest.getInstance("MD5");
-            } catch (NoSuchAlgorithmException e) {
-                throw new IllegalStateException("No md5 algorithm found");
-            }
-        }
-    };
-
-    public static String toHexStr(byte[] bytes) {
-        int j = bytes.length;
-        char[] str = new char[j * 2];
-        int k = 0;
-        for (int i = 0; i < j; i++) {
-            byte byte0 = bytes[i];
-            str[k++] = HEX_DIGITS_CHAR[byte0 >>> 4 & 0xf];
-            str[k++] = HEX_DIGITS_CHAR[byte0 & 0xf];
-        }
-        return String.valueOf(str);
-    }
-
-    public static String getMd5(String msg) {
-        MessageDigest md5 = MD5.get();
-        md5.reset();
-        return toHexStr(md5.digest(msg.getBytes()));
-    }
-
-    public static String byteArrayToHexString(byte[] b) {
+	public static String byteArrayToHexString(byte[] b) {
 		StringBuffer resultSb = new StringBuffer();
 		StringBuffer resultSb = new StringBuffer();
 		for (int i = 0; i < b.length; i++){
 		for (int i = 0; i < b.length; i++){
 			resultSb.append(byteToHexString(b[i]));
 			resultSb.append(byteToHexString(b[i]));
@@ -49,10 +49,10 @@ public class MD5Util {
 		}
 		}
 		int d1 = n / 16;
 		int d1 = n / 16;
 		int d2 = n % 16;
 		int d2 = n % 16;
-        return HEX_DIGITS[d1] + HEX_DIGITS[d2];
+		return hexDigits[d1] + hexDigits[d2];
 	}
 	}
 
 
-    public static String md5Encode(String origin, String charsetname) {
+	public static String MD5Encode(String origin, String charsetname) {
 		String resultString = null;
 		String resultString = null;
 		try {
 		try {
 			resultString = new String(origin);
 			resultString = new String(origin);
@@ -66,9 +66,27 @@ public class MD5Util {
 		}
 		}
 		return resultString;
 		return resultString;
 	}
 	}
-
-    private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",
+	public static String md5Encode(String origin, String charsetname) {
+		String resultString = null;
+		try {
+			resultString = new String(origin);
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			if (charsetname == null || "".equals(charsetname)) {
+				resultString = byteArrayToHexString(md.digest(resultString.getBytes()));
+			} else {
+				resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname)));
+			}
+		} catch (Exception exception) {
+		}
+		return resultString;
+	}
+	private static final String[] hexDigits = { "0", "1", "2", "3", "4", "5",
+			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
+	private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
-    private static final char[] HEX_DIGITS_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+	private static final char[] HEX_DIGITS_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 
 
+	public static String getFileMd5(String path) throws Exception {
+		return DigestUtils.md5Hex(new FileInputStream(path));
+	}
 }
 }

+ 208 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MinioUtil.java

@@ -0,0 +1,208 @@
+package org.jeecg.common.util;
+
+import io.minio.MinioClient;
+import io.minio.errors.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.multipart.MultipartFile;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * minio文件上传工具类
+ */
+@Slf4j
+public class MinioUtil {
+    private static String minioUrl;
+    private static String minioName;
+    private static String minioPass;
+    private static String bucketName;
+
+    public static void setMinioUrl(String minioUrl) {
+        MinioUtil.minioUrl = minioUrl;
+    }
+
+    public static void setMinioName(String minioName) {
+        MinioUtil.minioName = minioName;
+    }
+
+    public static void setMinioPass(String minioPass) {
+        MinioUtil.minioPass = minioPass;
+    }
+
+    public static void setBucketName(String bucketName) {
+        MinioUtil.bucketName = bucketName;
+    }
+
+    public static String getMinioUrl() {
+        return minioUrl;
+    }
+
+    public static String getBucketName() {
+        return bucketName;
+    }
+
+    private static MinioClient minioClient = null;
+
+    /**
+     * 上传文件
+     * @param file
+     * @return
+     */
+    public static String upload(MultipartFile file, String bizPath, String customBucket) {
+        String file_url = "";
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(customBucket)){
+            newBucket = customBucket;
+        }
+        try {
+            initMinio(minioUrl, minioName,minioPass);
+            // 检查存储桶是否已经存在
+            if(minioClient.bucketExists(newBucket)) {
+                log.info("Bucket already exists.");
+            } else {
+                // 创建一个名为ota的存储桶
+                minioClient.makeBucket(newBucket);
+                log.info("create a new bucket.");
+            }
+            InputStream stream = file.getInputStream();
+            // 获取文件名
+            String orgName = file.getOriginalFilename();
+            orgName = CommonUtils.getFileName(orgName);
+            String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
+
+            // 使用putObject上传一个本地文件到存储桶中。
+            minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream");
+            stream.close();
+            file_url = minioUrl+newBucket+"/"+objectName;
+        }catch (IOException e){
+            log.error(e.getMessage(), e);
+        } catch (InvalidKeyException e) {
+            log.error(e.getMessage(), e);
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(), e);
+        } catch (NoResponseException e) {
+            log.error(e.getMessage(), e);
+        } catch (XmlPullParserException e) {
+            log.error(e.getMessage(), e);
+        } catch (InvalidArgumentException e) {
+            log.error(e.getMessage(), e);
+        } catch (RegionConflictException e) {
+            log.error(e.getMessage(), e);
+        } catch (InvalidBucketNameException e) {
+            log.error(e.getMessage(), e);
+        } catch (ErrorResponseException e) {
+            log.error(e.getMessage(), e);
+        } catch (InternalException e) {
+            log.error(e.getMessage(), e);
+        } catch (InsufficientDataException e) {
+            log.error(e.getMessage(), e);
+        }
+        return file_url;
+    }
+
+    /**
+     * 文件上传
+     * @param file
+     * @param bizPath
+     * @return
+     */
+    public static String upload(MultipartFile file, String bizPath) {
+        return  upload(file,bizPath,null);
+    }
+
+    /**
+     * 获取文件流
+     * @param bucketName
+     * @param objectName
+     * @return
+     */
+    public static InputStream getMinioFile(String bucketName,String objectName){
+        InputStream inputStream = null;
+        try {
+            initMinio(minioUrl, minioName, minioPass);
+            inputStream = minioClient.getObject(bucketName, objectName);
+        } catch (Exception e) {
+            log.info("文件获取失败" + e.getMessage());
+        }
+        return inputStream;
+    }
+
+    /**
+     * 删除文件
+     * @param bucketName
+     * @param objectName
+     * @throws Exception
+     */
+    public static void removeObject(String bucketName, String objectName) {
+        try {
+            initMinio(minioUrl, minioName,minioPass);
+            minioClient.removeObject(bucketName, objectName);
+        }catch (Exception e){
+            log.info("文件删除失败" + e.getMessage());
+        }
+    }
+
+    /**
+     * 获取文件外链
+     * @param bucketName
+     * @param objectName
+     * @param expires
+     * @return
+     */
+    public static String getObjectURL(String bucketName, String objectName, Integer expires) {
+        initMinio(minioUrl, minioName,minioPass);
+        try{
+            String url = minioClient.presignedGetObject(bucketName, objectName, expires);
+            return URLDecoder.decode(url,"UTF-8");
+        }catch (Exception e){
+            log.info("文件路径获取失败" + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 初始化客户端
+     * @param minioUrl
+     * @param minioName
+     * @param minioPass
+     * @return
+     */
+    private static MinioClient initMinio(String minioUrl, String minioName,String minioPass) {
+        if (minioClient == null) {
+            try {
+                minioClient = new MinioClient(minioUrl, minioName,minioPass);
+            } catch (InvalidEndpointException e) {
+                e.printStackTrace();
+            } catch (InvalidPortException e) {
+                e.printStackTrace();
+            }
+        }
+        return minioClient;
+    }
+
+    /**
+     * 上传文件到minio
+     * @param stream
+     * @param relativePath
+     * @return
+     */
+    public static String upload(InputStream stream,String relativePath) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException, RegionConflictException, InvalidArgumentException {
+        initMinio(minioUrl, minioName,minioPass);
+        if(minioClient.bucketExists(bucketName)) {
+            log.info("Bucket already exists.");
+        } else {
+            // 创建一个名为ota的存储桶
+            minioClient.makeBucket(bucketName);
+            log.info("create a new bucket.");
+        }
+        minioClient.putObject(bucketName,relativePath, stream, stream.available(),"application/octet-stream");
+        stream.close();
+        return minioUrl+bucketName+"/"+relativePath;
+    }
+
+}

+ 17 - 16
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java

@@ -17,8 +17,8 @@ public class PasswordUtil {
 	/**
 	/**
 	 * 定义使用的算法为:PBEWITHMD5andDES算法
 	 * 定义使用的算法为:PBEWITHMD5andDES算法
 	 */
 	 */
-    public static final String ALGORITHM = "PBEWithMD5AndDES";
-    public static final String SALT = "63293188";
+	public static final String ALGORITHM = "PBEWithMD5AndDES";//加密算法
+	public static final String Salt = "63293188";//密钥
 
 
 	/**
 	/**
 	 * 定义迭代次数为1000次
 	 * 定义迭代次数为1000次
@@ -27,7 +27,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
 	 * 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
-	 * 
+	 *
 	 * @return byte[] 盐值
 	 * @return byte[] 盐值
 	 * */
 	 * */
 	public static byte[] getSalt() throws Exception {
 	public static byte[] getSalt() throws Exception {
@@ -39,17 +39,17 @@ public class PasswordUtil {
 
 
 	public static byte[] getStaticSalt() {
 	public static byte[] getStaticSalt() {
 		// 产出盐
 		// 产出盐
-        return SALT.getBytes();
+		return Salt.getBytes();
 	}
 	}
 
 
 	/**
 	/**
 	 * 根据PBE密码生成一把密钥
 	 * 根据PBE密码生成一把密钥
-	 * 
+	 *
 	 * @param password
 	 * @param password
 	 *            生成密钥时所使用的密码
 	 *            生成密钥时所使用的密码
 	 * @return Key PBE算法密钥
 	 * @return Key PBE算法密钥
 	 * */
 	 * */
-    private static Key getPbeKey(String password) {
+	private static Key getPBEKey(String password) {
 		// 实例化使用的算法
 		// 实例化使用的算法
 		SecretKeyFactory keyFactory;
 		SecretKeyFactory keyFactory;
 		SecretKey secretKey = null;
 		SecretKey secretKey = null;
@@ -69,7 +69,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 加密明文字符串
 	 * 加密明文字符串
-	 * 
+	 *
 	 * @param plaintext
 	 * @param plaintext
 	 *            待加密的明文字符串
 	 *            待加密的明文字符串
 	 * @param password
 	 * @param password
@@ -81,15 +81,16 @@ public class PasswordUtil {
 	 */
 	 */
 	public static String encrypt(String plaintext, String password, String salt) {
 	public static String encrypt(String plaintext, String password, String salt) {
 
 
-        Key key = getPbeKey(password);
+		Key key = getPBEKey(password);
 		byte[] encipheredData = null;
 		byte[] encipheredData = null;
 		PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
 		PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
 		try {
 		try {
 			Cipher cipher = Cipher.getInstance(ALGORITHM);
 			Cipher cipher = Cipher.getInstance(ALGORITHM);
 
 
 			cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
 			cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
-
-			encipheredData = cipher.doFinal(plaintext.getBytes());
+			//update-begin-author:sccott date:20180815 for:中文作为用户名时,加密的密码windows和linux会得到不同的结果 gitee/issues/IZUD7
+			encipheredData = cipher.doFinal(plaintext.getBytes("utf-8"));
+			//update-end-author:sccott date:20180815 for:中文作为用户名时,加密的密码windows和linux会得到不同的结果 gitee/issues/IZUD7
 		} catch (Exception e) {
 		} catch (Exception e) {
 		}
 		}
 		return bytesToHexString(encipheredData);
 		return bytesToHexString(encipheredData);
@@ -97,7 +98,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 解密密文字符串
 	 * 解密密文字符串
-	 * 
+	 *
 	 * @param ciphertext
 	 * @param ciphertext
 	 *            待解密的密文字符串
 	 *            待解密的密文字符串
 	 * @param password
 	 * @param password
@@ -109,7 +110,7 @@ public class PasswordUtil {
 	 */
 	 */
 	public static String decrypt(String ciphertext, String password, String salt) {
 	public static String decrypt(String ciphertext, String password, String salt) {
 
 
-        Key key = getPbeKey(password);
+		Key key = getPBEKey(password);
 		byte[] passDec = null;
 		byte[] passDec = null;
 		PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
 		PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
 		try {
 		try {
@@ -128,7 +129,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 将字节数组转换为十六进制字符串
 	 * 将字节数组转换为十六进制字符串
-	 * 
+	 *
 	 * @param src
 	 * @param src
 	 *            字节数组
 	 *            字节数组
 	 * @return
 	 * @return
@@ -151,13 +152,13 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 将十六进制字符串转换为字节数组
 	 * 将十六进制字符串转换为字节数组
-	 * 
+	 *
 	 * @param hexString
 	 * @param hexString
 	 *            十六进制字符串
 	 *            十六进制字符串
 	 * @return
 	 * @return
 	 */
 	 */
 	public static byte[] hexStringToBytes(String hexString) {
 	public static byte[] hexStringToBytes(String hexString) {
-        if (hexString == null || "".equals(hexString)) {
+		if (hexString == null || "".equals(hexString)) {
 			return null;
 			return null;
 		}
 		}
 		hexString = hexString.toUpperCase();
 		hexString = hexString.toUpperCase();
@@ -176,4 +177,4 @@ public class PasswordUtil {
 	}
 	}
 
 
 
 
-}
+}

+ 61 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java

@@ -0,0 +1,61 @@
+package org.jeecg.common.util;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component
+public class PmsUtil {
+
+
+    private static String uploadPath;
+
+    @Value("${jeecg.path.upload}")
+    public void setUploadPath(String uploadPath) {
+        PmsUtil.uploadPath = uploadPath;
+    }
+
+    public static String saveErrorTxtByList(List<String> msg, String name) {
+        Date d = new Date();
+        String saveDir = "logs" + File.separator + DateUtils.yyyyMMdd.get().format(d) + File.separator;
+        String saveFullDir = uploadPath + File.separator + saveDir;
+
+        File saveFile = new File(saveFullDir);
+        if (!saveFile.exists()) {
+            saveFile.mkdirs();
+        }
+        name += DateUtils.yyyymmddhhmmss.get().format(d) + Math.round(Math.random() * 10000);
+        String saveFilePath = saveFullDir + name + ".txt";
+
+        try {
+            //封装目的地
+            BufferedWriter bw = new BufferedWriter(new FileWriter(saveFilePath));
+            //遍历集合
+            for (String s : msg) {
+                //写数据
+                if (s.indexOf("_") > 0) {
+                    String[] arr = s.split("_");
+                    bw.write("第" + arr[0] + "行:" + arr[1]);
+                } else {
+                    bw.write(s);
+                }
+                //bw.newLine();
+                bw.write("\r\n");
+            }
+            //释放资源
+            bw.flush();
+            bw.close();
+        } catch (Exception e) {
+            log.info("excel导入生成错误日志文件异常:" + e.getMessage());
+        }
+        return saveDir + name + ".txt";
+    }
+
+}

+ 42 - 41
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java

@@ -1,16 +1,17 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.jeecg.common.exception.JeecgBootException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 /**
 /**
  * redis 工具类
  * redis 工具类
  * @Author Scott
  * @Author Scott
@@ -26,7 +27,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 指定缓存失效时间
 	 * 指定缓存失效时间
-     *
+	 * 
 	 * @param key  键
 	 * @param key  键
 	 * @param time 时间(秒)
 	 * @param time 时间(秒)
 	 * @return
 	 * @return
@@ -45,7 +46,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 根据key 获取过期时间
 	 * 根据key 获取过期时间
-     *
+	 * 
 	 * @param key 键 不能为null
 	 * @param key 键 不能为null
 	 * @return 时间(秒) 返回0代表为永久有效
 	 * @return 时间(秒) 返回0代表为永久有效
 	 */
 	 */
@@ -55,7 +56,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 判断key是否存在
 	 * 判断key是否存在
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return true 存在 false不存在
 	 * @return true 存在 false不存在
 	 */
 	 */
@@ -70,7 +71,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 删除缓存
 	 * 删除缓存
-     *
+	 * 
 	 * @param key 可以传一个值 或多个
 	 * @param key 可以传一个值 或多个
 	 */
 	 */
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
@@ -87,7 +88,7 @@ public class RedisUtil {
 	// ============================String=============================
 	// ============================String=============================
 	/**
 	/**
 	 * 普通缓存获取
 	 * 普通缓存获取
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return 值
 	 * @return 值
 	 */
 	 */
@@ -97,7 +98,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 普通缓存放入
 	 * 普通缓存放入
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @return true成功 false失败
 	 * @return true成功 false失败
@@ -115,7 +116,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 普通缓存放入并设置时间
 	 * 普通缓存放入并设置时间
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
 	 * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
@@ -137,9 +138,9 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 递增
 	 * 递增
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
-     * @param delta  要增加几(大于0)
+	 * @param by  要增加几(大于0)
 	 * @return
 	 * @return
 	 */
 	 */
 	public long incr(String key, long delta) {
 	public long incr(String key, long delta) {
@@ -151,9 +152,9 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 递减
 	 * 递减
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
-     * @param delta 要减少几(小于0)
+	 * @param by  要减少几(小于0)
 	 * @return
 	 * @return
 	 */
 	 */
 	public long decr(String key, long delta) {
 	public long decr(String key, long delta) {
@@ -166,7 +167,7 @@ public class RedisUtil {
 	// ================================Map=================================
 	// ================================Map=================================
 	/**
 	/**
 	 * HashGet
 	 * HashGet
-     *
+	 * 
 	 * @param key  键 不能为null
 	 * @param key  键 不能为null
 	 * @param item 项 不能为null
 	 * @param item 项 不能为null
 	 * @return 值
 	 * @return 值
@@ -177,7 +178,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 获取hashKey对应的所有键值
 	 * 获取hashKey对应的所有键值
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return 对应的多个键值
 	 * @return 对应的多个键值
 	 */
 	 */
@@ -187,7 +188,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * HashSet
 	 * HashSet
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @param map 对应多个键值
 	 * @param map 对应多个键值
 	 * @return true 成功 false 失败
 	 * @return true 成功 false 失败
@@ -204,7 +205,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * HashSet 并设置时间
 	 * HashSet 并设置时间
-     *
+	 * 
 	 * @param key  键
 	 * @param key  键
 	 * @param map  对应多个键值
 	 * @param map  对应多个键值
 	 * @param time 时间(秒)
 	 * @param time 时间(秒)
@@ -225,7 +226,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 向一张hash表中放入数据,如果不存在将创建
 	 * 向一张hash表中放入数据,如果不存在将创建
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param item  项
 	 * @param item  项
 	 * @param value 值
 	 * @param value 值
@@ -243,7 +244,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 向一张hash表中放入数据,如果不存在将创建
 	 * 向一张hash表中放入数据,如果不存在将创建
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param item  项
 	 * @param item  项
 	 * @param value 值
 	 * @param value 值
@@ -265,7 +266,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 删除hash表中的值
 	 * 删除hash表中的值
-     *
+	 * 
 	 * @param key  键 不能为null
 	 * @param key  键 不能为null
 	 * @param item 项 可以使多个 不能为null
 	 * @param item 项 可以使多个 不能为null
 	 */
 	 */
@@ -275,7 +276,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 判断hash表中是否有该项的值
 	 * 判断hash表中是否有该项的值
-     *
+	 * 
 	 * @param key  键 不能为null
 	 * @param key  键 不能为null
 	 * @param item 项 不能为null
 	 * @param item 项 不能为null
 	 * @return true 存在 false不存在
 	 * @return true 存在 false不存在
@@ -286,7 +287,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * hash递增 如果不存在,就会创建一个 并把新增后的值返回
 	 * hash递增 如果不存在,就会创建一个 并把新增后的值返回
-     *
+	 * 
 	 * @param key  键
 	 * @param key  键
 	 * @param item 项
 	 * @param item 项
 	 * @param by   要增加几(大于0)
 	 * @param by   要增加几(大于0)
@@ -298,7 +299,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * hash递减
 	 * hash递减
-     *
+	 * 
 	 * @param key  键
 	 * @param key  键
 	 * @param item 项
 	 * @param item 项
 	 * @param by   要减少记(小于0)
 	 * @param by   要减少记(小于0)
@@ -311,7 +312,7 @@ public class RedisUtil {
 	// ============================set=============================
 	// ============================set=============================
 	/**
 	/**
 	 * 根据key获取Set中的所有值
 	 * 根据key获取Set中的所有值
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return
 	 * @return
 	 */
 	 */
@@ -326,7 +327,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 根据value从一个set中查询,是否存在
 	 * 根据value从一个set中查询,是否存在
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @return true 存在 false不存在
 	 * @return true 存在 false不存在
@@ -342,7 +343,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将数据放入set缓存
 	 * 将数据放入set缓存
-     *
+	 * 
 	 * @param key    键
 	 * @param key    键
 	 * @param values 值 可以是多个
 	 * @param values 值 可以是多个
 	 * @return 成功个数
 	 * @return 成功个数
@@ -358,7 +359,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将set数据放入缓存
 	 * 将set数据放入缓存
-     *
+	 * 
 	 * @param key    键
 	 * @param key    键
 	 * @param time   时间(秒)
 	 * @param time   时间(秒)
 	 * @param values 值 可以是多个
 	 * @param values 值 可以是多个
@@ -379,7 +380,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 获取set缓存的长度
 	 * 获取set缓存的长度
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return
 	 * @return
 	 */
 	 */
@@ -394,7 +395,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 移除值为value的
 	 * 移除值为value的
-     *
+	 * 
 	 * @param key    键
 	 * @param key    键
 	 * @param values 值 可以是多个
 	 * @param values 值 可以是多个
 	 * @return 移除的个数
 	 * @return 移除的个数
@@ -412,7 +413,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 获取list缓存的内容
 	 * 获取list缓存的内容
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param start 开始
 	 * @param start 开始
 	 * @param end   结束 0 到 -1代表所有值
 	 * @param end   结束 0 到 -1代表所有值
@@ -429,7 +430,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 获取list缓存的长度
 	 * 获取list缓存的长度
-     *
+	 * 
 	 * @param key 键
 	 * @param key 键
 	 * @return
 	 * @return
 	 */
 	 */
@@ -444,7 +445,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 通过索引 获取list中的值
 	 * 通过索引 获取list中的值
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
 	 * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
 	 * @return
 	 * @return
@@ -460,7 +461,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将list放入缓存
 	 * 将list放入缓存
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @param time  时间(秒)
 	 * @param time  时间(秒)
@@ -478,7 +479,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将list放入缓存
 	 * 将list放入缓存
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @param time  时间(秒)
 	 * @param time  时间(秒)
@@ -499,7 +500,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将list放入缓存
 	 * 将list放入缓存
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @param time  时间(秒)
 	 * @param time  时间(秒)
@@ -517,7 +518,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 将list放入缓存
 	 * 将list放入缓存
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param value 值
 	 * @param value 值
 	 * @param time  时间(秒)
 	 * @param time  时间(秒)
@@ -538,7 +539,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 根据索引修改list中的某条数据
 	 * 根据索引修改list中的某条数据
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param index 索引
 	 * @param index 索引
 	 * @param value 值
 	 * @param value 值
@@ -556,7 +557,7 @@ public class RedisUtil {
 
 
 	/**
 	/**
 	 * 移除N个值为value
 	 * 移除N个值为value
-     *
+	 * 
 	 * @param key   键
 	 * @param key   键
 	 * @param count 移除多少个
 	 * @param count 移除多少个
 	 * @param value 值
 	 * @param value 值

+ 238 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ReflectHelper.java

@@ -0,0 +1,238 @@
+package org.jeecg.common.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+/**
+ * @author 张代浩
+ * @desc 通过反射来动态调用get 和 set 方法
+ */
+@Slf4j
+public class ReflectHelper {
+
+    private Class cls;
+
+    /**
+     * 传过来的对象
+     */
+    private Object obj;
+
+    /**
+     * 存放get方法
+     */
+    private Hashtable<String, Method> getMethods = null;
+    /**
+     * 存放set方法
+     */
+    private Hashtable<String, Method> setMethods = null;
+
+    /**
+     * 定义构造方法 -- 一般来说是个pojo
+     *
+     * @param o 目标对象
+     */
+    public ReflectHelper(Object o) {
+        obj = o;
+        initMethods();
+    }
+
+    /**
+     * @desc 初始化
+     */
+    public void initMethods() {
+        getMethods = new Hashtable<String, Method>();
+        setMethods = new Hashtable<String, Method>();
+        cls = obj.getClass();
+        Method[] methods = cls.getMethods();
+        // 定义正则表达式,从方法中过滤出getter / setter 函数.
+        String gs = "get(\\w+)";
+        Pattern getM = Pattern.compile(gs);
+        String ss = "set(\\w+)";
+        Pattern setM = Pattern.compile(ss);
+        // 把方法中的"set" 或者 "get" 去掉
+        String rapl = "$1";
+        String param;
+        for (int i = 0; i < methods.length; ++i) {
+            Method m = methods[i];
+            String methodName = m.getName();
+            if (Pattern.matches(gs, methodName)) {
+                param = getM.matcher(methodName).replaceAll(rapl).toLowerCase();
+                getMethods.put(param, m);
+            } else if (Pattern.matches(ss, methodName)) {
+                param = setM.matcher(methodName).replaceAll(rapl).toLowerCase();
+                setMethods.put(param, m);
+            } else {
+                // logger.info(methodName + " 不是getter,setter方法!");
+            }
+        }
+    }
+
+    /**
+     * @desc 调用set方法
+     */
+    public boolean setMethodValue(String property, Object object) {
+        Method m = setMethods.get(property.toLowerCase());
+        if (m != null) {
+            try {
+                // 调用目标类的setter函数
+                m.invoke(obj, object);
+                return true;
+            } catch (Exception ex) {
+                log.info("invoke getter on " + property + " error: " + ex.toString());
+                return false;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @desc 调用set方法
+     */
+    public Object getMethodValue(String property) {
+        Object value = null;
+        Method m = getMethods.get(property.toLowerCase());
+        if (m != null) {
+            try {
+                /*
+                 * 调用obj类的setter函数
+                 */
+                value = m.invoke(obj, new Object[]{});
+
+            } catch (Exception ex) {
+                log.info("invoke getter on " + property + " error: " + ex.toString());
+            }
+        }
+        return value;
+    }
+
+    /**
+     * 把map中的内容全部注入到obj中
+     *
+     * @param data
+     * @return
+     */
+    public Object setAll(Map<String, Object> data) {
+        if (data == null || data.keySet().size() <= 0) {
+            return null;
+        }
+        for (Entry<String, Object> entry : data.entrySet()) {
+            this.setMethodValue(entry.getKey(), entry.getValue());
+        }
+        return obj;
+    }
+
+    /**
+     * 把map中的内容全部注入到obj中
+     *
+     * @param o
+     * @param data
+     * @return
+     */
+    public static Object setAll(Object o, Map<String, Object> data) {
+        ReflectHelper reflectHelper = new ReflectHelper(o);
+        reflectHelper.setAll(data);
+        return o;
+    }
+
+    /**
+     * 把map中的内容全部注入到新实例中
+     *
+     * @param clazz
+     * @param data
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T setAll(Class<T> clazz, Map<String, Object> data) {
+        T o = null;
+        try {
+            o = clazz.newInstance();
+        } catch (Exception e) {
+            e.printStackTrace();
+            o = null;
+            return o;
+        }
+        return (T) setAll(o, data);
+    }
+
+    /**
+     * 根据传入的class将mapList转换为实体类list
+     *
+     * @param mapist
+     * @param clazz
+     * @return
+     */
+    public static <T> List<T> transList2Entrys(List<Map<String, Object>> mapist, Class<T> clazz) {
+        List<T> list = new ArrayList<T>();
+        if (mapist != null && mapist.size() > 0) {
+            for (Map<String, Object> data : mapist) {
+                list.add(ReflectHelper.setAll(clazz, data));
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 根据属性名获取属性值
+     */
+    public static Object getFieldValueByName(String fieldName, Object o) {
+        try {
+            String firstLetter = fieldName.substring(0, 1).toUpperCase();
+            String getter = "get" + firstLetter + fieldName.substring(1);
+            Method method = o.getClass().getMethod(getter, new Class[]{});
+            Object value = method.invoke(o, new Object[]{});
+            return value;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 获取属性名数组
+     */
+    public static String[] getFiledName(Object o) {
+        Field[] fields = o.getClass().getDeclaredFields();
+        String[] fieldNames = new String[fields.length];
+        for (int i = 0; i < fields.length; i++) {
+            //log.info(fields[i].getType());
+            fieldNames[i] = fields[i].getName();
+        }
+        return fieldNames;
+    }
+
+    /**
+     * 获取属性类型(type),属性名(name),属性值(value)的map组成的list
+     */
+    public static List<Map> getFiledsInfo(Object o) {
+        Field[] fields = o.getClass().getDeclaredFields();
+        String[] fieldNames = new String[fields.length];
+        List<Map> list = new ArrayList<Map>();
+        Map<String, Object> infoMap = null;
+        for (int i = 0; i < fields.length; i++) {
+            infoMap = new HashMap<String, Object>();
+            infoMap.put("type", fields[i].getType().toString());
+            infoMap.put("name", fields[i].getName());
+            infoMap.put("value", getFieldValueByName(fields[i].getName(), o));
+            list.add(infoMap);
+        }
+        return list;
+    }
+
+    /**
+     * 获取对象的所有属性值,返回一个对象数组
+     */
+    public static Object[] getFiledValues(Object o) {
+        String[] fieldNames = getFiledName(o);
+        Object[] value = new Object[fieldNames.length];
+        for (int i = 0; i < fieldNames.length; i++) {
+            value[i] = getFieldValueByName(fieldNames[i], o);
+        }
+        return value;
+    }
+
+}

+ 121 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestDesformUtil.java

@@ -0,0 +1,121 @@
+package org.jeecg.common.util;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 通过 RESTful 风格的接口操纵 desform 里的数据
+ *
+ * @author sunjianlei
+ */
+public class RestDesformUtil {
+
+    private static String domain = null;
+    private static String path = null;
+
+    static {
+        domain = SpringContextUtils.getDomain();
+        path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
+    }
+
+    /**
+     * 查询数据
+     *
+     * @param desformCode
+     * @param dataId
+     * @param token
+     * @return
+     */
+    public static Result queryOne(String desformCode, String dataId, String token) {
+        String url = getBaseUrl(desformCode, dataId).toString();
+        HttpHeaders headers = getHeaders(token);
+        ResponseEntity<JSONObject> result = RestUtil.request(url, HttpMethod.GET, headers, null, null, JSONObject.class);
+        return packageReturn(result);
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param desformCode
+     * @param formData
+     * @param token
+     * @return
+     */
+    public static Result addOne(String desformCode, JSONObject formData, String token) {
+        return addOrEditOne(desformCode, formData, token, HttpMethod.POST);
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param desformCode
+     * @param formData
+     * @param token
+     * @return
+     */
+    public static Result editOne(String desformCode, JSONObject formData, String token) {
+        return addOrEditOne(desformCode, formData, token, HttpMethod.PUT);
+    }
+
+    private static Result addOrEditOne(String desformCode, JSONObject formData, String token, HttpMethod method) {
+        String url = getBaseUrl(desformCode).toString();
+        HttpHeaders headers = getHeaders(token);
+        ResponseEntity<JSONObject> result = RestUtil.request(url, method, headers, null, formData, JSONObject.class);
+        return packageReturn(result);
+    }
+
+    /**
+     * 删除数据
+     *
+     * @param desformCode
+     * @param dataId
+     * @param token
+     * @return
+     */
+    public static Result removeOne(String desformCode, String dataId, String token) {
+        String url = getBaseUrl(desformCode, dataId).toString();
+        HttpHeaders headers = getHeaders(token);
+        ResponseEntity<JSONObject> result = RestUtil.request(url, HttpMethod.DELETE, headers, null, null, JSONObject.class);
+        return packageReturn(result);
+    }
+
+    private static Result packageReturn(ResponseEntity<JSONObject> result) {
+        if (result.getBody() != null) {
+            return result.getBody().toJavaObject(Result.class);
+        }
+        return Result.error("操作失败");
+    }
+
+    private static StringBuilder getBaseUrl() {
+        StringBuilder builder = new StringBuilder(domain).append(path);
+        builder.append("/desform/api");
+        return builder;
+    }
+
+    private static StringBuilder getBaseUrl(String desformCode, String dataId) {
+        StringBuilder builder = getBaseUrl();
+        builder.append("/").append(desformCode);
+        if (dataId != null) {
+            builder.append("/").append(dataId);
+        }
+        return builder;
+    }
+
+    private static StringBuilder getBaseUrl(String desformCode) {
+        return getBaseUrl(desformCode, null);
+    }
+
+    private static HttpHeaders getHeaders(String token) {
+        HttpHeaders headers = new HttpHeaders();
+        String mediaType = MediaType.APPLICATION_JSON_UTF8_VALUE;
+        headers.setContentType(MediaType.parseMediaType(mediaType));
+        headers.set("Accept", mediaType);
+        headers.set("X-Access-Token", token);
+        return headers;
+    }
+
+}

+ 247 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java

@@ -0,0 +1,247 @@
+package org.jeecg.common.util;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.http.*;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 调用 Restful 接口 Util
+ *
+ * @author sunjianlei
+ */
+public class RestUtil {
+
+    private static String domain = null;
+
+    public static String getDomain() {
+        if (domain == null) {
+            domain = SpringContextUtils.getDomain();
+        }
+        return domain;
+    }
+
+    public static String path = null;
+
+    public static String getPath() {
+        if (path == null) {
+            path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
+        }
+        return path;
+    }
+
+    public static String getBaseUrl() {
+        return getDomain() + getPath();
+    }
+
+    /**
+     * RestAPI 调用器
+     */
+    private final static RestTemplate RT;
+
+    static {
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setConnectTimeout(3000);
+        requestFactory.setReadTimeout(3000);
+        RT = new RestTemplate(requestFactory);
+        // 解决乱码问题
+        RT.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+    }
+
+    public static RestTemplate getRestTemplate() {
+        return RT;
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url) {
+        return getNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url, JSONObject variables) {
+        return getNative(url, variables, null).getBody();
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url, JSONObject variables, JSONObject params) {
+        return getNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 get 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> getNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.GET, variables, params);
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url) {
+        return postNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONObject params) {
+        return postNative(url, null, params).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONObject variables, JSONObject params) {
+        return postNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 POST 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> postNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.POST, variables, params);
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url) {
+        return putNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url, JSONObject params) {
+        return putNative(url, null, params).getBody();
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url, JSONObject variables, JSONObject params) {
+        return putNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 put 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> putNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.PUT, variables, params);
+    }
+
+    /**
+     * 发送 delete 请求
+     */
+    public static JSONObject delete(String url) {
+        return deleteNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 delete 请求
+     */
+    public static JSONObject delete(String url, JSONObject variables, JSONObject params) {
+        return deleteNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 delete 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> deleteNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.DELETE, null, variables, params, JSONObject.class);
+    }
+
+    /**
+     * 发送请求
+     */
+    public static ResponseEntity<JSONObject> request(String url, HttpMethod method, JSONObject variables, JSONObject params) {
+        return request(url, method, getHeaderApplicationJson(), variables, params, JSONObject.class);
+    }
+
+    /**
+     * 发送请求
+     *
+     * @param url          请求地址
+     * @param method       请求方式
+     * @param headers      请求头  可空
+     * @param variables    请求url参数 可空
+     * @param params       请求body参数 可空
+     * @param responseType 返回类型
+     * @return ResponseEntity<responseType>
+     */
+    public static <T> ResponseEntity<T> request(String url, HttpMethod method, HttpHeaders headers, JSONObject variables, JSONObject params, Class<T> responseType) {
+        if (StringUtils.isEmpty(url)) {
+            throw new RuntimeException("url 不能为空");
+        }
+        if (method == null) {
+            throw new RuntimeException("method 不能为空");
+        }
+        if (headers == null) {
+            headers = new HttpHeaders();
+        }
+        // 请求体
+        String body = "";
+        if (params != null) {
+            body = params.toJSONString();
+        }
+        // 拼接 url 参数
+        if (variables != null) {
+            url += ("?" + asUrlVariables(variables));
+        }
+        // 发送请求
+        HttpEntity<String> request = new HttpEntity<>(body, headers);
+        return RT.exchange(url, method, request, responseType);
+    }
+
+    /**
+     * 获取JSON请求头
+     */
+    private static HttpHeaders getHeaderApplicationJson() {
+        return getHeader(MediaType.APPLICATION_JSON_UTF8_VALUE);
+    }
+
+    /**
+     * 获取请求头
+     */
+    private static HttpHeaders getHeader(String mediaType) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.parseMediaType(mediaType));
+        headers.add("Accept", mediaType);
+        return headers;
+    }
+
+    /**
+     * 将 JSONObject 转为 a=1&b=2&c=3...&n=n 的形式
+     */
+    public static String asUrlVariables(JSONObject variables) {
+        Map<String, Object> source = variables.getInnerMap();
+        Iterator<String> it = source.keySet().iterator();
+        StringBuilder urlVariables = new StringBuilder();
+        while (it.hasNext()) {
+            String key = it.next();
+            String value = "";
+            Object object = source.get(key);
+            if (object != null) {
+                if (!StringUtils.isEmpty(object.toString())) {
+                    value = object.toString();
+                }
+            }
+            urlVariables.append("&").append(key).append("=").append(value);
+        }
+        // 去掉第一个&
+        return urlVariables.substring(1);
+    }
+
+}

+ 63 - 67
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java

@@ -1,5 +1,7 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.springframework.beans.BeansException;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ApplicationContextAware;
@@ -7,82 +9,76 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
 @Component
 @Component
 public class SpringContextUtils implements ApplicationContextAware {
 public class SpringContextUtils implements ApplicationContextAware {
 
 
-    /**
-     * 上下文对象实例
-     */
-    private static ApplicationContext applicationContext;
+	/**
+	 * 上下文对象实例
+	 */
+	private static ApplicationContext applicationContext;
 
 
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        SpringContextUtils.applicationContext = applicationContext;
-    }
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+		SpringContextUtils.applicationContext = applicationContext;
+	}
 
 
-    /**
-     * 获取applicationContext
-     *
-     * @return
-     */
-    public static ApplicationContext getApplicationContext() {
-        return applicationContext;
-    }
+	/**
+	 * 获取applicationContext
+	 *
+	 * @return
+	 */
+	public static ApplicationContext getApplicationContext() {
+		return applicationContext;
+	}
 
 
-    /**
-     * 获取HttpServletRequest
-     */
-    public static HttpServletRequest getHttpServletRequest() {
-        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
-    }
+	/**
+	  * 获取HttpServletRequest
+	 */
+	public static HttpServletRequest getHttpServletRequest() {
+		return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+	}
 
 
-    public static String getDomain(){
-        HttpServletRequest request = getHttpServletRequest();
-        StringBuffer url = request.getRequestURL();
-        return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
-    }
+	public static String getDomain(){
+		HttpServletRequest request = getHttpServletRequest();
+		StringBuffer url = request.getRequestURL();
+		return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
+	}
 
 
-    public static String getOrigin(){
-        HttpServletRequest request = getHttpServletRequest();
-        return request.getHeader("Origin");
-    }
+	public static String getOrigin(){
+		HttpServletRequest request = getHttpServletRequest();
+		return request.getHeader("Origin");
+	}
 
 
-    /**
-     * 通过name获取 Bean.
-     *
-     * @param name
-     * @return
-     */
-    public static Object getBean(String name) {
-        return getApplicationContext().getBean(name);
-    }
+	/**
+	 * 通过name获取 Bean.
+	 *
+	 * @param name
+	 * @return
+	 */
+	public static Object getBean(String name) {
+		return getApplicationContext().getBean(name);
+	}
 
 
-    /**
-     * 通过class获取Bean.
-     *
-     * @param clazz
-     * @param       <T>
-     * @return
-     */
-    public static <T> T getBean(Class<T> clazz) {
-        return getApplicationContext().getBean(clazz);
-    }
+	/**
+	 * 通过class获取Bean.
+	 *
+	 * @param clazz
+	 * @param       <T>
+	 * @return
+	 */
+	public static <T> T getBean(Class<T> clazz) {
+		return getApplicationContext().getBean(clazz);
+	}
 
 
-    /**
-     * 通过name,以及Clazz返回指定的Bean
-     *
-     * @param name
-     * @param clazz
-     * @param       <T>
-     * @return
-     */
-    public static <T> T getBean(String name, Class<T> clazz) {
-        return getApplicationContext().getBean(name, clazz);
-    }
+	/**
+	 * 通过name,以及Clazz返回指定的Bean
+	 *
+	 * @param name
+	 * @param clazz
+	 * @param       <T>
+	 * @return
+	 */
+	public static <T> T getBean(String name, Class<T> clazz) {
+		return getApplicationContext().getBean(name, clazz);
+	}
 }
 }

+ 69 - 13
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java

@@ -1,6 +1,9 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
+import cn.hutool.crypto.SecureUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.exception.JeecgBootException;
+import javax.servlet.http.HttpServletRequest;
 
 
 /**
 /**
  * sql注入处理工具类
  * sql注入处理工具类
@@ -9,7 +12,32 @@ import lombok.extern.slf4j.Slf4j;
  */
  */
 @Slf4j
 @Slf4j
 public class SqlInjectionUtil {
 public class SqlInjectionUtil {
-    final static String XSS_STR = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
+	/**
+	 * sign 用于表字典加签的盐值【SQL漏洞】
+	 * (上线修改值 20200501,同步修改前端的盐值)
+	 */
+	private final static String TABLE_DICT_SIGN_SALT = "20200501";
+	private final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
+
+	/*
+	* 针对表字典进行额外的sign签名校验(增加安全机制)
+	* @param dictCode:
+	* @param sign:
+	* @param request:
+	* @Return: void
+	*/
+	public static void checkDictTableSign(String dictCode, String sign, HttpServletRequest request) {
+		//表字典SQL注入漏洞,签名校验
+		String accessToken = request.getHeader("X-Access-Token");
+		String signStr = dictCode + SqlInjectionUtil.TABLE_DICT_SIGN_SALT + accessToken;
+		String javaSign = SecureUtil.md5(signStr);
+		if (!javaSign.equals(sign)) {
+			log.error("表字典,SQL注入漏洞签名校验失败 :" + sign + "!=" + javaSign+ ",dictCode=" + dictCode);
+			throw new JeecgBootException("无权限访问!");
+		}
+		log.info(" 表字典,SQL注入漏洞签名校验成功!sign=" + sign + ",dictCode=" + dictCode);
+	}
+
 
 
 	/**
 	/**
 	 * sql注入过滤处理,遇到注入关键字抛异常
 	 * sql注入过滤处理,遇到注入关键字抛异常
@@ -21,11 +49,12 @@ public class SqlInjectionUtil {
 		if (value == null || "".equals(value)) {
 		if (value == null || "".equals(value)) {
 			return;
 			return;
 		}
 		}
-        // 统一转为小写
-        value = value.toLowerCase();
-        String[] xssArr = XSS_STR.split("\\|");
+		// 统一转为小写
+		value = value.toLowerCase();
+		String[] xssArr = xssStr.split("\\|");
 		for (int i = 0; i < xssArr.length; i++) {
 		for (int i = 0; i < xssArr.length; i++) {
 			if (value.indexOf(xssArr[i]) > -1) {
 			if (value.indexOf(xssArr[i]) > -1) {
+				log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
 				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 				throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 				throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 			}
 			}
@@ -35,20 +64,21 @@ public class SqlInjectionUtil {
 
 
 	/**
 	/**
 	 * sql注入过滤处理,遇到注入关键字抛异常
 	 * sql注入过滤处理,遇到注入关键字抛异常
-	 *
-     * @param values
+	 * 
+	 * @param values
 	 * @return
 	 * @return
 	 */
 	 */
 	public static void filterContent(String[] values) {
 	public static void filterContent(String[] values) {
-        String[] xssArr = XSS_STR.split("\\|");
+		String[] xssArr = xssStr.split("\\|");
 		for (String value : values) {
 		for (String value : values) {
 			if (value == null || "".equals(value)) {
 			if (value == null || "".equals(value)) {
 				return;
 				return;
 			}
 			}
-            // 统一转为小写
-            value = value.toLowerCase();
+			// 统一转为小写
+			value = value.toLowerCase();
 			for (int i = 0; i < xssArr.length; i++) {
 			for (int i = 0; i < xssArr.length; i++) {
 				if (value.indexOf(xssArr[i]) > -1) {
 				if (value.indexOf(xssArr[i]) > -1) {
+					log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
 					log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 					log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 					throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 					throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 				}
 				}
@@ -64,15 +94,41 @@ public class SqlInjectionUtil {
 	 */
 	 */
 	@Deprecated
 	@Deprecated
 	public static void specialFilterContent(String value) {
 	public static void specialFilterContent(String value) {
-		String specialXssStr = "exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|+|,";
+		String specialXssStr = " exec | insert | select | delete | update | drop | count | chr | mid | master | truncate | char | declare |;|+|";
 		String[] xssArr = specialXssStr.split("\\|");
 		String[] xssArr = specialXssStr.split("\\|");
 		if (value == null || "".equals(value)) {
 		if (value == null || "".equals(value)) {
 			return;
 			return;
 		}
 		}
-        // 统一转为小写
-        value = value.toLowerCase();
+		// 统一转为小写
+		value = value.toLowerCase();
 		for (int i = 0; i < xssArr.length; i++) {
 		for (int i = 0; i < xssArr.length; i++) {
-			if (value.indexOf(xssArr[i]) > -1) {
+			if (value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) {
+				log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
+				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
+				throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
+			}
+		}
+		return;
+	}
+
+
+    /**
+     * @特殊方法(不通用) 仅用于Online报表SQL解析,注入过滤
+     * @param value
+     * @return
+     */
+	@Deprecated
+	public static void specialFilterContentForOnlineReport(String value) {
+		String specialXssStr = " exec | insert | delete | update | drop | chr | mid | master | truncate | char | declare |";
+		String[] xssArr = specialXssStr.split("\\|");
+		if (value == null || "".equals(value)) {
+			return;
+		}
+		// 统一转为小写
+		value = value.toLowerCase();
+		for (int i = 0; i < xssArr.length; i++) {
+			if (value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) {
+				log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
 				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
 				throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 				throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
 			}
 			}

+ 70 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java

@@ -0,0 +1,70 @@
+package org.jeecg.common.util;
+
+/**
+ * 系统公告自定义跳转方式
+ */
+public enum SysAnnmentTypeEnum {
+    /**
+     * 邮件跳转组件
+     */
+    EMAIL("email", "component", "modules/eoa/email/modals/EoaEmailInForm"),
+    /**
+     * 工作流跳转链接我的办公
+     */
+    BPM("bpm", "url", "/bpm/task/MyTaskList");
+
+    /**
+     * 业务类型(email:邮件 bpm:流程)
+     */
+    private String type;
+    /**
+     * 打开方式 组件:component 路由:url
+     */
+    private String openType;
+    /**
+     * 组件/路由 地址
+     */
+    private String openPage;
+
+    SysAnnmentTypeEnum(String type, String openType, String openPage) {
+        this.type = type;
+        this.openType = openType;
+        this.openPage = openPage;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getOpenType() {
+        return openType;
+    }
+
+    public void setOpenType(String openType) {
+        this.openType = openType;
+    }
+
+    public String getOpenPage() {
+        return openPage;
+    }
+
+    public void setOpenPage(String openPage) {
+        this.openPage = openPage;
+    }
+
+    public static SysAnnmentTypeEnum getByType(String type) {
+        if (oConvertUtils.isEmpty(type)) {
+            return null;
+        }
+        for (SysAnnmentTypeEnum val : values()) {
+            if (val.getType().equals(type)) {
+                return val;
+            }
+        }
+        return null;
+    }
+}

+ 4 - 4
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/UUIDGenerator.java

@@ -18,8 +18,8 @@ public class UUIDGenerator {
 	 */
 	 */
 
 
 	public static String generate() {
 	public static String generate() {
-        return new StringBuilder(32).append(format(getIp())).append(
-                format(getJvm())).append(format(getHiTime())).append(
+		return new StringBuilder(32).append(format(getIP())).append(
+				format(getJVM())).append(format(getHiTime())).append(
 				format(getLoTime())).append(format(getCount())).toString();
 				format(getLoTime())).append(format(getCount())).toString();
 		
 		
 	}
 	}
@@ -53,7 +53,7 @@ public class UUIDGenerator {
 		return buf.toString();
 		return buf.toString();
 	}
 	}
 
 
-    private final static int getJvm() {
+	private final static int getJVM() {
 		return JVM;
 		return JVM;
 	}
 	}
 
 
@@ -69,7 +69,7 @@ public class UUIDGenerator {
 	/**
 	/**
 	 * Unique in a local network
 	 * Unique in a local network
 	 */
 	 */
-    private final static int getIp() {
+	private final static int getIP() {
 		return IP;
 		return IP;
 	}
 	}
 
 

+ 161 - 152
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java

@@ -6,159 +6,168 @@ import io.netty.util.internal.StringUtil;
  * 流水号生成规则(按默认规则递增,数字从1-99开始递增,数字到99,递增字母;位数不够增加位数)
  * 流水号生成规则(按默认规则递增,数字从1-99开始递增,数字到99,递增字母;位数不够增加位数)
  * A001
  * A001
  * A001A002
  * A001A002
- *
  * @Author zhangdaihao
  * @Author zhangdaihao
+ *
  */
  */
 public class YouBianCodeUtil {
 public class YouBianCodeUtil {
-    /**
-     * 代表数字位数
-     * 数字位数(默认生成3位的数字)
-     */
-    private static final int NUM_LENGTH = 2;
-
-    public static final int ZHANWEI_LENGTH = 1 + NUM_LENGTH;
-
-    /**
-     * 根据前一个code,获取同级下一个code
-     * 例如:当前最大code为D01A04,下一个code为:D01A05
-     *
-     * @param code
-     * @return
-     */
-    public static synchronized String getNextYouBianCode(String code) {
-        String newcode = "";
-        if (code == null || code == "") {
-            String zimu = "A";
-            String num = getStrNum(1);
-            newcode = zimu + num;
-        } else {
-            String beforeCode = code.substring(0, code.length() - 1 - NUM_LENGTH);
-            String afterCode = code.substring(code.length() - 1 - NUM_LENGTH, code.length());
-            char afterCodeZimu = afterCode.substring(0, 1).charAt(0);
-            Integer afterCodeNum = Integer.parseInt(afterCode.substring(1));
-
-            String nextNum = "";
-            char nextZimu = 'A';
-            // 先判断数字等于999*,则计数从1重新开始,递增
-            if (afterCodeNum == getMaxNumByLength(NUM_LENGTH)) {
-                nextNum = getNextStrNum(0);
-            } else {
-                nextNum = getNextStrNum(afterCodeNum);
-            }
-            // 先判断数字等于999*,则字母从A重新开始,递增
-            if (afterCodeNum == getMaxNumByLength(NUM_LENGTH)) {
-                nextZimu = getNextZiMu(afterCodeZimu);
-            } else {
-                nextZimu = afterCodeZimu;
-            }
-
-            // 例如Z99,下一个code就是Z99A01
-            if ('Z' == afterCodeZimu && getMaxNumByLength(NUM_LENGTH) == afterCodeZimu) {
-                newcode = code + (nextZimu + nextNum);
-            } else {
-                newcode = beforeCode + (nextZimu + nextNum);
-            }
-        }
-        return newcode;
-
-    }
-
-    /**
-     * 根据父亲code,获取下级的下一个code
-     * <p>
-     * 例如:父亲CODE:A01
-     * 当前CODE:A01B03
-     * 获取的code:A01B04
-     *
-     * @param parentCode 上级code
-     * @param localCode  同级code
-     * @return
-     */
-    public static synchronized String getSubYouBianCode(String parentCode, String localCode) {
-        if (localCode != null && localCode != "") {
-            return getNextYouBianCode(localCode);
-        } else {
-            parentCode = parentCode + "A" + getNextStrNum(0);
-        }
-        return parentCode;
-    }
-
-
-    /**
-     * 将数字前面位数补零
-     *
-     * @param num
-     * @return
-     */
-    private static String getNextStrNum(int num) {
-        return getStrNum(getNextNum(num));
-    }
-
-    /**
-     * 将数字前面位数补零
-     *
-     * @param num
-     * @return
-     */
-    private static String getStrNum(int num) {
-        String s = String.format("%0" + NUM_LENGTH + "d", num);
-        return s;
-    }
-
-    /**
-     * 递增获取下个数字
-     *
-     * @param num
-     * @return
-     */
-    private static int getNextNum(int num) {
-        num++;
-        return num;
-    }
-
-    /**
-     * 递增获取下个字母
-     *
-     * @param zimu
-     * @return
-     */
-    private static char getNextZiMu(char zimu) {
-        if (zimu == 'Z') {
-            return 'A';
-        }
-        zimu++;
-        return zimu;
-    }
-
-    /**
-     * 根据数字位数获取最大值
-     *
-     * @param length
-     * @return
-     */
-    private static int getMaxNumByLength(int length) {
-        if (length == 0) {
-            return 0;
-        }
-        String maxNum = "";
-        for (int i = 0; i < length; i++) {
-            maxNum = maxNum + "9";
-        }
-        return Integer.parseInt(maxNum);
-    }
-
-    public static String[] cutYouBianCode(String code) {
-        if (code == null || StringUtil.isNullOrEmpty(code)) {
-            return null;
-        } else {
-            //获取标准长度为numLength+1,截取的数量为code.length/numLength+1
-            int c = code.length() / (NUM_LENGTH + 1);
-            String[] cutcode = new String[c];
-            for (int i = 0; i < c; i++) {
-                cutcode[i] = code.substring(0, (i + 1) * (NUM_LENGTH + 1));
-            }
-            return cutcode;
-        }
-
-    }
+
+	// 数字位数(默认生成3位的数字)
+
+	private static final int numLength = 2;//代表数字位数
+
+	public static final int zhanweiLength = 1+numLength;
+
+	/**
+	 * 根据前一个code,获取同级下一个code
+	 * 例如:当前最大code为D01A04,下一个code为:D01A05
+	 *
+	 * @param code
+	 * @return
+	 */
+	public static synchronized String getNextYouBianCode(String code) {
+		String newcode = "";
+		if (code == null || code =="") {
+			String zimu = "A";
+			String num = getStrNum(1);
+			newcode = zimu + num;
+		} else {
+			String before_code = code.substring(0, code.length() - 1- numLength);
+			String after_code = code.substring(code.length() - 1 - numLength,code.length());
+			char after_code_zimu = after_code.substring(0, 1).charAt(0);
+			Integer after_code_num = Integer.parseInt(after_code.substring(1));
+//			org.jeecgframework.core.util.LogUtil.info(after_code);
+//			org.jeecgframework.core.util.LogUtil.info(after_code_zimu);
+//			org.jeecgframework.core.util.LogUtil.info(after_code_num);
+
+			String nextNum = "";
+			char nextZimu = 'A';
+			// 先判断数字等于999*,则计数从1重新开始,递增
+			if (after_code_num == getMaxNumByLength(numLength)) {
+				nextNum = getNextStrNum(0);
+			} else {
+				nextNum = getNextStrNum(after_code_num);
+			}
+			// 先判断数字等于999*,则字母从A重新开始,递增
+			if(after_code_num == getMaxNumByLength(numLength)) {
+				nextZimu = getNextZiMu(after_code_zimu);
+			}else{
+				nextZimu = after_code_zimu;
+			}
+
+			// 例如Z99,下一个code就是Z99A01
+			if ('Z' == after_code_zimu && getMaxNumByLength(numLength) == after_code_num) {
+				newcode = code + (nextZimu + nextNum);
+			} else {
+				newcode = before_code + (nextZimu + nextNum);
+			}
+		}
+		return newcode;
+
+	}
+
+	/**
+	 * 根据父亲code,获取下级的下一个code
+	 *
+	 * 例如:父亲CODE:A01
+	 *       当前CODE:A01B03
+	 *       获取的code:A01B04
+	 *
+	 * @param parentCode   上级code
+	 * @param localCode    同级code
+	 * @return
+	 */
+	public static synchronized String getSubYouBianCode(String parentCode,String localCode) {
+		if(localCode!=null && localCode!=""){
+
+//			return parentCode + getNextYouBianCode(localCode);
+			return getNextYouBianCode(localCode);
+
+		}else{
+			parentCode = parentCode + "A"+ getNextStrNum(0);
+		}
+		return parentCode;
+	}
+
+
+
+	/**
+	 * 将数字前面位数补零
+	 *
+	 * @param num
+	 * @return
+	 */
+	private static String getNextStrNum(int num) {
+		return getStrNum(getNextNum(num));
+	}
+
+	/**
+	 * 将数字前面位数补零
+	 *
+	 * @param num
+	 * @return
+	 */
+	private static String getStrNum(int num) {
+		String s = String.format("%0" + numLength + "d", num);
+		return s;
+	}
+
+	/**
+	 * 递增获取下个数字
+	 *
+	 * @param num
+	 * @return
+	 */
+	private static int getNextNum(int num) {
+		num++;
+		return num;
+	}
+
+	/**
+	 * 递增获取下个字母
+	 *
+	 * @param num
+	 * @return
+	 */
+	private static char getNextZiMu(char zimu) {
+		if (zimu == 'Z') {
+			return 'A';
+		}
+		zimu++;
+		return zimu;
+	}
+
+	/**
+	 * 根据数字位数获取最大值
+	 * @param length
+	 * @return
+	 */
+	private static int getMaxNumByLength(int length){
+		if(length==0){
+			return 0;
+		}
+		String max_num = "";
+		for (int i=0;i<length;i++){
+			max_num = max_num + "9";
+		}
+		return Integer.parseInt(max_num);
+	}
+	public static String[] cutYouBianCode(String code){
+		if(code==null || StringUtil.isNullOrEmpty(code)){
+			return null;
+		}else{
+			//获取标准长度为numLength+1,截取的数量为code.length/numLength+1
+			int c = code.length()/(numLength+1);
+			String[] cutcode = new String[c];
+			for(int i =0 ; i <c;i++){
+				cutcode[i] = code.substring(0,(i+1)*(numLength+1));
+			}
+			return cutcode;
+		}
+
+	}
+	public static void main(String[] args) {
+		// org.jeecgframework.core.util.LogUtil.info(getNextZiMu('C'));
+		// org.jeecgframework.core.util.LogUtil.info(getNextNum(8));
+	    // org.jeecgframework.core.util.LogUtil.info(cutYouBianCode("C99A01B01")[2]);
+	}
 }
 }

+ 31 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/DbValidationQueryEnum.java

@@ -0,0 +1,31 @@
+package org.jeecg.common.util.db;
+
+public enum DbValidationQueryEnum {
+    ORACLE("oracle", "SELECT 1 FROM DUAL"),
+    MYSQL("mysql", "select 1"),
+    SQLSERVER("sqlserver", "SELECT 1 FROM DUAL"),;
+
+    DbValidationQueryEnum(String dbType, String validationQuerySql) {
+        this.dbType = dbType;
+        this.validationQuerySql = validationQuerySql;
+    }
+
+    private String dbType;
+    private String validationQuerySql;
+
+    public String getDbType() {
+        return dbType;
+    }
+
+    public void setDbType(String dbType) {
+        this.dbType = dbType;
+    }
+
+    public String getValidationQuerySql() {
+        return validationQuerySql;
+    }
+
+    public void setValidationQuerySql(String validationQuerySql) {
+        this.validationQuerySql = validationQuerySql;
+    }
+}

+ 167 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/FreemarkerParseFactory.java

@@ -0,0 +1,167 @@
+package org.jeecg.common.util.db;
+
+import freemarker.cache.StringTemplateLoader;
+import freemarker.core.ParseException;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
+
+import java.io.StringWriter;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * @author 赵俊夫
+ * @version V1.0
+ * @Title:FreemarkerHelper
+ * @description:Freemarker引擎协助类
+ * @date Jul 5, 2013 2:58:29 PM
+ */
+@Slf4j
+public class FreemarkerParseFactory {
+
+    private static final String ENCODE = "utf-8";
+    /**
+     * 参数格式化工具类
+     */
+    private static final String MINI_DAO_FORMAT = "DaoFormat";
+
+    /**
+     * 文件缓存
+     */
+    private static final Configuration _tplConfig = new Configuration();
+    /**
+     * SQL 缓存
+     */
+    private static final Configuration _sqlConfig = new Configuration();
+
+    private static StringTemplateLoader stringTemplateLoader = new StringTemplateLoader();
+
+    // 使用内嵌的(?ms)打开单行和多行模式
+    private final static Pattern p = Pattern
+            .compile("(?ms)/\\*.*?\\*/|^\\s*//.*?$");
+
+    static {
+        _tplConfig.setClassForTemplateLoading(
+                new FreemarkerParseFactory().getClass(), "/");
+        _tplConfig.setNumberFormat("0.#####################");
+        _sqlConfig.setTemplateLoader(stringTemplateLoader);
+        _sqlConfig.setNumberFormat("0.#####################");
+        //classic_compatible设置,解决报空指针错误
+        _sqlConfig.setClassicCompatible(true);
+    }
+
+    /**
+     * 判断模板是否存在
+     *
+     * @throws Exception
+     */
+    public static boolean isExistTemplate(String tplName) throws Exception {
+        try {
+            Template mytpl = _tplConfig.getTemplate(tplName, "UTF-8");
+            if (mytpl == null) {
+                return false;
+            }
+        } catch (Exception e) {
+            //update-begin--Author:scott  Date:20180320 for:解决问题 - 错误提示sql文件不存在,实际问题是sql freemarker用法错误-----
+            if (e instanceof ParseException) {
+                log.error(e.getMessage(), e.fillInStackTrace());
+                throw new Exception(e);
+            }
+            log.debug("----isExistTemplate----" + e.toString());
+            //update-end--Author:scott  Date:20180320 for:解决问题 - 错误提示sql文件不存在,实际问题是sql freemarker用法错误------
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 解析ftl模板
+     *
+     * @param tplName 模板名
+     * @param paras   参数
+     * @return
+     */
+    public static String parseTemplate(String tplName, Map<String, Object> paras) {
+        try {
+            log.debug(" minidao sql templdate : " + tplName);
+            StringWriter swriter = new StringWriter();
+            Template mytpl = _tplConfig.getTemplate(tplName, ENCODE);
+            if (paras.containsKey(MINI_DAO_FORMAT)) {
+                throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
+            }
+            paras.put(MINI_DAO_FORMAT, new SimpleFormat());
+            mytpl.process(paras, swriter);
+            String sql = getSqlText(swriter.toString());
+            paras.remove(MINI_DAO_FORMAT);
+            return sql;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e.fillInStackTrace());
+            log.error("发送一次的模板key:{ " + tplName + " }");
+            throw new RuntimeException("解析SQL模板异常");
+        }
+    }
+
+    /**
+     * 解析ftl
+     *
+     * @param tplContent 模板内容
+     * @param paras      参数
+     * @return String 模板解析后内容
+     */
+    public static String parseTemplateContent(String tplContent,
+                                              Map<String, Object> paras) {
+        try {
+            StringWriter swriter = new StringWriter();
+            if (stringTemplateLoader.findTemplateSource("sql_" + tplContent.hashCode()) == null) {
+                stringTemplateLoader.putTemplate("sql_" + tplContent.hashCode(), tplContent);
+            }
+            Template mytpl = _sqlConfig.getTemplate("sql_" + tplContent.hashCode(), ENCODE);
+            if (paras.containsKey(MINI_DAO_FORMAT)) {
+                throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
+            }
+            paras.put(MINI_DAO_FORMAT, new SimpleFormat());
+            mytpl.process(paras, swriter);
+            String sql = getSqlText(swriter.toString());
+            paras.remove(MINI_DAO_FORMAT);
+            return sql;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e.fillInStackTrace());
+            log.error("发送一次的模板key:{ " + tplContent + " }");
+            throw new RuntimeException("解析SQL模板异常");
+        }
+    }
+
+    /**
+     * 除去无效字段,去掉注释 不然批量处理可能报错 去除无效的等于
+     */
+    private static String getSqlText(String sql) {
+        // 将注释替换成""
+        sql = p.matcher(sql).replaceAll("");
+        sql = sql.replaceAll("\\n", " ").replaceAll("\\t", " ")
+                .replaceAll("\\s{1,}", " ").trim();
+        // 去掉 最后是 where这样的问题
+        if (sql.endsWith("where") || sql.endsWith("where ")) {
+            sql = sql.substring(0, sql.lastIndexOf("where"));
+        }
+        // 去掉where and 这样的问题
+        int index = 0;
+        while ((index = StringUtils.indexOfIgnoreCase(sql, "where and", index)) != -1) {
+            sql = sql.substring(0, index + 5)
+                    + sql.substring(index + 9, sql.length());
+        }
+        // 去掉 , where 这样的问题
+        index = 0;
+        while ((index = StringUtils.indexOfIgnoreCase(sql, ", where", index)) != -1) {
+            sql = sql.substring(0, index)
+                    + sql.substring(index + 1, sql.length());
+        }
+        // 去掉 最后是 ,这样的问题
+        if (sql.endsWith(",") || sql.endsWith(", ")) {
+            sql = sql.substring(0, sql.lastIndexOf(","));
+        }
+        return sql;
+    }
+}

+ 31 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DbValidationQueryEnum.java

@@ -0,0 +1,31 @@
+package org.jeecg.common.util.dynamic.db;
+
+public enum DbValidationQueryEnum {
+    ORACLE("oracle", "SELECT 1 FROM DUAL"),
+    MYSQL("mysql", "select 1"),
+    SQLSERVER("sqlserver", "SELECT 1 FROM DUAL"),;
+
+    DbValidationQueryEnum(String dbType, String validationQuerySql) {
+        this.dbType = dbType;
+        this.validationQuerySql = validationQuerySql;
+    }
+
+    private String dbType;
+    private String validationQuerySql;
+
+    public String getDbType() {
+        return dbType;
+    }
+
+    public void setDbType(String dbType) {
+        this.dbType = dbType;
+    }
+
+    public String getValidationQuerySql() {
+        return validationQuerySql;
+    }
+
+    public void setValidationQuerySql(String validationQuerySql) {
+        this.validationQuerySql = validationQuerySql;
+    }
+}

+ 167 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java

@@ -0,0 +1,167 @@
+package org.jeecg.common.util.dynamic.db;
+
+import freemarker.cache.StringTemplateLoader;
+import freemarker.core.ParseException;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
+
+import java.io.StringWriter;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * @author 赵俊夫
+ * @version V1.0
+ * @Title:FreemarkerHelper
+ * @description:Freemarker引擎协助类
+ * @date Jul 5, 2013 2:58:29 PM
+ */
+@Slf4j
+public class FreemarkerParseFactory {
+
+    private static final String ENCODE = "utf-8";
+    /**
+     * 参数格式化工具类
+     */
+    private static final String MINI_DAO_FORMAT = "DaoFormat";
+
+    /**
+     * 文件缓存
+     */
+    private static final Configuration _tplConfig = new Configuration();
+    /**
+     * SQL 缓存
+     */
+    private static final Configuration _sqlConfig = new Configuration();
+
+    private static StringTemplateLoader stringTemplateLoader = new StringTemplateLoader();
+
+    // 使用内嵌的(?ms)打开单行和多行模式
+    private final static Pattern p = Pattern
+            .compile("(?ms)/\\*.*?\\*/|^\\s*//.*?$");
+
+    static {
+        _tplConfig.setClassForTemplateLoading(
+                new FreemarkerParseFactory().getClass(), "/");
+        _tplConfig.setNumberFormat("0.#####################");
+        _sqlConfig.setTemplateLoader(stringTemplateLoader);
+        _sqlConfig.setNumberFormat("0.#####################");
+        //classic_compatible设置,解决报空指针错误
+        _sqlConfig.setClassicCompatible(true);
+    }
+
+    /**
+     * 判断模板是否存在
+     *
+     * @throws Exception
+     */
+    public static boolean isExistTemplate(String tplName) throws Exception {
+        try {
+            Template mytpl = _tplConfig.getTemplate(tplName, "UTF-8");
+            if (mytpl == null) {
+                return false;
+            }
+        } catch (Exception e) {
+            //update-begin--Author:scott  Date:20180320 for:解决问题 - 错误提示sql文件不存在,实际问题是sql freemarker用法错误-----
+            if (e instanceof ParseException) {
+                log.error(e.getMessage(), e.fillInStackTrace());
+                throw new Exception(e);
+            }
+            log.debug("----isExistTemplate----" + e.toString());
+            //update-end--Author:scott  Date:20180320 for:解决问题 - 错误提示sql文件不存在,实际问题是sql freemarker用法错误------
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 解析ftl模板
+     *
+     * @param tplName 模板名
+     * @param paras   参数
+     * @return
+     */
+    public static String parseTemplate(String tplName, Map<String, Object> paras) {
+        try {
+            log.debug(" minidao sql templdate : " + tplName);
+            StringWriter swriter = new StringWriter();
+            Template mytpl = _tplConfig.getTemplate(tplName, ENCODE);
+            if (paras.containsKey(MINI_DAO_FORMAT)) {
+                throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
+            }
+            paras.put(MINI_DAO_FORMAT, new SimpleFormat());
+            mytpl.process(paras, swriter);
+            String sql = getSqlText(swriter.toString());
+            paras.remove(MINI_DAO_FORMAT);
+            return sql;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e.fillInStackTrace());
+            log.error("发送一次的模板key:{ " + tplName + " }");
+            throw new RuntimeException("解析SQL模板异常");
+        }
+    }
+
+    /**
+     * 解析ftl
+     *
+     * @param tplContent 模板内容
+     * @param paras      参数
+     * @return String 模板解析后内容
+     */
+    public static String parseTemplateContent(String tplContent,
+                                              Map<String, Object> paras) {
+        try {
+            StringWriter swriter = new StringWriter();
+            if (stringTemplateLoader.findTemplateSource("sql_" + tplContent.hashCode()) == null) {
+                stringTemplateLoader.putTemplate("sql_" + tplContent.hashCode(), tplContent);
+            }
+            Template mytpl = _sqlConfig.getTemplate("sql_" + tplContent.hashCode(), ENCODE);
+            if (paras.containsKey(MINI_DAO_FORMAT)) {
+                throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
+            }
+            paras.put(MINI_DAO_FORMAT, new SimpleFormat());
+            mytpl.process(paras, swriter);
+            String sql = getSqlText(swriter.toString());
+            paras.remove(MINI_DAO_FORMAT);
+            return sql;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e.fillInStackTrace());
+            log.error("发送一次的模板key:{ " + tplContent + " }");
+            throw new RuntimeException("解析SQL模板异常");
+        }
+    }
+
+    /**
+     * 除去无效字段,去掉注释 不然批量处理可能报错 去除无效的等于
+     */
+    private static String getSqlText(String sql) {
+        // 将注释替换成""
+        sql = p.matcher(sql).replaceAll("");
+        sql = sql.replaceAll("\\n", " ").replaceAll("\\t", " ")
+                .replaceAll("\\s{1,}", " ").trim();
+        // 去掉 最后是 where这样的问题
+        if (sql.endsWith("where") || sql.endsWith("where ")) {
+            sql = sql.substring(0, sql.lastIndexOf("where"));
+        }
+        // 去掉where and 这样的问题
+        int index = 0;
+        while ((index = StringUtils.indexOfIgnoreCase(sql, "where and", index)) != -1) {
+            sql = sql.substring(0, index + 5)
+                    + sql.substring(index + 9, sql.length());
+        }
+        // 去掉 , where 这样的问题
+        index = 0;
+        while ((index = StringUtils.indexOfIgnoreCase(sql, ", where", index)) != -1) {
+            sql = sql.substring(0, index)
+                    + sql.substring(index + 1, sql.length());
+        }
+        // 去掉 最后是 ,这样的问题
+        if (sql.endsWith(",") || sql.endsWith(", ")) {
+            sql = sql.substring(0, sql.lastIndexOf(","));
+        }
+        return sql;
+    }
+}

+ 98 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java

@@ -0,0 +1,98 @@
+package org.jeecg.common.util.encryption;
+
+import org.apache.shiro.codec.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * AES 加密
+ */
+public class AesEncryptUtil {
+
+    //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
+    private static String KEY = EncryptedString.key;
+    private static String IV = EncryptedString.iv;
+
+    /**
+     * 加密方法
+     * @param data  要加密的数据
+     * @param key 加密key
+     * @param iv 加密iv
+     * @return 加密的结果
+     * @throws Exception
+     */
+    public static String encrypt(String data, String key, String iv) throws Exception {
+        try {
+
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
+            int blockSize = cipher.getBlockSize();
+
+            byte[] dataBytes = data.getBytes();
+            int plaintextLength = dataBytes.length;
+            if (plaintextLength % blockSize != 0) {
+                plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
+            }
+
+            byte[] plaintext = new byte[plaintextLength];
+            System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+
+            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+            byte[] encrypted = cipher.doFinal(plaintext);
+
+            return Base64.encodeToString(encrypted);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 解密方法
+     * @param data 要解密的数据
+     * @param key  解密key
+     * @param iv 解密iv
+     * @return 解密的结果
+     * @throws Exception
+     */
+    public static String desEncrypt(String data, String key, String iv) throws Exception {
+        try {
+			byte[] encrypted1 = Base64.decode(data);
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+            cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
+            byte[] original = cipher.doFinal(encrypted1);
+            String originalString = new String(original);
+            return originalString;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 使用默认的key和iv加密
+     * @param data
+     * @return
+     * @throws Exception
+     */
+    public static String encrypt(String data) throws Exception {
+        return encrypt(data, KEY, IV);
+    }
+
+    /**
+     * 使用默认的key和iv解密
+     * @param data
+     * @return
+     * @throws Exception
+     */
+    public static String desEncrypt(String data) throws Exception {
+        return desEncrypt(data, KEY, IV);
+    }
+}

+ 12 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java

@@ -0,0 +1,12 @@
+package org.jeecg.common.util.encryption;
+
+
+import lombok.Data;
+
+@Data
+public class  EncryptedString {
+
+    public static  String key = "1234567890adbcde";//长度为16个字符
+
+    public static  String iv  = "1234567890hjlkew";//长度为16个字符
+}

+ 28 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java

@@ -0,0 +1,28 @@
+package org.jeecg.common.util.jsonschema;
+
+import lombok.Data;
+
+/**
+ * 列 配置基本信息
+ */
+@Data
+public class BaseColumn {
+
+    /**
+     * 列配置 描述 -对应数据库字段描述
+     */
+    private String title;
+
+    /**
+     * 列配置 名称 -对应数据库字段名
+     */
+    private String field;
+
+    public BaseColumn(){}
+
+    public BaseColumn(String title,String field){
+        this.title = title;
+        this.field = field;
+    }
+
+}

+ 98 - 27
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
-import lombok.Data;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.system.vo.DictModel;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -12,30 +12,34 @@ import com.alibaba.fastjson.JSONObject;
 /**
 /**
  * 验证通用属性
  * 验证通用属性
  */
  */
-@Data
 public abstract class CommonProperty implements Serializable{
 public abstract class CommonProperty implements Serializable{
+
 	private static final long serialVersionUID = -426159949502493187L;
 	private static final long serialVersionUID = -426159949502493187L;
+
+
 	protected String key;
 	protected String key;
+
+
 	/**
 	/**
 	 * <p>此关键字的值必须是字符串或数组。如果它是一个数组,那么数组的元素必须是字符串,并且必须是唯一的。
 	 * <p>此关键字的值必须是字符串或数组。如果它是一个数组,那么数组的元素必须是字符串,并且必须是唯一的。
 	 * <p>字符串值必须是六种基本类型之一(“null”,“boolean”,“object”,“array”,“number”或“string”),或“integer”,它匹配任何数字,零分数部分。
 	 * <p>字符串值必须是六种基本类型之一(“null”,“boolean”,“object”,“array”,“number”或“string”),或“integer”,它匹配任何数字,零分数部分。
 	 * <p>当且仅当实例位于为此关键字列出的任何集合中时,实例才会验证。
 	 * <p>当且仅当实例位于为此关键字列出的任何集合中时,实例才会验证。
-     *
+	 *
 	 */
 	 */
 	protected String type;
 	protected String type;
-	
+
 	/**
 	/**
 	 * 对应JsonSchema的enum
 	 * 对应JsonSchema的enum
 	 * <p>该关键字的值必须是一个数组。这个数组应该至少有一个元素。数组中的元素应该是唯一的。如果实例的值等于此关键字的数组值中的某个元素,则实例将对此关键字成功验证。
 	 * <p>该关键字的值必须是一个数组。这个数组应该至少有一个元素。数组中的元素应该是唯一的。如果实例的值等于此关键字的数组值中的某个元素,则实例将对此关键字成功验证。
 	 * 数组中的元素可以是任何值,包括null
 	 * 数组中的元素可以是任何值,包括null
-	 * 
+	 *
 	 *  {
 	 *  {
 	 *   "type": "string",
 	 *   "type": "string",
 	 *   "enum": ["1", "2", "3"] 需要的话可以通过这个include转一下
 	 *   "enum": ["1", "2", "3"] 需要的话可以通过这个include转一下
 	 *	}
 	 *	}
 	 */
 	 */
 	protected List<DictModel> include;
 	protected List<DictModel> include;
-	
+
 	/**
 	/**
 	 * 对应JsonSchema的const
 	 * 对应JsonSchema的const
 	 * <p>此关键字的值可以是任何类型,包括null。
 	 * <p>此关键字的值可以是任何类型,包括null。
@@ -43,25 +47,87 @@ public abstract class CommonProperty implements Serializable{
 	 */
 	 */
 	protected Object constant;
 	protected Object constant;
 
 
-    /**
-     * 三个自定义 属性
-     */
-    /**
-     * 展示类型
-     */
-    protected String view;
-    /**
-     * 数据库字段备注
-     */
-    protected String title;
-    /**
-     * 字段显示排序
-     */
-    protected Integer order;
-    /**
-     * 是否禁用
-     */
-    protected boolean disabled;
+	//三个自定义 属性
+	protected String view;// 展示类型
+	protected String title;//数据库字段备注
+	protected Integer order;//字段显示排序
+
+	protected boolean disabled;//是否禁用
+
+	protected String defVal; // 字段默认值
+
+	public String getDefVal() {
+		return defVal;
+	}
+
+	public void setDefVal(String defVal) {
+		this.defVal = defVal;
+	}
+
+	public boolean isDisabled() {
+		return disabled;
+	}
+
+	public void setDisabled(boolean disabled) {
+		this.disabled = disabled;
+	}
+
+	public String getView() {
+		return view;
+	}
+
+	public void setView(String view) {
+		this.view = view;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public List<DictModel> getInclude() {
+		return include;
+	}
+
+	public void setInclude(List<DictModel> include) {
+		this.include = include;
+	}
+
+	public Object getConstant() {
+		return constant;
+	}
+
+	public void setConstant(Object constant) {
+		this.constant = constant;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public Integer getOrder() {
+		return order;
+	}
+
+	public void setOrder(Integer order) {
+		this.order = order;
+	}
+
 	/**
 	/**
 	 * 返回一个map有两个key
 	 * 返回一个map有两个key
 	 * <P>key ---> Property JSON的key
 	 * <P>key ---> Property JSON的key
@@ -69,8 +135,8 @@ public abstract class CommonProperty implements Serializable{
 	 * @return
 	 * @return
 	 */
 	 */
 	public abstract Map<String,Object> getPropertyJson();
 	public abstract Map<String,Object> getPropertyJson();
-	
-    public JSONObject getCommonJson() {
+
+	public JSONObject getCommonJson() {
 		JSONObject json = new JSONObject();
 		JSONObject json = new JSONObject();
 		json.put("type", type);
 		json.put("type", type);
 		if(include!=null && include.size()>0) {
 		if(include!=null && include.size()>0) {
@@ -95,6 +161,11 @@ public abstract class CommonProperty implements Serializable{
 			JSONObject ui = JSONObject.parseObject(str);
 			JSONObject ui = JSONObject.parseObject(str);
 			json.put("ui", ui);
 			json.put("ui", ui);
 		}
 		}
+		if (StringUtils.isNotBlank(defVal)) {
+			json.put("defVal", defVal);
+		}
 		return json;
 		return json;
 	}
 	}
+
+
 }
 }

+ 8 - 8
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java

@@ -13,9 +13,9 @@ public class JsonSchemaDescrip implements Serializable{
 	 * 
 	 * 
 	 */
 	 */
 	private static final long serialVersionUID = 7682073117441544718L;
 	private static final long serialVersionUID = 7682073117441544718L;
-
-
-	private String schema = "http://json-schema.org/draft-07/schema#";
+	
+	
+	private String $schema = "http://json-schema.org/draft-07/schema#";
 	
 	
 	/**
 	/**
 	 * 用它给我们的模式提供了标题。
 	 * 用它给我们的模式提供了标题。
@@ -43,12 +43,12 @@ public class JsonSchemaDescrip implements Serializable{
 		this.required = required;
 		this.required = required;
 	}
 	}
 
 
-    public String getSchema() {
-		return schema;
-    }
+	public String get$schema() {
+		return $schema;
+	}
 
 
-    public void setSchema(String schema) {
-		this.schema = schema;
+	public void set$schema(String $schema) {
+		this.$schema = $schema;
 	}
 	}
 
 
 	public String getTitle() {
 	public String getTitle() {

+ 12 - 41
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java

@@ -1,26 +1,27 @@
 package org.jeecg.common.util.jsonschema;
 package org.jeecg.common.util.jsonschema;
 
 
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-
-import java.io.*;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import lombok.extern.slf4j.Slf4j;
+
 @Slf4j
 @Slf4j
 public class JsonschemaUtil {
 public class JsonschemaUtil {
-
+	
 	/**
 	/**
 	 * 生成JsonSchema
 	 * 生成JsonSchema
-     *
+	 * 
 	 * @param descrip
 	 * @param descrip
 	 * @param propertyList
 	 * @param propertyList
 	 * @return
 	 * @return
 	 */
 	 */
 	public static JSONObject getJsonSchema(JsonSchemaDescrip descrip, List<CommonProperty> propertyList) {
 	public static JSONObject getJsonSchema(JsonSchemaDescrip descrip, List<CommonProperty> propertyList) {
 		JSONObject obj = new JSONObject();
 		JSONObject obj = new JSONObject();
-        obj.put("$schema", descrip.getSchema());
+		obj.put("$schema", descrip.get$schema());
 		obj.put("type", descrip.getType());
 		obj.put("type", descrip.getType());
 		obj.put("title", descrip.getTitle());
 		obj.put("title", descrip.getTitle());
 
 
@@ -34,11 +35,11 @@ public class JsonschemaUtil {
 		}
 		}
 		obj.put("properties", properties);
 		obj.put("properties", properties);
 		//鬼知道这里为什么报错 org.jeecg.modules.system.model.DictModel cannot be cast to org.jeecg.modules.system.model.DictModel
 		//鬼知道这里为什么报错 org.jeecg.modules.system.model.DictModel cannot be cast to org.jeecg.modules.system.model.DictModel
-        log.info("---JSONSchema--->" + obj.toJSONString());
+		//log.info("---JSONSchema--->"+obj.toJSONString());
 		return obj;
 		return obj;
 	}
 	}
-
-    /**
+	
+	/**
 	 * 生成JsonSchema 用于子对象
 	 * 生成JsonSchema 用于子对象
 	 * @param title 子对象描述
 	 * @param title 子对象描述
 	 * @param requiredArr 子对象必填属性名集合
 	 * @param requiredArr 子对象必填属性名集合
@@ -62,38 +63,8 @@ public class JsonschemaUtil {
 			properties.put(map.get("key").toString(), map.get("prop"));
 			properties.put(map.get("key").toString(), map.get("prop"));
 		}
 		}
 		obj.put("properties", properties);
 		obj.put("properties", properties);
-        log.info("---JSONSchema--->" + obj.toString());
+		//log.info("---JSONSchema--->"+obj.toString());
 		return obj;
 		return obj;
 	}
 	}
 
 
-    /**
-     * 读取json文件,返回json串
-     *
-     * @param fileName
-     * @return
-     */
-	public static String readJsonFile(String fileName) throws IOException {
-        String jsonStr = "";
-		FileReader fileReader = null;
-		Reader reader = null;
-		try {
-            File jsonFile = new File(fileName);
-			fileReader = new FileReader(jsonFile);
-			reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
-            int ch = 0;
-            StringBuffer sb = new StringBuffer();
-            while ((ch = reader.read()) != -1) {
-                sb.append((char) ch);
-            }
-            jsonStr = sb.toString();
-            return jsonStr;
-		} catch (Exception e) {
-            e.printStackTrace();
-            return null;
-		} finally {
-			fileReader.close();
-			reader.close();
-		}
-    }
-
 }
 }

+ 1 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java

@@ -15,7 +15,7 @@ import com.alibaba.fastjson.JSONObject;
  */
  */
 @Data
 @Data
 public class DictProperty extends CommonProperty {
 public class DictProperty extends CommonProperty {
-	
+
 	private static final long serialVersionUID = 3786503639885610767L;
 	private static final long serialVersionUID = 3786503639885610767L;
 
 
     /**
     /**

+ 38 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java

@@ -0,0 +1,38 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 字典属性
+ * @author 86729
+ *
+ */
+public class HiddenProperty extends CommonProperty {
+	
+	private static final long serialVersionUID = -8939298551502162479L;
+	
+	public HiddenProperty() {}
+	
+	public HiddenProperty(String key,String title) {
+		this.type = "string";
+		this.view = "hidden";
+		this.key = key;
+		this.title = title;
+	}
+	
+	@Override
+	public Map<String, Object> getPropertyJson() {
+		Map<String,Object> map = new HashMap<>();
+		map.put("key",getKey());
+		JSONObject prop = getCommonJson();
+		prop.put("hidden",true);
+		map.put("prop",prop);
+		return map;
+	}
+
+}

+ 66 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java

@@ -0,0 +1,66 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.util.jsonschema.BaseColumn;
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 级联下拉
+ */
+public class LinkDownProperty extends CommonProperty {
+
+    /**
+     * 配置信息
+     */
+    String dictTable;
+
+    /**
+     * 级联下拉组件 的其他级联列
+     */
+    List<BaseColumn> otherColumns;
+
+    public String getDictTable(){
+        return this.dictTable;
+    }
+
+    public void setDictTable(String dictTable){
+        this.dictTable = dictTable;
+    }
+
+    public List<BaseColumn> getOtherColumns(){
+        return this.otherColumns;
+    }
+
+    public void setOtherColumns(List<BaseColumn> otherColumns){
+        this.otherColumns = otherColumns;
+    }
+
+    public LinkDownProperty() {}
+
+    /**
+     *  构造器
+     */
+    public LinkDownProperty(String key,String title,String dictTable) {
+        this.type = "string";
+        this.view = "link_down";
+        this.key = key;
+        this.title = title;
+        this.dictTable= dictTable;
+    }
+
+    @Override
+    public Map<String, Object> getPropertyJson() {
+        Map<String, Object> map = new HashMap<>();
+        map.put("key", getKey());
+        JSONObject prop = getCommonJson();
+        JSONObject temp = JSONObject.parseObject(this.dictTable);
+        prop.put("config", temp);
+        prop.put("others", otherColumns);
+        map.put("prop", prop);
+        return map;
+    }
+}

+ 0 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java

@@ -43,7 +43,6 @@ public class NumberProperty extends CommonProperty {
 	 * 大于等于
 	 * 大于等于
 	 */
 	 */
 	private Integer exclusiveMinimum;
 	private Integer exclusiveMinimum;
-
 	
 	
 	private String pattern;
 	private String pattern;
 
 
@@ -86,7 +85,6 @@ public class NumberProperty extends CommonProperty {
 	public void setExclusiveMinimum(Integer exclusiveMinimum) {
 	public void setExclusiveMinimum(Integer exclusiveMinimum) {
 		this.exclusiveMinimum = exclusiveMinimum;
 		this.exclusiveMinimum = exclusiveMinimum;
 	}
 	}
-
 	
 	
 	public String getPattern() {
 	public String getPattern() {
 		return pattern;
 		return pattern;
@@ -149,7 +147,6 @@ public class NumberProperty extends CommonProperty {
 		if(pattern!=null) {
 		if(pattern!=null) {
 			prop.put("pattern",pattern);
 			prop.put("pattern",pattern);
 		}
 		}
-
 		map.put("prop",prop);
 		map.put("prop",prop);
 		return map;
 		return map;
 	}
 	}

+ 23 - 27
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java

@@ -1,36 +1,32 @@
 package org.jeecg.common.util.jsonschema.validate;
 package org.jeecg.common.util.jsonschema.validate;
 
 
-import com.alibaba.fastjson.JSONObject;
-import org.jeecg.common.system.vo.DictModel;
-import org.jeecg.common.util.jsonschema.CommonProperty;
-
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
-public class StringProperty extends CommonProperty {
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.util.jsonschema.CommonProperty;
 
 
-	private static final long serialVersionUID = -3200493311633999539L;
+import com.alibaba.fastjson.JSONObject;
 
 
+public class StringProperty extends CommonProperty {
+	
+	private static final long serialVersionUID = -3200493311633999539L;
+	
 	private Integer maxLength;
 	private Integer maxLength;
-
-    private Integer minLength;
-
-    /**
+	
+	private Integer minLength;
+	
+	/**
 	 * 根据ECMA 262正则表达式方言,该字符串应该是有效的正则表达式。
 	 * 根据ECMA 262正则表达式方言,该字符串应该是有效的正则表达式。
 	 */
 	 */
 	private String pattern;
 	private String pattern;
-
-
-    /**
+	
+	/**
 	 * 错误提示信息
 	 * 错误提示信息
 	 */
 	 */
 	private String errorInfo;
 	private String errorInfo;
-
+	
 	public Integer getMaxLength() {
 	public Integer getMaxLength() {
 		return maxLength;
 		return maxLength;
 	}
 	}
@@ -55,9 +51,8 @@ public class StringProperty extends CommonProperty {
 	public void setPattern(String pattern) {
 	public void setPattern(String pattern) {
 		this.pattern = pattern;
 		this.pattern = pattern;
 	}
 	}
-
-
-    public String getErrorInfo() {
+	
+	public String getErrorInfo() {
 		return errorInfo;
 		return errorInfo;
 	}
 	}
 
 
@@ -66,9 +61,10 @@ public class StringProperty extends CommonProperty {
 		this.errorInfo = errorInfo;
 		this.errorInfo = errorInfo;
 	}
 	}
 
 
-	public StringProperty() {}
 
 
-    /**
+	public StringProperty() {}
+	
+	/**
 	 *  一般字符串类型走这个构造器
 	 *  一般字符串类型走这个构造器
 	 * @param key 字段名
 	 * @param key 字段名
 	 * @param title 字段备注
 	 * @param title 字段备注
@@ -82,11 +78,11 @@ public class StringProperty extends CommonProperty {
 		this.title = title;
 		this.title = title;
 		this.type = "string";
 		this.type = "string";
 	}
 	}
-
-    /**
-     *  列表类型的走这个构造器
+	
+	/**
+         *  列表类型的走这个构造器  
 	 * @param key 字段名
 	 * @param key 字段名
-     * @param title 字段备注
+	 * @param title 字段备注 
 	 * @param view 展示控件 list-checkbox-radio
 	 * @param view 展示控件 list-checkbox-radio
 	 * @param maxLength 数据库字段最大长度
 	 * @param maxLength 数据库字段最大长度
 	 * @param include 数据字典
 	 * @param include 数据字典

+ 46 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java

@@ -0,0 +1,46 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 开关 属性
+ */
+public class SwitchProperty extends CommonProperty {
+
+	//扩展参数配置信息
+	private String extendStr;
+
+	public SwitchProperty() {}
+
+	/**
+	 *  构造器
+	 */
+	public SwitchProperty(String key, String title, String extendStr) {
+		this.type = "string";
+		this.view = "switch";
+		this.key = key;
+		this.title = title;
+		this.extendStr = extendStr;
+	}
+	
+	@Override
+	public Map<String, Object> getPropertyJson() {
+		Map<String,Object> map = new HashMap<>();
+		map.put("key",getKey());
+		JSONObject prop = getCommonJson();
+		JSONArray array = new JSONArray();
+		if(extendStr!=null) {
+			array = JSONArray.parseArray(extendStr);
+			prop.put("extendOption",array);
+		}
+		map.put("prop",prop);
+		return map;
+	}
+
+	//TODO 重构问题:数据字典 只是字符串类的还是有存储的数值类型?只有字符串请跳过这个 只改前端
+}

+ 60 - 14
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java

@@ -15,19 +15,17 @@ import com.alibaba.fastjson.JSONObject;
 public class TreeSelectProperty extends CommonProperty {
 public class TreeSelectProperty extends CommonProperty {
 	
 	
 	private static final long serialVersionUID = 3786503639885610767L;
 	private static final long serialVersionUID = 3786503639885610767L;
-    /**
-     * 表名,文本,id
-     */
-    private String dict;
-    /**
-     * 父级字段 默认pid
-     */
-    private String pidField;
-    /**
-     * 父级节点的值 暂时没用到 默认为0
-     */
-    private String pidValue;
+
+	private String dict;//表名,文本,id
+	private String pidField;//父级字段 默认pid
+	private String pidValue;//父级节点的值 暂时没用到 默认为0
 	private String hasChildField;
 	private String hasChildField;
+	private String textField;//树形下拉保存text值的字段名
+
+	/**
+	 * 是不是pid 组件 1是 0否
+	 */
+	private Integer pidComponent = 0;
 	
 	
 	public String getDict() {
 	public String getDict() {
 		return dict;
 		return dict;
@@ -62,9 +60,25 @@ public class TreeSelectProperty extends CommonProperty {
 	}
 	}
 
 
 	public TreeSelectProperty() {}
 	public TreeSelectProperty() {}
-	
+
+	public String getTextField() {
+		return textField;
+	}
+
+	public void setTextField(String textField) {
+		this.textField = textField;
+	}
+
+	public Integer getPidComponent() {
+		return pidComponent;
+	}
+
+	public void setPidComponent(Integer pidComponent) {
+		this.pidComponent = pidComponent;
+	}
+
 	/**
 	/**
-	 *  构造器
+	 *  构造器 构造普通树形下拉
 	 */
 	 */
 	public TreeSelectProperty(String key,String title,String dict,String pidField,String pidValue) {
 	public TreeSelectProperty(String key,String title,String dict,String pidField,String pidValue) {
 		this.type = "string";
 		this.type = "string";
@@ -75,6 +89,32 @@ public class TreeSelectProperty extends CommonProperty {
 		this.pidField= pidField;
 		this.pidField= pidField;
 		this.pidValue= pidValue;
 		this.pidValue= pidValue;
 	}
 	}
+
+	/**
+	 * 分类字典下拉专用
+	 * @param key
+	 * @param title
+	 * @param pidValue
+	 */
+	public TreeSelectProperty(String key,String title,String pidValue) {
+		this.type = "string";
+		this.view = "cat_tree";
+		this.key = key;
+		this.title = title;
+		this.pidValue = pidValue;
+	}
+
+	/**
+	 * 分类字典 支持存储text 下拉专用
+	 * @param key
+	 * @param title
+	 * @param pidValue
+	 * @param textField
+	 */
+	public TreeSelectProperty(String key,String title,String pidValue,String textField) {
+		this(key,title,pidValue);
+		this.textField = textField;
+	}
 	
 	
 	@Override
 	@Override
 	public Map<String, Object> getPropertyJson() {
 	public Map<String, Object> getPropertyJson() {
@@ -90,9 +130,15 @@ public class TreeSelectProperty extends CommonProperty {
 		if(pidValue!=null) {
 		if(pidValue!=null) {
 			prop.put("pidValue",pidValue);
 			prop.put("pidValue",pidValue);
 		}
 		}
+		if(textField!=null) {
+			prop.put("textField",textField);
+		}
 		if(hasChildField!=null) {
 		if(hasChildField!=null) {
 			prop.put("hasChildField",hasChildField);
 			prop.put("hasChildField",hasChildField);
 		}
 		}
+		if(pidComponent!=null) {
+			prop.put("pidComponent",pidComponent);
+		}
 		map.put("prop",prop);
 		map.put("prop",prop);
 		return map;
 		return map;
 	}
 	}

+ 146 - 51
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java

@@ -1,8 +1,10 @@
 package org.jeecg.common.util;
 package org.jeecg.common.util;
 
 
-import org.apache.commons.lang.StringEscapeUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.BigInteger;
@@ -20,6 +22,7 @@ import java.util.regex.Pattern;
  * @Author  张代浩
  * @Author  张代浩
  *
  *
  */
  */
+@Slf4j
 public class oConvertUtils {
 public class oConvertUtils {
 	public static boolean isEmpty(Object object) {
 	public static boolean isEmpty(Object object) {
 		if (object == null) {
 		if (object == null) {
@@ -35,7 +38,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static boolean isNotEmpty(Object object) {
 	public static boolean isNotEmpty(Object object) {
-        if (object != null && !"".equals(object) && !"null".equals(object)) {
+		if (object != null && !"".equals(object) && !"null".equals(object)) {
 			return (true);
 			return (true);
 		}
 		}
 		return (false);
 		return (false);
@@ -46,11 +49,23 @@ public class oConvertUtils {
 		return temp;
 		return temp;
 	}
 	}
 
 
+	public static String StrToUTF(String strIn, String sourceCode, String targetCode) {
+		strIn = "";
+		try {
+			strIn = new String(strIn.getBytes("ISO-8859-1"), "GBK");
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return strIn;
+
+	}
+
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
-        if (strIn == null || "".equals(strIn.trim())) {
+		String strOut = null;
+		if (strIn == null || "".equals(strIn.trim())) {
 			return strIn;
 			return strIn;
 		}
 		}
-		String strOut = null;
 		try {
 		try {
 			byte[] b = strIn.getBytes(sourceCode);
 			byte[] b = strIn.getBytes(sourceCode);
 			strOut = new String(b, targetCode);
 			strOut = new String(b, targetCode);
@@ -62,7 +77,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static int getInt(String s, int defval) {
 	public static int getInt(String s, int defval) {
-		if (s == null || s.trim().equals("")) {
+		if (s == null || s == "") {
 			return (defval);
 			return (defval);
 		}
 		}
 		try {
 		try {
@@ -73,7 +88,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static int getInt(String s) {
 	public static int getInt(String s) {
-		if (s == null || s.trim().equals("")) {
+		if (s == null || s == "") {
 			return 0;
 			return 0;
 		}
 		}
 		try {
 		try {
@@ -84,7 +99,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static int getInt(String s, Integer df) {
 	public static int getInt(String s, Integer df) {
-		if (s == null || s.trim().equals("")) {
+		if (s == null || s == "") {
 			return df;
 			return df;
 		}
 		}
 		try {
 		try {
@@ -95,10 +110,10 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static Integer[] getInts(String[] s) {
 	public static Integer[] getInts(String[] s) {
+		Integer[] integer = new Integer[s.length];
 		if (s == null) {
 		if (s == null) {
 			return null;
 			return null;
 		}
 		}
-		Integer[] integer = new Integer[s.length];
 		for (int i = 0; i < s.length; i++) {
 		for (int i = 0; i < s.length; i++) {
 			integer[i] = Integer.parseInt(s[i]);
 			integer[i] = Integer.parseInt(s[i]);
 		}
 		}
@@ -107,7 +122,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static double getDouble(String s, double defval) {
 	public static double getDouble(String s, double defval) {
-		if (s == null || s.trim().equals("")) {
+		if (s == null || s == "") {
 			return (defval);
 			return (defval);
 		}
 		}
 		try {
 		try {
@@ -124,6 +139,14 @@ public class oConvertUtils {
 		return s;
 		return s;
 	}
 	}
 
 
+	/*public static Short getShort(String s) {
+		if (StringUtil.isNotEmpty(s)) {
+			return (Short.parseShort(s));
+		} else {
+			return null;
+		}
+	}*/
+
 	public static int getInt(Object object, int defval) {
 	public static int getInt(Object object, int defval) {
 		if (isEmpty(object)) {
 		if (isEmpty(object)) {
 			return (defval);
 			return (defval);
@@ -153,12 +176,12 @@ public class oConvertUtils {
 		return s.intValue();
 		return s.intValue();
 	}
 	}
 
 
-	public static Integer[] getIntegerArray(String[] object) {
+	public static Integer[] getIntegerArry(String[] object) {
 		int len = object.length;
 		int len = object.length;
 		Integer[] result = new Integer[len];
 		Integer[] result = new Integer[len];
 		try {
 		try {
 			for (int i = 0; i < len; i++) {
 			for (int i = 0; i < len; i++) {
-                result[i] = Integer.getInteger(object[i].trim());
+				result[i] = new Integer(object[i].trim());
 			}
 			}
 			return result;
 			return result;
 		} catch (NumberFormatException e) {
 		} catch (NumberFormatException e) {
@@ -175,9 +198,9 @@ public class oConvertUtils {
 	 * @param s
 	 * @param s
 	 * @return
 	 * @return
 	 */
 	 */
-    public static String escapeJava(Object s) {
+	/*public static String escapeJava(Object s) {
 		return StringEscapeUtils.escapeJava(getString(s));
 		return StringEscapeUtils.escapeJava(getString(s));
-    }
+	}*/
 
 
 	public static String getString(Object object) {
 	public static String getString(Object object) {
 		if (isEmpty(object)) {
 		if (isEmpty(object)) {
@@ -209,7 +232,12 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static long stringToLong(String str) {
 	public static long stringToLong(String str) {
-		return Long.valueOf(str);
+		Long test = new Long(0);
+		try {
+			test = Long.valueOf(str);
+		} catch (Exception e) {
+		}
+		return test.longValue();
 	}
 	}
 
 
 	/**
 	/**
@@ -229,12 +257,12 @@ public class oConvertUtils {
 
 
 	/**
 	/**
 	 * 判断一个类是否为基本数据类型。
 	 * 判断一个类是否为基本数据类型。
-     *
+	 *
 	 * @param clazz
 	 * @param clazz
 	 *            要判断的类。
 	 *            要判断的类。
 	 * @return true 表示为基本数据类型。
 	 * @return true 表示为基本数据类型。
 	 */
 	 */
-	private static boolean isBaseDataType(Class clazz) {
+	private static boolean isBaseDataType(Class clazz) throws Exception {
 		return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive());
 		return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive());
 	}
 	}
 
 
@@ -262,25 +290,22 @@ public class oConvertUtils {
 	 * @throws SocketException
 	 * @throws SocketException
 	 */
 	 */
 	public static String getRealIp() throws SocketException {
 	public static String getRealIp() throws SocketException {
-        // 本地IP,如果没有配置外网IP则返回它
-        String localip = null;
-        // 外网IP
-        String netip = null;
+		String localip = null;// 本地IP,如果没有配置外网IP则返回它
+		String netip = null;// 外网IP
 
 
 		Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
 		Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
 		InetAddress ip = null;
 		InetAddress ip = null;
-        // 是否找到外网IP
-        boolean finded = false;
+		boolean finded = false;// 是否找到外网IP
 		while (netInterfaces.hasMoreElements() && !finded) {
 		while (netInterfaces.hasMoreElements() && !finded) {
 			NetworkInterface ni = netInterfaces.nextElement();
 			NetworkInterface ni = netInterfaces.nextElement();
 			Enumeration<InetAddress> address = ni.getInetAddresses();
 			Enumeration<InetAddress> address = ni.getInetAddresses();
 			while (address.hasMoreElements()) {
 			while (address.hasMoreElements()) {
 				ip = address.nextElement();
 				ip = address.nextElement();
-				if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(':') == -1) {
+				if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP
 					netip = ip.getHostAddress();
 					netip = ip.getHostAddress();
 					finded = true;
 					finded = true;
 					break;
 					break;
-				} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(':') == -1) {
+				} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP
 					localip = ip.getHostAddress();
 					localip = ip.getHostAddress();
 				}
 				}
 			}
 			}
@@ -295,7 +320,7 @@ public class oConvertUtils {
 
 
 	/**
 	/**
 	 * java去除字符串中的空格、回车、换行符、制表符
 	 * java去除字符串中的空格、回车、换行符、制表符
-     *
+	 *
 	 * @param str
 	 * @param str
 	 * @return
 	 * @return
 	 */
 	 */
@@ -312,7 +337,7 @@ public class oConvertUtils {
 
 
 	/**
 	/**
 	 * 判断元素是否在数组内
 	 * 判断元素是否在数组内
-     *
+	 *
 	 * @param substring
 	 * @param substring
 	 * @param source
 	 * @param source
 	 * @return
 	 * @return
@@ -331,13 +356,20 @@ public class oConvertUtils {
 	}
 	}
 
 
 	/**
 	/**
+	 * 获取Map对象
+	 */
+	public static Map<Object, Object> getHashMap() {
+		return new HashMap<Object, Object>();
+	}
+
+	/**
 	 * SET转换MAP
 	 * SET转换MAP
-     *
-	 * @param setobj
+	 *
+	 * @param str
 	 * @return
 	 * @return
 	 */
 	 */
-    public static Map<Object, Object> setToMap(Set<Object> setobj) {
-		Map<Object, Object> map = new HashMap<>();
+	public static Map<Object, Object> SetToMap(Set<Object> setobj) {
+		Map<Object, Object> map = getHashMap();
 		for (Iterator iterator = setobj.iterator(); iterator.hasNext();) {
 		for (Iterator iterator = setobj.iterator(); iterator.hasNext();) {
 			Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
 			Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
 			map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim());
 			map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim());
@@ -346,7 +378,7 @@ public class oConvertUtils {
 
 
 	}
 	}
 
 
-    public static boolean isInnerIp(String ipAddress) {
+	public static boolean isInnerIP(String ipAddress) {
 		boolean isInnerIp = false;
 		boolean isInnerIp = false;
 		long ipNum = getIpNum(ipAddress);
 		long ipNum = getIpNum(ipAddress);
 		/**
 		/**
@@ -358,7 +390,7 @@ public class oConvertUtils {
 		long bEnd = getIpNum("172.31.255.255");
 		long bEnd = getIpNum("172.31.255.255");
 		long cBegin = getIpNum("192.168.0.0");
 		long cBegin = getIpNum("192.168.0.0");
 		long cEnd = getIpNum("192.168.255.255");
 		long cEnd = getIpNum("192.168.255.255");
-        isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || "127.0.0.1".equals(ipAddress);
+		isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || "127.0.0.1".equals(ipAddress);
 		return isInnerIp;
 		return isInnerIp;
 	}
 	}
 
 
@@ -368,7 +400,9 @@ public class oConvertUtils {
 		long b = Integer.parseInt(ip[1]);
 		long b = Integer.parseInt(ip[1]);
 		long c = Integer.parseInt(ip[2]);
 		long c = Integer.parseInt(ip[2]);
 		long d = Integer.parseInt(ip[3]);
 		long d = Integer.parseInt(ip[3]);
-		return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
+
+		long ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
+		return ipNum;
 	}
 	}
 
 
 	private static boolean isInner(long userIp, long begin, long end) {
 	private static boolean isInner(long userIp, long begin, long end) {
@@ -379,7 +413,7 @@ public class oConvertUtils {
 	 * 将下划线大写方式命名的字符串转换为驼峰式。
 	 * 将下划线大写方式命名的字符串转换为驼峰式。
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 例如:hello_world->helloWorld
 	 * 例如:hello_world->helloWorld
-     *
+	 *
 	 * @param name
 	 * @param name
 	 *            转换前的下划线大写方式命名的字符串
 	 *            转换前的下划线大写方式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
@@ -398,7 +432,7 @@ public class oConvertUtils {
 			//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 			//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 		}
 		}
 		// 用下划线将原始字符串分割
 		// 用下划线将原始字符串分割
-        String[] camels = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {
 			if (camel.isEmpty()) {
@@ -422,12 +456,12 @@ public class oConvertUtils {
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 例如:hello_world,test_id->helloWorld,testId
 	 * 例如:hello_world,test_id->helloWorld,testId
 	 *
 	 *
-     * @param names
+	 * @param name
 	 *            转换前的下划线大写方式命名的字符串
 	 *            转换前的下划线大写方式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
 	 */
 	 */
 	public static String camelNames(String names) {
 	public static String camelNames(String names) {
-        if (names == null || "".equals(names)) {
+		if(names==null|| "".equals(names)){
 			return null;
 			return null;
 		}
 		}
 		StringBuffer sf = new StringBuffer();
 		StringBuffer sf = new StringBuffer();
@@ -445,7 +479,7 @@ public class oConvertUtils {
 	 * 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
 	 * 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
 	 * 例如:hello_world->HelloWorld
 	 * 例如:hello_world->HelloWorld
-     *
+	 *
 	 * @param name
 	 * @param name
 	 *            转换前的下划线大写方式命名的字符串
 	 *            转换前的下划线大写方式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
@@ -461,7 +495,7 @@ public class oConvertUtils {
 			return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
 			return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
 		}
 		}
 		// 用下划线将原始字符串分割
 		// 用下划线将原始字符串分割
-        String[] camels = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {
 			if (camel.isEmpty()) {
@@ -475,18 +509,17 @@ public class oConvertUtils {
 	}
 	}
 	//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 	//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 
 
-    /**
+	/**
 	 * 将驼峰命名转化成下划线
 	 * 将驼峰命名转化成下划线
 	 * @param para
 	 * @param para
 	 * @return
 	 * @return
 	 */
 	 */
 	public static String camelToUnderline(String para){
 	public static String camelToUnderline(String para){
         if(para.length()<3){
         if(para.length()<3){
-            return para.toLowerCase();
+        	return para.toLowerCase();
         }
         }
         StringBuilder sb=new StringBuilder(para);
         StringBuilder sb=new StringBuilder(para);
-        //定位
-        int temp = 0;
+        int temp=0;//定位
         //从第三个字符开始 避免命名不规范
         //从第三个字符开始 避免命名不规范
         for(int i=2;i<para.length();i++){
         for(int i=2;i<para.length();i++){
             if(Character.isUpperCase(para.charAt(i))){
             if(Character.isUpperCase(para.charAt(i))){
@@ -511,9 +544,9 @@ public class oConvertUtils {
 		return sb.toString();
 		return sb.toString();
 	}
 	}
 
 
-    /**
+	/**
 	 * 获取类的所有属性,包括父类
 	 * 获取类的所有属性,包括父类
-     *
+	 *
 	 * @param object
 	 * @param object
 	 * @return
 	 * @return
 	 */
 	 */
@@ -529,8 +562,7 @@ public class oConvertUtils {
 		return fields;
 		return fields;
 	}
 	}
 
 
-
-    /**
+	/**
 	  * 将map的key全部转成小写
 	  * 将map的key全部转成小写
 	 * @param list
 	 * @param list
 	 * @return
 	 * @return
@@ -539,13 +571,76 @@ public class oConvertUtils {
 		List<Map<String, Object>> select = new ArrayList<>();
 		List<Map<String, Object>> select = new ArrayList<>();
 		for (Map<String, Object> row : list) {
 		for (Map<String, Object> row : list) {
 			 Map<String, Object> resultMap = new HashMap<>();
 			 Map<String, Object> resultMap = new HashMap<>();
-            Set<String> keySet = row.keySet();
-            for (String key : keySet) {
-                String newKey = key.toLowerCase();
-                resultMap.put(newKey, row.get(key));
+			 Set<String> keySet = row.keySet();
+			 for (String key : keySet) {
+				 String newKey = key.toLowerCase();
+				 resultMap.put(newKey, row.get(key));
 			 }
 			 }
 			 select.add(resultMap);
 			 select.add(resultMap);
 		}
 		}
 		return select;
 		return select;
 	}
 	}
+
+	/**
+	 * 将entityList转换成modelList
+	 * @param fromList
+	 * @param tClass
+	 * @param <F>
+	 * @param <T>
+	 * @return
+	 */
+	public static<F,T> List<T> entityListToModelList(List<F> fromList, Class<T> tClass){
+		if(fromList.isEmpty() || fromList == null){
+			return null;
+		}
+		List<T> tList = new ArrayList<>();
+		for(F f : fromList){
+			T t = entityToModel(f, tClass);
+			tList.add(t);
+		}
+		return tList;
+	}
+
+	public static<F,T> T entityToModel(F entity, Class<T> modelClass) {
+		log.debug("entityToModel : Entity属性的值赋值到Model");
+		Object model = null;
+		if (entity == null || modelClass ==null) {
+			return null;
+		}
+
+		try {
+			model = modelClass.newInstance();
+		} catch (InstantiationException e) {
+			log.error("entityToModel : 实例化异常", e);
+		} catch (IllegalAccessException e) {
+			log.error("entityToModel : 安全权限异常", e);
+		}
+		BeanUtils.copyProperties(entity, model);
+		return (T)model;
+	}
+
+	/**
+	 * 判断 list 是否为空
+	 *
+	 * @param list
+	 * @return true or false
+	 * list == null		: true
+	 * list.size() == 0	: true
+	 */
+	public static boolean listIsEmpty(Collection list) {
+		return (list == null || list.size() == 0);
+	}
+
+	/**
+	 * 判断 list 是否不为空
+	 *
+	 * @param list
+	 * @return true or false
+	 * list == null		: false
+	 * list.size() == 0	: false
+	 */
+	public static boolean listIsNotEmpty(Collection list) {
+		return !listIsEmpty(list);
+	}
+
 }
 }

+ 289 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java

@@ -0,0 +1,289 @@
+package org.jeecg.common.util.oss;
+
+import com.aliyun.oss.ClientConfiguration;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.common.auth.DefaultCredentialProvider;
+import com.aliyun.oss.model.CannedAccessControlList;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.PutObjectResult;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.http.fileupload.FileItemStream;
+import org.jeecg.common.util.CommonUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * @Description: 阿里云 oss 上传工具类(高依赖版)
+ * @Date: 2019/5/10
+ */
+@Slf4j
+public class OssBootUtil {
+
+    private static String endPoint;
+    private static String accessKeyId;
+    private static String accessKeySecret;
+    private static String bucketName;
+    private static String staticDomain;
+
+    public static void setEndPoint(String endPoint) {
+        OssBootUtil.endPoint = endPoint;
+    }
+
+    public static void setAccessKeyId(String accessKeyId) {
+        OssBootUtil.accessKeyId = accessKeyId;
+    }
+
+    public static void setAccessKeySecret(String accessKeySecret) {
+        OssBootUtil.accessKeySecret = accessKeySecret;
+    }
+
+    public static void setBucketName(String bucketName) {
+        OssBootUtil.bucketName = bucketName;
+    }
+
+    public static void setStaticDomain(String staticDomain) {
+        OssBootUtil.staticDomain = staticDomain;
+    }
+
+    public static String getStaticDomain() {
+        return staticDomain;
+    }
+
+    /**
+     * oss 工具客户端
+     */
+    private static OSSClient ossClient = null;
+
+    /**
+     * 上传文件至阿里云 OSS
+     * 文件上传成功,返回文件完整访问路径
+     * 文件上传失败,返回 null
+     *
+     * @param file    待上传文件
+     * @param fileDir 文件保存目录
+     * @return oss 中的相对文件路径
+     */
+    public static String upload(MultipartFile file, String fileDir,String customBucket) {
+        String FILE_URL = null;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        StringBuilder fileUrl = new StringBuilder();
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(customBucket)){
+            newBucket = customBucket;
+        }
+        try {
+            //判断桶是否存在,不存在则创建桶
+            if(!ossClient.doesBucketExist(newBucket)){
+                ossClient.createBucket(newBucket);
+            }
+            // 获取文件名
+            String orgName = file.getOriginalFilename();
+            orgName = CommonUtils.getFileName(orgName);
+            String fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
+            if (!fileDir.endsWith("/")) {
+                fileDir = fileDir.concat("/");
+            }
+            fileUrl = fileUrl.append(fileDir + fileName);
+
+            if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+                FILE_URL = staticDomain + "/" + fileUrl;
+            } else {
+                FILE_URL = "https://" + newBucket + "." + endPoint + "/" + fileUrl;
+            }
+            PutObjectResult result = ossClient.putObject(newBucket, fileUrl.toString(), file.getInputStream());
+            // 设置权限(公开读)
+//            ossClient.setBucketAcl(newBucket, CannedAccessControlList.PublicRead);
+            if (result != null) {
+                log.info("------OSS文件上传成功------" + fileUrl);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return FILE_URL;
+    }
+
+    /**
+     * 文件上传
+     * @param file
+     * @param fileDir
+     * @return
+     */
+    public static String upload(MultipartFile file, String fileDir) {
+        return upload(file, fileDir,null);
+    }
+
+    /**
+     * 上传文件至阿里云 OSS
+     * 文件上传成功,返回文件完整访问路径
+     * 文件上传失败,返回 null
+     *
+     * @param file    待上传文件
+     * @param fileDir 文件保存目录
+     * @return oss 中的相对文件路径
+     */
+    public static String upload(FileItemStream file, String fileDir) {
+        String FILE_URL = null;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        StringBuilder fileUrl = new StringBuilder();
+        try {
+            String suffix = file.getName().substring(file.getName().lastIndexOf('.'));
+            String fileName = UUID.randomUUID().toString().replace("-", "") + suffix;
+            if (!fileDir.endsWith("/")) {
+                fileDir = fileDir.concat("/");
+            }
+            fileUrl = fileUrl.append(fileDir + fileName);
+
+            if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+                FILE_URL = staticDomain + "/" + fileUrl;
+            } else {
+                FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl;
+            }
+            PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(), file.openStream());
+            // 设置权限(公开读)
+            ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+            if (result != null) {
+                log.info("------OSS文件上传成功------" + fileUrl);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return FILE_URL;
+    }
+
+    /**
+     * 删除文件
+     * @param url
+     */
+    public static void deleteUrl(String url) {
+        deleteUrl(url,null);
+    }
+
+    /**
+     * 删除文件
+     * @param url
+     */
+    public static void deleteUrl(String url,String bucket) {
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(bucket)){
+            newBucket = bucket;
+        }
+        String bucketUrl = "";
+        if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+            bucketUrl = staticDomain + "/" ;
+        } else {
+            bucketUrl = "https://" + newBucket + "." + endPoint + "/";
+        }
+        url = url.replace(bucketUrl,"");
+        ossClient.deleteObject(newBucket, url);
+    }
+
+    /**
+     * 删除文件
+     * @param fileName
+     */
+    public static void delete(String fileName) {
+        ossClient.deleteObject(bucketName, fileName);
+    }
+
+    /**
+     * 获取文件流
+     * @param objectName
+     * @param bucket
+     * @return
+     */
+    public static InputStream getOssFile(String objectName,String bucket){
+        InputStream inputStream = null;
+        try{
+            String newBucket = bucketName;
+            if(oConvertUtils.isNotEmpty(bucket)){
+                newBucket = bucket;
+            }
+            initOSS(endPoint, accessKeyId, accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(newBucket,objectName);
+            inputStream = new BufferedInputStream(ossObject.getObjectContent());
+        }catch (Exception e){
+            log.info("文件获取失败" + e.getMessage());
+        }
+        return inputStream;
+    }
+
+    /**
+     * 获取文件流
+     * @param objectName
+     * @return
+     */
+    public static InputStream getOssFile(String objectName){
+        return getOssFile(objectName,null);
+    }
+
+    /**
+     * 获取文件外链
+     * @param bucketName
+     * @param objectName
+     * @param expires
+     * @return
+     */
+    public static String getObjectURL(String bucketName, String objectName, Date expires) {
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        try{
+            if(ossClient.doesObjectExist(bucketName,objectName)){
+                URL url = ossClient.generatePresignedUrl(bucketName,objectName,expires);
+                return URLDecoder.decode(url.toString(),"UTF-8");
+            }
+        }catch (Exception e){
+            log.info("文件路径获取失败" + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 初始化 oss 客户端
+     *
+     * @return
+     */
+    private static OSSClient initOSS(String endpoint, String accessKeyId, String accessKeySecret) {
+        if (ossClient == null) {
+            ossClient = new OSSClient(endpoint,
+                    new DefaultCredentialProvider(accessKeyId, accessKeySecret),
+                    new ClientConfiguration());
+        }
+        return ossClient;
+    }
+
+
+    /**
+     * 上传文件到oss
+     * @param stream
+     * @param relativePath
+     * @return
+     */
+    public static String upload(InputStream stream, String relativePath) {
+        String FILE_URL = null;
+        String fileUrl = relativePath;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+            FILE_URL = staticDomain + "/" + relativePath;
+        } else {
+            FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl;
+        }
+        PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(),stream);
+        // 设置权限(公开读)
+        ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+        if (result != null) {
+            log.info("------OSS文件上传成功------" + fileUrl);
+        }
+        return FILE_URL;
+    }
+
+
+}

+ 77 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/SecurityTools.java

@@ -0,0 +1,77 @@
+package org.jeecg.common.util.security;
+
+import cn.hutool.core.codec.Base64Decoder;
+import cn.hutool.core.codec.Base64Encoder;
+import cn.hutool.crypto.SecureUtil;
+import cn.hutool.crypto.asymmetric.KeyType;
+import cn.hutool.crypto.asymmetric.RSA;
+import cn.hutool.crypto.asymmetric.Sign;
+import cn.hutool.crypto.asymmetric.SignAlgorithm;
+import cn.hutool.crypto.symmetric.AES;
+import cn.hutool.json.JSONObject;
+import org.jeecg.common.util.security.entity.*;
+
+import javax.crypto.SecretKey;
+import java.security.KeyPair;
+
+public class SecurityTools {
+    public static final String ALGORITHM = "AES/ECB/PKCS5Padding";
+
+    public static SecurityResp valid(SecurityReq req) {
+        SecurityResp resp=new SecurityResp();
+        String pubKey=req.getPubKey();
+        String aesKey=req.getAesKey();
+        String data=req.getData();
+        String signData=req.getSignData();
+        RSA rsa=new RSA(null, Base64Decoder.decode(pubKey));
+        Sign sign= new Sign(SignAlgorithm.SHA1withRSA,null,pubKey);
+
+
+
+        byte[] decryptAes = rsa.decrypt(aesKey, KeyType.PublicKey);
+        //log.info("rsa解密后的秘钥"+ Base64Encoder.encode(decryptAes));
+        AES aes = SecureUtil.aes(decryptAes);
+
+        String dencrptValue =aes.decryptStr(data);
+        //log.info("解密后报文"+dencrptValue);
+        resp.setData(new JSONObject(dencrptValue));
+
+        boolean verify = sign.verify(dencrptValue.getBytes(), Base64Decoder.decode(signData));
+        resp.setSuccess(verify);
+        return resp;
+    }
+
+    public static SecuritySignResp sign(SecuritySignReq req) {
+        SecretKey secretKey = SecureUtil.generateKey(ALGORITHM);
+        byte[] key= secretKey.getEncoded();
+        String prikey=req.getPrikey();
+        String data=req.getData();
+
+        AES aes = SecureUtil.aes(key);
+        aes.getSecretKey().getEncoded();
+        String encrptData =aes.encryptBase64(data);
+        RSA rsa=new RSA(prikey,null);
+        byte[] encryptAesKey = rsa.encrypt(secretKey.getEncoded(), KeyType.PrivateKey);
+        //log.info(("rsa加密过的秘钥=="+Base64Encoder.encode(encryptAesKey));
+
+        Sign sign= new Sign(SignAlgorithm.SHA1withRSA,prikey,null);
+        byte[] signed = sign.sign(data.getBytes());
+
+        //log.info(("签名数据===》》"+Base64Encoder.encode(signed));
+
+        SecuritySignResp resp=new SecuritySignResp();
+        resp.setAesKey(Base64Encoder.encode(encryptAesKey));
+        resp.setData(encrptData);
+        resp.setSignData(Base64Encoder.encode(signed));
+        return resp;
+    }
+    public static MyKeyPair generateKeyPair(){
+        KeyPair keyPair= SecureUtil.generateKeyPair(SignAlgorithm.SHA1withRSA.getValue(),2048);
+        String priKey= Base64Encoder.encode(keyPair.getPrivate().getEncoded());
+        String pubkey= Base64Encoder.encode(keyPair.getPublic().getEncoded());
+        MyKeyPair resp=new MyKeyPair();
+        resp.setPriKey(priKey);
+        resp.setPubKey(pubkey);
+        return resp;
+    }
+}

+ 9 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java

@@ -0,0 +1,9 @@
+package org.jeecg.common.util.security.entity;
+
+import lombok.Data;
+
+@Data
+public class MyKeyPair {
+    private String priKey;
+    private String pubKey;
+}

+ 11 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java

@@ -0,0 +1,11 @@
+package org.jeecg.common.util.security.entity;
+
+import lombok.Data;
+
+@Data
+public class SecurityReq {
+    private String data;
+    private String pubKey;
+    private String signData;
+    private String aesKey;
+}

+ 10 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java

@@ -0,0 +1,10 @@
+package org.jeecg.common.util.security.entity;
+
+import cn.hutool.json.JSONObject;
+import lombok.Data;
+
+@Data
+public class SecurityResp {
+    private Boolean success;
+    private JSONObject data;
+}

+ 9 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java

@@ -0,0 +1,9 @@
+package org.jeecg.common.util.security.entity;
+
+import lombok.Data;
+
+@Data
+public class SecuritySignReq {
+    private String data;
+    private String prikey;
+}

+ 10 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java

@@ -0,0 +1,10 @@
+package org.jeecg.common.util.security.entity;
+
+import lombok.Data;
+
+@Data
+public class SecuritySignResp {
+    private String data;
+    private String signData;
+    private String aesKey;
+}

+ 1 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java

@@ -8,9 +8,7 @@ import org.jeecg.common.util.oConvertUtils;
  * @Date 2019年02月14日
  * @Date 2019年02月14日
  */
  */
 public enum QueryRuleEnum {
 public enum QueryRuleEnum {
-    /**
-     * Query 规则 常量
-     */
+
     GT(">","大于"),
     GT(">","大于"),
     GE(">=","大于等于"),
     GE(">=","大于等于"),
     LT("<","小于"),
     LT("<","小于"),

+ 0 - 78
jeecg-boot-base-common/src/main/java/org/jeecg/modules/system/entity/SysPermissionDataRule.java

@@ -1,78 +0,0 @@
-package org.jeecg.modules.system.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-/**
- * <p>
- * 菜单权限规则表
- * </p>
- *
- * @Author huangzhilin
- * @since 2019-03-29
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-public class SysPermissionDataRule implements Serializable {
-	
-	private static final long serialVersionUID = 1L;
-	
-	/**
-	 * id
-	 */
-	@TableId(type = IdType.UUID)
-	private String id;
-	
-	/**
-	 * 对应的菜单id
-	 */
-	private String permissionId;
-	
-	/**
-	 * 规则名称
-	 */
-	private String ruleName;
-	
-	/**
-	 * 字段
-	 */
-	private String ruleColumn;
-	
-	/**
-	 * 条件
-	 */
-	private String ruleConditions;
-	
-	/**
-	 * 规则值
-	 */
-	private String ruleValue;
-	
-	/**
-	 * 创建时间
-	 */
-	private Date createTime;
-	
-	/**
-	 * 创建人
-	 */
-	private String createBy;
-	
-	/**
-	 * 修改时间
-	 */
-	private Date updateTime;
-	
-	/**
-	 * 修改人
-	 */
-	private String updateBy;
-}

File diff suppressed because it is too large
+ 51 - 0
jeecg-boot-base-common/src/main/resources/static/pca.json


+ 4 - 0
jeecg-boot-module-system/.gitattributes

@@ -0,0 +1,4 @@
+*.js linguist-language=Java
+*.css linguist-language=Java
+*.html linguist-language=Java
+*.vue linguist-language=Java

+ 42 - 19
jeecg-boot-module-system/pom.xml

@@ -47,42 +47,73 @@
             <version>2.0.2</version>
             <version>2.0.2</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-check</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>me.zhyd.oauth</groupId>
+            <artifactId>JustAuth</artifactId>
+            <version>1.15.6</version>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <groupId>org.slf4j</groupId>
             <artifactId>jcl-over-slf4j</artifactId>
             <artifactId>jcl-over-slf4j</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <groupId>cn.com.ctop</groupId>
-            <artifactId>module-media</artifactId>
+            <artifactId>module-common</artifactId>
             <version>2.0.2</version>
             <version>2.0.2</version>
         </dependency>
         </dependency>
-
         <dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <groupId>cn.com.ctop</groupId>
-            <artifactId>module-common</artifactId>
+            <artifactId>module-kuaishou</artifactId>
             <version>2.0.2</version>
             <version>2.0.2</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <groupId>cn.com.ctop</groupId>
-            <artifactId>module-kuaishou</artifactId>
+            <artifactId>module-toutiao</artifactId>
             <version>2.0.2</version>
             <version>2.0.2</version>
+            <scope>compile</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <groupId>cn.com.ctop</groupId>
-            <artifactId>module-toutiao</artifactId>
+            <artifactId>module-oa</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-shiwan</artifactId>
             <version>2.0.2</version>
             <version>2.0.2</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
+
         <dependency>
         <dependency>
             <groupId>cn.com.ctop</groupId>
             <groupId>cn.com.ctop</groupId>
-            <artifactId>performance-appraisal</artifactId>
+            <artifactId>module-alarm</artifactId>
             <version>2.0.2</version>
             <version>2.0.2</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
+
         <dependency>
         <dependency>
             <groupId>com.aliyun.oss</groupId>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>
             <version>3.5.0</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.crazycake</groupId>
+            <artifactId>shiro-redis</artifactId>
+            <version>3.1.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.shiro</groupId>
+                    <artifactId>shiro-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
         <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-csv -->
         <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-csv -->
         <dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <groupId>org.apache.commons</groupId>
@@ -108,12 +139,6 @@
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
-            <groupId>com.bstek.ureport</groupId>
-            <artifactId>ureport2-console</artifactId>
-            <version>2.2.9</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.poi</groupId>
             <groupId>org.apache.poi</groupId>
             <artifactId>poi</artifactId>
             <artifactId>poi</artifactId>
             <version>3.17</version>
             <version>3.17</version>
@@ -129,13 +154,6 @@
             <artifactId>poi-ooxml-schemas</artifactId>
             <artifactId>poi-ooxml-schemas</artifactId>
             <version>3.17</version>
             <version>3.17</version>
         </dependency>
         </dependency>
-
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>easyexcel</artifactId>
-            <version>1.1.2-beat1</version>
-        </dependency>
-
         <dependency>
         <dependency>
             <groupId>com.bstek.ureport</groupId>
             <groupId>com.bstek.ureport</groupId>
             <artifactId>ureport2-core</artifactId>
             <artifactId>ureport2-core</artifactId>
@@ -151,6 +169,11 @@
             <artifactId>pagehelper</artifactId>
             <artifactId>pagehelper</artifactId>
             <version>5.1.11</version>
             <version>5.1.11</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.jimureport</groupId>
+            <artifactId>spring-boot-starter-jimureport</artifactId>
+            <version>1.1-beta</version>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <dependencyManagement>
     <dependencyManagement>

+ 21 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -1,19 +1,19 @@
 package org.jeecg;
 package org.jeecg;
 
 
 import cn.com.ctop.common.module.utils.SpringUtils;
 import cn.com.ctop.common.module.utils.SpringUtils;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.catalina.Context;
+import org.apache.tomcat.util.scan.StandardJarScanner;
 import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.constant.AccountReportConstants;
-import org.jeecg.modules.system.util.ExtMappingJackson2HttpMessageConverter;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.context.annotation.Import;
 import org.springframework.core.env.Environment;
 import org.springframework.core.env.Environment;
-import org.springframework.web.client.RestTemplate;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
 
 import java.net.InetAddress;
 import java.net.InetAddress;
@@ -21,7 +21,9 @@ import java.net.UnknownHostException;
 
 
 @Slf4j
 @Slf4j
 @EnableSwagger2
 @EnableSwagger2
-@SpringBootApplication
+@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
+        org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class
+})
 @ComponentScan(basePackages = {"cn.com.ctop", "org.jeecg"})
 @ComponentScan(basePackages = {"cn.com.ctop", "org.jeecg"})
 @Configuration
 @Configuration
 @Import(SpringUtils.class)
 @Import(SpringUtils.class)
@@ -41,21 +43,23 @@ public class JeecgApplication {
                 "----------------------------------------------------------");
                 "----------------------------------------------------------");
     }
     }
 
 
-    @Bean
-    RestTemplate restTemplate(){
-        RestTemplate restTemplate = new RestTemplate();
-        restTemplate.getMessageConverters().add(new ExtMappingJackson2HttpMessageConverter());
-        return restTemplate;
-    }
-
-    @Bean
-    public PaginationInterceptor paginationInterceptor() {
-        return new PaginationInterceptor();
-    }
-    //加载数据字典
+    /**
+     * 加载数据字典
+     */
     @Bean
     @Bean
     public void instanceFiledDic(){
     public void instanceFiledDic(){
         AccountReportConstants.getInstance().init();
         AccountReportConstants.getInstance().init();
     }
     }
-
+    /**
+     * tomcat-embed-jasper引用后提示jar找不到的问题
+     */
+    @Bean
+    public TomcatServletWebServerFactory tomcatFactory() {
+        return new TomcatServletWebServerFactory() {
+            @Override
+            protected void postProcessContext(Context context) {
+                ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
+            }
+        };
+    }
 }
 }

+ 6 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGui.java

@@ -3,19 +3,18 @@ package org.jeecg;
 import org.jeecgframework.codegenerate.window.CodeWindow;
 import org.jeecgframework.codegenerate.window.CodeWindow;
 
 
 /**
 /**
- * @title: 单表代码生成器入口
+ * @Title: 单表代码生成器入口
+ * 【 GUI模式已弃用,请转移Online模式进行代码生成 】
  * @Author 张代浩
  * @Author 张代浩
- * @site www.jeecg.org
+ * @site www.jeecg.com
  * @Version:V1.0.1
  * @Version:V1.0.1
  */
  */
 public class JeecgOneGui {
 public class JeecgOneGui {
 
 
-    /**
-     * 详细使用手册: http://jeecg-boot.mydoc.io/?t=338140
-     */
+	/** 详细使用手册: http://doc.jeecg.com/1275846 */
     public static void main(String[] args) {
     public static void main(String[] args) {
-        new CodeWindow().pack();
-    }
+    	new CodeWindow().pack();
+	}
 }
 }
 
 
 
 

+ 30 - 23
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java

@@ -9,9 +9,10 @@ import org.jeecgframework.codegenerate.generate.pojo.onetomany.SubTableVo;
 
 
 /**
 /**
  * 代码生成器入口【一对多】
  * 代码生成器入口【一对多】
+ * 【 GUI模式已弃用,请转移Online模式进行代码生成 】
  * @Author 张代浩
  * @Author 张代浩
  * @site www.jeecg.org
  * @site www.jeecg.org
- * 
+ *
  */
  */
 public class JeecgOneToMainUtil {
 public class JeecgOneToMainUtil {
 
 
@@ -22,40 +23,46 @@ public class JeecgOneToMainUtil {
 	public static void main(String[] args) {
 	public static void main(String[] args) {
 		//第一步:设置主表配置
 		//第一步:设置主表配置
 		MainTableVo mainTable = new MainTableVo();
 		MainTableVo mainTable = new MainTableVo();
-        //表名
-        mainTable.setTableName("ctop_material_info");
-        //实体名
-        mainTable.setEntityName("MaterialInfo");
-        //包名
-        mainTable.setEntityPackage("ctop");
-        //描述
-        mainTable.setFtlDescription("素材库");
-		
+		mainTable.setTableName("jeecg_order_main");//表名
+		mainTable.setEntityName("GuiTestOrderMain");	 //实体名
+		mainTable.setEntityPackage("gui");	 //包名
+		mainTable.setFtlDescription("GUI订单管理");	 //描述
+
 		//第二步:设置子表集合配置
 		//第二步:设置子表集合配置
 		List<SubTableVo> subTables = new ArrayList<SubTableVo>();
 		List<SubTableVo> subTables = new ArrayList<SubTableVo>();
 		//[1].子表一
 		//[1].子表一
 		SubTableVo po = new SubTableVo();
 		SubTableVo po = new SubTableVo();
-        //表名
-        po.setTableName("ctop_material_ascription");
-        //实体名
-        po.setEntityName("MaterialAscription");
-        //包名
-        po.setEntityPackage("ctop");
-        //描述
-        po.setFtlDescription("素材归属");
+		po.setTableName("jeecg_order_customer");//表名
+		po.setEntityName("GuiTestOrderCustom");	    //实体名
+		po.setEntityPackage("gui");	        //包名
+		po.setFtlDescription("客户明细");       //描述
 		//子表外键参数配置
 		//子表外键参数配置
-		/*说明: 
+		/*说明:
 		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
 		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
 		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
 		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
 		 * c) 多个外键字段,采用逗号分隔;
 		 * c) 多个外键字段,采用逗号分隔;
-		*/
-        po.setForeignKeys(new String[]{"material_id"});
+		 */
+		po.setForeignKeys(new String[]{"order_id"});
 		subTables.add(po);
 		subTables.add(po);
+		//[2].子表二
+		SubTableVo po2 = new SubTableVo();
+		po2.setTableName("jeecg_order_ticket");		//表名
+		po2.setEntityName("GuiTestOrderTicket");			//实体名
+		po2.setEntityPackage("gui"); 				//包名
+		po2.setFtlDescription("产品明细");			//描述
+		//子表外键参数配置
+		/*说明:
+		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
+		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
+		 * c) 多个外键字段,采用逗号分隔;
+		 */
+		po2.setForeignKeys(new String[]{"order_id"});
+		subTables.add(po2);
 		mainTable.setSubTables(subTables);
 		mainTable.setSubTables(subTables);
-		
+
 		//第三步:一对多(父子表)数据模型,代码生成
 		//第三步:一对多(父子表)数据模型,代码生成
 		try {
 		try {
-			new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile();
+			new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile(null);
 		} catch (Exception e) {
 		} catch (Exception e) {
 			e.printStackTrace();
 			e.printStackTrace();
 		}
 		}

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/config/AutoPoiConfig.java

@@ -9,10 +9,11 @@ import org.springframework.context.annotation.Configuration;
  * @Date: 2018/2/7
  * @Date: 2018/2/7
  * @description: autopoi 配置类
  * @description: autopoi 配置类
  */
  */
+
 @Configuration
 @Configuration
 public class AutoPoiConfig {
 public class AutoPoiConfig {
-
-    /**
+	
+	/**
 	 * excel注解字典参数支持(导入导出字典值,自动翻译)
 	 * excel注解字典参数支持(导入导出字典值,自动翻译)
 	 * 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
 	 * 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
 	 * 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;
 	 * 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;

+ 38 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/MinioConfig.java

@@ -0,0 +1,38 @@
+package org.jeecg.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.MinioUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Minio文件上传配置文件
+ */
+@Slf4j
+@Configuration
+public class MinioConfig {
+    @Value(value = "${jeecg.minio.minio_url}")
+    private String minioUrl;
+    @Value(value = "${jeecg.minio.minio_name}")
+    private String minioName;
+    @Value(value = "${jeecg.minio.minio_pass}")
+    private String minioPass;
+    @Value(value = "${jeecg.minio.bucketName}")
+    private String bucketName;
+
+    @Bean
+    public void initMinio(){
+        if(!minioUrl.startsWith("http")){
+            minioUrl = "http://" + minioUrl;
+        }
+        if(!minioUrl.endsWith("/")){
+            minioUrl = minioUrl.concat("/");
+        }
+        MinioUtil.setMinioUrl(minioUrl);
+        MinioUtil.setMinioName(minioName);
+        MinioUtil.setMinioPass(minioPass);
+        MinioUtil.setBucketName(bucketName);
+    }
+
+}

+ 9 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/config/MybatisPlusConfig.java

@@ -1,10 +1,9 @@
 package org.jeecg.config;
 package org.jeecg.config;
 
 
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
 import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.annotation.MapperScan;
 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 com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 
 
 /**
 /**
  * 单数据源配置(jeecg.datasource.open = false时生效)
  * 单数据源配置(jeecg.datasource.open = false时生效)
@@ -12,18 +11,18 @@ import org.springframework.context.annotation.Configuration;
  *
  *
  */
  */
 @Configuration
 @Configuration
-@MapperScan(value = {"org.jeecg.modules.**.mapper*", "cn.com.ctop.**.mapper*"})
-
+@MapperScan(value={"org.jeecg.modules.**.mapper*","cn.com.ctop.**.mapper*"})
 public class MybatisPlusConfig {
 public class MybatisPlusConfig {
 
 
     /**
     /**
          *  分页插件
          *  分页插件
      */
      */
-    /*@Bean
+    @Bean
     public PaginationInterceptor paginationInterceptor() {
     public PaginationInterceptor paginationInterceptor() {
-        return new PaginationInterceptor();
-    }*/
-
+        // 设置sql的limit为无限制,默认是500
+        return new PaginationInterceptor().setLimit(-1);
+    }
+    
 //    /**
 //    /**
 //     * mybatis-plus SQL执行效率插件【生产环境可以关闭】
 //     * mybatis-plus SQL执行效率插件【生产环境可以关闭】
 //     */
 //     */
@@ -31,5 +30,6 @@ public class MybatisPlusConfig {
 //    public PerformanceInterceptor performanceInterceptor() {
 //    public PerformanceInterceptor performanceInterceptor() {
 //        return new PerformanceInterceptor();
 //        return new PerformanceInterceptor();
 //    }
 //    }
-
+    
+   
 }
 }

+ 0 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java

@@ -42,7 +42,6 @@ public class RedisConfig extends CachingConfigurerSupport {
 		return new KeyGenerator() {
 		return new KeyGenerator() {
 			@Override
 			@Override
 			public Object generate(Object target, Method method, Object... params) {
 			public Object generate(Object target, Method method, Object... params) {
-
 				StringBuilder sb = new StringBuilder();
 				StringBuilder sb = new StringBuilder();
 				sb.append(target.getClass().getName());
 				sb.append(target.getClass().getName());
 				sb.append(method.getDeclaringClass().getName());
 				sb.append(method.getDeclaringClass().getName());
@@ -97,11 +96,8 @@ public class RedisConfig extends CachingConfigurerSupport {
 		// RedisCacheConfiguration config =
 		// RedisCacheConfiguration config =
 		// RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair);
 		// RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair);
 		// 创建默认缓存配置对象
 		// 创建默认缓存配置对象
-
-		// 创建默认缓存配置对象
         //设置缓存默认有效期3小时;
         //设置缓存默认有效期3小时;
         RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(3));
         RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(3));
-
 		RedisCacheManager cacheManager = new RedisCacheManager(writer, config);
 		RedisCacheManager cacheManager = new RedisCacheManager(writer, config);
 		return cacheManager;
 		return cacheManager;
 	}
 	}

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/RestTemplateConfig.java

@@ -0,0 +1,24 @@
+package org.jeecg.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
+        return new RestTemplate(factory);
+    }
+
+    @Bean
+    public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
+        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
+        factory.setReadTimeout(5000);//ms
+        factory.setConnectTimeout(15000);//ms
+        return factory;
+    }
+}

+ 100 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -7,12 +7,17 @@ import org.apache.shiro.spring.LifecycleBeanPostProcessor;
 import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
 import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
 import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
 import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
 import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
 import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.crazycake.shiro.RedisCacheManager;
+import org.crazycake.shiro.RedisManager;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.shiro.authc.ShiroRealm;
 import org.jeecg.modules.shiro.authc.ShiroRealm;
 import org.jeecg.modules.shiro.authc.aop.JwtFilter;
 import org.jeecg.modules.shiro.authc.aop.JwtFilter;
 import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
 import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+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 org.springframework.context.annotation.DependsOn;
 import org.springframework.context.annotation.DependsOn;
+import org.springframework.util.StringUtils;
 
 
 import javax.servlet.Filter;
 import javax.servlet.Filter;
 import java.util.HashMap;
 import java.util.HashMap;
@@ -27,6 +32,14 @@ import java.util.Map;
 
 
 @Configuration
 @Configuration
 public class ShiroConfig {
 public class ShiroConfig {
+    @Value("${spring.redis.port}")
+    private String port;
+
+    @Value("${spring.redis.host}")
+    private String host;
+
+    @Value("${spring.redis.password}")
+    private String redisPassword;
 
 
     /**
     /**
      * Filter Chain定义说明
      * Filter Chain定义说明
@@ -40,12 +53,15 @@ public class ShiroConfig {
         ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
         ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
         shiroFilterFactoryBean.setSecurityManager(securityManager);
         shiroFilterFactoryBean.setSecurityManager(securityManager);
         // 拦截器
         // 拦截器
-        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
+        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
         // 配置不会被拦截的链接 顺序判断
         // 配置不会被拦截的链接 顺序判断
         //登录接口排除
         //登录接口排除
+        filterChainDefinitionMap.put("/sys/mLogin", "anon");
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
-
+        filterChainDefinitionMap.put("/ctop/rule/**", "anon");
+        //第三方登录
+        filterChainDefinitionMap.put("/thirdLogin/**", "anon");
         //获取加密串
         //获取加密串
         filterChainDefinitionMap.put("/sys/getEncryptedString", "anon");
         filterChainDefinitionMap.put("/sys/getEncryptedString", "anon");
         //短信验证码
         //短信验证码
@@ -74,7 +90,10 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
         filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
         filterChainDefinitionMap.put("/template/creative/words/get", "anon");
         filterChainDefinitionMap.put("/template/creative/words/get", "anon");
         filterChainDefinitionMap.put("template/bytedance/industry/list", "anon");
         filterChainDefinitionMap.put("template/bytedance/industry/list", "anon");
-
+        //积木报表排除
+        filterChainDefinitionMap.put("/jmreport/**", "anon");
+        filterChainDefinitionMap.put("/**/*.js.map", "anon");
+        filterChainDefinitionMap.put("/**/*.css.map", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/creative/words/get", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/creative/words/get", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/action/text", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/action/text", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/industry/list", "anon");
         filterChainDefinitionMap.put("/bytedance/batch/industry/list", "anon");
@@ -83,6 +102,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
         filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
         filterChainDefinitionMap.put("/ctop/byteDance/homePage/report/*", "anon");
         filterChainDefinitionMap.put("/ctop/byteDance/homePage/report/*", "anon");
         filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
         filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
+        filterChainDefinitionMap.put("/dimension/report/*", "anon");
 
 
         filterChainDefinitionMap.put("/v1/**", "anon");
         filterChainDefinitionMap.put("/v1/**", "anon");
 
 
@@ -105,6 +125,12 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/kuaishou/report", "anon");
         filterChainDefinitionMap.put("/kuaishou/report", "anon");
         filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
         filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
         filterChainDefinitionMap.put("/**/*.mp4", "anon");
         filterChainDefinitionMap.put("/**/*.mp4", "anon");
+        //activiti
+        filterChainDefinitionMap.put("/activiti/**", "anon");
+        filterChainDefinitionMap.put("/diagram-viewer/**", "anon");
+        filterChainDefinitionMap.put("/editor-app/**", "anon");
+        //大屏设计器排除
+        filterChainDefinitionMap.put("/big/screen/**", "anon");
 
 
         //性能监控
         //性能监控
         filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
         filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
@@ -124,7 +150,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
         filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
         filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
         filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
         filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
-        filterChainDefinitionMap.put("/template/convert/**", "anon");//文件上传接口
+        filterChainDefinitionMap.put("/template/convert/**", "anon");
         filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
 
 
@@ -134,16 +160,44 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");
-
+        filterChainDefinitionMap.put("/test/testdouyinmusic", "anon");
+        filterChainDefinitionMap.put("/test/syncDouyinMusic", "anon");
+        filterChainDefinitionMap.put("/test/parseDouyinMusic", "anon");
         filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get", "anon");
         filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get", "anon");
 
 
         filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
         filterChainDefinitionMap.put("/zip/download", "anon");
         filterChainDefinitionMap.put("/zip/download", "anon");
+        //WebSocket
+        filterChainDefinitionMap.put("/websocket/*", "anon");
         //爬虫接口
         //爬虫接口
         filterChainDefinitionMap.put("/graphql/video", "anon");
         filterChainDefinitionMap.put("/graphql/video", "anon");
         filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/job/test/*", "anon");
         filterChainDefinitionMap.put("/job/test/*", "anon");
+        filterChainDefinitionMap.put("/third/*", "anon");
+        filterChainDefinitionMap.put("/ctop/kuaishou/dailyPage/**", "anon");
+        filterChainDefinitionMap.put("/rest/script/*", "anon");
+        filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
+        filterChainDefinitionMap.put("/ctop/report/bytedance/*", "anon");
+        filterChainDefinitionMap.put("/shiwan/shiwanFileUpload/*", "anon");
+        filterChainDefinitionMap.put("/oa/wechatNoList/*", "anon");
+        filterChainDefinitionMap.put("/ruleGroup/*", "anon");
+        filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
+        filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCreativeTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchGroupTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCampaignTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/**", "anon");
+        filterChainDefinitionMap.put("/batch/kuaiShouGroupTemplate/*", "anon");
+        filterChainDefinitionMap.put("/kuaishouBatch/**", "anon");
+        filterChainDefinitionMap.put("/kuaishou/creative/*", "anon");
+        filterChainDefinitionMap.put("/ai/aiKuaiShouAppInfo/*", "anon");
+        filterChainDefinitionMap.put("/explore/*", "anon");
+        filterChainDefinitionMap.put("/ai/batchUpdate/*", "anon");
+        filterChainDefinitionMap.put("/ctop/kuaishou/videoReport/*", "anon");
+        filterChainDefinitionMap.put("/ai/create/*", "anon");
+        //filterChainDefinitionMap.put("/overView/*", "anon");
+        filterChainDefinitionMap.put("/kuaishouCrowdPack/**", "anon");
 
 
         // 添加自己的过滤器并且取名为jwt
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);
         Map<String, Filter> filterMap = new HashMap<>(1);
@@ -188,11 +242,17 @@ public class ShiroConfig {
     public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
     public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
         DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
         DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
         defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
         defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        /**
+         * 解决重复代理问题 github#994
+         * 添加前缀判断 不匹配 任何Advisor
+         */
+        defaultAdvisorAutoProxyCreator.setUsePrefix(true);
+        defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
         return defaultAdvisorAutoProxyCreator;
         return defaultAdvisorAutoProxyCreator;
     }
     }
 
 
     @Bean
     @Bean
-    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+    public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
         return new LifecycleBeanPostProcessor();
         return new LifecycleBeanPostProcessor();
     }
     }
 
 
@@ -203,4 +263,38 @@ public class ShiroConfig {
         return advisor;
         return advisor;
     }
     }
 
 
+    /**
+     * cacheManager 缓存 redis实现
+     * 使用的是shiro-redis开源插件
+     *
+     * @return
+     */
+    public RedisCacheManager redisCacheManager() {
+        RedisCacheManager redisCacheManager = new RedisCacheManager();
+        redisCacheManager.setRedisManager(redisManager());
+        //redis中针对不同用户缓存(此处的id需要对应user实体中的id字段,用于唯一标识)
+        redisCacheManager.setPrincipalIdFieldName("id");
+        //用户权限信息缓存时间
+        redisCacheManager.setExpire(200000);
+        return redisCacheManager;
+    }
+
+    /**
+     * 配置shiro redisManager
+     * 使用的是shiro-redis开源插件
+     *
+     * @return
+     */
+    @Bean
+    public RedisManager redisManager() {
+        RedisManager redisManager = new RedisManager();
+        redisManager.setHost(host);
+        redisManager.setPort(oConvertUtils.getInt(port));
+        redisManager.setTimeout(0);
+        if (!StringUtils.isEmpty(redisPassword)) {
+            redisManager.setPassword(redisPassword);
+        }
+        return redisManager;
+    }
+
 }
 }

+ 0 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/StaticConfig.java


Some files were not shown because too many files changed in this diff