Forráskód Böngészése

fix: 信用惩戒查询过滤公司没有keyno查询

许家凯 3 éve
szülő
commit
9076637be0

+ 21 - 2
src/main/scala/com/winhc/bigdata/spark/ng/credit_punishment/CreditPunishmentEntityAgg.scala

@@ -50,6 +50,7 @@ case class CreditPunishmentEntityAgg(s: SparkSession
           .toSeq.mkStringOrNull()
       }
     }
+
     spark.udf.register("get_rowkey_by_prefix", get_rowkey_by_prefix _)
 
     def get_gender(card_num: String): Int = {
@@ -74,6 +75,24 @@ case class CreditPunishmentEntityAgg(s: SparkSession
 
     spark.udf.register("get_gender", get_gender _)
     spark.udf.register("get_birth_year", get_birth_year _)
+
+
+    def deleted_person_data(entity_type: Long, name: String, card_num: String, deleted: Long): Long = {
+      try {
+        if (entity_type == 1 && card_num == null) {
+          if (name.contains("公司")) 9
+          else deleted
+        } else
+          deleted
+      } catch {
+        case ex: Exception => {
+          deleted
+        }
+      }
+    }
+
+    spark.udf.register("deleted_person_data", deleted_person_data _)
+
     sql(
       s"""
          |CREATE TABLE IF NOT EXISTS $target_tab
@@ -337,7 +356,7 @@ case class CreditPunishmentEntityAgg(s: SparkSession
          |        ,company_zxr_final_case_num_1
          |        ,company_zxr_restrict_num_1
          |
-         |        ,deleted
+         |        ,deleted_person_data(1,name,card_num,deleted) as deleted
          |        ,company_dishonest_info_rowkey
          |        ,company_zxr_rowkey
          |        ,company_zxr_final_case_rowkey
@@ -375,7 +394,7 @@ case class CreditPunishmentEntityAgg(s: SparkSession
          |        ,company_zxr_final_case_num_1
          |        ,company_zxr_restrict_num_1
          |
-         |        ,deleted
+         |        ,deleted_person_data(1,name,card_num,deleted) as deleted
          |        ,company_dishonest_info_rowkey
          |        ,company_zxr_rowkey
          |        ,company_zxr_final_case_rowkey