Kaynağa Gözat

fix: 索引geo兼容

许家凯 3 yıl önce
ebeveyn
işleme
633562b65a

+ 10 - 1
src/main/scala/com/winhc/bigdata/spark/ng/jobs/CompanyIndexJob.scala

@@ -55,6 +55,15 @@ case class CompanyIndexJob(s: SparkSession,
 
     import com.winhc.bigdata.spark.utils.CompanyIndexUtils.company_score_weight
 
+    def get_geo(lat: String, lng: String): String = {
+      if (StringUtils.isEmpty(lat) || StringUtils.isEmpty(lng)) {
+        return null
+      }
+      s"$lat,$lng"
+    }
+
+
+    spark.udf.register("get_geo", get_geo _)
     spark.udf.register("get_company_score_weight", company_score_weight _)
 
     /*  def get_category(code: String, index: String): String = {
@@ -309,7 +318,7 @@ case class CompanyIndexJob(s: SparkSession,
          |        ,reg_location
          |        ,get_phones_emails(phones) AS phones
          |        ,get_phones_emails(emails) AS emails
-         |        ,CONCAT_WS(',',lat,lng) AS geo
+         |        ,get_geo(lat,lng) AS geo
          |        ,logo
          |        ,reg_number
          |        ,get_company_score_weight(reg_status,name,reg_capital_amount,company_type) as company_score_weight