|
@@ -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;
|
|
|
+ }
|
|
|
+}
|