diff --git a/.gitignore b/.gitignore index 50655a1c..252d9b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ .project .class **/target +**/webapp/userfiles **/WEB-INF/classes **/logs/log*.log \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 9017f113..ec7b1a97 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -49,17 +49,21 @@ + + + + + - com.esotericsoftware - kryo - ${esotericsoftware.kryo.version} + de.ruedigermoeller + fst + ${ruedigermoeller-fst.version} - + - org.codeartisans - org.json - ${codeartisans.json.version} + org.json + json diff --git a/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java b/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java index ba67ff15..181151c4 100644 --- a/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java +++ b/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java @@ -12,11 +12,9 @@ import java.lang.reflect.Method; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.nustaq.serialization.FSTConfiguration; import org.springframework.beans.BeanUtils; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; import com.jeesite.common.io.IOUtils; /** @@ -109,6 +107,20 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { String str = ObjectUtils.toString(val); return !"".equals(str) && !"null".equals(str.trim().toLowerCase()) ? str : defaultVal; } + + /** + * 拷贝一个对象(但是子对象无法拷贝) + * @param source + * @param ignoreProperties + */ + public static Object copyBean(Object source, String... ignoreProperties){ + if (source == null){ + return null; + } + Object target = BeanUtils.instantiate(source.getClass()); + BeanUtils.copyProperties(source, target, ignoreProperties); + return target; + } /** * 注解到对象复制,只复制能匹配上的方法。 硕正组件用。 @@ -137,29 +149,36 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { } } } - + /** * 序列化对象 * @param object * @return */ public static byte[] serialize(Object object) { + if (object == null){ + return null; + } + long beginTime = System.currentTimeMillis(); + byte[] bytes = null; ObjectOutputStream oos = null; ByteArrayOutputStream baos = null; try { - if (object != null) { - baos = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(baos); - oos.writeObject(object); - return baos.toByteArray(); - } + baos = new ByteArrayOutputStream(); + oos = new ObjectOutputStream(baos); + oos.writeObject(object); + bytes = baos.toByteArray(); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(oos); IOUtils.closeQuietly(baos); } - return null; + long totalTime = System.currentTimeMillis() - beginTime; + if (totalTime > 3000){ + System.out.println("Serialize time: " + TimeUtils.formatDateAgo(totalTime)); + } + return bytes; } /** @@ -168,13 +187,18 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * @return */ public static Object unserialize(byte[] bytes) { + if (bytes == null){ + return null; + } + long beginTime = System.currentTimeMillis(); + Object object = null; ByteArrayInputStream bais = null; ObjectInputStream ois = null; try { - if (bytes != null && bytes.length > 0) { + if (bytes.length > 0) { bais = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bais); - return ois.readObject(); + object = ois.readObject(); } } catch (Exception e) { e.printStackTrace(); @@ -182,66 +206,112 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { IOUtils.closeQuietly(ois); IOUtils.closeQuietly(bais); } - return null; + long totalTime = System.currentTimeMillis() - beginTime; + if (totalTime > 3000){ + System.out.println("Unserialize time: " + TimeUtils.formatDateAgo(totalTime)); + } + return object; } - // Kryo不是线程安全的,所以要建立一个线程变量,每一个线程实例化一次 - public static final ThreadLocal kryos = new ThreadLocal() { - @Override - protected Kryo initialValue() { - Kryo kryo = new Kryo(); - return kryo; - }; - }; - +// // Kryo不是线程安全的,所以要建立一个线程变量,每一个线程实例化一次 +// public static final ThreadLocal kryos = new ThreadLocal() { +// @Override +// protected Kryo initialValue() { +// Kryo kryo = new Kryo(); +// // 设置false关闭注册行为, Kryo支持对注册行为,如kryo.register(SomeClazz.class); +// // 这会赋予该Class一个从0开始的编号,但Kryo使用注册行为最大的问题在于, +// // 其不保证同一个Class每一次注册的号码想用,这与注册的顺序有关,也就意味着在不同的机器、 +// // 同一个机器重启前后都有可能拥有不同的编号,这会导致序列化产生问题,所以在分布式项目中,一般关闭注册行为。 +// kryo.setRegistrationRequired(false); +// // 支持循环引用 +// kryo.setReferences(true); +// return kryo; +// }; +// }; +// +// /** +// * Kryo序列化对象 +// * @param object +// * @return +// */ +// public static byte[] serializeKryo(Object object) { +// byte[] bytes = null; +// Output output = null; +// try { +// if (object != null) { +// output = new Output(1024, -1); +// kryos.get().writeClassAndObject(output, object); +// bytes = output.toBytes(); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } finally { +// if (output != null) { +// output.close(); +// } +// } +// return bytes; +// } +// +// /** +// * Kryo反序列化对象 +// * @param bytes +// * @return +// */ +// public static Object unserializeKryo(byte[] bytes) { +// Object object = null; +// Input input = null; +// try { +// if (bytes != null && bytes.length > 0) { +// input = new Input(bytes, 0, bytes.length); +// object = kryos.get().readClassAndObject(input); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } finally { +// if (input != null) { +// input.close(); +// } +// } +// return object; +// } + + // FST序列化配置对象 + private static FSTConfiguration fst = FSTConfiguration.createDefaultConfiguration(); + /** - * Kryo序列化对象 + * FST 序列化对象 * @param object * @return */ - public static byte[] serializeKryo(Object object) { -// long beginTime = System.currentTimeMillis(); - byte[] bytes = null; - Output output = null; - try { - if (object != null) { - output = new Output(1024, -1); - kryos.get().writeClassAndObject(output, object); - bytes = output.toBytes(); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (output != null) { - output.close(); - } + public static byte[] serializeFst(Object object) { + if (object == null){ + return null; + } + long beginTime = System.currentTimeMillis(); + byte[] bytes = fst.asByteArray(object); + long totalTime = System.currentTimeMillis() - beginTime; + if (totalTime > 3000){ + System.out.println("Fst serialize time: " + TimeUtils.formatDateAgo(totalTime)); } -// GlobalConfig.log(ObjectUtils.class, object + " 序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime)); return bytes; } /** - * Kryo反序列化对象 + * FST 反序列化对象 * @param bytes * @return */ - public static Object unserializeKryo(byte[] bytes) { -// long beginTime = System.currentTimeMillis(); - Object object = null; - Input input = null; - try { - if (bytes != null && bytes.length > 0) { - input = new Input(bytes, 0, bytes.length); - object = kryos.get().readClassAndObject(input); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (input != null) { - input.close(); - } + public static Object unserializeFst(byte[] bytes) { + if (bytes == null){ + return null; + } + long beginTime = System.currentTimeMillis(); + Object object = fst.asObject(bytes); + long totalTime = System.currentTimeMillis() - beginTime; + if (totalTime > 3000){ + System.out.println("Fst unserialize time: " + TimeUtils.formatDateAgo(totalTime)); } -// GlobalConfig.log(ObjectUtils.class, object + " 反序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime)); return object; } @@ -253,22 +323,8 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { if (source == null){ return null; } - byte[] bytes = ObjectUtils.serializeKryo(source); - Object target = ObjectUtils.unserializeKryo(bytes); - return target; - } - - /** - * 拷贝一个对象(但是子对象无法拷贝) - * @param source - * @param ignoreProperties - */ - public static Object copyBean(Object source, String... ignoreProperties){ - if (source == null){ - return null; - } - Object target = BeanUtils.instantiate(source.getClass()); - BeanUtils.copyProperties(source, target, ignoreProperties); + byte[] bytes = ObjectUtils.serializeFst(source); + Object target = ObjectUtils.unserializeFst(bytes); return target; } diff --git a/modules/core/src/main/java/com/jeesite/modules/db/InitCoreData.xlsx b/modules/core/src/main/java/com/jeesite/modules/db/InitCoreData.xlsx index a2cc279e..00ef2db9 100644 Binary files a/modules/core/src/main/java/com/jeesite/modules/db/InitCoreData.xlsx and b/modules/core/src/main/java/com/jeesite/modules/db/InitCoreData.xlsx differ diff --git a/modules/core/src/main/resources/jeesite-core.yml b/modules/core/src/main/resources/jeesite-core.yml index 19208a77..c0aa75db 100644 --- a/modules/core/src/main/resources/jeesite-core.yml +++ b/modules/core/src/main/resources/jeesite-core.yml @@ -86,24 +86,21 @@ jdbc: # Redis 配置 redis: - # 是否启用 Redis - enabled: false - # Redis 连接参数 - host: 192.168.11.12 + host: 127.0.0.1 port: 6379 isSSL: false timeout: 2000 password: 1234 database: 0 - # 定义Key的前缀标识 - keyPrefix: jeesite - # Redis 连接池配置 pool: maxIdle: 3 maxTotal: 20 + + # 定义Key的前缀标识 + keyPrefix: ${jdbc.tablePrefix} # 是否启用Redis系统缓存及会话 cacheAndSession: false @@ -312,7 +309,7 @@ session: sessionIdCookieName: jeesite.session.id #共享的SessionId的Cookie名称,保存到跟路径下,第三方应用获取。同一域名下多个项目时需设置共享Cookie的名称。 - shareSessionIdCookieName: jeesite.session.id + shareSessionIdCookieName: ${session.sessionIdCookieName} # MyBatis 相关 mybatis: diff --git a/modules/core/src/main/resources/views/modules/sys/logForm.html b/modules/core/src/main/resources/views/modules/sys/logForm.html index 23c3d3f3..407a99e1 100644 --- a/modules/core/src/main/resources/views/modules/sys/logForm.html +++ b/modules/core/src/main/resources/views/modules/sys/logForm.html @@ -95,18 +95,18 @@
+ * 业务类型:
- <#form:input path="bizKey" maxlength="64" class="form-control "/> + <#form:input path="bizType" maxlength="64" class="form-control "/>
+ * 业务主键:
- <#form:input path="bizType" maxlength="64" class="form-control "/> + <#form:input path="bizKey" maxlength="64" class="form-control "/>
diff --git a/modules/core/src/main/resources/views/modules/sys/logList.html b/modules/core/src/main/resources/views/modules/sys/logList.html index a8214b03..acc6059d 100644 --- a/modules/core/src/main/resources/views/modules/sys/logList.html +++ b/modules/core/src/main/resources/views/modules/sys/logList.html @@ -45,18 +45,18 @@
-
- -
- <#form:input path="bizKey" maxlength="64" class="form-control width-90"/> -
-
<#form:input path="bizType" maxlength="64" class="form-control width-90"/>
+
+ +
+ <#form:input path="bizKey" maxlength="64" class="form-control width-90"/> +
+
@@ -104,8 +104,8 @@ $('#dataGrid').dataGrid({ {header:'异常', name:'isException', index:'a.is_exception', width:60, align:"center", formatter: function(val, obj, row, act){ return js.getDictLabel(${@DictUtils.getDictListJson('sys_yes_no')}, val, '未知', true); }}, - {header:'业务主键', name:'bizKey', index:'a.biz_key', width:90, align:"center"}, {header:'业务类型', name:'bizType', index:'a.biz_type', width:90, align:"center"}, + {header:'业务主键', name:'bizKey', index:'a.biz_key', width:90, align:"center"}, {header:'操作时间', name:'createDate', index:'a.create_date', width:100, align:"center"}, {header:'客户端IP', name:'remoteAddr', index:'a.remote_addr', width:100, align:"center"}, {header:'设备名称', name:'deviceName', index:'a.device_name', width:100, align:"center"}, diff --git a/parent/pom.xml b/parent/pom.xml index d5ef0dc6..0116a40e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -24,8 +24,9 @@ 3.4 2.5 1.3.1 - 4.0.0 - 20130603 + + 2.56 + 20170516 5.5.1 3.14 diff --git a/web/db/oracle/test.sql b/web/db/oracle/test.sql index cadf227c..40ebca66 100644 --- a/web/db/oracle/test.sql +++ b/web/db/oracle/test.sql @@ -10,7 +10,7 @@ DROP TABLE test_tree CASCADE CONSTRAINTS; /* Create Tables */ --- test_data +-- 测试数据 CREATE TABLE test_data ( id varchar2(64) NOT NULL, @@ -35,7 +35,7 @@ CREATE TABLE test_data ); --- test_data_child +-- 测试数据子表 CREATE TABLE test_data_child ( id varchar2(64) NOT NULL, @@ -56,7 +56,7 @@ CREATE TABLE test_data_child ); --- test_tree +-- 测试树表 CREATE TABLE test_tree ( id varchar2(64) NOT NULL, @@ -81,7 +81,7 @@ CREATE TABLE test_tree /* Comments */ -COMMENT ON TABLE test_data IS 'test_data'; +COMMENT ON TABLE test_data IS '测试数据'; COMMENT ON COLUMN test_data.id IS '编号'; COMMENT ON COLUMN test_data.test_input IS '单行文本'; COMMENT ON COLUMN test_data.test_textarea IS '多行文本'; @@ -90,7 +90,7 @@ COMMENT ON COLUMN test_data.test_select_multiple IS '下拉多选'; COMMENT ON COLUMN test_data.test_radio IS '单选框'; COMMENT ON COLUMN test_data.test_checkbox IS '复选框'; COMMENT ON COLUMN test_data.test_date IS '日期选择'; -COMMENT ON COLUMN test_data.test_datetime IS '日期时间选择'; +COMMENT ON COLUMN test_data.test_datetime IS '日期时间'; COMMENT ON COLUMN test_data.test_user_code IS '用户选择'; COMMENT ON COLUMN test_data.test_office_code IS '部门选择'; COMMENT ON COLUMN test_data.test_company_code IS '公司选择'; @@ -100,7 +100,7 @@ COMMENT ON COLUMN test_data.create_date IS '创建时间'; COMMENT ON COLUMN test_data.update_by IS '更新者'; COMMENT ON COLUMN test_data.update_date IS '更新时间'; COMMENT ON COLUMN test_data.remarks IS '备注信息'; -COMMENT ON TABLE test_data_child IS 'test_data_child'; +COMMENT ON TABLE test_data_child IS '测试数据子表'; COMMENT ON COLUMN test_data_child.id IS '编号'; COMMENT ON COLUMN test_data_child.test_sort IS '排序号'; COMMENT ON COLUMN test_data_child.test_data_id IS '父表主键'; @@ -111,11 +111,11 @@ COMMENT ON COLUMN test_data_child.test_select_multiple IS '下拉多选'; COMMENT ON COLUMN test_data_child.test_radio IS '单选框'; COMMENT ON COLUMN test_data_child.test_checkbox IS '复选框'; COMMENT ON COLUMN test_data_child.test_date IS '日期选择'; -COMMENT ON COLUMN test_data_child.test_datetime IS '日期时间选择'; +COMMENT ON COLUMN test_data_child.test_datetime IS '日期时间'; COMMENT ON COLUMN test_data_child.test_user_code IS '用户选择'; COMMENT ON COLUMN test_data_child.test_office_code IS '部门选择'; COMMENT ON COLUMN test_data_child.test_company_code IS '公司选择'; -COMMENT ON TABLE test_tree IS 'test_tree'; +COMMENT ON TABLE test_tree IS '测试树表'; COMMENT ON COLUMN test_tree.id IS '编号'; COMMENT ON COLUMN test_tree.parent_code IS '父级编号'; COMMENT ON COLUMN test_tree.parent_codes IS '所有父级编号'; diff --git a/web/db/test.erm b/web/db/test.erm index 632e3dc1..199fdf58 100644 --- a/web/db/test.erm +++ b/web/db/test.erm @@ -12,7 +12,7 @@ 0 1.0 0 - 48 + 31 128 128 @@ -712,7 +712,7 @@ timestamp - 3b2a776b71472966918ed6f30e56b7ebf0c7b9ec + 38b1e9d7b26e11fab47d111ba7f951b0705aabe1 null null false @@ -723,7 +723,7 @@ false - 日期时间选择 + 日期时间 test_datetime timestamp @@ -1003,7 +1003,7 @@ test_tree - test_tree + 测试树表 @@ -1102,7 +1102,7 @@ test_data - test_data + 测试数据 @@ -1373,7 +1373,7 @@ - 3b2a776b71472966918ed6f30e56b7ebf0c7b9ec + 38b1e9d7b26e11fab47d111ba7f951b0705aabe1 c131dc5cb7ce6f1aa5e8d5f86f2002c8ae1bb8f6 @@ -1530,7 +1530,7 @@ test_data_child - test_data_child + 测试数据子表 @@ -1867,7 +1867,7 @@ - 3b2a776b71472966918ed6f30e56b7ebf0c7b9ec + 38b1e9d7b26e11fab47d111ba7f951b0705aabe1 b91171b99f3628aadb0e6986fbfa30cc547b280e diff --git a/web/src/main/resources/jeesite.yml b/web/src/main/resources/jeesite.yml index 431b8947..e280aea0 100644 --- a/web/src/main/resources/jeesite.yml +++ b/web/src/main/resources/jeesite.yml @@ -22,6 +22,17 @@ jdbc: # password: jeesite # testSql: SELECT 1 +# Redis 配置 +redis: + + # Redis 连接参数 + host: 192.168.11.12 + port: 6379 + password: 1234 + + # 是否启用Redis系统缓存及会话 + cacheAndSession: false + #============================# #===== System settings ======# #============================#