瀏覽代碼

feat(ng.change): 变更计算区分存量、增量时间字段

JimZhang 3 年之前
父節點
當前提交
c93fe9a204

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/auction_tracking.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class auction_tracking(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc? DateUtils.getBizDate(newMap("update_time")) | DateUtils.getBizDate(newMap("start_time"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_abnormal_info.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_abnormal_info(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc? DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("put_date"))
 }

+ 0 - 1
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_check_info.scala

@@ -5,7 +5,6 @@ package com.winhc.bigdata.spark.ng.change.table
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
 
-
 case class company_check_info(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 

+ 2 - 1
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_court_announcement.scala

@@ -4,10 +4,11 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 
 case class company_court_announcement(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc? DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("publish_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_court_open_announcement.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_court_open_announcement(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("start_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_court_register.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_court_register(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("filing_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_env_punishment.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_env_punishment(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("publish_time"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_illegal_info.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_illegal_info(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("put_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_own_tax.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_own_tax(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("publish_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_punishment_info.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_punishment_info(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("decision_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_punishment_info_creditchina.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_punishment_info_creditchina(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("decision_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_send_announcement.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_send_announcement(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("start_date"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/company_tax_contravention.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class company_tax_contravention(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("publish_time"))
 }

+ 2 - 2
src/main/scala/com/winhc/bigdata/spark/ng/change/table/zxr_evaluate_results.scala

@@ -4,10 +4,10 @@ package com.winhc.bigdata.spark.ng.change.table
 
 import com.winhc.bigdata.spark.ng.change.NgCompanyChangeHandle
 import com.winhc.bigdata.spark.utils.DateUtils
-
+import com.winhc.bigdata.spark.ng.change.utils.Bool._
 
 case class zxr_evaluate_results(equCols: Seq[String],is_inc:Boolean) extends NgCompanyChangeHandle {
 
 
-  override protected def getBizDate(newMap: Map[String, String]): String = DateUtils.getBizDate(newMap("update_time"))
+  override protected def getBizDate(newMap: Map[String, String]): String = is_inc?DateUtils.getBizDate(newMap("update_time"))|DateUtils.getBizDate(newMap("publish_time"))
 }

+ 19 - 0
src/main/scala/com/winhc/bigdata/spark/ng/change/utils/Bool.scala

@@ -0,0 +1,19 @@
+package com.winhc.bigdata.spark.ng.change.utils
+
+import scala.language.implicitConversions
+
+/**
+ * @author ZhangJi
+ * @since 2021-06-30 15:47
+ */
+
+case class Bool(b: Boolean) {
+  def ?[X](t: => X) = new {
+    def |(f: => X) = if (b) t else f
+  }
+}
+
+object Bool {
+  implicit def BooleanBool(b: Boolean): Bool = Bool(b)
+}
+