소스 검색

参与方事件

qxp 3 년 전
부모
커밋
5dd4410a84
2개의 변경된 파일134개의 추가작업 그리고 25개의 파일을 삭제
  1. 134 25
      sql-achievement/存储过程/参与方事件.sql
  2. BIN
      sql-achievement/存储过程/表结构和字段.xls

+ 134 - 25
sql-achievement/存储过程/参与方事件.sql

@@ -72,6 +72,8 @@ replication 1;
 
 
 ==================================================初始化数据====================================================================
+
+DROP SEQUENCE IF EXISTS globaleTripID_sequence;
 CREATE OR REPLACE PROCEDURE init_partytimeline_main() -- 创建主存储过程
 IS    
 DECLARE
@@ -82,13 +84,17 @@ BEGIN
   init_insuranceclaimthread_edorlist(partytimeline_count)
   partytimeline_count:=partytimeline_count+1;
   --2.从保全表中初始化 参与事件
-  init_insuranceclaimthread_dorinfo(partytimeline_count)
+  init_insuranceclaimthread_edorinfo(partytimeline_count)
+  partytimeline_count:=partytimeline_count+1;
+  --  3.初始化理赔相关信息
+  init_insuranceclaimthread_insuranceclaimthread(partytimeline_count)
+  partytimeline_count:=partytimeline_count+1;
+ --  4.初始化投保赔相关信息
+  init_insuranceclaimthread_InsuranceArrangement(partytimeline_count)
   partytimeline_count:=partytimeline_count+1;
-
 
   --  用于以后更新时是用的序列
   strsql:='
-  DROP SEQUENCE IF EXISTS globaleTripID_sequence;
   CREATE SEQUENCE globaleTripID_sequence
   INCREMENT BY 1
   START WITH '|| partytimeline_count||'
@@ -96,7 +102,7 @@ BEGIN
   NOMINVALUE
   NOCYCLE
   CACHE 1;
-  ';  
+  '
 
   EXECUTE IMMEDIATE strsql
 
@@ -188,9 +194,9 @@ BEGIN
       PPhone   
     ) = (
       select 
-          ApplicantID ,--客户等级
-          AppCertID ,--贡献度分
-          AppPhone--家庭加分
+          ApplicantID ,
+          AppCertID ,
+          AppPhone
         from shanglifeecif.InsuranceArrangement b
         where b.PolicyNo = a.contno
     ) WHERE 1=1 ;
@@ -218,7 +224,7 @@ BEGIN
     PCertID,
     PPhone,
     '投保人',
-    '保',
+    '保',
     cusappdate,
     edoracceptno,
     contno,
@@ -241,6 +247,10 @@ END;
 
 
 
+=============================================================================================================================================================
+============================================================根据edorinfo更新========================================================================================
+==========================================================================================================================================================
+
 --------------------------------根据edorinfo更新 保全----------------------------------------
 /*
   contno  string DEFAULT NULL COMMENT '保单号', 
@@ -257,7 +267,7 @@ END;
   EDORCVALIDATE     string DEFAULT NULL COMMENT '保全生效日期 '
 */
 
-CREATE OR REPLACE PROCEDURE init_insuranceclaimthread_dorinfo(partytimeline_count OUT int) 
+CREATE OR REPLACE PROCEDURE init_insuranceclaimthread_edorinfo(partytimeline_count OUT int) 
 IS    
 BEGIN
   --初始化临时表
@@ -265,30 +275,29 @@ BEGIN
   insert into PartyTimeLine_edor_tmp(
       id,
       contno,
-      appntname,
-      cusappdate,
-      edoracceptno,
-      edorvalidate
+      PPhone,
+      PCertID,
+      edoracceptno ,
+      edorvalidate 
+
   )
   SELECT 
     row_number()over(),
     contno,
-    appntname,
+    lcmobile,
+    lcidno,
     EDORAPPDATE,
-    edoracceptno,
     EDORCVALIDATE
   from shanghailifeecif.audit_edorlist;
 
   --更新临时表信息
   UPDATE PartyTimeLine_edor_tmp a SET (
       PartyID  ,-- 参与方ID
-      PCertID     ,-- 参与方证件号码
-      PPhone   
+      appntname
     ) = (
       select 
-          ApplicantID ,--客户等级
-          AppCertID ,--贡献度分
-          AppPhone--家庭加分
+          ApplicantID ,
+          appname--投保人名称
         from shanglifeecif.InsuranceArrangement b
         where b.PolicyNo = a.contno
     ) WHERE 1=1 ;
@@ -310,13 +319,13 @@ BEGIN
       CREATED_TIME
   )
   SELECT 
-    row_number()over(),
+    row_number()over() +partytimeline_count,
     PartyID,
     appntname,
     PCertID,
     PPhone,
     '投保人',
-    '保',
+    '保',
     cusappdate,
     edoracceptno,
     contno,
@@ -332,20 +341,115 @@ BEGIN
 
   EXCEPTION
       WHEN HIVE_EXCEPTION THEN 
-         log_exception('init_insuranceclaimthread_dorinfo',sqlerrm(),sqlcode())
+         log_exception('init_insuranceclaimthread_edorinfo',sqlerrm(),sqlcode())
       WHEN Others THEN
-         log_exception('init_insuranceclaimthread_dorinfo',sqlerrm(),sqlcode())
+         log_exception('init_insuranceclaimthread_edorinfo',sqlerrm(),sqlcode())
 END;
 
 
 
+=============================================================================================================================================================
+============================================================根据insuranceclaimthread更新理赔========================================================================================
+==========================================================================================================================================================
+
+
+CREATE OR REPLACE PROCEDURE init_insuranceclaimthread_insuranceclaimthread(partytimeline_count OUT int) 
+IS    
+BEGIN
+  --初始化临时表、
+  insert into PartyTimeLine(
+      TripID,
+      PartyID, --参与方id
+      Name,
+      PCertID,
+      PPhone,
+      PRole,
+      Scenario,
+      SDate,
+      ThreadID,
+      ParentID,
+      EndDate,
+      CREATED_BY,
+      CREATED_TIME
+  )
+  SELECT 
+    row_number()over() +partytimeline_count,
+    applicantid,
+    appname,
+    appcertid,
+    appphone,
+    '投保人',
+    '报案',
+    crdate,
+    icthreadid,
+    policyno,
+    csdate,
+    'admin',
+    sysdate
+  from qxp.insuranceclaimthread where applicantid is not null;
+
+    --已经存在的数据行数
+  select count(0) into partytimeline_count from PartyTimeLine
+
+
+  EXCEPTION
+      WHEN HIVE_EXCEPTION THEN 
+         log_exception('init_insuranceclaimthread_insuranceclaimthread',sqlerrm(),sqlcode())
+      WHEN Others THEN
+         log_exception('init_insuranceclaimthread_insuranceclaimthread',sqlerrm(),sqlcode())
+END;
 
 
+=============================================================================================================================================================
+============================================================根据InsuranceArrangement更新投保========================================================================================
+==========================================================================================================================================================
 
 
+CREATE OR REPLACE PROCEDURE init_insuranceclaimthread_InsuranceArrangement(partytimeline_count OUT int) 
+IS    
+BEGIN
+  --初始化临时表、
+  insert into PartyTimeLine(
+      TripID,
+      PartyID, --参与方id
+      Name,
+      PCertID,
+      PPhone,
+      PRole,
+      Scenario,
+      SDate,
+      ThreadID,
+      ParentID,
+      EndDate,
+      CREATED_BY,
+      CREATED_TIME
+  )
+  SELECT 
+    row_number()over() +partytimeline_count,
+    applicantid,
+    appname,
+    appcertid,
+    appphone,
+    '投保人',
+    '投保',
+    PADate,
+    PANo,
+    PolicyNo,
+    PMDate ,
+    'admin',
+    sysdate
+  from shanglifeecif.InsuranceArrangement where applicantid is not null;
 
+    --已经存在的数据行数
+  select count(0) into partytimeline_count from PartyTimeLine
 
 
+  EXCEPTION
+      WHEN HIVE_EXCEPTION THEN 
+         log_exception('init_insuranceclaimthread_InsuranceArrangement',sqlerrm(),sqlcode())
+      WHEN Others THEN
+         log_exception('init_insuranceclaimthread_InsuranceArrangement',sqlerrm(),sqlcode())
+END;
 
 
 
@@ -368,6 +472,8 @@ END;
 --从 audit_edorlist 的表中插入的数据为 619006
 --有1060个数据 因为查不到保单无法进入数据库
 
+--带edorinfo 一共插入 619685 
+
 
 
 
@@ -384,4 +490,7 @@ SELECT contno,cusappdate FROM audit_edorlist GROUP BY contno,cusappdate
 SELECT count(1) a,contno FROM audit_edorlist GROUP BY contno,cusappdate ORDER BY a DESC;
 
 --查询重复最多的数据
-SELECT * FROM audit_edorlist WHERE contno = '2018020800060078';
+SELECT * FROM audit_edorlist WHERE contno = '2018020800060078';
+
+
+--

BIN
sql-achievement/存储过程/表结构和字段.xls