xufei 2 år sedan
förälder
incheckning
ba60a5b796

+ 2 - 1
src/main/java/com/winhc/bigdata/udf/etl/RegisteredCapitalFormat.java

@@ -35,7 +35,8 @@ public class RegisteredCapitalFormat extends UDF {
 
     public static void main(String[] args) {
         RegisteredCapitalFormat registeredCapitalFormat = new RegisteredCapitalFormat();
-        String s = "0.0000 万元 人民币";
+        String s = "50.00 (单位:元/万元)";
+        //String s = "0.0000 万元 人民币";
         //String s = "10 万元";
         //String s = "10 万元 人民币";
         //String s = "10.00100 万元 人民币";

+ 26 - 8
src/main/java/com/winhc/bigdata/udf/string/FindTraditional2SimpleError.java

@@ -5,12 +5,29 @@ import com.aliyun.odps.utils.StringUtils;
 import com.github.houbb.opencc4j.util.ZhConverterUtil;
 import com.github.stuxuhai.jpinyin.ChineseHelper;
 
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+
 /**
  * @author: XuJiakai
  * 2022/3/4 10:31
  */
 public class FindTraditional2SimpleError extends UDF {
-    public Boolean evaluate(String val) {
+    public Boolean evaluate(String cname, String historyNames) {
+        if (StringUtils.isEmpty(cname) && StringUtils.isEmpty(historyNames)) {
+            return true;
+        }
+        if (!compare(cname)) return false;
+        if (StringUtils.isEmpty(historyNames)) return true;
+        Set<Boolean> set = Arrays.stream(historyNames.split("\t;\t"))
+                .filter(StringUtils::isNotBlank)
+                .map(String::trim)
+                .map(this::compare).collect(Collectors.toSet());
+        return !set.contains(false);
+    }
+
+    public Boolean compare(String val) {
         if (StringUtils.isEmpty(val)) {
             return true;
         }
@@ -23,12 +40,13 @@ public class FindTraditional2SimpleError extends UDF {
 
     public static void main(String[] args) {
         FindTraditional2SimpleError simple = new FindTraditional2SimpleError();
-        System.out.println(simple.evaluate("滙"));
-        System.out.println(simple.evaluate("匯"));
-        System.out.println(simple.evaluate("彙"));
-        System.out.println(simple.evaluate("恆"));
-        System.out.println(simple.evaluate("文徵明"));
-        System.out.println(simple.evaluate("徵信"));
-        System.out.println(simple.evaluate("瞭望"));
+        System.out.println(simple.evaluate("深圳市联创银格尔科技有限公司","彙深圳市联创银格尔科技有限公司\t;\t深圳市联创金格尔通讯设备有限公司\t;\t深圳市联创三阳软件有限公司\t;\t"));
+        System.out.println(simple.evaluate("滙",null));
+        System.out.println(simple.evaluate("匯",null));
+        System.out.println(simple.evaluate("彙",null));
+        System.out.println(simple.evaluate("恆",null));
+        System.out.println(simple.evaluate("文徵明",null));
+        System.out.println(simple.evaluate("徵信",null));
+        System.out.println(simple.evaluate("瞭望",null));
     }
 }