Переглянути джерело

fix: 动态 知识产权只计新增

许家凯 3 роки тому
батько
коміт
3d6cd0e6af

+ 14 - 1
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_certificate.scala

@@ -4,6 +4,7 @@ package com.winhc.bigdata.spark.ng.dynamic.handle
 
 import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -13,6 +14,18 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_certificate(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty
@@ -23,7 +36,7 @@ case class company_certificate(is_inc: Boolean) extends NgCompanyDynamicHandle {
         , rta_info = null)
     )
     val info = entityInfo.filter(r => StringUtils.isNotEmpty(r.keyno))
-    if(info.nonEmpty){
+    if (info.nonEmpty) {
       list = list :+ getCompanyDynamicRecord(change_extract, null, null, null, info)
     }
     list

+ 13 - 0
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_copyright_reg.scala

@@ -4,6 +4,7 @@ package com.winhc.bigdata.spark.ng.dynamic.handle
 
 import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -13,6 +14,18 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_copyright_reg(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty

+ 13 - 0
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_copyright_works.scala

@@ -4,6 +4,7 @@ package com.winhc.bigdata.spark.ng.dynamic.handle
 
 import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -13,6 +14,18 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_copyright_works(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty

+ 14 - 2
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_icp.scala

@@ -2,8 +2,9 @@
 
 package com.winhc.bigdata.spark.ng.dynamic.handle
 
-import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -13,6 +14,17 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_icp(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty
@@ -23,7 +35,7 @@ case class company_icp(is_inc: Boolean) extends NgCompanyDynamicHandle {
         , rta_info = null)
     )
     val info = entityInfo.filter(r => StringUtils.isNotEmpty(r.keyno))
-    if(info.nonEmpty){
+    if (info.nonEmpty) {
       list = list :+ getCompanyDynamicRecord(change_extract, null, null, null, info)
     }
     list

+ 12 - 0
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_patent.scala

@@ -4,6 +4,7 @@ package com.winhc.bigdata.spark.ng.dynamic.handle
 
 import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -13,6 +14,17 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_patent(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty

+ 13 - 0
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_tm.scala

@@ -2,6 +2,7 @@ package com.winhc.bigdata.spark.ng.dynamic.handle
 
 import com.winhc.bigdata.spark.ng.dynamic.{AssociationEntityInfo, ChangeExtract, CompanyDynamicRecord, NgCompanyDynamicHandle, NgCompanyRiskLevelType}
 import com.winhc.bigdata.spark.implicits.MapHelper._
+import com.winhc.bigdata.spark.ng.dynamic.utils.CompanyDynamicUtils
 import org.apache.commons.lang3.StringUtils
 
 import scala.collection.mutable
@@ -11,6 +12,18 @@ import scala.collection.mutable
  * @date: 2021/7/20 16:40
  */
 case class company_tm(is_inc: Boolean) extends NgCompanyDynamicHandle {
+
+
+  override def filter: (String, String, Seq[String], Map[String, String], Map[String, String]) => Boolean = (update_type: String, biz_date: String, change_fields: Seq[String], old_data: Map[String, String], new_data: Map[String, String]) => {
+    if (CompanyDynamicUtils.default_filter(update_type, biz_date, change_fields, old_data, new_data)) {
+      if (update_type.equals("insert")) true
+      else
+        false
+    } else {
+      false
+    }
+  }
+
   override def flat_map: ChangeExtract => Seq[CompanyDynamicRecord] = (change_extract: ChangeExtract) => {
     val new_data = change_extract.new_data
     var list: mutable.Seq[CompanyDynamicRecord] = mutable.Seq.empty