数据
This commit is contained in:
parent
eb133c0365
commit
893b697d5a
@ -4,14 +4,67 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
|
|||||||
-- Created : 2023/3/10 15:13:34
|
-- Created : 2023/3/10 15:13:34
|
||||||
-- Purpose : 桌面霸屏项目基础数据生成包
|
-- Purpose : 桌面霸屏项目基础数据生成包
|
||||||
|
|
||||||
PROCEDURE 车非基础数据(a_gen_date IN DATE);
|
PROCEDURE 车非基础数据
|
||||||
|
(
|
||||||
|
a_start_date IN DATE,
|
||||||
|
a_end_date IN DATE
|
||||||
|
);
|
||||||
|
|
||||||
|
PROCEDURE gen_车非临时数据
|
||||||
|
(
|
||||||
|
a_start_date IN DATE,
|
||||||
|
a_end_date IN DATE
|
||||||
|
);
|
||||||
|
|
||||||
END telsale_archievement_pkg;
|
END telsale_archievement_pkg;
|
||||||
/
|
/
|
||||||
CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
||||||
|
|
||||||
PROCEDURE 车非基础数据(a_gen_date IN DATE) IS
|
PROCEDURE 车非基础数据
|
||||||
CURSOR cur_chefei IS
|
(
|
||||||
|
a_start_date IN DATE,
|
||||||
|
a_end_date IN DATE
|
||||||
|
) IS
|
||||||
|
--l_count INTEGER; --已有记录的数量
|
||||||
|
BEGIN
|
||||||
|
--产生临时数据
|
||||||
|
gen_车非临时数据(a_start_date,
|
||||||
|
a_end_date);
|
||||||
|
|
||||||
|
FOR caller_record IN (SELECT *
|
||||||
|
FROM 车非每日保费_t)
|
||||||
|
LOOP
|
||||||
|
BEGIN
|
||||||
|
DELETE 车非每日保费 cf
|
||||||
|
WHERE cf.签单日期 = caller_record.签单日期
|
||||||
|
AND cf.部门 = caller_record.部门
|
||||||
|
AND cf.经办人n = caller_record.经办人n
|
||||||
|
AND cf.坐席工号 = caller_record.坐席工号;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN no_data_found THEN
|
||||||
|
NULL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
INSERT INTO 车非每日保费
|
||||||
|
VALUES caller_record;
|
||||||
|
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN OTHERS THEN
|
||||||
|
NULL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
PROCEDURE gen_车非临时数据
|
||||||
|
(
|
||||||
|
a_start_date IN DATE,
|
||||||
|
a_end_date IN DATE
|
||||||
|
) IS
|
||||||
|
BEGIN
|
||||||
|
EXECUTE IMMEDIATE 'truncate table 车非每日保费_t';
|
||||||
|
|
||||||
|
INSERT INTO 车非每日保费_t
|
||||||
WITH aa AS
|
WITH aa AS
|
||||||
(SELECT to_char(t.signature_date,
|
(SELECT to_char(t.signature_date,
|
||||||
'yyyy-mm-dd') 签单日期,
|
'yyyy-mm-dd') 签单日期,
|
||||||
@ -24,9 +77,7 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
e.inception_date qbsj,
|
e.inception_date qbsj,
|
||||||
e.planned_end_date zzsj,
|
e.planned_end_date zzsj,
|
||||||
pt.premium_amount - nvl(pt.tax_amount,
|
pt.premium_amount - nvl(pt.tax_amount,
|
||||||
0) bf
|
0) bf,
|
||||||
--,qt.qdbf - nvl(qt.qdbf_tax_amount,0) bf
|
|
||||||
,
|
|
||||||
nt.ecompensation_rate * (pt.premium_amount - nvl(pt.tax_amount,
|
nt.ecompensation_rate * (pt.premium_amount - nvl(pt.tax_amount,
|
||||||
0)) fxbf,
|
0)) fxbf,
|
||||||
z.department_name bm,
|
z.department_name bm,
|
||||||
@ -110,8 +161,6 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
LEFT JOIN datacenter.dc_YZH_ZXYS YS
|
LEFT JOIN datacenter.dc_YZH_ZXYS YS
|
||||||
ON YS.坐席工号 = nvl(zx.workerno,
|
ON YS.坐席工号 = nvl(zx.workerno,
|
||||||
et.telpartnercode)
|
et.telpartnercode)
|
||||||
--left join v_lsj_dimian dm on dm.vin=v.vin and e.selling_channel_type='25' and dm.MEMO like'%地面续保%'
|
|
||||||
--left join datacenter.dc_lsj_zx_team zt on zt.name=coalesce(zc.name,zc1.name,bc.name,dm.JBRMC)
|
|
||||||
WHERE t.signature_date >= to_date('2023-01-01 00:00:00',
|
WHERE t.signature_date >= to_date('2023-01-01 00:00:00',
|
||||||
'yyyy-mm-dd hh24:mi:ss')
|
'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND t.signature_date < to_date(to_char(SYSDATE - 1,
|
AND t.signature_date < to_date(to_char(SYSDATE - 1,
|
||||||
@ -122,7 +171,6 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
AND qt.tflag = '0' --条件:类型为个人
|
AND qt.tflag = '0' --条件:类型为个人
|
||||||
AND qt.usage_xm = '家庭自用车'
|
AND qt.usage_xm = '家庭自用车'
|
||||||
--条件:单程提车、摩托车、拖拉机
|
--条件:单程提车、摩托车、拖拉机
|
||||||
--and e.policy_no in ('AXIMC90Y1419B038594J','AXIMC90CTP19B039593R','AXIMC04CTP19B013473X')
|
|
||||||
AND e.planned_end_date - e.inception_date >= 360
|
AND e.planned_end_date - e.inception_date >= 360
|
||||||
--条件:保单周期
|
--条件:保单周期
|
||||||
)
|
)
|
||||||
@ -228,7 +276,6 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
ON qna.policy_no = q.policy_no
|
ON qna.policy_no = q.policy_no
|
||||||
LEFT JOIN datacenter.dc_yangg_gkxzh gk
|
LEFT JOIN datacenter.dc_yangg_gkxzh gk
|
||||||
ON gk.product_code = e.product_code --分散型险种
|
ON gk.product_code = e.product_code --分散型险种
|
||||||
--left join datacenter.dc_yangg_zbxzh zb on zb.product_code = e.product_code --政保险种
|
|
||||||
LEFT JOIN dd
|
LEFT JOIN dd
|
||||||
ON dd.tid = qna.t_cre
|
ON dd.tid = qna.t_cre
|
||||||
WHERE qna.tflag = '0'
|
WHERE qna.tflag = '0'
|
||||||
@ -239,15 +286,12 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
2) != 0 THEN
|
2) != 0 THEN
|
||||||
'是'
|
'是'
|
||||||
END) IS NULL
|
END) IS NULL
|
||||||
--and q.endorsement_no = '无'
|
|
||||||
AND e.policy_status = '1'
|
AND e.policy_status = '1'
|
||||||
AND gk.product_code IS NOT NULL
|
AND gk.product_code IS NOT NULL
|
||||||
AND (e.product_code LIKE '2%' OR e.product_code LIKE '1106%' --意健 --责任
|
AND (e.product_code LIKE '2%' OR e.product_code LIKE '1106%' --意健 --责任
|
||||||
OR e.product_code LIKE '1107%' OR e.product_code LIKE '1108%' OR e.product_code LIKE '1307%' OR
|
OR e.product_code LIKE '1107%' OR e.product_code LIKE '1108%' OR e.product_code LIKE '1307%' OR e.product_code LIKE '1304A400%' --家财
|
||||||
e.product_code LIKE '1304A400%' --家财
|
|
||||||
|
|
||||||
)
|
)
|
||||||
--and e.product_code not in ('22KC9800')
|
|
||||||
AND q.signature_date >= to_date('2023-01-01 00:00:00',
|
AND q.signature_date >= to_date('2023-01-01 00:00:00',
|
||||||
'yyyy-mm-dd hh24:mi:ss')
|
'yyyy-mm-dd hh24:mi:ss')
|
||||||
AND q.signature_date < to_date(to_char(SYSDATE - 1,
|
AND q.signature_date < to_date(to_char(SYSDATE - 1,
|
||||||
@ -273,10 +317,10 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
FROM dd
|
FROM dd
|
||||||
LEFT JOIN cc
|
LEFT JOIN cc
|
||||||
ON cc.融合证件 = dd.tid
|
ON cc.融合证件 = dd.tid
|
||||||
AND cc.mm_f = dd.mm) --OR cc.融合证件 = dd.btid
|
AND cc.mm_f = dd.mm)
|
||||||
--select * from ff
|
SELECT to_date(签单日期,
|
||||||
SELECT 签单日期,
|
'yyyy-mm-dd'),
|
||||||
--mm,
|
mm 月份,
|
||||||
bm 部门,
|
bm 部门,
|
||||||
科室N,
|
科室N,
|
||||||
经办人N,
|
经办人N,
|
||||||
@ -288,8 +332,10 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
nvl(SUM(融合保费),
|
nvl(SUM(融合保费),
|
||||||
0) 车非融合保费
|
0) 车非融合保费
|
||||||
FROM ff
|
FROM ff
|
||||||
WHERE ff.签单日期 = to_char(a_gen_date,
|
WHERE ff.签单日期 >= to_char(a_start_date,
|
||||||
'yyyy-mm-dd')
|
'yyyy-mm-dd')
|
||||||
|
AND ff.签单日期 <= to_char(a_end_date,
|
||||||
|
'yyyy-mm-dd')
|
||||||
AND bm IN ('续保业务部',
|
AND bm IN ('续保业务部',
|
||||||
'湖里支公司')
|
'湖里支公司')
|
||||||
GROUP BY 签单日期,
|
GROUP BY 签单日期,
|
||||||
@ -302,11 +348,6 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
经办人N
|
经办人N
|
||||||
ORDER BY 部门,
|
ORDER BY 部门,
|
||||||
坐席名称;
|
坐席名称;
|
||||||
BEGIN
|
|
||||||
FOR caller_record IN cur_chefei
|
|
||||||
LOOP
|
|
||||||
NULL;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
@ -18,9 +18,8 @@ WITH aa AS
|
|||||||
0)) fxbf,
|
0)) fxbf,
|
||||||
z.department_name bm,
|
z.department_name bm,
|
||||||
CASE
|
CASE
|
||||||
WHEN (et.telpartnercode LIKE '%HC%' OR
|
WHEN (et.telpartnercode LIKE '%HC%' OR zx.workerno IN (SELECT code
|
||||||
zx.workerno IN (SELECT code
|
FROM datacenter.dc_lsj_zx_hc)) THEN
|
||||||
FROM datacenter.dc_lsj_zx_hc)) THEN
|
|
||||||
'º£²×·á¿¥'
|
'º£²×·á¿¥'
|
||||||
ELSE
|
ELSE
|
||||||
''
|
''
|
||||||
@ -230,8 +229,7 @@ bb AS
|
|||||||
AND e.policy_status = '1'
|
AND e.policy_status = '1'
|
||||||
AND gk.product_code IS NOT NULL
|
AND gk.product_code IS NOT NULL
|
||||||
AND (e.product_code LIKE '2%' OR e.product_code LIKE '1106%' --Ò⽡ --ÔðÈÎ
|
AND (e.product_code LIKE '2%' OR e.product_code LIKE '1106%' --Ò⽡ --ÔðÈÎ
|
||||||
OR e.product_code LIKE '1107%' OR e.product_code LIKE '1108%' OR e.product_code LIKE '1307%' OR
|
OR e.product_code LIKE '1107%' OR e.product_code LIKE '1108%' OR e.product_code LIKE '1307%' OR e.product_code LIKE '1304A400%' --¼Ò²Æ
|
||||||
e.product_code LIKE '1304A400%' --¼Ò²Æ
|
|
||||||
|
|
||||||
)
|
)
|
||||||
--and e.product_code not in ('22KC9800')
|
--and e.product_code not in ('22KC9800')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user