();
@@ -80,7 +82,7 @@ public class QueryGenerator {
log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
return queryWrapper;
}
-
+
/**
* 组装Mybatis Plus 查询条件
* 使用此方法 需要有如下几点注意:
@@ -109,7 +111,10 @@ public class QueryGenerator {
}
}
- String name, type;
+ String name, type, column;
+ // update-begin--Author:taoyan Date:20200923 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
+ //定义实体字段和数据库字段名称的映射 高级查询中 只能获取实体字段 如果设置TableField注解 那么查询条件会出问题
+ Map fieldColumnMap = new HashMap();
for (int i = 0; i < origDescriptors.length; i++) {
//aliasName = origDescriptors[i].getName(); mybatis 不存在实体属性 不用处理别名的情况
name = origDescriptors[i].getName();
@@ -120,52 +125,24 @@ public class QueryGenerator {
}
Object value = PropertyUtils.getSimpleProperty(searchObj, name);
- // update-begin--Author:taoyan Date:20200910 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
- //如果字段加注解了@TableField(exist = false),不走DB查询
- //TODO 存在缺陷,这个写法 clazz.getDeclaredField(name) 获取不到继承的父实体字段
- try {
- if (oConvertUtils.isNotEmpty(value)) {
- Field field = searchObj.getClass().getDeclaredField(name);
- if (field != null) {
- TableField tableField = field.getAnnotation(TableField.class);
- if (tableField != null && tableField.exist() == false) {
- continue;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
+ column = getTableFieldName(searchObj.getClass(), name);
+ if(column==null){
+ //column为null只有一种情况 那就是 添加了注解@TableField(exist = false) 后续都不用处理了
+ continue;
}
- // update-end--Author:taoyan Date:20200910 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询 -------
-
+ fieldColumnMap.put(name,column);
//数据权限查询
if(ruleMap.containsKey(name)) {
- addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
+ addRuleToQueryWrapper(ruleMap.get(name), column, 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);
- }
- //多值查询
- if (parameterMap != null && parameterMap.containsKey(name + MULTI)) {
- endValue = parameterMap.get(name + MULTI)[0].trim();
- addQueryByRule(queryWrapper, name.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
- }
-
+ //区间查询
+ doIntervalQuery(queryWrapper, parameterMap, type, name, column);
//判断单值 参数带不同标识字符串 走不同的查询
//TODO 这种前后带逗号的支持分割后模糊查询需要否 使多选字段的查询生效
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);
+ final String field = oConvertUtils.camelToUnderline(column);
if(vals.length>1) {
queryWrapper.and(j -> {
j = j.like(field,vals[0]);
@@ -187,7 +164,7 @@ public class QueryGenerator {
//rule = QueryRuleEnum.LIKE;
//}
// add -end 添加判断为字符串时设为全模糊查询
- addEasyQuery(queryWrapper, name, rule, value);
+ addEasyQuery(queryWrapper, column, rule, value);
}
} catch (Exception e) {
@@ -198,9 +175,38 @@ public class QueryGenerator {
doMultiFieldsOrder(queryWrapper, parameterMap);
//高级查询
- doSuperQuery(queryWrapper, parameterMap);
+ doSuperQuery(queryWrapper, parameterMap, fieldColumnMap);
+ // update-end--Author:taoyan Date:20200923 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
}
+
+
+ /**
+ * 区间查询
+ * @param queryWrapper query对象
+ * @param parameterMap 参数map
+ * @param type 字段类型
+ * @param filedName 字段名称
+ * @param columnName 列名称
+ */
+ private static void doIntervalQuery(QueryWrapper> queryWrapper, Map parameterMap, String type, String filedName, String columnName) throws ParseException {
+ // 添加 判断是否有区间值
+ String endValue = null,beginValue = null;
+ if (parameterMap != null && parameterMap.containsKey(filedName + BEGIN)) {
+ beginValue = parameterMap.get(filedName + BEGIN)[0].trim();
+ addQueryByRule(queryWrapper, columnName, type, beginValue, QueryRuleEnum.GE);
+
+ }
+ if (parameterMap != null && parameterMap.containsKey(filedName + END)) {
+ endValue = parameterMap.get(filedName + END)[0].trim();
+ addQueryByRule(queryWrapper, columnName, type, endValue, QueryRuleEnum.LE);
+ }
+ //多值查询
+ if (parameterMap != null && parameterMap.containsKey(filedName + MULTI)) {
+ endValue = parameterMap.get(filedName + MULTI)[0].trim();
+ addQueryByRule(queryWrapper, columnName.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
+ }
+ }
//多字段排序 TODO 需要修改前端
public static void doMultiFieldsOrder(QueryWrapper> queryWrapper,Map parameterMap) {
@@ -230,10 +236,11 @@ public class QueryGenerator {
/**
* 高级查询
- * @param queryWrapper
- * @param parameterMap
+ * @param queryWrapper 查询对象
+ * @param parameterMap 参数对象
+ * @param fieldColumnMap 实体字段和数据库列对应的map
*/
- public static void doSuperQuery(QueryWrapper> queryWrapper,Map parameterMap) {
+ public static void doSuperQuery(QueryWrapper> queryWrapper,Map parameterMap, Map fieldColumnMap) {
if(parameterMap!=null&& parameterMap.containsKey(SUPER_QUERY_PARAMS)){
String superQueryParams = parameterMap.get(SUPER_QUERY_PARAMS)[0];
String superQueryMatchType = parameterMap.get(SUPER_QUERY_MATCH_TYPE) != null ? parameterMap.get(SUPER_QUERY_MATCH_TYPE)[0] : MatchTypeEnum.AND.getValue();
@@ -254,7 +261,7 @@ public class QueryGenerator {
&& oConvertUtils.isNotEmpty(rule.getVal())) {
log.debug("SuperQuery ==> " + rule.toString());
- addEasyQuery(andWrapper, rule.getField(), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
+ addEasyQuery(andWrapper, fieldColumnMap.get(rule.getField()), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
// 如果拼接方式是OR,就拼接OR
if (MatchTypeEnum.OR == matchType && i < (conditions.size() - 1)) {
@@ -346,10 +353,16 @@ public class QueryGenerator {
String val = (value + "").toString().trim();
if (rule == QueryRuleEnum.LIKE) {
value = val.substring(1, val.length() - 1);
+ //mysql 模糊查询之特殊字符下划线 (_、\)
+ value = specialStrConvert(value.toString());
} else if (rule == QueryRuleEnum.LEFT_LIKE || rule == QueryRuleEnum.NE) {
value = val.substring(1);
+ //mysql 模糊查询之特殊字符下划线 (_、\)
+ value = specialStrConvert(value.toString());
} else if (rule == QueryRuleEnum.RIGHT_LIKE) {
value = val.substring(0, val.length() - 1);
+ //mysql 模糊查询之特殊字符下划线 (_、\)
+ value = specialStrConvert(value.toString());
} else if (rule == QueryRuleEnum.IN) {
value = val.split(",");
} else {
@@ -707,6 +720,10 @@ public class QueryGenerator {
return " '"+str+"' ";
}
}else {
+ // 如果不是字符串 有一种特殊情况 popup调用都走这个逻辑 参数传递的可能是“‘admin’”这种格式的
+ if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType()) && str.endsWith("'") && str.startsWith("'")){
+ return " N"+str;
+ }
return value.toString();
}
}
@@ -790,13 +807,17 @@ public class QueryGenerator {
sb.append(sql_and+getSqlRuleValue(ruleMap.get(c).getRuleValue()));
}
}
- String name;
+ String name, column;
for (int i = 0; i < origDescriptors.length; i++) {
name = origDescriptors[i].getName();
if (judgedIsUselessField(name)) {
continue;
}
if(ruleMap.containsKey(name)) {
+ column = getTableFieldName(clazz, name);
+ if(column==null){
+ continue;
+ }
SysPermissionDataRuleModel dataRule = ruleMap.get(name);
QueryRuleEnum rule = QueryRuleEnum.getByValue(dataRule.getRuleConditions());
Class propType = origDescriptors[i].getPropertyType();
@@ -807,7 +828,7 @@ public class QueryGenerator {
}else {
value = NumberUtils.parseNumber(dataRule.getRuleValue(),propType);
}
- String filedSql = getSingleSqlByRule(rule, oConvertUtils.camelToUnderline(name), value,isString);
+ String filedSql = getSingleSqlByRule(rule, oConvertUtils.camelToUnderline(column), value,isString);
sb.append(sql_and+filedSql);
}
}
@@ -830,14 +851,18 @@ public class QueryGenerator {
queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));
}
}
- String name;
+ String name, column;
for (int i = 0; i < origDescriptors.length; i++) {
name = origDescriptors[i].getName();
if (judgedIsUselessField(name)) {
continue;
}
+ column = getTableFieldName(clazz, name);
+ if(column==null){
+ continue;
+ }
if(ruleMap.containsKey(name)) {
- addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
+ addRuleToQueryWrapper(ruleMap.get(name), column, origDescriptors[i].getPropertyType(), queryWrapper);
}
}
}
@@ -895,5 +920,87 @@ public class QueryGenerator {
private static String getDbType(){
return CommonUtils.getDatabaseType();
}
-
+
+
+ /**
+ * 获取class的 包括父类的
+ * @param clazz
+ * @return
+ */
+ private static List getClassFields(Class> clazz) {
+ List list = new ArrayList();
+ Field[] fields;
+ do{
+ fields = clazz.getDeclaredFields();
+ for(int i = 0;i clazz, String name) {
+ try {
+ //如果字段加注解了@TableField(exist = false),不走DB查询
+ Field field = null;
+ try {
+ field = clazz.getDeclaredField(name);
+ } catch (NoSuchFieldException e) {
+ //e.printStackTrace();
+ }
+
+ //如果为空,则去父类查找字段
+ if (field == null) {
+ List allFields = getClassFields(clazz);
+ List searchFields = allFields.stream().filter(a -> a.getName().equals(name)).collect(Collectors.toList());
+ if(searchFields!=null && searchFields.size()>0){
+ field = searchFields.get(0);
+ }
+ }
+
+ if (field != null) {
+ TableField tableField = field.getAnnotation(TableField.class);
+ if (tableField != null){
+ if(tableField.exist() == false){
+ //如果设置了TableField false 这个字段不需要处理
+ return null;
+ }else{
+ String column = tableField.value();
+ //如果设置了TableField value 这个字段是实体字段
+ if(!"".equals(column)){
+ return column;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return name;
+ }
+
+ /**
+ * mysql 模糊查询之特殊字符下划线 (_、\)
+ *
+ * @param value:
+ * @Return: java.lang.String
+ */
+ private static String specialStrConvert(String value) {
+ if (DataBaseConstant.DB_TYPE_MYSQL.equals(getDbType())) {
+ String[] special_str = QueryGenerator.LIKE_MYSQL_SPECIAL_STRS.split(",");
+ for (String str : special_str) {
+ if (value.indexOf(str) !=-1) {
+ value = value.replace(str, "\\" + str);
+ }
+ }
+ }
+ return value;
+ }
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/query/QueryRuleEnum.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JeecgDataAutorUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JwtUtil.java
similarity index 96%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JwtUtil.java
index 2fe4d62f..e3a9420f 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JwtUtil.java
@@ -201,8 +201,8 @@ public class JwtUtil {
return returnValue;
}
- public static void main(String[] args) {
- String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
- System.out.println(JwtUtil.getUsername(token));
- }
+// public static void main(String[] args) {
+// String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
+// System.out.println(JwtUtil.getUsername(token));
+// }
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/ComboModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/ComboModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/ComboModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/ComboModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DictModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DictModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictQuery.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DictQuery.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DictQuery.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DictQuery.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/DynamicDataSourceModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/LoginUser.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/LoginUser.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/LoginUser.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysCategoryModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysDepartModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysPermissionDataRuleModel.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/vo/SysUserCacheInfo.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserType.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/BrowserType.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserType.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/BrowserType.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/BrowserUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/BrowserUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/BrowserUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/CommonUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/CommonUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/CommonUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/CommonUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsEnum.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DySmsEnum.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsEnum.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DySmsEnum.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DySmsHelper.java
similarity index 94%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DySmsHelper.java
index 654bedd5..e619de46 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DySmsHelper.java
@@ -114,10 +114,9 @@ public class DySmsHelper {
}
- public static void main(String[] args) throws ClientException, InterruptedException {
- JSONObject obj = new JSONObject();
- obj.put("code", "1234");
- sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
-
- }
+// public static void main(String[] args) throws ClientException, InterruptedException {
+// JSONObject obj = new JSONObject();
+// obj.put("code", "1234");
+// sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
+// }
}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FieldPresenceUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FieldPresenceUtil.java
new file mode 100644
index 00000000..2a47e17c
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FieldPresenceUtil.java
@@ -0,0 +1,436 @@
+package org.jeecg.common.util;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.POIXMLDocument;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecgframework.core.util.ApplicationContextUtil;
+import org.jeecgframework.dict.service.AutoPoiDictServiceI;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecgframework.poi.excel.annotation.ExcelCollection;
+import org.jeecgframework.poi.excel.annotation.ExcelTarget;
+import org.jeecgframework.poi.excel.annotation.ExcelVerify;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.entity.params.ExcelCollectionParams;
+import org.jeecgframework.poi.excel.entity.params.ExcelImportEntity;
+import org.jeecgframework.poi.excel.entity.params.ExcelVerifyEntity;
+import org.jeecgframework.poi.exception.excel.ExcelImportException;
+import org.jeecgframework.poi.exception.excel.enums.ExcelImportEnum;
+import org.jeecgframework.poi.util.ExcelUtil;
+import org.jeecgframework.poi.util.PoiPublicUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 验证excel标题是否存在,当前默认有0.8(80%)即可通过验证
+ */
+public class FieldPresenceUtil {
+ /**当有标题到达多少可以通过验证*/
+ public static final Double NUM = 0.8;
+
+ public static Boolean fieldPresence(InputStream inputstream, Class> pojoClass, ImportParams params) {
+ Workbook book = null;
+ int errorNum = 0;
+ int successNum = 0;
+ if (!(inputstream.markSupported())) {
+ inputstream = new PushbackInputStream(inputstream, 8);
+ }
+ try {
+ if (POIFSFileSystem.hasPOIFSHeader(inputstream)) {
+ book = new HSSFWorkbook(inputstream);
+ } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) {
+ book = new XSSFWorkbook(OPCPackage.open(inputstream));
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InvalidFormatException e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < params.getSheetNum(); i++) {
+ Row row = null;
+ //跳过表头和标题行
+ Iterator rows;
+ try{
+ rows= book.getSheetAt(i).rowIterator();
+ }catch (Exception e){
+ //为空说明读取不到,故不是excel
+ throw new RuntimeException("请导入正确格式的excel文件!");
+ }
+
+
+ for (int j = 0; j < params.getTitleRows() + params.getHeadRows(); j++) {
+ try{
+ row = rows.next();
+ }catch (NoSuchElementException e){
+ //为空说明标题不出在,excel格式错误
+ throw new RuntimeException("请填写内容标题!");
+ }
+ }
+ Sheet sheet = book.getSheetAt(i);
+ Map titlemap = null;
+ try {
+ titlemap = getTitleMap(sheet, params);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Set columnIndexSet = titlemap.keySet();
+ Integer maxColumnIndex = Collections.max(columnIndexSet);
+ Integer minColumnIndex = Collections.min(columnIndexSet);
+ while (rows.hasNext() && (row == null || sheet.getLastRowNum() - row.getRowNum() > params.getLastOfInvalidRow())) {
+ row = rows.next();
+ Map excelParams = new HashMap();
+ List excelCollection = new ArrayList();
+ String targetId = null;
+ if (!Map.class.equals(pojoClass)) {
+ Field fileds[] = PoiPublicUtil.getClassFields(pojoClass);
+ ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class);
+ if (etarget != null) {
+ targetId = etarget.value();
+ }
+ try {
+ getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ int firstCellNum = row.getFirstCellNum();
+ if (firstCellNum > minColumnIndex) {
+ firstCellNum = minColumnIndex;
+ }
+ int lastCellNum = row.getLastCellNum();
+ if (lastCellNum < maxColumnIndex + 1) {
+ lastCellNum = maxColumnIndex + 1;
+ }
+ for (int j = firstCellNum, le = lastCellNum; j < le; j++) {
+ String titleString = (String) titlemap.get(j);
+ if (excelParams.containsKey(titleString) || Map.class.equals(pojoClass)) {
+ successNum+=1;
+ }else{
+ if(excelCollection.size()>0){
+ Iterator var33 = excelCollection.iterator();
+ ExcelCollectionParams param = (ExcelCollectionParams)var33.next();
+ if (param.getExcelParams().containsKey(titleString)) {
+ successNum+=1;
+ }else{
+ errorNum+=1;
+ }
+ }else{
+ errorNum+=1;
+ }
+ }
+ }
+ if(successNumerrorNum){
+ if(errorNum>0){
+ double newNumber = (double) successNum / (successNum + errorNum);
+ BigDecimal bg = new BigDecimal(newNumber);
+ double f1 = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
+ if(f1 getTitleMap(Sheet sheet, ImportParams params) throws Exception {
+ Map titlemap = new HashMap();
+ Iterator cellTitle = null;
+ String collectionName = null;
+ Row headRow = null;
+ int headBegin = params.getTitleRows();
+ int allRowNum = sheet.getPhysicalNumberOfRows();
+ while(headRow == null && headBegin < allRowNum){
+ headRow = sheet.getRow(headBegin++);
+ }
+ if(headRow==null){
+ throw new Exception("不识别该文件");
+ }
+ if (ExcelUtil.isMergedRegion(sheet, headRow.getRowNum(), 0)) {
+ params.setHeadRows(2);
+ }else{
+ params.setHeadRows(1);
+ }
+ cellTitle = headRow.cellIterator();
+ while (cellTitle.hasNext()) {
+ Cell cell = cellTitle.next();
+ String value = getKeyValue(cell);
+ if (StringUtils.isNotEmpty(value)) {
+ titlemap.put(cell.getColumnIndex(), value);//加入表头列表
+ }
+ }
+
+ //多行表头
+ for (int j = headBegin; j < headBegin + params.getHeadRows()-1; j++) {
+ headRow = sheet.getRow(j);
+ cellTitle = headRow.cellIterator();
+ while (cellTitle.hasNext()) {
+ Cell cell = cellTitle.next();
+ String value = getKeyValue(cell);
+ if (StringUtils.isNotEmpty(value)) {
+ int columnIndex = cell.getColumnIndex();
+ //当前cell的上一行是否为合并单元格
+ if(ExcelUtil.isMergedRegion(sheet, cell.getRowIndex()-1, columnIndex)){
+ collectionName = ExcelUtil.getMergedRegionValue(sheet, cell.getRowIndex()-1, columnIndex);
+ if(params.isIgnoreHeader(collectionName)){
+ titlemap.put(cell.getColumnIndex(), value);
+ }else{
+ titlemap.put(cell.getColumnIndex(), collectionName + "_" + value);
+ }
+ }else{
+ titlemap.put(cell.getColumnIndex(), value);
+ }
+ }
+ }
+ }
+ return titlemap;
+ }
+ /**
+ * 获取key的值,针对不同类型获取不同的值
+ *
+ * @Author JEECG
+ * @date 20201023
+ * @param cell
+ * @return
+ */
+ private static String getKeyValue(Cell cell) {
+ if(cell==null){
+ return null;
+ }
+ Object obj = null;
+ switch (cell.getCellType()) {
+ case Cell.CELL_TYPE_STRING:
+ obj = cell.getStringCellValue();
+ break;
+ case Cell.CELL_TYPE_BOOLEAN:
+ obj = cell.getBooleanCellValue();
+ break;
+ case Cell.CELL_TYPE_NUMERIC:
+ obj = cell.getNumericCellValue();
+ break;
+ case Cell.CELL_TYPE_FORMULA:
+ obj = cell.getCellFormula();
+ break;
+ }
+ return obj == null ? null : obj.toString().trim();
+ }
+
+ /**
+ * 获取需要导出的全部字段
+ *
+ *
+ *
+ * @param targetId
+ * 目标ID
+ * @param fields
+ * @param excelCollection
+ * @throws Exception
+ */
+ public static void getAllExcelField(String targetId, Field[] fields, Map excelParams, List excelCollection, Class> pojoClass, List getMethods) throws Exception {
+ ExcelImportEntity excelEntity = null;
+ for (int i = 0; i < fields.length; i++) {
+ Field field = fields[i];
+ if (PoiPublicUtil.isNotUserExcelUserThis(null, field, targetId)) {
+ continue;
+ }
+ if (PoiPublicUtil.isCollection(field.getType())) {
+ // 集合对象设置属性
+ ExcelCollectionParams collection = new ExcelCollectionParams();
+ collection.setName(field.getName());
+ Map temp = new HashMap();
+ ParameterizedType pt = (ParameterizedType)field.getGenericType();
+ Class> clz = (Class)pt.getActualTypeArguments()[0];
+ collection.setType(clz);
+ getExcelFieldList(targetId, PoiPublicUtil.getClassFields(clz), clz, temp, (List)null);
+ collection.setExcelParams(temp);
+ collection.setExcelName(((ExcelCollection)field.getAnnotation(ExcelCollection.class)).name());
+ additionalCollectionName(collection);
+ excelCollection.add(collection);
+ } else if (PoiPublicUtil.isJavaClass(field)) {
+ addEntityToMap(targetId, field, (ExcelImportEntity)excelEntity, pojoClass, getMethods, excelParams);
+ } else {
+ List newMethods = new ArrayList();
+ if (getMethods != null) {
+ newMethods.addAll(getMethods);
+ }
+ newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass));
+ getAllExcelField(targetId, PoiPublicUtil.getClassFields(field.getType()), excelParams, excelCollection, field.getType(), newMethods);
+ }
+ }
+ }
+ public static void getExcelFieldList(String targetId, Field[] fields, Class> pojoClass, Map temp, List getMethods) throws Exception {
+ ExcelImportEntity excelEntity = null;
+ for (int i = 0; i < fields.length; i++) {
+ Field field = fields[i];
+ if (!PoiPublicUtil.isNotUserExcelUserThis((List)null, field, targetId)) {
+ if (PoiPublicUtil.isJavaClass(field)) {
+ addEntityToMap(targetId, field, (ExcelImportEntity)excelEntity, pojoClass, getMethods, temp);
+ } else {
+ List newMethods = new ArrayList();
+ if (getMethods != null) {
+ newMethods.addAll(getMethods);
+ }
+
+ newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass, field.getType()));
+ getExcelFieldList(targetId, PoiPublicUtil.getClassFields(field.getType()), field.getType(), temp, newMethods);
+ }
+ }
+ }
+ }
+ /**
+ * 追加集合名称到前面
+ *
+ * @param collection
+ */
+ private static void additionalCollectionName(ExcelCollectionParams collection) {
+ Set keys = new HashSet();
+ keys.addAll(collection.getExcelParams().keySet());
+ Iterator var3 = keys.iterator();
+
+ while(var3.hasNext()) {
+ String key = (String)var3.next();
+ collection.getExcelParams().put(collection.getExcelName() + "_" + key, collection.getExcelParams().get(key));
+ collection.getExcelParams().remove(key);
+ }
+ }
+ /**
+ * 把这个注解解析放到类型对象中
+ *
+ * @param targetId
+ * @param field
+ * @param excelEntity
+ * @param pojoClass
+ * @param getMethods
+ * @param temp
+ * @throws Exception
+ */
+ public static void addEntityToMap(String targetId, Field field, ExcelImportEntity excelEntity, Class> pojoClass, List getMethods, Map temp) throws Exception {
+ Excel excel = field.getAnnotation(Excel.class);
+ excelEntity = new ExcelImportEntity();
+ excelEntity.setType(excel.type());
+ excelEntity.setSaveUrl(excel.savePath());
+ excelEntity.setSaveType(excel.imageType());
+ excelEntity.setReplace(excel.replace());
+ excelEntity.setDatabaseFormat(excel.databaseFormat());
+ excelEntity.setVerify(getImportVerify(field));
+ excelEntity.setSuffix(excel.suffix());
+ excelEntity.setNumFormat(excel.numFormat());
+ excelEntity.setGroupName(excel.groupName());
+ //update-begin-author:taoYan date:20180202 for:TASK #2067 【bug excel 问题】excel导入字典文本翻译问题
+ excelEntity.setMultiReplace(excel.multiReplace());
+ if(StringUtils.isNotEmpty(excel.dicCode())){
+ AutoPoiDictServiceI jeecgDictService = null;
+ try {
+ jeecgDictService = ApplicationContextUtil.getContext().getBean(AutoPoiDictServiceI.class);
+ } catch (Exception e) {
+ }
+ if(jeecgDictService!=null){
+ String[] dictReplace = jeecgDictService.queryDict(excel.dictTable(), excel.dicCode(), excel.dicText());
+ if(excelEntity.getReplace()!=null && dictReplace!=null && dictReplace.length!=0){
+ excelEntity.setReplace(dictReplace);
+ }
+ }
+ }
+ //update-end-author:taoYan date:20180202 for:TASK #2067 【bug excel 问题】excel导入字典文本翻译问题
+ getExcelField(targetId, field, excelEntity, excel, pojoClass);
+ if (getMethods != null) {
+ List newMethods = new ArrayList();
+ newMethods.addAll(getMethods);
+ newMethods.add(excelEntity.getMethod());
+ excelEntity.setMethods(newMethods);
+ }
+ temp.put(excelEntity.getName(), excelEntity);
+
+ }
+ public static void getExcelField(String targetId, Field field, ExcelImportEntity excelEntity, Excel excel, Class> pojoClass) throws Exception {
+ excelEntity.setName(getExcelName(excel.name(), targetId));
+ String fieldname = field.getName();
+ //update-begin-author:taoyan for:TASK #2798 【例子】导入扩展方法,支持自定义导入字段转换规则
+ excelEntity.setMethod(PoiPublicUtil.getMethod(fieldname, pojoClass, field.getType(),excel.importConvert()));
+ //update-end-author:taoyan for:TASK #2798 【例子】导入扩展方法,支持自定义导入字段转换规则
+ if (StringUtils.isNotEmpty(excel.importFormat())) {
+ excelEntity.setFormat(excel.importFormat());
+ } else {
+ excelEntity.setFormat(excel.format());
+ }
+ }
+ /**
+ * 判断在这个单元格显示的名称
+ *
+ * @param exportName
+ * @param targetId
+ * @return
+ */
+ public static String getExcelName(String exportName, String targetId) {
+ if (exportName.indexOf("_") < 0) {
+ return exportName;
+ }
+ String[] arr = exportName.split(",");
+ for (String str : arr) {
+ if (str.indexOf(targetId) != -1) {
+ return str.split("_")[0];
+ }
+ }
+ return null;
+ }
+ /**
+ * 获取导入校验参数
+ *
+ * @param field
+ * @return
+ */
+ public static ExcelVerifyEntity getImportVerify(Field field) {
+ ExcelVerify verify = field.getAnnotation(ExcelVerify.class);
+ if (verify != null) {
+ ExcelVerifyEntity entity = new ExcelVerifyEntity();
+ entity.setEmail(verify.isEmail());
+ entity.setInterHandler(verify.interHandler());
+ entity.setMaxLength(verify.maxLength());
+ entity.setMinLength(verify.minLength());
+ entity.setMobile(verify.isMobile());
+ entity.setNotNull(verify.notNull());
+ entity.setRegex(verify.regex());
+ entity.setRegexTip(verify.regexTip());
+ entity.setTel(verify.isTel());
+ return entity;
+ }
+ return null;
+ }
+}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/FillRuleUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FillRuleUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/FillRuleUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FillRuleUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/HTMLUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/HTMLUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/HTMLUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/HTMLUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/IPUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/IPUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/IPUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/IPUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ImportExcelUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ImportExcelUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ImportExcelUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ImportExcelUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MinioUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java
similarity index 95%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MinioUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java
index df8a3af5..37dcade1 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MinioUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java
@@ -3,6 +3,7 @@ package org.jeecg.common.util;
import io.minio.MinioClient;
import io.minio.errors.*;
import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.filter.StrAttackFilter;
import org.springframework.web.multipart.MultipartFile;
import org.xmlpull.v1.XmlPullParserException;
@@ -55,6 +56,9 @@ public class MinioUtil {
*/
public static String upload(MultipartFile file, String bizPath, String customBucket) {
String file_url = "";
+ //update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+ bizPath=StrAttackFilter.filter(bizPath);
+ //update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
String newBucket = bucketName;
if(oConvertUtils.isNotEmpty(customBucket)){
newBucket = customBucket;
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MyClassLoader.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyClassLoader.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MyClassLoader.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyClassLoader.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PasswordUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PasswordUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PmsUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PmsUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RedisUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RedisUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ReflectHelper.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ReflectHelper.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/ReflectHelper.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ReflectHelper.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestDesformUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestDesformUtil.java
similarity index 96%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestDesformUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestDesformUtil.java
index 934c5c2f..d6843469 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestDesformUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestDesformUtil.java
@@ -19,7 +19,7 @@ public class RestDesformUtil {
static {
domain = SpringContextUtils.getDomain();
- path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
+ path = oConvertUtils.getString(SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path"));
}
/**
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestUtil.java
similarity index 96%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestUtil.java
index b6581091..95f6ccfc 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RestUtil.java
@@ -1,6 +1,7 @@
package org.jeecg.common.util;
import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.*;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
@@ -16,6 +17,7 @@ import java.util.Map;
*
* @author sunjianlei
*/
+@Slf4j
public class RestUtil {
private static String domain = null;
@@ -33,11 +35,13 @@ public class RestUtil {
if (path == null) {
path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
}
- return path;
+ return oConvertUtils.getString(path);
}
public static String getBaseUrl() {
- return getDomain() + getPath();
+ String basepath = getDomain() + getPath();
+ log.info(" RestUtil.getBaseUrl: " + basepath);
+ return basepath;
}
/**
@@ -182,6 +186,7 @@ public class RestUtil {
* @return ResponseEntity
*/
public static ResponseEntity request(String url, HttpMethod method, HttpHeaders headers, JSONObject variables, Object params, Class responseType) {
+ log.info(" RestUtil --- request --- url = "+ url);
if (StringUtils.isEmpty(url)) {
throw new RuntimeException("url 不能为空");
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SpringContextUtils.java
similarity index 83%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SpringContextUtils.java
index 534d8bb4..fd4d8f75 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SpringContextUtils.java
@@ -2,6 +2,7 @@ package org.jeecg.common.util;
import javax.servlet.http.HttpServletRequest;
+import org.jeecg.common.constant.ServiceNameConstants;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -38,10 +39,19 @@ public class SpringContextUtils implements ApplicationContextAware {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
}
+ /**
+ * 获取项目根路径 basePath
+ */
public static String getDomain(){
HttpServletRequest request = getHttpServletRequest();
StringBuffer url = request.getRequestURL();
- return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
+ //微服务情况下,获取gateway的basePath
+ String basePath = request.getHeader(ServiceNameConstants.X_GATEWAY_BASE_PATH);
+ if(oConvertUtils.isNotEmpty(basePath)){
+ return basePath;
+ }else{
+ return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
+ }
}
public static String getOrigin(){
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
similarity index 99%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
index 54b0af6f..e4ae69af 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
@@ -17,7 +17,7 @@ public class SqlInjectionUtil {
* (上线修改值 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 |+|,";
+ private final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+";
/*
* 针对表字典进行额外的sign签名校验(增加安全机制)
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SysAnnmentTypeEnum.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/TokenUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TokenUtils.java
similarity index 98%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/TokenUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TokenUtils.java
index d768f821..026e61db 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/TokenUtils.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TokenUtils.java
@@ -36,7 +36,7 @@ public class TokenUtils {
* 验证Token
*/
public static boolean verifyToken(HttpServletRequest request, CommonAPI commonAPI, RedisUtil redisUtil) {
- log.info(" -- url --" + request.getRequestURL());
+ log.debug(" -- url --" + request.getRequestURL());
String token = getTokenByRequest(request);
if (StringUtils.isBlank(token)) {
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/UUIDGenerator.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/UUIDGenerator.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/UUIDGenerator.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/UUIDGenerator.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
similarity index 93%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
index 2cd14e1d..ede4faec 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
@@ -165,9 +165,9 @@ public class YouBianCodeUtil {
}
}
- 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]);
- }
+// 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]);
+// }
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DataSourceCachePool.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/DataSourceCachePool.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DataSourceCachePool.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/DataSourceCachePool.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DynamicDBUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/DynamicDBUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/DynamicDBUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/DynamicDBUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
similarity index 83%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
index f97868e7..a2c4358b 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
@@ -101,23 +101,21 @@ public class AesEncryptUtil {
- /**
- * 测试
- */
- public static void main(String args[]) throws Exception {
+// /**
+// * 测试
+// */
+// public static void main(String args[]) throws Exception {
+// String test1 = "sa";
+// String test =new String(test1.getBytes(),"UTF-8");
+// String data = null;
+// String key = KEY;
+// String iv = IV;
+// // /g2wzfqvMOeazgtsUVbq1kmJawROa6mcRAzwG1/GeJ4=
+// data = encrypt(test, key, iv);
+// System.out.println("数据:"+test);
+// System.out.println("加密:"+data);
+// String jiemi =desEncrypt(data, key, iv).trim();
+// System.out.println("解密:"+jiemi);
+// }
- String test1 = "sa";
- String test =new String(test1.getBytes(),"UTF-8");
- String data = null;
- String key = KEY;
- String iv = IV;
- // /g2wzfqvMOeazgtsUVbq1kmJawROa6mcRAzwG1/GeJ4=
- data = encrypt(test, key, iv);
- System.out.println("数据:"+test);
- System.out.println("加密:"+data);
- String jiemi =desEncrypt(data, key, iv).trim();
- System.out.println("解密:"+jiemi);
-
-
- }
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/EncryptedString.java
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/filter/StrAttackFilter.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/filter/StrAttackFilter.java
new file mode 100644
index 00000000..9197a7d6
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/filter/StrAttackFilter.java
@@ -0,0 +1,24 @@
+package org.jeecg.common.util.filter;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * 文件上传字符串过滤特殊字符
+ */
+public class StrAttackFilter {
+
+ public static String filter(String str) throws PatternSyntaxException {
+ // 清除掉所有特殊字符
+ String regEx = "[`_《》~!@#$%^&*()+=|{}':;',\\[\\].<>?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(str);
+ return m.replaceAll("").trim();
+ }
+
+// public static void main(String[] args) {
+// String filter = filter("@#jeecg/《》【bo】¥%……&*(o))))!@t<>,.,/?'\'~~`");
+// System.out.println(filter);
+// }
+}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
similarity index 92%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
index bfdbd7f5..06005701 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
@@ -54,6 +54,8 @@ public abstract class CommonProperty implements Serializable{
protected String defVal; // 字段默认值
+ protected String fieldExtendJson;//扩展参数
+
public String getDefVal() {
return defVal;
}
@@ -126,6 +128,14 @@ public abstract class CommonProperty implements Serializable{
this.order = order;
}
+ public String getFieldExtendJson() {
+ return fieldExtendJson;
+ }
+
+ public void setFieldExtendJson(String fieldExtendJson) {
+ this.fieldExtendJson = fieldExtendJson;
+ }
+
/**
* 返回一个map有两个key
* key ---> Property JSON的key
@@ -162,6 +172,9 @@ public abstract class CommonProperty implements Serializable{
if (defVal!=null && defVal.length()>0) {
json.put("defVal", defVal);
}
+ if(fieldExtendJson != null){
+ json.put("fieldExtendJson", fieldExtendJson);
+ }
return json;
}
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oConvertUtils.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oConvertUtils.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
similarity index 96%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
index 6c3e670b..e8cf9a6d 100644
--- a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java
@@ -9,6 +9,7 @@ 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.filter.StrAttackFilter;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.web.multipart.MultipartFile;
@@ -114,6 +115,9 @@ public class OssBootUtil {
if (!fileDir.endsWith("/")) {
fileDir = fileDir.concat("/");
}
+ //update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+ fileDir=StrAttackFilter.filter(fileDir);
+ //update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
fileUrl = fileUrl.append(fileDir + fileName);
if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
@@ -163,8 +167,8 @@ public class OssBootUtil {
if (!fileDir.endsWith("/")) {
fileDir = fileDir.concat("/");
}
+ fileDir = StrAttackFilter.filter(fileDir);
fileUrl = fileUrl.append(fileDir + fileName);
-
if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
FILE_URL = staticDomain + "/" + fileUrl;
} else {
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/SecurityTools.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/SecurityTools.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/SecurityTools.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/SecurityTools.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/MyKeyPair.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecurityReq.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecurityResp.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecuritySignReq.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/entity/SecuritySignResp.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/ObjectParseUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/ObjectParseUtil.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/ObjectParseUtil.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/ObjectParseUtil.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/QueryRuleEnum.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleVo.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/QueryRuleVo.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/superSearch/QueryRuleVo.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/superSearch/QueryRuleVo.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/config/AutoPoiConfig.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiConfig.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/config/AutoPoiConfig.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiConfig.java
diff --git a/jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/config/CorsFilterCondition.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/CorsFilterCondition.java
similarity index 100%
rename from jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/config/CorsFilterCondition.java
rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/CorsFilterCondition.java
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/JacksonAutoConfiguration.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/JacksonAutoConfiguration.java
new file mode 100644
index 00000000..18898d96
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/JacksonAutoConfiguration.java
@@ -0,0 +1,167 @@
+//package org.jeecg.config;
+//
+//import com.fasterxml.jackson.core.JsonGenerator;
+//import com.fasterxml.jackson.databind.*;
+//import com.fasterxml.jackson.databind.module.SimpleModule;
+//import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
+//import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
+//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.context.annotation.Primary;
+//import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+//
+//import java.io.IOException;
+//import java.math.BigDecimal;
+//import java.text.SimpleDateFormat;
+//import java.util.Date;
+//import java.util.List;
+//import java.util.TimeZone;
+//
+//import static org.jeecg.config.JacksonAutoConfiguration.SerializerFeature.*;
+//
+//
+///**
+// * @author: zyf
+// * @date: 2019/5/20 14:56
+// * @description:
+// */
+//@Slf4j
+//@Configuration
+//public class JacksonAutoConfiguration {
+//
+// public enum SerializerFeature {
+// WriteNullListAsEmpty,
+// WriteNullStringAsEmpty,
+// WriteNullNumberAsZero,
+// WriteNullBooleanAsFalse,
+// WriteNullMapAsEmpty;
+//
+// public final int mask;
+//
+// SerializerFeature() {
+// mask = (1 << ordinal());
+// }
+// }
+//
+// public static class FastJsonSerializerFeatureCompatibleForJackson extends BeanSerializerModifier {
+// final private JsonSerializer |