From 8e2bf96a1406db664d8d87f1bbbe68992187c870 Mon Sep 17 00:00:00 2001 From: "wei.peng" Date: Tue, 7 May 2019 14:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BE=E5=9B=9E=E4=B8=A2=E5=A4=B1=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/base/enumutil/BlockFormEnumUtil.java | 94 +++++++++++++++++++++- .../i3plus/pojo/base/enumutil/CommonEnumUtil.java | 4 + 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java index 5cccafd..639e7e9 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java @@ -832,7 +832,7 @@ public class BlockFormEnumUtil { PASSWORD(230, "PASSWORD", "密码"), DATE(300, "DATE", "日期(yyyy-MM-dd)"), DATE_TIME(310, "DATE_TIME", "时间(yyyy-MM-dd hh:mm:ss)"), -// ELEMENT(700, "DICT_SELECT", "元素"), + // ELEMENT(700, "DICT_SELECT", "元素"), DICTIONARY(800, "DICT_SELECT", "字典"), CASCADE(900, "CASCADE", "级联"); //FILE(400, "file", "文件"), @@ -1056,7 +1056,99 @@ public class BlockFormEnumUtil { return tmp; } + public Object getPropertyVirtual(Object ... objs){ + if(this.getValue() == STRING_SPLICE.getValue()){ + return getPropertyVirtualString(objs); + }else if(this.getValue() == NUM_ADD.getValue()){ + return getPropertyVirtualDoubleAdd(objs); + }else if(this.getValue() == NUM_LESS.getValue()){ + return getPropertyVirtualDoubleLess(objs); + }else if(this.getValue() == NUM_MAKE.getValue()){ + return getPropertyVirtualDoubleMake(objs); + }else if(this.getValue() == NUM_DIVISION.getValue()){ + return getPropertyVirtualDoubleDivision(objs); + } + return objs; + } + + private String getPropertyVirtualString(Object ... objs){ + if(objs != null && objs.length > 0){ + StringBuffer result = new StringBuffer(); + for (Object o : objs) { + result.append(o == null ? "" : o.toString()); + } + return result.toString(); + } + return null; + } + + private Double getPropertyVirtualDoubleAdd(Object ... objs){ + if(objs != null && objs.length > 0){ + Double result = new Double(0); + for (Object o : objs) { + try { + if(o != null){ + result += Double.parseDouble(o.toString()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return result; + } + return null; + } + + private Double getPropertyVirtualDoubleLess(Object ... objs){ + if(objs != null && objs.length > 0){ + Double result = new Double(0); + for (Object o : objs) { + try { + if(o != null){ + result -= Double.parseDouble(o.toString()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return result; + } + return null; + } + private Double getPropertyVirtualDoubleMake(Object ... objs){ + if(objs != null && objs.length > 0){ + Double result = new Double(0); + for (Object o : objs) { + try { + if(o != null){ + result *= Double.parseDouble(o.toString()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return result; + } + return null; + } + + private Double getPropertyVirtualDoubleDivision(Object ... objs){ + if(objs != null && objs.length > 0){ + Double result = new Double(0); + for (Object o : objs) { + try { + if(o != null){ + result /= Double.parseDouble(o.toString()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return result; + } + return null; + } } /** diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java index 104f18e..6c19f95 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java @@ -521,6 +521,10 @@ public class CommonEnumUtil { return value; } + public String getValueStr() { + return value + ""; + } + public String getDescription() { return description; }