Bläddra i källkod

fix: 动态股东引入出资比例

许家凯 3 år sedan
förälder
incheckning
19ed6fe764

+ 16 - 10
src/main/scala/com/winhc/bigdata/spark/ng/dynamic/handle/company_holder.scala

@@ -124,7 +124,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
     }
 
     //股东人员变化
-    def shareholder(beforeName: String, beforeKeyno: String, afterName: String, afterKeyno: String): Seq[CompanyDynamicRecord] = {
+    def shareholder(beforeName: String, beforeKeyno: String, beforePercent: String, afterName: String, afterKeyno: String, afterPercent: String): Seq[CompanyDynamicRecord] = {
       if (beforeName == null) {
         val cdr = getRecordPro(
           dynamicCode = "101102"
@@ -133,7 +133,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
           , label = "股东变化"
           , risk_level = NgCompanyRiskLevelType.Prompt
           , content = Seq(ChangeContent("101102", before = null
-            , after = Entity(afterName, afterKeyno)
+            , after = Entity(afterName, afterKeyno, afterPercent)
             , entity = Entity(name = company_name, keyno = company_id)))
         )
 
@@ -144,7 +144,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
           , label = "对外投资"
           , risk_level = NgCompanyRiskLevelType.Prompt
           , content = Seq(ChangeContent("109004", before = null
-            , after = Entity(name = company_name, keyno = company_id)
+            , after = Entity(name = company_name, keyno = company_id, afterPercent)
             , entity = Entity(afterName, afterKeyno)))
         )
         Seq(cdr, cdr2)
@@ -155,7 +155,8 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
           , name = company_name
           , label = "股东变化"
           , risk_level = NgCompanyRiskLevelType.Prompt
-          , content = Seq(ChangeContent("101102", before = Entity(beforeName, beforeKeyno)
+          , content = Seq(ChangeContent("101102"
+            , before = Entity(beforeName, beforeKeyno, beforePercent)
             , after = null
             , entity = Entity(name = company_name, keyno = company_id)))
         )
@@ -166,7 +167,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
           , name = beforeName
           , label = "对外投资"
           , risk_level = NgCompanyRiskLevelType.Prompt
-          , content = Seq(ChangeContent("109004", before = Entity(name = company_name, keyno = company_id)
+          , content = Seq(ChangeContent("109004", before = Entity(name = company_name, keyno = company_id, beforePercent)
             , after = null
             , entity = Entity(beforeName, beforeKeyno)))
         )
@@ -176,7 +177,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
     }
 
     //股东新增对外投资
-    def holderNew(name: String, keyno: String, companyName: String, companyId: String): Seq[CompanyDynamicRecord] = {
+    def holderNew(name: String, keyno: String, companyName: String, companyId: String, percent: String): Seq[CompanyDynamicRecord] = {
       val cdr = getRecordPro(
         dynamicCode = "109004"
         , keyno = keyno
@@ -184,7 +185,7 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
         , label = "对外投资"
         , risk_level = NgCompanyRiskLevelType.Prompt
         , content = Seq(ChangeContent("109004", before = null
-          , after = Entity(companyName, companyId)
+          , after = Entity(companyName, companyId, percent)
           , entity = Entity(name = name, keyno = keyno)))
       )
       Seq(cdr)
@@ -198,21 +199,25 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
         val n_company_name = new_data("company_name")
         val n_holder_name = new_data("holder_name")
         val n_holder_id = new_data("holder_id")
+        val n_percent = new_data("percent")
 
-        list = list ++ shareholder(null, null, n_holder_name, n_holder_id)
+        list = list ++ shareholder(null, null, null, n_holder_name, n_holder_id, n_percent)
       }
       case "create" => {
         //公司新成立
         val n_holder_name = new_data("holder_name")
         val n_holder_id = new_data("holder_id")
-        list = list ++ holderNew(n_holder_name, n_holder_id, company_name, company_id)
+        val n_percent = new_data("percent")
+        list = list ++ holderNew(n_holder_name, n_holder_id, company_name, company_id, n_percent)
       }
 
       case "update" => {
         //股东出资额发变化
         if (change_fields.contains("amount")) {
           val o_capital = getRealCapital(old_data("capital"))
+          val o_percent = getRealCapital(old_data("percent"))
           val n_capital = getRealCapital(new_data("capital"))
+          val n_percent = getRealCapital(new_data("percent"))
 
           val old_amount = (o_capital == null) ? old_data("amount") | o_capital
           val new_amount = (n_capital == null) ? new_data("amount") | n_capital
@@ -232,7 +237,8 @@ case class company_holder(is_inc: Boolean) extends NgCompanyDynamicHandle {
         val n_company_name = new_data("company_name")
         val n_holder_name = new_data("holder_name")
         val n_holder_id = new_data("holder_id")
-        list = list ++ shareholder(n_holder_name, n_holder_id, null, null)
+        val n_percent = new_data("percent")
+        list = list ++ shareholder(n_holder_name, n_holder_id, n_percent, null, null, null)
       }
     }
     list