Parcourir la source

fix: 动态 工商动态不折叠

许家凯 il y a 3 ans
Parent
commit
85f7fd7940

+ 22 - 19
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/CompanyDynamicRecord.scala

@@ -93,33 +93,36 @@ case class CompanyDynamicRecord(id: String,
       return null
     }
     // todo 留下人名,为后期补id
-     val rec = association_entity_info.filter(r => StringUtils.isNotEmpty(r.name))
-     if (rec.isEmpty) return null
-
-     if (rec.length != association_entity_info.length)
-       return CompanyDynamicRecord(id,
-         rec,
-         rowkey,
-         tn,
-         update_type,
-         dynamic_code,
-         dynamic_info,
-         agg_detail_text,
-         agg_detail_rowkey,
-         biz_time,
-         dynamic_time,
-         update_time,
-         create_time
-       )
+    val rec = association_entity_info.filter(r => StringUtils.isNotEmpty(r.name))
+    if (rec.isEmpty) return null
+
+    if (rec.length != association_entity_info.length)
+      return CompanyDynamicRecord(id,
+        rec,
+        rowkey,
+        tn,
+        update_type,
+        dynamic_code,
+        dynamic_info,
+        agg_detail_text,
+        agg_detail_rowkey,
+        biz_time,
+        dynamic_time,
+        update_time,
+        create_time
+      )
     this
   }
 
   import com.winhc.bigdata.spark.implicits.BaseHelper._
 
+  val bus_tn = Seq("company", "company_staff", "company_holder", "company_change").toSet
+
   def to_row(): Row = {
     val risk_level_str = association_entity_info.map(_.risk_level).distinct.mkString(",")
     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)) s"${dynamic_code}_${dynamic_time}" else s"${CollapseKeyArgs.transform(tn)}_${dynamic_time}"
     Row(SecureUtil.md5(id)
       , association_entity_info.toJson()
       , rowkey
@@ -131,7 +134,7 @@ case class CompanyDynamicRecord(id: String,
       , dynamic_info.toJson()
       , agg_detail_text
       , agg_detail_rowkey_str
-      , s"${CollapseKeyArgs.transform(tn)}_${dynamic_time}"
+      , collapse_key
       , biz_time
       , dynamic_time
       , update_time