From f439102653b84a3e44c2232633b5d4b0154add27 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 30 Aug 2019 16:15:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EtoolbarDef?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/data/connection/NameDatabaseConnection.java | 4 ---- .../com/fanruan/api/data/connection/NameReference.java | 4 ++++ .../com/fanruan/api/design/ui/toolbar/ToolBarDef.java | 10 ++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/data/connection/NameDatabaseConnection.java create mode 100644 src/main/java/com/fanruan/api/data/connection/NameReference.java create mode 100644 src/main/java/com/fanruan/api/design/ui/toolbar/ToolBarDef.java diff --git a/src/main/java/com/fanruan/api/data/connection/NameDatabaseConnection.java b/src/main/java/com/fanruan/api/data/connection/NameDatabaseConnection.java deleted file mode 100644 index 408e9e8..0000000 --- a/src/main/java/com/fanruan/api/data/connection/NameDatabaseConnection.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.data.connection; - -public class NameDatabaseConnection extends com.fr.data.impl.NameDatabaseConnection{ -} diff --git a/src/main/java/com/fanruan/api/data/connection/NameReference.java b/src/main/java/com/fanruan/api/data/connection/NameReference.java new file mode 100644 index 0000000..86aa41d --- /dev/null +++ b/src/main/java/com/fanruan/api/data/connection/NameReference.java @@ -0,0 +1,4 @@ +package com.fanruan.api.data.connection; + +public class NameReference extends com.fr.data.impl.NameDatabaseConnection{ +} diff --git a/src/main/java/com/fanruan/api/design/ui/toolbar/ToolBarDef.java b/src/main/java/com/fanruan/api/design/ui/toolbar/ToolBarDef.java new file mode 100644 index 0000000..131e71e --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/toolbar/ToolBarDef.java @@ -0,0 +1,10 @@ +package com.fanruan.api.design.ui.toolbar; + +/* +* 用来定义工具栏 +* */ +public class ToolBarDef extends com.fr.design.menu.ToolBarDef{ + public ToolBarDef() { + + } +} From 906eac78e278d76f3cff62bf2a60413828f5822e Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Mon, 2 Sep 2019 16:10:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E6=94=B9=E5=86=99mongodb=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E7=9A=84=E7=AC=AC=E4=B8=80=E6=AC=A1finekit?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/cal/ParameterKit.java | 11 ++++++++ .../fanruan/api/design/macro/UIConstants.java | 1 + .../com/fanruan/api/err/JSONException.java | 11 ++++++++ .../java/com/fanruan/api/json/JSONArray.java | 26 +++++++++++++++++++ .../java/com/fanruan/api/json/JSONObject.java | 16 ++++++++++++ .../java/com/fanruan/api/util/CodeKit.java | 15 +++++++++++ .../java/com/fanruan/api/util/DateKit.java | 18 +++++++++++++ .../java/com/fanruan/api/util/GeneralKit.java | 12 +++++++++ .../com/fanruan/api/util/CodeKitTest.java | 12 +++++++++ .../com/fanruan/api/util/DateKitTest.java | 18 +++++++++++++ .../com/fanruan/api/util/GeneralKitTest.java | 7 +++++ 11 files changed, 147 insertions(+) create mode 100644 src/main/java/com/fanruan/api/err/JSONException.java create mode 100644 src/main/java/com/fanruan/api/json/JSONArray.java create mode 100644 src/main/java/com/fanruan/api/json/JSONObject.java create mode 100644 src/main/java/com/fanruan/api/util/CodeKit.java create mode 100644 src/main/java/com/fanruan/api/util/DateKit.java create mode 100644 src/test/java/com/fanruan/api/util/CodeKitTest.java create mode 100644 src/test/java/com/fanruan/api/util/DateKitTest.java diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index 963e152..86bff51 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -89,4 +89,15 @@ public class ParameterKit { public static @NotNull ParameterMapNameSpace createParameterMapNameSpace(ParameterProvider[] ps) { return ParameterMapNameSpace.create(ps); } + /** + * 获得新的参数集合 + * + * @param paramTexts sql语句 + * @param ps 旧的参数集合 + * @return 新参数集合 + */ + public static Parameter[] analyzeAndUnionSameParameters(String[] paramTexts, + Parameter[] ps){ + return ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps); + } } diff --git a/src/main/java/com/fanruan/api/design/macro/UIConstants.java b/src/main/java/com/fanruan/api/design/macro/UIConstants.java index 613600f..96206c1 100644 --- a/src/main/java/com/fanruan/api/design/macro/UIConstants.java +++ b/src/main/java/com/fanruan/api/design/macro/UIConstants.java @@ -4,5 +4,6 @@ import java.awt.*; public class UIConstants { Color UIPOPUPMENU_LINE_COLOR = new Color(13158861); + Color LINE_COLOR = new Color(153, 153, 153); int ARC = 0; } diff --git a/src/main/java/com/fanruan/api/err/JSONException.java b/src/main/java/com/fanruan/api/err/JSONException.java new file mode 100644 index 0000000..9de7f2e --- /dev/null +++ b/src/main/java/com/fanruan/api/err/JSONException.java @@ -0,0 +1,11 @@ +package com.fanruan.api.err; + +public class JSONException extends com.fr.json.JSONException{ + public JSONException(String var1) { + super(var1); + } + + public JSONException(Throwable var1) { + super(var1); + } +} diff --git a/src/main/java/com/fanruan/api/json/JSONArray.java b/src/main/java/com/fanruan/api/json/JSONArray.java new file mode 100644 index 0000000..3199f27 --- /dev/null +++ b/src/main/java/com/fanruan/api/json/JSONArray.java @@ -0,0 +1,26 @@ +package com.fanruan.api.json; + +import java.util.*; +import java.lang.*; + +public class JSONArray extends com.fr.json.JSONArray{ + public JSONArray(){ + + } + + public JSONArray(Collection collection){ + super(collection); + } + + public JSONArray(List list) { + super(list); + } + + public JSONArray(Object array) { + super(array); + } + + public JSONArray(String json) { + super(json); + } +} diff --git a/src/main/java/com/fanruan/api/json/JSONObject.java b/src/main/java/com/fanruan/api/json/JSONObject.java new file mode 100644 index 0000000..31a53ba --- /dev/null +++ b/src/main/java/com/fanruan/api/json/JSONObject.java @@ -0,0 +1,16 @@ +package com.fanruan.api.json; +import java.util.*; + +public class JSONObject extends com.fr.json.JSONObject{ + public JSONObject(){ + + } + + public JSONObject(Map map){ + super(map); + } + + public JSONObject(String json){ + super(json); + } +} diff --git a/src/main/java/com/fanruan/api/util/CodeKit.java b/src/main/java/com/fanruan/api/util/CodeKit.java new file mode 100644 index 0000000..b819eb4 --- /dev/null +++ b/src/main/java/com/fanruan/api/util/CodeKit.java @@ -0,0 +1,15 @@ +package com.fanruan.api.util; + +import com.fr.stable.CodeUtils; +import com.fr.stable.CommonCodeUtils; + +public class CodeKit { + /** + * 给字符串解密 + * @param passwordText 待解密的字符串 + * @return 解密后的字符串 + */ + public static String passwordDecode(String passwordText) { + return CodeUtils.passwordDecode(passwordText); + } +} diff --git a/src/main/java/com/fanruan/api/util/DateKit.java b/src/main/java/com/fanruan/api/util/DateKit.java new file mode 100644 index 0000000..072e6e0 --- /dev/null +++ b/src/main/java/com/fanruan/api/util/DateKit.java @@ -0,0 +1,18 @@ +package com.fanruan.api.util; + +import com.fr.general.DateUtils; + +import java.util.Date; + +public class DateKit { + /** + * 将字符串转化为日期 + * + * @param str 字符串 + * @param returnNull 转化失败的时候是否返回null + * @return 将字符串转化为相应的日期值 + */ + public static Date string2Date(String str, boolean returnNull) { + return DateUtils.string2Date(str, returnNull); + } +} diff --git a/src/main/java/com/fanruan/api/util/GeneralKit.java b/src/main/java/com/fanruan/api/util/GeneralKit.java index 30a74bb..f86fa54 100644 --- a/src/main/java/com/fanruan/api/util/GeneralKit.java +++ b/src/main/java/com/fanruan/api/util/GeneralKit.java @@ -2,7 +2,9 @@ package com.fanruan.api.util; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; +import com.fr.stable.CommonUtils; import com.fr.third.guava.base.Objects; +import com.fr.stable.StableUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -69,4 +71,14 @@ public class GeneralKit { public static int compare(Object obj1, Object obj2) { return ComparatorUtils.compare(obj1, obj2); } + + /** + * 将一个数组中的元素按照给定的连接符连接成一个字符串 + * @param array 数组 + * @param se 连接符 + * @return 连接后的字符串 + */ + public static String join(Object[] array, String se) { + return StableUtils.join(array, se); + } } diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java new file mode 100644 index 0000000..10853e6 --- /dev/null +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -0,0 +1,12 @@ +package com.fanruan.api.util; + +import com.fr.stable.CommonCodeUtils; +import org.junit.Assert; +import org.junit.Test; + +public class CodeKitTest { + @Test + public void passwordDecode(String passwordText) { + Assert.assertEquals(CodeKit.passwordDecode(passwordText), 123); + } +} diff --git a/src/test/java/com/fanruan/api/util/DateKitTest.java b/src/test/java/com/fanruan/api/util/DateKitTest.java new file mode 100644 index 0000000..31ae43c --- /dev/null +++ b/src/test/java/com/fanruan/api/util/DateKitTest.java @@ -0,0 +1,18 @@ +package com.fanruan.api.util; + +import java.util.Date; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import org.junit.Assert; +import org.junit.Test; + +public class DateKitTest { + @Test + public void string2Date() throws Exception{ + DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd"); + Date myDate = dateFormat2.parse("2019-02-20"); + Assert.assertEquals(DateKit.string2Date("2019-02-20", false), myDate); + Assert.assertEquals(DateKit.string2Date("abcd", false), new Date()); + Assert.assertEquals(DateKit.string2Date("abcd", true), null); + } +} diff --git a/src/test/java/com/fanruan/api/util/GeneralKitTest.java b/src/test/java/com/fanruan/api/util/GeneralKitTest.java index 7bbefa6..b4457c1 100644 --- a/src/test/java/com/fanruan/api/util/GeneralKitTest.java +++ b/src/test/java/com/fanruan/api/util/GeneralKitTest.java @@ -39,4 +39,11 @@ public class GeneralKitTest extends Prepare { Assert.assertEquals(GeneralKit.compare(s,s3),0); Assert.assertEquals(GeneralKit.compare(s,s2),1); } + + @Test + public void join() { + Object obj [] = {1,2,3,4}; + String result = "1-2-3-4"; + Assert.assertEquals(GeneralKit.join(obj, "-"),result); + } } \ No newline at end of file From 751d82b980c6292e10c471738aa42f4ee222da75 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Mon, 2 Sep 2019 17:30:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update:=20=E9=92=88=E5=AF=B9pr=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/cal/ParameterKit.java | 3 +-- .../api/data/connection/NameReference.java | 4 --- .../com/fanruan/api/err/JSONException.java | 7 +++-- .../java/com/fanruan/api/json/JSONArray.java | 26 ------------------- .../java/com/fanruan/api/json/JSONKit.java | 11 ++++++++ .../java/com/fanruan/api/json/JSONObject.java | 16 ------------ .../com/fanruan/api/security/SecurityKit.java | 10 +++++++ 7 files changed, 27 insertions(+), 50 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/data/connection/NameReference.java delete mode 100644 src/main/java/com/fanruan/api/json/JSONArray.java create mode 100644 src/main/java/com/fanruan/api/json/JSONKit.java delete mode 100644 src/main/java/com/fanruan/api/json/JSONObject.java diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index 86bff51..102e6a4 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -96,8 +96,7 @@ public class ParameterKit { * @param ps 旧的参数集合 * @return 新参数集合 */ - public static Parameter[] analyzeAndUnionSameParameters(String[] paramTexts, - Parameter[] ps){ + public static ParameterProvider[] analyzeAndUnionSameParameters(String[] paramTexts, Parameter[] ps){ return ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps); } } diff --git a/src/main/java/com/fanruan/api/data/connection/NameReference.java b/src/main/java/com/fanruan/api/data/connection/NameReference.java deleted file mode 100644 index 86aa41d..0000000 --- a/src/main/java/com/fanruan/api/data/connection/NameReference.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.data.connection; - -public class NameReference extends com.fr.data.impl.NameDatabaseConnection{ -} diff --git a/src/main/java/com/fanruan/api/err/JSONException.java b/src/main/java/com/fanruan/api/err/JSONException.java index 9de7f2e..393c32e 100644 --- a/src/main/java/com/fanruan/api/err/JSONException.java +++ b/src/main/java/com/fanruan/api/err/JSONException.java @@ -1,8 +1,11 @@ package com.fanruan.api.err; +/* +* 定义json的异常 +* */ public class JSONException extends com.fr.json.JSONException{ - public JSONException(String var1) { - super(var1); + public JSONException(String message) { + super(message); } public JSONException(Throwable var1) { diff --git a/src/main/java/com/fanruan/api/json/JSONArray.java b/src/main/java/com/fanruan/api/json/JSONArray.java deleted file mode 100644 index 3199f27..0000000 --- a/src/main/java/com/fanruan/api/json/JSONArray.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fanruan.api.json; - -import java.util.*; -import java.lang.*; - -public class JSONArray extends com.fr.json.JSONArray{ - public JSONArray(){ - - } - - public JSONArray(Collection collection){ - super(collection); - } - - public JSONArray(List list) { - super(list); - } - - public JSONArray(Object array) { - super(array); - } - - public JSONArray(String json) { - super(json); - } -} diff --git a/src/main/java/com/fanruan/api/json/JSONKit.java b/src/main/java/com/fanruan/api/json/JSONKit.java new file mode 100644 index 0000000..2514012 --- /dev/null +++ b/src/main/java/com/fanruan/api/json/JSONKit.java @@ -0,0 +1,11 @@ +package com.fanruan.api.json; +import com.fr.json.JSONObject; + +public class JSONKit { + public static JSONObject create() { + return new JSONObject(); + } + public static JSONObject create(String text) { + return new JSONObject(text); + } +} diff --git a/src/main/java/com/fanruan/api/json/JSONObject.java b/src/main/java/com/fanruan/api/json/JSONObject.java deleted file mode 100644 index 31a53ba..0000000 --- a/src/main/java/com/fanruan/api/json/JSONObject.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fanruan.api.json; -import java.util.*; - -public class JSONObject extends com.fr.json.JSONObject{ - public JSONObject(){ - - } - - public JSONObject(Map map){ - super(map); - } - - public JSONObject(String json){ - super(json); - } -} diff --git a/src/main/java/com/fanruan/api/security/SecurityKit.java b/src/main/java/com/fanruan/api/security/SecurityKit.java index 5a72db1..e6e903c 100644 --- a/src/main/java/com/fanruan/api/security/SecurityKit.java +++ b/src/main/java/com/fanruan/api/security/SecurityKit.java @@ -1,6 +1,7 @@ package com.fanruan.api.security; import com.fr.security.SecurityToolbox; +import com.fr.stable.CodeUtils; /** * @author richie @@ -25,4 +26,13 @@ public class SecurityKit { public static String decrypt(String cipherText) { return SecurityToolbox.decrypt(cipherText); } + /** + * 给字符串解密 + * @param passwordText 待解密的字符串 + * @return 解密后的字符串 + */ + @Deprecated + public static String passwordDecode(String passwordText) { + return CodeUtils.passwordDecode(passwordText); + } } From f70371559742c213d27d11cc4a39a13c73cec6ba Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Mon, 2 Sep 2019 18:04:18 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=E9=92=88=E5=AF=B9pr=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=92=8C=E4=BF=AE=E6=94=B9=E3=80=82=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9javadoc=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/err/JSONException.java | 10 +++++----- src/main/java/com/fanruan/api/json/JSONKit.java | 10 ++++++++++ .../java/com/fanruan/api/json/JSONKitTest.java | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/test/java/com/fanruan/api/json/JSONKitTest.java diff --git a/src/main/java/com/fanruan/api/err/JSONException.java b/src/main/java/com/fanruan/api/err/JSONException.java index 393c32e..1abb13a 100644 --- a/src/main/java/com/fanruan/api/err/JSONException.java +++ b/src/main/java/com/fanruan/api/err/JSONException.java @@ -1,14 +1,14 @@ package com.fanruan.api.err; -/* -* 定义json的异常 -* */ +/** + * 用来定义和JSON相关的异常 + * */ public class JSONException extends com.fr.json.JSONException{ public JSONException(String message) { super(message); } - public JSONException(Throwable var1) { - super(var1); + public JSONException(Throwable error) { + super(error); } } diff --git a/src/main/java/com/fanruan/api/json/JSONKit.java b/src/main/java/com/fanruan/api/json/JSONKit.java index 2514012..86bdedf 100644 --- a/src/main/java/com/fanruan/api/json/JSONKit.java +++ b/src/main/java/com/fanruan/api/json/JSONKit.java @@ -2,9 +2,19 @@ package com.fanruan.api.json; import com.fr.json.JSONObject; public class JSONKit { + /** + * 创建一个JSONObject对象 + * + * @return 一个JSONObject对象 + */ public static JSONObject create() { return new JSONObject(); } + /** + * 创建一个JSONObject对象 + * @param text 用来创建对象时的字符串 + * @return 一个JSONObject对象 + */ public static JSONObject create(String text) { return new JSONObject(text); } diff --git a/src/test/java/com/fanruan/api/json/JSONKitTest.java b/src/test/java/com/fanruan/api/json/JSONKitTest.java new file mode 100644 index 0000000..32c4261 --- /dev/null +++ b/src/test/java/com/fanruan/api/json/JSONKitTest.java @@ -0,0 +1,15 @@ +package com.fanruan.api.json; +import com.fanruan.api.util.ArrayKit; +import com.fr.json.JSONObject; + +import org.junit.Assert; +import org.junit.Test; + +public class JSONKitTest { + @Test + public void create() throws Exception{ + Assert.assertEquals(JSONKit.create(), new JSONObject()); + Assert.assertEquals(JSONKit.create("{test:123}"), new JSONObject("{test:123}")); + + } +}