保存进度!

This commit is contained in:
Kane Wang 2023-05-18 15:40:04 +08:00
parent 34c60ada3e
commit fa79a8f8d1
2 changed files with 51 additions and 8 deletions

View File

@ -4,11 +4,15 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
-- Created : 2023/3/10 15:13:34 -- Created : 2023/3/10 15:13:34
-- Purpose : 桌面霸屏项目基础数据生成包 -- Purpose : 桌面霸屏项目基础数据生成包
TYPE cur_type IS REF CURSOR;
PROCEDURE department_archievement PROCEDURE department_archievement
( (
a_department_code IN VARCHAR2, a_department_code IN VARCHAR2,
a_attaching_rate OUT VARCHAR2, a_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2 a_renewal_rate OUT VARCHAR2,
a_total OUT VARCHAR2,
a_mensual_cur OUT cur_type
); );
END telsale_archievement_pkg; END telsale_archievement_pkg;
@ -20,14 +24,27 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
( (
a_department_code IN VARCHAR2, a_department_code IN VARCHAR2,
a_attaching_rate OUT VARCHAR2, a_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2 a_renewal_rate OUT VARCHAR2,
a_total OUT VARCHAR2,
a_mensual_cur OUT cur_type
) IS ) IS
l_this_month VARCHAR2(4); l_this_month VARCHAR2(4);
l_this_year DATE;
l_department_name VARCHAR2(100); l_department_name VARCHAR2(100);
BEGIN BEGIN
l_this_month := to_char(SYSDATE, l_this_month := to_char(SYSDATE,
'mm') || '月'; 'mm') || '月';
l_this_year := to_date(to_char(SYSDATE,
'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss');
SELECT bm.department_name
INTO l_department_name
FROM idst0.bm_t bm
WHERE bm.department_code = a_department_code;
--车非渗透率
SELECT decode(SUM(cf.车险个人客户保费), SELECT decode(SUM(cf.车险个人客户保费),
0, 0,
0, 0,
@ -38,11 +55,7 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
WHERE cf.月份 = l_this_month WHERE cf.月份 = l_this_month
AND 部门代码 = a_department_code; AND 部门代码 = a_department_code;
SELECT bm.department_name --续保率
INTO l_department_name
FROM idst0.bm_t bm
WHERE bm.department_code = a_department_code;
SELECT decode(SUM(到期数), SELECT decode(SUM(到期数),
0, 0,
0, 0,
@ -51,6 +64,31 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
INTO a_renewal_rate INTO a_renewal_rate
FROM 坐席续保统计 FROM 坐席续保统计
WHERE 部门 = l_department_name; WHERE 部门 = l_department_name;
--总业绩
SELECT round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费),
0),
0)
INTO a_total
FROM 车非每日保费 cf
WHERE 部门代码 = a_department_code
AND 签单日期 >= l_this_year
AND 签单日期 <= SYSDATE;
--每月业绩
OPEN a_mensual_cur FOR
SELECT cf.月份 mm,
round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费),
0),
0) bf
FROM 车非每日保费 cf
WHERE 部门代码 = a_department_code
AND 签单日期 >= to_date(to_char(SYSDATE,
'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss')
AND 签单日期 <= SYSDATE
GROUP BY cf.月份
ORDER BY cf.月份;
END; END;
BEGIN BEGIN

View File

@ -19,6 +19,8 @@ import java.sql.CallableStatement;
import java.util.Vector; import java.util.Vector;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import oracle.jdbc.OracleTypes;
public class DepartmentArchievement public class DepartmentArchievement
{ {
@ -66,7 +68,7 @@ public class DepartmentArchievement
{ {
DepartmentArchievement archievement = new DepartmentArchievement(); DepartmentArchievement archievement = new DepartmentArchievement();
String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?)}"; String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?,?,?)}";
Class.forName( "oracle.jdbc.driver.OracleDriver" ); Class.forName( "oracle.jdbc.driver.OracleDriver" );
Connection connection = DriverManager.getConnection( jdbcURL, userName, password ); Connection connection = DriverManager.getConnection( jdbcURL, userName, password );
@ -75,11 +77,14 @@ public class DepartmentArchievement
statement.setString( 1, departmentCode ); statement.setString( 1, departmentCode );
statement.registerOutParameter( 2, java.sql.Types.VARCHAR ); statement.registerOutParameter( 2, java.sql.Types.VARCHAR );
statement.registerOutParameter( 3, java.sql.Types.VARCHAR ); statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
statement.registerOutParameter( 4, java.sql.Types.VARCHAR );
statement.registerOutParameter( 5, OracleTypes.CURSOR );
statement.execute(); statement.execute();
String attach_rate = statement.getString( 2 ); String attach_rate = statement.getString( 2 );
String renewal_rate = statement.getString( 3 ); String renewal_rate = statement.getString( 3 );
String totalArchievement = statement.getString( 4 );
archievement.setAttachingRate( attach_rate ); archievement.setAttachingRate( attach_rate );
archievement.setInsuranceRenewalRate( renewal_rate ); archievement.setInsuranceRenewalRate( renewal_rate );