Browse Source

合格率计算手填默认值

yangyj 1 year ago
parent
commit
eb5caa4387

+ 17 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/FormData.java

@@ -3,6 +3,7 @@ package org.springblade.manager.dto;
 
 import lombok.Data;
 import lombok.Setter;
+import org.checkerframework.checker.units.qual.A;
 import org.springblade.common.utils.BaseUtils;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringPool;
@@ -10,6 +11,7 @@ import org.springblade.manager.entity.Formula;
 
 import java.util.*;
 import java.util.function.Function;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -244,11 +246,25 @@ public class FormData {
         return !Objects.isNull(this.getFormula());
     }
 
+
+    /*元素非空判断*/
+    public static Predicate<Object> isNotEmpty = s->{
+        if(s!=null){
+            String s1= s.toString().replaceAll("[\\s\\t\\n]+","");
+            return !s1.isEmpty()&&!s1.matches("[/]+");
+        }
+        return false;
+    };
+
+/*    public static void main(String[] args) {
+        List<String> list = Arrays.asList("//","/1/"," "," xxx  ","/");
+        list.forEach(e-> System.out.println(isNotEmpty.test(e)));
+    }*/
     /**
      * 元素内容是否为空
      */
     public Boolean empty() {
-        return !(Func.isNotEmpty(this.values) && this.values.stream().map(ElementData::getValue).anyMatch(Func::isNotEmpty));
+        return !(this.values.size()>0&& this.values.stream().map(ElementData::getValue).anyMatch(isNotEmpty));
     }
 
     public List<Object> getRawValue(){