|
@@ -31,6 +31,8 @@ import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
import static java.math.BigDecimal.ROUND_CEILING;
|
|
|
import static java.math.BigDecimal.ROUND_HALF_UP;
|
|
|
|
|
@@ -3338,35 +3340,50 @@ public class CustomFunction {
|
|
|
}
|
|
|
return r;
|
|
|
}
|
|
|
- public static Object __join(Object ...args){
|
|
|
- StringBuilder r = new StringBuilder();
|
|
|
- if(args!=null){
|
|
|
- if(args.length>=2){
|
|
|
- String separator=handleNull(args[args.length-1]);
|
|
|
- for(int i=0;i<args.length-1;i++){
|
|
|
- r.append(_join(args[i],separator)).append(separator);
|
|
|
- }
|
|
|
- if(r.length()>0){
|
|
|
- r.deleteCharAt(r.length()-1);
|
|
|
- }
|
|
|
- }else{
|
|
|
- return _join(args[0],"、");
|
|
|
- }
|
|
|
- }
|
|
|
- return r.toString();
|
|
|
- }
|
|
|
- public static Object join(Object o1,Object o2,Object o3,Object separator){
|
|
|
- return __join(o1,o2,o3,separator);
|
|
|
- }
|
|
|
- public static Object join(Object o1,Object o2,Object separator){
|
|
|
- return __join(o1,o2,separator);
|
|
|
- }
|
|
|
+// public static Object __join(Object ...args){
|
|
|
+// StringBuilder r = new StringBuilder();
|
|
|
+// if(args!=null){
|
|
|
+// if(args.length>=2){
|
|
|
+// String separator=handleNull(args[args.length-1]);
|
|
|
+// for(int i=0;i<args.length-1;i++){
|
|
|
+// r.append(_join(args[i],separator)).append(separator);
|
|
|
+// }
|
|
|
+// if(r.length()>0){
|
|
|
+// r.deleteCharAt(r.length()-1);
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// return _join(args[0],"、");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return r.toString();
|
|
|
+// }
|
|
|
+// public static Object join(Object o1,Object o2,Object o3,Object separator){
|
|
|
+// return __join(o1,o2,o3,separator);
|
|
|
+// }
|
|
|
+// public static Object join(Object o1,Object o2,Object separator){
|
|
|
+// return __join(o1,o2,separator);
|
|
|
+// }
|
|
|
+// public static Object join(Object o1,Object separator){
|
|
|
+// return __join(o1,separator);
|
|
|
+// }
|
|
|
+// public static Object join(Object o1){
|
|
|
+// return __join(o1);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
public static Object join(Object o1,Object separator){
|
|
|
- return __join(o1,separator);
|
|
|
- }
|
|
|
- public static Object join(Object o1){
|
|
|
- return __join(o1);
|
|
|
+ Optional<Object> op =Optional.ofNullable(o1);
|
|
|
+ if(op.isPresent()){
|
|
|
+ String s=StringUtils.handleNull(separator);
|
|
|
+ if(StringUtils.isEmpty(s)){
|
|
|
+ s="、";
|
|
|
+ }
|
|
|
+ return op.map(CustomFunction::obj2List).get().stream().map(StringUtils::handleNull).collect(Collectors.joining(s));
|
|
|
+ };
|
|
|
+ return "";
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @Description String 转List
|
|
|
* @Param [o, separator]
|