Explorar el Código

fix: 法院公告当事人去重

许家凯 hace 3 años
padre
commit
e240e6a857

+ 16 - 2
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/CompanyDynamicRecord.scala

@@ -28,7 +28,21 @@ case class AssociationEntityInfo(keyno: String
                                  , name: String
                                  , risk_level: NgCompanyRiskLevelType //变更风险等级
                                  , rta_info: String //描述
-                                )
+                                ) extends Comparable[AssociationEntityInfo] {
+
+
+  override def hashCode(): Int = s"$name@$risk_level".hashCode()
+
+  override def equals(obj: Any): Boolean =
+    obj match {
+      case d: AssociationEntityInfo =>
+        s"$name@$risk_level".equals(s"${d.name}@${d.risk_level}")
+      case _ =>
+        false
+    }
+
+  override def compareTo(o: AssociationEntityInfo): Int = s"$name@$risk_level".compareTo(s"${o.name}@${o.risk_level}")
+}
 
 case class RowkeyInfo(rowkey: String, tn: String) {
   def toStr(): String = {
@@ -123,7 +137,7 @@ case class CompanyDynamicRecord(id: String,
     val risk_level_detail = association_entity_info.filter(r => StringUtils.isNotBlank(r.keyno)).map(r => s"${r.keyno}@@${r.risk_level}").distinct.mkStringOrNull(",")
     val agg_detail_rowkey_str: String = if (agg_detail_rowkey == null || agg_detail_rowkey.isEmpty) null else agg_detail_rowkey.map(_.toStr).mkString(",")
     val collapse_key = if (bus_tn.contains(tn)) {
-      if (dynamic_code.equals("110101"))//存量法人变化转化为增量的code
+      if (dynamic_code.equals("110101")) //存量法人变化转化为增量的code
         s"101003_${dynamic_time}"
       else
         s"${dynamic_code}_${dynamic_time}"

+ 1 - 0
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/NgCompanyDynamic.scala

@@ -199,6 +199,7 @@ object NgCompanyDynamic {
     val spark = SparkUtils.InitEnv(this.getClass.getSimpleName, config)
 
     //    val tn = "auction_tracking,company_land_announcement,company_own_tax"
+    //    val tn = "company_holder"
     val tn = "all"
     var dynamicArgs = NgCompanyDynamicArgs.getStartArgs(inc)
     var aggArgs = NgCompanyDynamicArgs.getAggArgs

+ 3 - 3
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_court_announcement.scala

@@ -20,9 +20,9 @@ case class company_court_announcement(is_inc:Boolean) extends DailyAggHandle wit
       val defendant_info = new_data.getOrEmptyStr("litigant_info")
       list = list ++ getEntity(defendant_info, "litigant_id", "name", NgCompanyRiskLevelType.Caution, "当事人")
 
-//      val plaintiff_info = new_data.getOrEmptyStr("plaintiff_info")
-//      list = list ++ getEntity(plaintiff_info, "litigant_id", "name", NgCompanyRiskLevelType.Prompt, "做为原告/上诉人")
-      list
+      val plaintiff_info = new_data.getOrEmptyStr("plaintiff_info")
+      list = list ++ getEntity(plaintiff_info, "litigant_id", "name", NgCompanyRiskLevelType.Prompt, "当事人")
+      list.distinct
     } catch {
       case e: Exception => {
         logError(e.getMessage, e)