Selaa lähdekoodia

feat: v7_tyc_company_compare

许家凯 2 vuotta sitten
vanhempi
commit
c81a31d40e
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 27 0
      src/main/java/com/winhc/bigdata/udf/V7CompanyCompare.java

+ 27 - 0
src/main/java/com/winhc/bigdata/udf/V7CompanyCompare.java

@@ -0,0 +1,27 @@
+package com.winhc.bigdata.udf;
+
+import com.aliyun.odps.udf.UDF;
+import com.aliyun.odps.utils.StringUtils;
+
+/**
+ * @author: XuJiakai
+ * 2022/3/22 08:57
+ * v7_tyc_company_compare
+ */
+public class V7CompanyCompare extends UDF {
+    public String evaluate(String companyName, String regLocation, String regCapitalAmount, String businessScope) {
+        try {
+            if (companyName.contains("公司")) {
+                return coalesce(regLocation, "") + "\001" + coalesce(regCapitalAmount, "") + "\001" + coalesce(businessScope, "");
+            } else {
+                return "";
+            }
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
+    private static String coalesce(String str, String defaultStr) {
+        return StringUtils.isBlank(str) ? defaultStr : str;
+    }
+}