|
@@ -453,7 +453,7 @@ DROP SEQUENCE IF EXISTS globaleCusId_sequence;
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE init_individual_main() -- 初始化 数据全部插入
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_main() -- 初始化 数据全部插入
|
|
|
IS
|
|
|
DECLARE
|
|
|
individual_count int
|
|
@@ -461,17 +461,17 @@ DECLARE
|
|
|
BEGIN
|
|
|
--先验是否一个客户id有多条记录对应不通的证件类别
|
|
|
--初始化 身份证 用户
|
|
|
- init_individual_0(individual_count);
|
|
|
+ shanglifeecif.init_individual_0(individual_count);
|
|
|
|
|
|
--初始化 护照用户
|
|
|
individual_count:=individual_count+1;
|
|
|
- init_individual_1(individual_count);
|
|
|
+ shanglifeecif.init_individual_1(individual_count);
|
|
|
--初始化 驾照用户
|
|
|
individual_count:=individual_count+1;
|
|
|
- init_individual_3(individual_count);
|
|
|
+ shanglifeecif.init_individual_3(individual_count);
|
|
|
--其他 证件类型用户
|
|
|
individual_count:=individual_count+1;
|
|
|
- init_individual_other(individual_count);
|
|
|
+ shanglifeecif.init_individual_other(individual_count);
|
|
|
|
|
|
--初始化 全局序列
|
|
|
individual_count:=individual_count+1;
|
|
@@ -490,10 +490,10 @@ BEGIN
|
|
|
EXECUTE IMMEDIATE strsql
|
|
|
|
|
|
--更新用户等级信息
|
|
|
- up_t_customers_class_1();
|
|
|
+ shanglifeecif.up_t_customers_class_1();
|
|
|
|
|
|
--更新职业信息
|
|
|
- up_health_insurance_listing_1();
|
|
|
+ shanglifeecif.up_health_insurance_listing_1();
|
|
|
|
|
|
EXCEPTION
|
|
|
WHEN HIVE_EXCEPTION THEN
|
|
@@ -510,12 +510,12 @@ END;
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE init_individual_0( individual_count OUT int) -- 初始化 省份证
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_0( individual_count OUT int) -- 初始化 省份证
|
|
|
IS
|
|
|
BEGIN
|
|
|
|
|
|
--查询出此次处理的数据并出表中
|
|
|
- insert into individual (
|
|
|
+ insert into shanglifeecif.individual (
|
|
|
indid,
|
|
|
custid,
|
|
|
|
|
@@ -539,7 +539,7 @@ BEGIN
|
|
|
idcard ,
|
|
|
|
|
|
sysdate,
|
|
|
- 'qxp'
|
|
|
+ 'admin'
|
|
|
FROM (
|
|
|
SELECT
|
|
|
customerno AS scustid,--投保人
|
|
@@ -564,7 +564,7 @@ BEGIN
|
|
|
WHERE insuredno IS NOT NULL AND insuredidtype=0
|
|
|
) tmpTable
|
|
|
--已经存在的数据行数
|
|
|
- select count(0) into individual_count from individual
|
|
|
+ select count(0) into individual_count from shanglifeecif.individual
|
|
|
EXCEPTION
|
|
|
WHEN HIVE_EXCEPTION THEN
|
|
|
log_exception('init_individual_0',sqlerrm(),sqlcode())
|
|
@@ -576,12 +576,12 @@ END;
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE init_individual_1(individual_count INOUT int) -- 初始化 护照
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_1(individual_count INOUT int) -- 初始化 护照
|
|
|
IS
|
|
|
BEGIN
|
|
|
|
|
|
--查询出此次处理的数据并出表中
|
|
|
- insert into individual (
|
|
|
+ insert into shanglifeecif.individual (
|
|
|
indid,
|
|
|
custid,
|
|
|
|
|
@@ -606,7 +606,7 @@ BEGIN
|
|
|
idcard ,
|
|
|
|
|
|
sysdate,
|
|
|
- 'qxp'
|
|
|
+ 'admin'
|
|
|
FROM (
|
|
|
SELECT
|
|
|
customerno AS scustid,--投保人
|
|
@@ -632,7 +632,7 @@ BEGIN
|
|
|
) tmpTable
|
|
|
|
|
|
--已经存在的数据行数
|
|
|
- select count(0) into individual_count from individual
|
|
|
+ select count(0) into individual_count from shanglifeecif.individual
|
|
|
|
|
|
EXCEPTION
|
|
|
WHEN HIVE_EXCEPTION THEN
|
|
@@ -643,12 +643,12 @@ END;
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE init_individual_3(individual_count INOUT int) -- 初始化 护照
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_3(individual_count INOUT int) -- 初始化 护照
|
|
|
IS
|
|
|
BEGIN
|
|
|
|
|
|
--查询出此次处理的数据并出表中
|
|
|
- insert into individual(
|
|
|
+ insert into shanglifeecif.individual(
|
|
|
indid,
|
|
|
custid,
|
|
|
|
|
@@ -672,7 +672,7 @@ BEGIN
|
|
|
idcard ,
|
|
|
|
|
|
sysdate,
|
|
|
- 'qxp'
|
|
|
+ 'admin'
|
|
|
FROM (
|
|
|
SELECT
|
|
|
customerno AS scustid,--投保人
|
|
@@ -698,7 +698,7 @@ BEGIN
|
|
|
) tmpTable
|
|
|
|
|
|
--已经存在的数据行数
|
|
|
- select count(0) into individual_count from individual
|
|
|
+ select count(0) into individual_count from shanglifeecif.individual
|
|
|
|
|
|
EXCEPTION
|
|
|
WHEN HIVE_EXCEPTION THEN
|
|
@@ -710,12 +710,12 @@ END;
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE init_individual_other(individual_count INOUT int) -- 初始化 护照
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_other(individual_count INOUT int) -- 初始化出了以上三种证件信息
|
|
|
IS
|
|
|
BEGIN
|
|
|
|
|
|
--查询出此次处理的数据并出表中
|
|
|
- insert into individual(
|
|
|
+ insert into shanglifeecif.individual(
|
|
|
indid,
|
|
|
custid,
|
|
|
|
|
@@ -736,7 +736,7 @@ BEGIN
|
|
|
gender ,
|
|
|
birthday,
|
|
|
sysdate,
|
|
|
- 'qxp'
|
|
|
+ 'admin'
|
|
|
FROM (
|
|
|
SELECT
|
|
|
customerno AS scustid,--投保人
|
|
@@ -762,23 +762,19 @@ BEGIN
|
|
|
) tmpTable
|
|
|
|
|
|
--已经存在的数据行数
|
|
|
- select count(0) into individual_count from individual
|
|
|
+ select count(0) into individual_count from shanglifeecif.individual
|
|
|
+
|
|
|
|
|
|
- EXCEPTION
|
|
|
- WHEN HIVE_EXCEPTION THEN
|
|
|
- log_exception('init_individual_other',sqlerrm(),sqlcode())
|
|
|
- WHEN Others THEN
|
|
|
- log_exception('init_individual_other',sqlerrm(),sqlcode())
|
|
|
END;
|
|
|
|
|
|
--创建存储过程 插入individual_search
|
|
|
!set plsqlUseSlash true
|
|
|
SET plsql.catch.hive.exception=true; --使用HIVE_EXCEPTION捕获Hive异常
|
|
|
--set plsql.compile.dml.check.semantic=false; --禁止编译过程对PL/SQL内部语法进行检查。
|
|
|
-CREATE OR REPLACE PROCEDURE up_t_customers_class_1() -- 创建存储过程
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.up_t_customers_class_1() -- 创建存储过程
|
|
|
IS
|
|
|
BEGIN
|
|
|
- UPDATE individual a SET (
|
|
|
+ UPDATE shanglifeecif.individual a SET (
|
|
|
CustClass ,-- 客户等级
|
|
|
ConValue ,-- 贡献度分
|
|
|
Awarded3 ,-- 家庭加分2
|
|
@@ -788,10 +784,17 @@ BEGIN
|
|
|
EndDate, -- 客户等级失效日期
|
|
|
Height, --身高
|
|
|
Weight, --体重
|
|
|
+ BMI,
|
|
|
PIncome, --个人年收入
|
|
|
FIncome, --家庭年收入
|
|
|
IncomeSource, --收入来源
|
|
|
- SIStatus --社保情况
|
|
|
+ SIStatus, --社保情况
|
|
|
+ Ethnic, --民族情况
|
|
|
+ Nation, --国籍
|
|
|
+ MaritalStat, --婚姻
|
|
|
+ Employer,--工作单位
|
|
|
+ Education,--学历
|
|
|
+ Dday--死亡日期
|
|
|
) = (
|
|
|
select
|
|
|
CLASS_VALUE ,--客户等级
|
|
@@ -803,12 +806,19 @@ BEGIN
|
|
|
END_DATE, --失效日期
|
|
|
STATURE, --身高
|
|
|
AVOIRDUPOIS,--体重
|
|
|
+ BMI,
|
|
|
YEARINCOME, --个人年收入
|
|
|
FAMILYYEARSALARY, --家庭年收入
|
|
|
INCOMESOURCE, --收入来源
|
|
|
- SOCIALINSUFLAG --社保情况
|
|
|
-
|
|
|
- from shanghailifeecif.t_customer_class b
|
|
|
+ SOCIALINSUFLAG, --社保情况
|
|
|
+ NATIONALITY, --民族情况
|
|
|
+ NATIVEPLACE, --国籍
|
|
|
+ MARRIAGE,--婚姻
|
|
|
+ GRPNAME,--工作单位名称
|
|
|
+ DEGREE,--学历
|
|
|
+ DEATHDATE--死亡日期
|
|
|
+
|
|
|
+ from t_customer_class b
|
|
|
where b.CUSTOMER_ID = a.scustid;
|
|
|
) WHERE 1=1 ;
|
|
|
EXCEPTION
|
|
@@ -818,8 +828,8 @@ BEGIN
|
|
|
log_exception('up_t_customers_class_1',sqlerrm(),sqlcode())
|
|
|
END;
|
|
|
/
|
|
|
-DROP TABLE IF EXISTS occupation_tmp;
|
|
|
-CREATE TABLE occupation_tmp(
|
|
|
+DROP TABLE IF EXISTS shanglifeecif.occupation_tmp;
|
|
|
+CREATE TABLE shanglifeecif.occupation_tmp(
|
|
|
scustid string not NULL COMMENT '客户号',
|
|
|
OccupationId string DEFAULT NULL COMMENT '名称',
|
|
|
Occupation string DEFAULT NULL COMMENT '出生日期' ,
|
|
@@ -829,13 +839,13 @@ CREATE TABLE occupation_tmp(
|
|
|
with shard number 10
|
|
|
replication 1;
|
|
|
--根据HEALTH_INSURANCE_LISTING表更新
|
|
|
-CREATE OR REPLACE PROCEDURE up_health_insurance_listing_1() -- 创建存储过程
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.up_health_insurance_listing_1() -- 创建存储过程
|
|
|
IS
|
|
|
BEGIN
|
|
|
--清楚临时表数据
|
|
|
- delete occupation_tmp;
|
|
|
+ delete shanglifeecif.occupation_tmp;
|
|
|
--插入去重数据到临时表
|
|
|
- insert into occupation_tmp(
|
|
|
+ insert into shanglifeecif.occupation_tmp(
|
|
|
scustid,
|
|
|
OccupationId,
|
|
|
Occupation,
|
|
@@ -853,7 +863,7 @@ BEGIN
|
|
|
|
|
|
--更新个人信息表
|
|
|
|
|
|
- UPDATE individual a SET (
|
|
|
+ UPDATE shanglifeecif.individual a SET (
|
|
|
OccupationId ,-- 职业代码
|
|
|
Occupation, -- 职业名称
|
|
|
HomeAdress
|
|
@@ -862,7 +872,7 @@ BEGIN
|
|
|
OccupationId ,--职业代码
|
|
|
Occupation,--职业名称
|
|
|
HomeAdress
|
|
|
- from occupation_tmp b
|
|
|
+ from shanglifeecif.occupation_tmp b
|
|
|
where b.scustid = a.scustid
|
|
|
) WHERE 1=1 ;
|
|
|
EXCEPTION
|
|
@@ -896,8 +906,8 @@ END;
|
|
|
=======================================================================================================================================
|
|
|
|
|
|
|
|
|
-DROP TABLE IF EXISTS scustid_unique_tmp;
|
|
|
-CREATE TABLE scustid_unique_tmp(
|
|
|
+DROP TABLE IF EXISTS shanglifeecif.scustid_unique_tmp;
|
|
|
+CREATE TABLE shanglifeecif.scustid_unique_tmp(
|
|
|
scustid string COMMENT '上游客户号' ,
|
|
|
indid string COMMENT '客户号'
|
|
|
)
|
|
@@ -907,15 +917,15 @@ with shard number 10
|
|
|
replication 1;
|
|
|
|
|
|
--更新individual 的用户关系
|
|
|
-CREATE OR REPLACE PROCEDURE up_scustid_unique_tmp() -- 创建存储过程
|
|
|
+CREATE OR REPLACE PROCEDURE shanglifeecif.up_scustid_unique_tmp() -- 创建存储过程
|
|
|
IS
|
|
|
BEGIN
|
|
|
--清楚临时表数据
|
|
|
- delete from scustid_unique_tmp;
|
|
|
+ delete from shanglifeecif.scustid_unique_tmp;
|
|
|
|
|
|
--插入临时表数据
|
|
|
- insert into scustid_unique_tmp(scustid,indid)
|
|
|
- select scustid,min(indid) from individual group by scustid;
|
|
|
+ insert into shanglifeecif.scustid_unique_tmp(scustid,indid)
|
|
|
+ select scustid,min(indid) from shanglifeecif.individual group by scustid;
|
|
|
|
|
|
EXCEPTION
|
|
|
WHEN HIVE_EXCEPTION THEN
|