Compare commits

..

24 Commits

Author SHA1 Message Date
Kane Wang 08ea359cd1 保存进度! 2023-08-29 18:57:27 +08:00
Kane Wang 8e0505bd49 完成坐席业绩的请求方法。 2023-08-29 10:55:30 +08:00
Kane Wang a74e612546 该死的node 20 2023-08-28 17:41:07 +08:00
Kane Wang 42c2e8bdf7 完成坐席业绩查询代码 2023-08-26 19:26:13 +08:00
unknown 83be988941 保存进度! 2023-08-26 10:24:03 +08:00
Kane Wang 2a92179adf 保存进度! 2023-08-25 23:00:43 +08:00
Kane Wang 9976c852ba 保存进度! 2023-08-25 22:47:25 +08:00
Kane Wang fd59698264 保存进度! 2023-08-25 20:47:36 +08:00
Kane Wang f5a53e2f55 保存进度! 2023-08-15 09:51:54 +08:00
Kane Wang 5b6285993f 保存进度! 2023-07-31 20:14:49 +08:00
unknown b2a973f7bd 保存进度! 2023-07-30 22:12:14 +08:00
unknown dcc925bb41 完成部门业绩和坐席排行榜的mybatis改造! 2023-07-30 22:11:00 +08:00
Kane Wang 8fd60d6b24 parameterType!!! 2023-07-30 20:07:59 +08:00
Kane Wang 090a551066 保存进度! 2023-07-30 19:11:56 +08:00
Kane Wang 9483b49a20 mybatisUtils加入使用默认参数的工厂函数。 2023-07-30 19:03:53 +08:00
unknown e436fbf89e Merge branch 'mybatis' of http://222.76.244.118:3000/CPICXIM/desktop_task_schedule into mybatis 2023-07-30 18:59:59 +08:00
unknown 0875919b5f 保存进度! 2023-07-30 18:59:48 +08:00
Kane Wang a5b008f056 保存进度! 2023-07-30 18:03:47 +08:00
unknown ada65278a1 保存进度! 2023-07-30 00:27:57 +08:00
unknown 38ec1c7d6c 保存进度! 2023-07-29 01:13:43 +08:00
Kane Wang 7ab604f3dd 保存进度! 2023-07-28 20:13:31 +08:00
unknown 374a87e1ee 保存进度! 2023-07-28 02:10:38 +08:00
unknown 7304ccf2e8 保存进度! 2023-07-27 21:43:56 +08:00
Kane Wang ff487c3fb6 保存进度! 2023-07-27 18:07:31 +08:00
38 changed files with 2329 additions and 999 deletions

View File

@ -8,7 +8,10 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
-- 异常
DEPARTMENTCODE_EXCEPTION_CODE CONSTANT INTEGER := -20000;
DEPARTMENTCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '部门代码无效';
DEPARTMENTCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '部门代码无效。';
CALLERCODE_EXCEPTION_CODE CONSTANT INTEGER := -20001;
CALLERCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '坐席工号无效。';
PROCEDURE department_archievement
(
@ -19,6 +22,15 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
a_mensual_cur OUT cur_type
);
PROCEDURE caller_archievement
(
a_caller_code IN VARCHAR2,
a_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2,
a_total OUT INTEGER,
a_mensual_cur OUT cur_type
);
PROCEDURE caller_arch_ranking_list
(
a_department_code IN VARCHAR2,
@ -30,147 +42,233 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
END telsale_archievement_pkg;
/
CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
-- 保费渗透率
PROCEDURE department_archievement
CREATE OR REPLACE PACKAGE BODY TELSALE_ARCHIEVEMENT_PKG IS
-- 部门业绩
PROCEDURE DEPARTMENT_ARCHIEVEMENT
(
a_department_code IN VARCHAR2,
a_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2,
a_total OUT INTEGER,
a_mensual_cur OUT cur_type
A_DEPARTMENT_CODE IN VARCHAR2,
A_ATTACHING_RATE OUT VARCHAR2,
A_RENEWAL_RATE OUT VARCHAR2,
A_TOTAL OUT INTEGER,
A_MENSUAL_CUR OUT CUR_TYPE
) IS
l_this_month VARCHAR2(4);
l_this_year VARCHAR2(4);
l_firstday DATE;
l_department_name VARCHAR2(100);
L_THIS_MONTH VARCHAR2(4);
L_THIS_YEAR VARCHAR2(4);
L_FIRSTDAY DATE;
L_DEPARTMENT_NAME VARCHAR2(100);
BEGIN
l_this_month := to_char(SYSDATE,
L_THIS_MONTH := TO_CHAR(SYSDATE,
'mm');
l_this_year := to_char(SYSDATE,
L_THIS_YEAR := TO_CHAR(SYSDATE,
'yyyy');
l_firstday := to_date(to_char(SYSDATE,
L_FIRSTDAY := TO_DATE(TO_CHAR(SYSDATE,
'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss');
-- 获取部门名称
BEGIN
SELECT department_name
INTO l_department_name
FROM idst0.bm_t bm
WHERE bm.department_code = a_department_code;
SELECT DEPARTMENT_NAME
INTO L_DEPARTMENT_NAME
FROM IDST0.BM_T BM
WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
EXCEPTION
-- 如果没有找到部门名称,说明代码错误,抛出异常
WHEN NO_DATA_FOUND THEN
raise_application_error(DEPARTMENTCODE_EXCEPTION_CODE,
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
DEPARTMENTCODE_EXCEPTION_MSG);
END;
--车非渗透率
SELECT DECODE(SUM(CF.车险个人客户保费),
0,
0,
ROUND((SUM(CF.车非融合保费) / SUM(CF.车险个人客户保费) * 100),
2))
INTO A_ATTACHING_RATE
FROM 坐席车非每日保费 CF
WHERE CF.月份 = L_THIS_MONTH
AND CF.年份 = L_THIS_YEAR
AND 部门代码 = A_DEPARTMENT_CODE;
--续保率
SELECT DECODE(SUM(到期数),
0,
0,
ROUND(SUM(已续保累计) / SUM(到期数) * 100,
2))
INTO A_RENEWAL_RATE
FROM 坐席续保统计
WHERE 部门 = L_DEPARTMENT_NAME;
--总业绩
SELECT ROUND(NVL(SUM(CF.车险个人客户保费 + CF.车非融合保费),
0),
0)
INTO A_TOTAL
FROM 坐席车非每日保费 CF
WHERE 部门代码 = A_DEPARTMENT_CODE
AND 签单日期 >= L_FIRSTDAY
AND 签单日期 <= SYSDATE;
--每月业绩
OPEN A_MENSUAL_CUR FOR
SELECT CF.月份 MM,
ROUND(NVL(SUM(CF.车险个人客户保费 + CF.车非融合保费) / 10000,
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 签单日期 < TO_DATE(TO_CHAR(SYSDATE,
'yyyy-mm') || '-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss')
GROUP BY CF.月份
ORDER BY CF.月份;
END;
/*******************************************************/
-- 坐席业绩
PROCEDURE caller_archievement
(
a_caller_code IN VARCHAR2,
a_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2,
a_total OUT INTEGER,
a_mensual_cur OUT cur_type
) IS
l_caller_name VARCHAR2(100);
l_this_month VARCHAR2(4);
l_this_year VARCHAR2(4);
l_firstday DATE;
BEGIN
--查询坐席名称,验证代码
BEGIN
SELECT saler_name
INTO l_caller_name
FROM tele_saler
WHERE saler_code = a_caller_code;
EXCEPTION
-- 如果没有查询到坐席名称,说明代码有误,抛出异常
WHEN no_data_found THEN
raise_application_error(CALLERCODE_EXCEPTION_CODE,
CALLERCODE_EXCEPTION_MSG);
END;
--车非渗透率
SELECT decode(SUM(cf.车险个人客户保费),
l_this_month := to_char(SYSDATE,
'mm');
l_this_year := to_char(SYSDATE,
'yyyy');
l_firstday := to_date(l_this_year || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss');
--总车险保费
SELECT round(nvl(SUM(cf.车险个人客户保费),
0),
2) bf
INTO a_total
FROM 坐席车非每日保费 cf
WHERE cf.坐席工号 = a_caller_code
AND cf.年份 = l_this_year;
--渗透率
SELECT decode(nvl(SUM(cf.车险个人客户保费),
0),
0,
0,
round((SUM(cf.车非融合保费) / SUM(cf.车险个人客户保费) * 100),
round(SUM(cf.车非融合保费) / SUM(cf.车险个人客户保费) * 100,
2))
INTO a_attaching_rate
FROM 坐席车非每日保费 cf
WHERE cf.月份 = l_this_month
WHERE cf.坐席工号 = a_caller_code
AND cf.年份 = l_this_year
AND 部门代码 = a_department_code;
AND cf.月份 = l_this_month;
--续保率
SELECT decode(SUM(到期数),
SELECT decode(nvl(SUM(xb.到期数),
0),
0,
0,
round(SUM(已续保累计) / SUM(到期数) * 100,
2))
round(SUM(xb.已续保累计) / SUM(xb.到期数) * 100,
2)) xbl
INTO a_renewal_rate
FROM 坐席续保统计
WHERE 部门 = l_department_name;
--总业绩
SELECT round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费),
0),
0)
INTO a_total
FROM 坐席车非每日保费 cf
WHERE 部门代码 = a_department_code
AND 签单日期 >= l_firstday
AND 签单日期 <= SYSDATE;
FROM 坐席续保统计 xb
WHERE xb.坐席工号 = a_caller_code;
--每月业绩
OPEN a_mensual_cur FOR
SELECT cf.月份 mm,
round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费) / 10000,
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,
0) BF
FROM 坐席车非每日保费 CF
WHERE cf.坐席工号 = a_caller_code
AND 签单日期 >= TO_DATE(TO_CHAR(SYSDATE,
'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss')
AND 签单日期 < to_date(to_char(SYSDATE,
AND 签单日期 < TO_DATE(TO_CHAR(SYSDATE,
'yyyy-mm') || '-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss')
GROUP BY cf.月份
ORDER BY cf.月份;
GROUP BY CF.月份
ORDER BY CF.月份;
END;
/*******************************************************/
-- 坐席排行榜
PROCEDURE caller_arch_ranking_list
PROCEDURE CALLER_ARCH_RANKING_LIST
(
a_department_code IN VARCHAR2,
a_year IN VARCHAR2,
a_month IN VARCHAR2,
a_attaching_ranking_list OUT cur_type,
a_renewal_ranking_list OUT cur_type
A_DEPARTMENT_CODE IN VARCHAR2,
A_YEAR IN VARCHAR2,
A_MONTH IN VARCHAR2,
A_ATTACHING_RANKING_LIST OUT CUR_TYPE,
A_RENEWAL_RANKING_LIST OUT CUR_TYPE
) IS
l_department_name VARCHAR2(100);
L_DEPARTMENT_NAME VARCHAR2(100);
BEGIN
-- 获取部门名称
BEGIN
SELECT department_name
INTO l_department_name
FROM idst0.bm_t bm
WHERE bm.department_code = a_department_code;
SELECT DEPARTMENT_NAME
INTO L_DEPARTMENT_NAME
FROM IDST0.BM_T BM
WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
EXCEPTION
-- 如果没有找到部门名称,说明代码错误,抛出异常
WHEN NO_DATA_FOUND THEN
raise_application_error(DEPARTMENTCODE_EXCEPTION_CODE,
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
DEPARTMENTCODE_EXCEPTION_MSG);
END;
-- 车非融合率排行榜
OPEN a_attaching_ranking_list FOR
SELECT 坐席名称,
round(decode(SUM(车险个人客户保费),
0,
0,
(SUM(车非融合保费) / SUM(车险个人客户保费)) * 100),
2) 车非渗透率
FROM 坐席车非每日保费
WHERE 月份 = a_month
AND 年份 = a_year
AND 部门代码 = a_department_code
GROUP BY 坐席名称
ORDER BY 车非渗透率 DESC;
-- 车非融合率排行榜
OPEN A_ATTACHING_RANKING_LIST FOR
SELECT ROWNUM,
坐席名称 AS CALLER_NAME,
车非渗透率 AS ATTACHING_RATE
FROM (SELECT 坐席名称,
ROUND(DECODE(nvl(SUM(车险个人客户保费),
0),
0,
0,
(SUM(车非融合保费) / SUM(车险个人客户保费)) * 100),
2) 车非渗透率
FROM 坐席车非每日保费
WHERE 月份 = A_MONTH
AND 年份 = A_YEAR
AND 部门代码 = A_DEPARTMENT_CODE
GROUP BY 坐席名称
ORDER BY 车非渗透率 DESC);
-- 续保率排行榜
OPEN a_renewal_ranking_list FOR
SELECT 坐席名称,
round(nvl((SUM(已续保累计) / SUM(到期数)) * 100,
0),
2) 续保率
FROM 坐席续保统计 xb
WHERE xb.部门 = l_department_name
GROUP BY 坐席名称
ORDER BY 续保率 DESC;
OPEN A_RENEWAL_RANKING_LIST FOR
SELECT ROWNUM,
坐席名称 AS CALLER_NAME,
续保率 AS RENEWAL_RATE
FROM (SELECT 坐席名称,
decode(nvl(SUM(xb.到期数),
0),
0,
0,
round(SUM(xb.已续保累计) / SUM(xb.到期数) * 100,
2)) 续保率
FROM 坐席续保统计 XB
WHERE XB.部门 = L_DEPARTMENT_NAME
GROUP BY 坐席名称
ORDER BY 续保率 DESC);
END;
BEGIN
NULL;
END telsale_archievement_pkg;
END TELSALE_ARCHIEVEMENT_PKG;
/

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,18 @@
drop table _T;
create global temporary table _T
drop table _T;
create global temporary table _T
(
DATE not null,
VARCHAR2(10) not null,
VARCHAR2(100) not null,
varchar2(100) not null,
n VARCHAR2(100) not null,
n VARCHAR2(100),
VARCHAR2(20),
VARCHAR2(30),
VARCHAR2(100),
NUMBER(16,2),
NUMBER(16,2)
DATE not null,
VARCHAR2(10) not null,
VARCHAR2(100) not null,
varchar2(100) not null,
n VARCHAR2(100) not null,
n VARCHAR2(100),
VARCHAR2(20),
VARCHAR2(30),
VARCHAR2(100),
NUMBER(16,2),
NUMBER(16,2)
)
on commit preserve rows;
-- Grant/Revoke object privileges
grant select, insert, delete, alter on _T to DATACENTER;
grant select, insert, delete, alter on _T to DATACENTER;

View File

@ -67,25 +67,28 @@ module.exports = {
js: "espree",
"<template>": "espree",
},
// project: "./tsconfig.json",
extraFileExtensions: [".vue",],
},
plugins: ["eslint-plugin-vue",],
extends: [
"plugin:vue/vue3-essential",
"plugin:vue/recommended",
"eslint:recommended",
// "standard-with-typescript",
// "standard-with-typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
indent: ["warn", 4,],
"no-trailing-spaces": ["error", {"ignoreComments": true,},],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn",
semi: ["error", "always",], // 控制行尾部分号
quotes: ["error", "double",],
"semi-spacing": ["error", {"before": false, "after": true,},], // 控制行尾部分号
"quotes": ["error", "double",],
"comma-dangle": ["error", {
arrays: "always",
objects: "always",
@ -144,11 +147,12 @@ module.exports = {
plugins: ["@typescript-eslint",],
extends: [
"eslint:recommended",
// "standard-with-typescript",
"standard-with-typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
"no-trailing-spaces": ["error", {"ignoreComments": true,},],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
@ -189,6 +193,7 @@ module.exports = {
"prefer-const": "warn",
"spaced-comment": "error",
"space-before-function-paren": "off",
"semi-spacing": ["error", {"before": false, "after": true,},],
},
},
],

File diff suppressed because it is too large Load Diff

View File

@ -9,29 +9,32 @@
"preview": "vite preview"
},
"dependencies": {
"@babel/eslint-parser": "^7.22.9",
"@babel/eslint-parser": "^7.22.11",
"@element-plus/icons-vue": "^2.1.0",
"axios": "^1.4.0",
"@rushstack/eslint-patch": "^1.3.3",
"@vue/eslint-config-typescript": "^11.0.3",
"babel": "^6.23.0",
"echarts": "^5.4.3",
"element-plus": "^2.3.8",
"element-plus": "^2.3.12",
"moment": "^2.29.4",
"sass-loader": "^13.3.2",
"ts-node": "^10.9.1",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.22.9",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@vitejs/plugin-vue": "^4.2.3",
"@babel/eslint-parser": "^7.22.11",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@vitejs/plugin-vue": "^4.3.3",
"@vue/cli-plugin-eslint": "^5.0.8",
"axios": "~1.5.0",
"eslint-config-recommended": "^4.1.0",
"eslint-plugin-vue": "^9.15.1",
"eslint-config-standard-with-typescript": "^39.0.0",
"eslint-plugin-vue": "^9.17.0",
"node-sass": "^9.0.0",
"sass": "^1.64.1",
"sass": "^1.66.1",
"style-loader": "^3.3.3",
"typescript": "^5.1.6",
"vue-eslint-parser": "^9.3.1"
}
}

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-03-17 14:31:14
* @LastEditTime: 2023-08-25 10:53:30
* @FilePath: /task_schedule/src/App.vue
* @Description:
* 应用的框架
@ -17,7 +17,7 @@
</template>
<script lang="ts">
import zhCn from "element-plus/lib/locale/lang/zh-cn"; // element-plus
import zhCn from "element-plus/es/locale/lang/zh-cn"; // element-plus
export default {
name: "App",

View File

@ -29,11 +29,13 @@ export default {
setup( props )
{
const ui = reactive({
mensualList:[],
});
//
const initCharts = () =>
{
console.log( "每月业绩", props.chartData );
const chartDom = document.getElementById( "chartWrapper" );
const myChart = echarts.init( chartDom as HTMLDivElement );
const option = {

View File

@ -8,6 +8,8 @@
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { testRankingListRequest } from "./testRankingListRequest.js";
// import { testRankingListRequest } from "./testRankingListRequest.js";
testRankingListRequest();
// testRankingListRequest();
console.log( "test" );

View File

@ -14,13 +14,12 @@
"target": "ESNext",
"module": "ESNext",
// "module": "CommonJS",
// "moduleResolution": "node",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": false,
"esModuleInterop": true,
"baseUrl": "./", // paths
"paths": { //
"@/*": [
@ -46,5 +45,8 @@
],
"exclude": [
"./node_modules",
]
],
"ts-node": {
"esm": true
},
}

View File

@ -24,4 +24,6 @@ export const API_URL = {
// URL_RANKINGLIST: "http://222.76.244.118:11101/desktop_archievement_backend/archievement/query_ranking_list.do",
URL_RANKINGLIST: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_ranking_list.do",
// 坐席业绩查询
URL_CALLER_ARCHIEVEMENT: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_caller_archievement.do",
};

View File

@ -3,16 +3,17 @@
* @Date: 2023-03-17 15:17:44
* @LastEditors: Kane
* @FilePath: /task_schedule/src/utils/archievement.ts
* @Description:
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { service as instance } from "./api/request.js";
import { API_URL } from "./api/config.js";
import { type Department } from "@/types/cpicxim/Department.js";
// import { type AxiosResponse } from "axios";
import { type Department } from "../types/cpicxim/Department.js";
import { type TelSaler } from "../types/cpicxim/TelSaler.js";
import { type AxiosResponse } from "axios";
interface Archievement
interface DepartmentArchievement // 定义业绩对象的结构
{
success: boolean;
message: string;
@ -25,48 +26,223 @@ interface Archievement
backward_list: string[];
}
interface CallerArchievement // 坐席业绩对象
{
success: boolean;
message: string;
total_archievement: number;
mensual_archievement_list: number[];
insurance_renewal_rate: string;
attaching_rate: string;
}
interface MenusalArchievementItem // 每月业绩清单的项目
{
month: number;
premium: string;
}
/**
*
* @param render
* @param departmentInfo
* @param render DepartmentArchievement对象调用
*/
function queryDepartmentArchievement( departmentInfo: Department, render: any ): void
{
// 默认的部门业绩对象
const archievement: DepartmentArchievement = {
success: false,
message: "",
total_archievement: 0,
mensual_archievement_list: [],
insurance_renewal_rate: "",
attaching_rate: "",
leading_reward_gainers: [],
advance_reward_gainers: [],
backward_list: [],
};
instance.request({
method: "post",
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
data: departmentInfo,
})
// 请求结束,将请求的结果写入业绩对象,然后调用功能渲染函数。
.then(( response ) =>
{
const archievement: Archievement = {
success: false,
message: "",
total_archievement: 0,
mensual_archievement_list: [],
insurance_renewal_rate: "",
attaching_rate: "",
leading_reward_gainers: [],
advance_reward_gainers: [],
backward_list: [],
};
const data = response.data ?? {};
archievement.success = data.success ?? false;
archievement.message = data.message ?? "";
archievement.mensual_archievement_list = data.mensual_archievement_list ?? [];
archievement.message = data.message ?? "服务器没有返回调用结果消息,请检查日志!";
archievement.total_archievement = data.total_archievement;
archievement.mensual_archievement_list = [];
archievement.insurance_renewal_rate = data.insurance_renewal_rate ?? "0.0";
archievement.attaching_rate = data.attaching_rate ?? "0.0";
archievement.leading_reward_gainers = data.leading_reward_gainers ?? [];
archievement.advance_reward_gainers = data.advance_reward_gainers ?? [];
archievement.backward_list = data.backward_list ?? [];
render( data );
// 转换每月业绩数据用month排序以后保留premium。
data.mensual_archievement_list.sort(( a: any, b: any ) => a.month - b.month );
data.mensual_archievement_list.forEach(( item: any ) =>
{
archievement.mensual_archievement_list.push( item.premium );
});
console.log( "每月业绩", archievement );
// 调用渲染函数
if ( render !== undefined )
{
render( archievement );
}
})
// 请求失败,将失败原因写入业绩对象,调用渲染函数
.catch(( error ) =>
{
console.log( error );
archievement.success = false;
archievement.message = String( error );
// 调用渲染函数
if ( render !== undefined )
{
render( archievement );
}
console.log( `queryDepartmentArchievement:查询部门${departmentInfo.departmentCode}业绩失败,原因${error}` );
});
}
export { queryDepartmentArchievement, type Archievement };
/**
* .
* 1
* 2012
* 3
* 4使message写入业绩对象
* @param callerInfo
* @param render CallerArchievement作为参数
*/
function queryCallerArchievement( callerInfo: TelSaler, render: any ): void
{
const caller = {
callerCode: callerInfo.telSalerCode,
callName: callerInfo.telSalerName,
};
// 默认的业绩对象
const callArchievement: CallerArchievement = {
success: false,
message: "",
total_archievement: 0,
mensual_archievement_list: [],
insurance_renewal_rate: "0.0",
attaching_rate: "0.0",
};
// 发送请求
instance.request({
method: "post",
url: API_URL.URL_CALLER_ARCHIEVEMENT,
data: caller,
})
// 请求完成时
.then(( response: AxiosResponse<any, any> ) =>
{
const data = response.data ?? {};
callArchievement.success = data.success ?? false;
callArchievement.message = data.message ?? "服务器没有返回调用结果消息,请检查日志!";
callArchievement.total_archievement = data.total_archievement ?? 0;
callArchievement.mensual_archievement_list = [];
callArchievement.insurance_renewal_rate = data.insurance_renewal_rate ?? "0.0";
callArchievement.attaching_rate = data.attaching_rate ?? "0.0";
// 检查业绩清单有没有缺漏缺漏的用0补上
const checkedList = checkMensualArchievement( data.mensual_archievement_list );
// 排序一下
checkedList.sort(( a: MenusalArchievementItem, b: MenusalArchievementItem ): number =>
{
return a.month - b.month;
});
// 将排序后的每月业绩写到业绩对象中
checkedList.forEach(( item: MenusalArchievementItem ): void =>
{
const premium = Number( item.premium );
callArchievement.mensual_archievement_list.push( premium );
});
// 调用渲染函数
if ( render !== undefined )
{
render( callArchievement );
}
console.log( `queryCallerArchievement查询结果${data}` );
})
// 请求失败将失败的原因保存到message属性调用渲染函数
.catch(( error: any ) =>
{
callArchievement.success = false;
callArchievement.message = String( error );
// 调用渲染函数
if ( render !== undefined )
{
render( callArchievement );
}
console.log( `queryCallerArchievement:查询坐席${callerInfo.telSalerCode}业绩失败,原因${error}` );
});
}
/**
* 0
* 12
* @param mensualArchievementList MenusalArchievementItem类型的数组
* @returns MenusalArchievementItem数组
*/
function checkMensualArchievement( mensualArchievementList: MenusalArchievementItem[]): MenusalArchievementItem[]
{
const checkedList: MenusalArchievementItem[] = [];
const itemMap = new Map();
itemMap.set( 1, "0" );
itemMap.set( 2, "0" );
itemMap.set( 3, "0" );
itemMap.set( 4, "0" );
itemMap.set( 5, "0" );
itemMap.set( 6, "0" );
itemMap.set( 7, "0" );
itemMap.set( 8, "0" );
itemMap.set( 9, "0" );
itemMap.set( 10, "0" );
itemMap.set( 11, "0" );
itemMap.set( 12, "0" );
mensualArchievementList.forEach(( item: MenusalArchievementItem ): void =>
{
itemMap.set( item.month, item.premium );
});
itemMap.forEach(( value, key, map ) =>
{
const item: MenusalArchievementItem = {
month: key,
premium: value,
};
checkedList.push( item );
});
return checkedList;
}
export {
queryDepartmentArchievement,
queryCallerArchievement,
type DepartmentArchievement,
type CallerArchievement
};

View File

@ -32,6 +32,9 @@ interface RankingListResponse
renewalRateRankingList: RankingListItem[];
}
// 判断用的正则表达式
const regexMonth = "(0[1-9])|(1[0-2])";
/**
*
* @param reqParam
@ -53,6 +56,9 @@ function requestRankingList( reqParam: RankingListRequest, rander: any ): void /
renewalRateRankingList: [],
};
// 检查请求参数
// TODO: 这里要加一个对month的正则表达式验证。
instance.request(
{
method: "post",

View File

@ -17,7 +17,7 @@
<div class="center-wrapper">
<span class="slogan">对标先进&nbsp;比学赶超</span>
<div class="total-archievement-wrapper">
<span>业绩</span>
<span>我的车险业绩</span>
<span>{{ getTotalArchievement }}</span>
</div>
<div class="archievement-wrapper">
@ -55,9 +55,7 @@
indicator-position="none"
:interval="4000"
>
<el-carousel-item
:key="1"
>
<el-carousel-item :key="1">
<RankingListComponent :ranking-list="ui.attachingRankingList" />
</el-carousel-item>
<el-carousel-item :key="2">
@ -88,9 +86,20 @@ import { computed, reactive, onBeforeMount, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import { getCallerInfo } from "@/utils/api/localStorage.js";
import { ElMessage } from "element-plus";
import { type Archievement, queryDepartmentArchievement } from "@/utils/archievement.js";
import
{
type DepartmentArchievement,
type CallerArchievement,
queryDepartmentArchievement,
queryCallerArchievement
} from "@/utils/archievement.js";
import { RankingListItem } from "@/types/cpicxim/RankingListItem.js";
import { type RankingListRequest, type RankingListResponse, requestRankingList } from "@/utils/ranking.js";
import
{
type RankingListRequest,
type RankingListResponse,
requestRankingList
} from "@/utils/ranking.js";
import { type Department } from "@/types/cpicxim/Department";
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
@ -127,7 +136,24 @@ export default {
setup()
{
const monthIndex = new Date();
const numInChinese = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",];
const thisMonth: number = monthIndex.getMonth();
const thisMonthString = thisMonth > 10 ? String( thisMonth ): "0" + String( thisMonth );
const thisYear: number = monthIndex.getFullYear();
const thisYearString: string = String( thisYear );
const numInChinese = [
"一",
"二",
"三",
"四",
"五",
"六",
"七",
"八",
"九",
"十",
"十一",
"十二",
];
const router = useRouter();
const callerInfo: TelSaler = getCallerInfo();
const ui: ui = reactive({
@ -145,26 +171,40 @@ export default {
});
let timerHandler = 0;
const getTotalArchievement = computed(() =>
const getTotalArchievement = computed(():string =>
{
const cnyFormat = new Intl.NumberFormat( "zh-cn",
{
style: "currency",
currency: "CNY",
minimumFractionDigits: 0,
});
const cnyFormat = new Intl.NumberFormat( "zh-cn", {
style: "currency",
currency: "CNY",
minimumFractionDigits: 0,
});
const archievement = cnyFormat.format( ui.totalArchievement );
return archievement;
});
//
const applyArchievementData = ( data: Archievement ) =>
/**
* 将请求函数获取的部门业绩数据渲染到页面上
* @param data DepartmentArchievementl类型的部门业绩数据对象
*/
const applyDepartmentArchievementData = ( data: DepartmentArchievement ): void =>
{
console.log( "部门业绩数据", data );
// console.log( "", data );
ui.chartData = data.mensual_archievement_list;
ui.totalArchievement = data.total_archievement;
//
if ( data.success !== true )
{
// 退
ElMessage({
message: data.message,
type: "error",
});
return;
}
// ui.chartData = data.mensual_archievement_list;
// ui.totalArchievement = data.total_archievement;
ui.attaching_rate = data.attaching_rate;
ui.insurance_renewal_rate = data.insurance_renewal_rate;
ui.leading_reward_gainers = data.leading_reward_gainers;
@ -175,7 +215,36 @@ export default {
// vue
ui.showUI = false;
setTimeout(() => { ui.showUI = true; }, 0 );
setTimeout(() =>
{
ui.showUI = true;
}, 0 );
};
const applyCallerArchievementData = ( data: CallerArchievement ): void =>
{
//
if ( data.success !== true )
{
// 退
ElMessage({
message: data.message,
type: "error",
});
return;
}
ui.chartData = data.mensual_archievement_list.slice( 0, thisMonth-1 );
ui.totalArchievement = data.total_archievement;
console.log( "业绩清单", ui.chartData );
ui.showUI = false;
setTimeout(() =>
{
ui.showUI = true;
}, 0 );
};
const applyRankingListData = ( data: RankingListResponse ): void =>
@ -189,7 +258,10 @@ export default {
console.log( "获取排行榜后的ui:", data );
setTimeout(() => { ui.showUI = true; }, 0 );
setTimeout(() =>
{
ui.showUI = true;
}, 0 );
};
// 退
@ -214,24 +286,23 @@ export default {
}
/**
* 刷新页面
* 用于定时对页面进行刷新其中会请求最新的业绩数据
*/
const refresh = () =>
{
const deparmentInfo: Department =
{
const deparmentInfo: Department = {
departmentCode: callerInfo.departmentCode,
departmentName: callerInfo.departmentName,
};
const rankinglistRequest: RankingListRequest =
{
const rankinglistRequest: RankingListRequest = {
departmentCode: callerInfo.departmentCode,
year: "2023",
month: "06",
year: thisYearString,
month: thisMonthString,
};
queryDepartmentArchievement( deparmentInfo, applyArchievementData );
queryDepartmentArchievement( deparmentInfo, applyDepartmentArchievementData );
queryCallerArchievement( callerInfo, applyCallerArchievementData );
requestRankingList( rankinglistRequest, applyRankingListData );
};
@ -255,7 +326,15 @@ export default {
clearInterval( timerHandler );
});
return { ui, callerInfo, timerHandler, getTotalArchievement, renderData: applyArchievementData, refresh, logoutDesktopArchievement, };
return {
ui,
callerInfo,
timerHandler,
getTotalArchievement,
renderData: applyDepartmentArchievementData,
refresh,
logoutDesktopArchievement,
};
},
};
</script>
@ -388,12 +467,13 @@ export default {
// >*+* {
// margin-top: 15px;
// }
> h1 {
>h1 {
font: {
family: "FZ-ZHUOHEI";
weight: 100;
size: 30px;
}
color: $color-bg-04;
text-align: center;
@ -401,7 +481,7 @@ export default {
width: 300px;
}
> div {
>div {
display: block;
height: 260px;
width: 300px;
@ -416,7 +496,7 @@ body {
$color-bg-03,
$color-bg-04,
$color-bg-05,
$color-bg-05);
$color-bg-05 );
}
div {

View File

@ -19,6 +19,7 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": false,
"isolatedModules": true,
"baseUrl": "./", // paths
"paths": { //
"@/*": [

View File

@ -1,5 +1,6 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic",
"vue.codeActions.enabled": false
"vue.codeActions.enabled": false,
"java.debug.settings.onBuildFailureProceed": true
}

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-07-27 11:05:53
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchivementMapper.java
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchievementMapper.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
@ -13,5 +13,7 @@ import java.util.HashMap;
public interface ArchievementMapper
{
public void getDepartmentArchievement(HashMap<String, Object> params);
}
public void getDepartmentArchievement( HashMap<String, Object> params );
public void getCallerArchievement( HashMap<String, Object> params );
}

View File

@ -0,0 +1,17 @@
/*
* @Author: Kane
* @Date: 2023-07-29 22:59:09
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/RankingListMapper.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.mybatis.mapper;
import java.util.HashMap;
public interface RankingListMapper
{
public void getRankingList( HashMap<String, Object> params );
}

View File

@ -16,18 +16,18 @@ public class MensualArchievementItem
public MensualArchievementItem()
{}
public MensualArchievementItem( String month, String premium)
public MensualArchievementItem( int month, String premium)
{
this.month = month;
this.premium = premium;
}
public String getMonth()
public int getMonth()
{
return month;
}
public void setMonth( String month )
public void setMonth( int month )
{
this.month = month;
}
@ -42,18 +42,14 @@ public class MensualArchievementItem
this.premium = premium;
}
@Override
public String toString()
{
return "MensualArchievementItem [month=" + month + ", premium=" + premium + "]";
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((month == null) ? 0 : month.hashCode());
result = prime * result + month;
result = prime * result + ((premium == null) ? 0 : premium.hashCode());
return result;
}
@ -68,11 +64,7 @@ public class MensualArchievementItem
if ( getClass() != obj.getClass() )
return false;
MensualArchievementItem other = (MensualArchievementItem) obj;
if ( month == null )
{
if ( other.month != null )
return false;
} else if ( !month.equals( other.month ) )
if ( month != other.month )
return false;
if ( premium == null )
{
@ -83,9 +75,17 @@ public class MensualArchievementItem
return true;
}
@Override
public String toString()
{
return "MensualArchievementItem [month=" + month + ", premium=" + premium + "]";
}
// 月份
@JsonProperty( "month" )
private String month;
private int month;
// 月总保费
@JsonProperty( "premium" )

View File

@ -0,0 +1,76 @@
/*
* @Author: Kane
* @Date: 2023-07-27 17:22:55
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/utils/MybatisUtils.java
* @Description: mybatis的工具集合
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.mybatis.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class MybatisUtils
{
private static HashMap<String, SqlSession> SessionMap = new HashMap<>();
private static String DEFAULT_CONFIGFILE = "mybatis/mybatis-config.xml";
/**
*
* @param configFile
* @return
* @throws IOException
*/
public static SqlSession getSqlSession(String configFile )
throws IOException
{
// 根据配置文件的路径查找是否已经创建了对应的session
SqlSession session = SessionMap.get(configFile);
// 找到就直接返回
if ( session != null )
{
return session;
}
// 没找到就创建一个
InputStream configIS = Resources.getResourceAsStream(configFile);
SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(configIS);
session = factory.openSession();
// 保存
SessionMap.put(configFile, session);
return session;
}
public static SqlSession getSqlSession()
throws IOException
{
// 根据配置文件的路径查找是否已经创建了对应的session
SqlSession session = SessionMap.get(DEFAULT_CONFIGFILE);
// 找到就直接返回
if ( session != null )
{
return session;
}
// 没找到就创建一个
InputStream configIS = Resources.getResourceAsStream(DEFAULT_CONFIGFILE);
SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(configIS);
session = factory.openSession();
// 保存
SessionMap.put(DEFAULT_CONFIGFILE, session);
return session;
}
}

View File

@ -8,4 +8,200 @@
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.utils.archievement;
package com.cpic.xim.utils.archievement;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cpic.xim.mybatis.mapper.ArchievementMapper;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.mybatis.utils.MybatisUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
public class CallerArchievement
{
private static Logger logger = LoggerFactory.getLogger( CallerArchievement.class );
private static ArrayList<MensualArchievementItem> monthArray = null;
/**
* 构造函数
* @param callerCode
* @param totalArchievement
* @param mensualArchievementList
* @param insuranceRenewalRate
* @param attachingRate
*/
public CallerArchievement( String callerCode, long totalArchievement,
ArrayList<MensualArchievementItem> mensualArchievementList, String insuranceRenewalRate,
String attachingRate)
{
this.callerCode = callerCode;
this.totalArchievement = totalArchievement;
this.mensualArchievementList = mensualArchievementList;
this.insuranceRenewalRate = insuranceRenewalRate;
this.attachingRate = attachingRate;
}
// 静态代码块
static
{
// 初始化月份
monthArray = new ArrayList<MensualArchievementItem>(12);
monthArray.add(new MensualArchievementItem(1, "0"));
monthArray.add(new MensualArchievementItem(2, "0"));
monthArray.add(new MensualArchievementItem(3, "0"));
monthArray.add(new MensualArchievementItem(4, "0"));
monthArray.add(new MensualArchievementItem(5, "0"));
monthArray.add(new MensualArchievementItem(6, "0"));
monthArray.add(new MensualArchievementItem(7, "0"));
monthArray.add(new MensualArchievementItem(8, "0"));
monthArray.add(new MensualArchievementItem(9, "0"));
monthArray.add(new MensualArchievementItem(10, "0"));
monthArray.add(new MensualArchievementItem(11, "0"));
monthArray.add(new MensualArchievementItem(12, "0"));
}
public CallerArchievement()
{
this.totalArchievement = 0;
this.mensualArchievementList = null;
this.insuranceRenewalRate = "";
this.attachingRate = "";
this.callerCode = "";
}
public static CallerArchievement getCallerArchievement( String callerCode ) throws IOException
{
CallerArchievement archievement = null;
SqlSession session = MybatisUtils.getSqlSession();
ArchievementMapper mapper = session.getMapper( ArchievementMapper.class );
HashMap<String, Object> params = new HashMap<String, Object>();
Integer totalArchievement = null;
String attachingRate = null;
String renewalRate = null;
ArrayList<MensualArchievementItem> mensual = null;
params.put( "a_caller_code", callerCode );
mapper.getCallerArchievement( params );
// 总业绩
if ( params.get( "a_total" ) instanceof Integer )
{
totalArchievement = (Integer) params.get( "a_total" );
} else
{
totalArchievement = Integer.valueOf( 0 );
}
// 车非融合
if ( params.get( "a_attaching_rate" ) instanceof String )
{
attachingRate = (String) params.get( "a_attaching_rate" );
} else
{
attachingRate = "0.0";
}
// 续保率
if ( params.get( "a_renewal_rate" ) instanceof String )
{
renewalRate = (String) params.get( "a_renewal_rate" );
} else
{
renewalRate = "0.0";
}
// 处理每月业绩
ArrayList<MensualArchievementItem> mensualList = new ArrayList<>(CallerArchievement.monthArray);
// 数据库接收的每月业绩要检查是否有缺漏
mensual = (ArrayList<MensualArchievementItem>) params.get( "a_mensual_cur" );
archievement = new CallerArchievement( callerCode, totalArchievement, mensual, renewalRate,
attachingRate );
return archievement;
}
public static Logger getLogger()
{
return logger;
}
public static void setLogger( Logger logger )
{
CallerArchievement.logger = logger;
}
public String getCallerCode()
{
return callerCode;
}
public void setCallerCode( String callerCode )
{
this.callerCode = callerCode;
}
public long getTotalArchievement()
{
return totalArchievement;
}
public void setTotalArchievement( long totalArchievement )
{
this.totalArchievement = totalArchievement;
}
public ArrayList<MensualArchievementItem> getMensualArchievementList()
{
return mensualArchievementList;
}
public void setMensualArchievementList(
ArrayList<MensualArchievementItem> mensualArchievementList )
{
this.mensualArchievementList = mensualArchievementList;
}
public String getInsuranceRenewalRate()
{
return insuranceRenewalRate;
}
public void setInsuranceRenewalRate( String insuranceRenewalRate )
{
this.insuranceRenewalRate = insuranceRenewalRate;
}
public String getAttachingRate()
{
return attachingRate;
}
public void setAttachingRate( String attachingRate )
{
this.attachingRate = attachingRate;
}
@JsonProperty( "caller_code" )
private String callerCode;
@JsonProperty( "total_archievement" )
private long totalArchievement; // 总业绩
// 每月业绩列表
// 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" )
private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率
@JsonProperty( "attaching_rate" )
private String attachingRate; // 车非渗透率
}

View File

@ -9,22 +9,21 @@
*/
package com.cpic.xim.utils.archievement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cpic.xim.mybatis.mapper.ArchievementMapper;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.mybatis.utils.MybatisUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes;
public class DepartmentArchievement
{
// 以后要改
private static String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
private static String userName = "desktop_archievement_admin";
private static String password = "Cpic123456";
// log4j2
private static Logger logger = LoggerFactory.getLogger(DepartmentArchievement.class);
/**
* 默认的构造函数提供给json使用
@ -32,21 +31,24 @@ public class DepartmentArchievement
public DepartmentArchievement()
{
this.totalArchievement = 0;
this.mensualArchievementList = new Vector<>();
this.mensualArchievementList = null;
this.insuranceRenewalRate = "";
this.attachingRate = "";
this.departmentCode = "";
}
/**
* @brief 构造函数提供所有成员对象的值
* @param totalArchievement
* @param mensualArchievementList
* @param insuranceRenewalRate
* @param attachingRate
* @param departmentCode 部门代码
* @param totalArchievement 总业绩
* @param mensualArchievementList 每月业绩表
* @param insuranceRenewalRate 续保率
* @param attachingRate 车非渗透率
*/
public DepartmentArchievement( long totalArchievement, Vector<Long> mensualArchievementList,
String insuranceRenewalRate, String attachingRate)
public DepartmentArchievement( String departmentCode, long totalArchievement,
ArrayList<MensualArchievementItem> mensualArchievementList, String insuranceRenewalRate, String attachingRate)
{
this.departmentCode = departmentCode;
this.totalArchievement = totalArchievement;
this.mensualArchievementList = mensualArchievementList;
this.insuranceRenewalRate = insuranceRenewalRate;
@ -57,86 +59,45 @@ public class DepartmentArchievement
* 静态方法用于根据部门代码查询部门业绩生成一个 DepartmentArchievement 对象
* @param departmentCode 部门代码
* @return
* @throws SQLException
* @throws ClassNotFoundException
* @throws IOException
*/
public static DepartmentArchievement queryDepartmentArchievement( String departmentCode )
throws SQLException, ClassNotFoundException
@SuppressWarnings("unchecked")
public static DepartmentArchievement getDepartmentArchievement( String departmentCode )
throws IOException
{
Connection connection = null;
java.sql.CallableStatement statement = null;
ResultSet menusual_cursor = null;
DepartmentArchievement archievement = null;
String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?,?,?)}";
try
{
Class.forName( "oracle.jdbc.driver.OracleDriver" );
connection = DriverManager.getConnection( jdbcURL, userName, password );
statement = connection.prepareCall( sql );
SqlSession session = MybatisUtils.getSqlSession();
ArchievementMapper mapper = session.getMapper(ArchievementMapper.class);
statement.setString( 1, departmentCode );
statement.registerOutParameter( 2, java.sql.Types.VARCHAR );
statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
statement.registerOutParameter( 4, java.sql.Types.INTEGER );
statement.registerOutParameter( 5, OracleTypes.CURSOR );
// 参数集合
HashMap<String, Object> params = new HashMap<>(5);
params.put("a_department_code", departmentCode);
statement.execute();
mapper.getDepartmentArchievement(params);
Vector<Long> menusual_list = new Vector<Long>();
String attach_rate = statement.getString( 2 );
String renewal_rate = statement.getString( 3 );
long totalArchievement = statement.getInt( 4 );
Integer totalArchievement = (Integer)params.get("a_total");
String attachingRate = (String)params.get("a_attaching_rate");
String renewalRate = (String)params.get("a_renewal_rate");
ArrayList<MensualArchievementItem> mensual = (ArrayList<MensualArchievementItem>)params.get("a_mensual_cur");
menusual_cursor = ((OracleCallableStatement) statement).getCursor( 5 );
while ( menusual_cursor.next())
{
menusual_list.add( menusual_cursor.getLong( 2 ) );
}
archievement = new DepartmentArchievement( totalArchievement, menusual_list,
renewal_rate, attach_rate );
archievement = new DepartmentArchievement(
departmentCode,
totalArchievement.intValue(),
mensual,
renewalRate,
attachingRate);
}
finally
catch ( IOException error )
{
try
{
if ( menusual_cursor != null )
{
menusual_cursor.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
String errorMessage = "查询" + departmentCode + "业绩时出现错误。";
try
{
if ( statement != null )
{
statement.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
logger.error(errorMessage, error);
try
{
if ( connection != null )
{
connection.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
throw error;
}
return archievement;
@ -152,12 +113,12 @@ public class DepartmentArchievement
this.totalArchievement = totalArchievement;
}
public Vector<Long> getMensualArchievementList()
public ArrayList<MensualArchievementItem> getMensualArchievementList()
{
return mensualArchievementList;
}
public void setMensualArchievementList( Vector<Long> mensualArchievementList )
public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
{
this.mensualArchievementList = mensualArchievementList;
}
@ -182,13 +143,26 @@ public class DepartmentArchievement
this.attachingRate = attachingRate;
}
public String getDepartmentCode()
{
return departmentCode;
}
public void setDepartmentCode( String departmentCode )
{
this.departmentCode = departmentCode;
}
@JsonProperty( "department_code" )
private String departmentCode;
@JsonProperty( "total_archievement" )
private long totalArchievement; // 总业绩
// 每月业绩列表
// 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" )
private Vector<Long> mensualArchievementList;
private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率

View File

@ -0,0 +1,25 @@
/*
* @Author: Kane
* @Date: 2023-07-28 18:39:50
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/exception/ConfigFileExecption.java
* @Description: 配置文件异常
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.utils.exception;
public class ConfigFileExecption extends Exception
{
public ConfigFileExecption()
{
super("配置文件错误!");
}
public ConfigFileExecption( String message )
{
super( message );
}
}

View File

@ -9,12 +9,17 @@
*/
package com.cpic.xim.utils.ranking;
import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.ibatis.session.SqlSession;
import com.cpic.xim.mybatis.mapper.RankingListMapper;
import com.cpic.xim.mybatis.utils.MybatisUtils;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes;
@ -26,8 +31,8 @@ public class CallerRankingList
private static String password = "Cpic123456";
private CallerRankingList( String departmentCode, String year, String month,
Vector<CallerRankingItem> attachingRateRankingList,
Vector<CallerRankingItem> renewalRateRankingList)
ArrayList<CallerRankingItem> attachingRateRankingList,
ArrayList<CallerRankingItem> renewalRateRankingList)
{
this.departmentCode = departmentCode;
this.year = year;
@ -36,6 +41,33 @@ public class CallerRankingList
this.renewalRateRankingList = renewalRateRankingList;
}
@SuppressWarnings("unchecked")
public static CallerRankingList getCallerRankingList( String departmentCode, String year,
String month ) throws IOException
{
CallerRankingList rankingList = null;
// String monthRegx = "(0[1-9])|(1[0-2])";
// String yearRegx = "202[0-9]";
SqlSession session = MybatisUtils.getSqlSession();
RankingListMapper mapper = session.getMapper(RankingListMapper.class);
HashMap<String,Object> params = new HashMap<>();
params.put("a_department_code", departmentCode);
params.put("a_year", year);
params.put("a_month", month);
mapper.getRankingList(params);
ArrayList<CallerRankingItem> attachingRateRankingList = (ArrayList<CallerRankingItem>)params.get("a_attaching_ranking_list");
ArrayList<CallerRankingItem> renewalRateList = (ArrayList<CallerRankingItem>)params.get("a_renewal_ranking_list");
rankingList = new CallerRankingList(departmentCode, year, month, attachingRateRankingList, renewalRateList);
return rankingList;
}
/**
* @brief static方法用于查询部门坐席排行榜
* @param departmentCode 部门代码
@ -43,7 +75,7 @@ public class CallerRankingList
* @param month 排行榜月份
* @return CallerRankingList的实例对象
*/
public static CallerRankingList getCallerRankingList( String departmentCode, String year,
public static CallerRankingList getCallerRankingList2( String departmentCode, String year,
String month ) throws ClassNotFoundException, SQLException
{
CallerRankingList rankingList = null;
@ -55,11 +87,11 @@ public class CallerRankingList
String sql = """
{call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?,?,?)}
""";
String monthRegx = "(0[1-9])|(1[0-2])";
String yearRegx = "20[0-2][0-0]";
// String monthRegx = "(0[1-9])|(1[0-2])";
// String yearRegx = "20[0-2][0-0]";
Vector<CallerRankingItem> attachingRateRankingList = new Vector<>();
Vector<CallerRankingItem> renewalRateRankingList = new Vector<>();
ArrayList<CallerRankingItem> attachingRateRankingList = new ArrayList<>();
ArrayList<CallerRankingItem> renewalRateRankingList = new ArrayList<>();
int index = 1;
@ -81,7 +113,7 @@ public class CallerRankingList
cur_attaching = ((OracleCallableStatement) statement).getCursor( 4 );
index = 1;
while ( cur_attaching.next())
while (cur_attaching.next())
{
String callerName = cur_attaching.getString( 1 );
String appraiseValue = cur_attaching.getString( 2 );
@ -98,7 +130,7 @@ public class CallerRankingList
cur_renewal = ((OracleCallableStatement) statement).getCursor( 5 );
index = 1;
while ( cur_renewal.next())
while (cur_renewal.next())
{
String callerName = cur_renewal.getString( 1 );
String appraiseValue = cur_renewal.getString( 2 );
@ -153,7 +185,6 @@ public class CallerRankingList
}
}
return rankingList;
}
@ -187,22 +218,22 @@ public class CallerRankingList
this.month = month;
}
public Vector<CallerRankingItem> getAttachingRateRankingList()
public ArrayList<CallerRankingItem> getAttachingRateRankingList()
{
return attachingRateRankingList;
}
public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList )
public void setAttachingRateRankingList( ArrayList<CallerRankingItem> attachingRateRankingList )
{
this.attachingRateRankingList = attachingRateRankingList;
}
public Vector<CallerRankingItem> getRenewalRateRankingList()
public ArrayList<CallerRankingItem> getRenewalRateRankingList()
{
return renewalRateRankingList;
}
public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList )
public void setRenewalRateRankingList( ArrayList<CallerRankingItem> renewalRateRankingList )
{
this.renewalRateRankingList = renewalRateRankingList;
}
@ -217,9 +248,9 @@ public class CallerRankingList
private String month;
// 车非融合率排行
private Vector<CallerRankingItem> attachingRateRankingList;
private ArrayList<CallerRankingItem> attachingRateRankingList;
// 续保率排行
private Vector<CallerRankingItem> renewalRateRankingList;
private ArrayList<CallerRankingItem> renewalRateRankingList;
}

View File

@ -11,7 +11,6 @@ package com.cpic.xim.web.controllers.account;
import java.sql.SQLException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

View File

@ -13,31 +13,41 @@
package com.cpic.xim.web.controllers.archievement;
import java.sql.SQLException;
import java.util.Vector;
import java.io.IOException;
import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.utils.archievement.CallerArchievement;
import com.cpic.xim.utils.archievement.DepartmentArchievement;
import com.cpic.xim.utils.ranking.CallerRankingItem;
import com.cpic.xim.utils.ranking.CallerRankingList;
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListRequest;
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListResponse;
import com.cpic.xim.web.controllers.archievement.caller.CallerArchievementQueryRequest;
import com.cpic.xim.web.controllers.archievement.caller.CallerArchievementQueryResult;
import com.cpic.xim.web.controllers.archievement.department.DepartmentArchievementQueryRequest;
import com.cpic.xim.web.controllers.archievement.department.DepartmentArchievementQueryResult;
@Controller
@RequestMapping( "/archievement" )
public class ArchievementQueryController
{
// 日志
private static Logger logger = LoggerFactory.getLogger( ArchievementQueryController.class );
/**
* 查询坐席业绩
*/
@PostMapping( "/query_caller_archievement.do" )
public void queryCallerArchievement()
{
// @PostMapping( "/query_caller_archievement.do" )
// public void queryCallerArchievement()
// {
}
// }
/**
* 查询部门业绩
@ -55,8 +65,8 @@ public class ArchievementQueryController
try
{
// 查询业绩
departmentArch = DepartmentArchievement
.queryDepartmentArchievement( request.getDepartmentCode() );
departmentArch =
DepartmentArchievement.getDepartmentArchievement( request.getDepartmentCode() );
result.setTotalArchievement( departmentArch.getTotalArchievement() );
result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() );
@ -67,11 +77,7 @@ public class ArchievementQueryController
result.addBackwardStaff( "王炜" );
result.setMensualArchievementList( departmentArch.getMensualArchievementList() );
}
catch ( SQLException error )
{
}
catch ( ClassNotFoundException error )
catch ( IOException error )
{
}
@ -82,6 +88,31 @@ public class ArchievementQueryController
return result;
}
@ResponseBody
@PostMapping( "/query_caller_archievement.do" )
public CallerArchievementQueryResult queryCallerArchievement(
@RequestBody CallerArchievementQueryRequest request )
{
CallerArchievementQueryResult result = null;
try
{
CallerArchievement archievement =
CallerArchievement.getCallerArchievement( request.getCallerCode() );
result = new CallerArchievementQueryResult( true, "查询成功", archievement.getCallerCode(),
request.getCallName(), archievement.getTotalArchievement(),
archievement.getMensualArchievementList(),
archievement.getInsuranceRenewalRate(), archievement.getAttachingRate() );
}
catch ( IOException error )
{
result = new CallerArchievementQueryResult(false, error.getMessage(), null, null, 0, null, null, null);
}
return result;
}
@RequestMapping( "/query_ranking_list.do" )
@ResponseBody
public RankingListResponse queryCallerArchievementRankingList(
@ -94,8 +125,8 @@ public class ArchievementQueryController
boolean success = false;
String message = "";
Vector<CallerRankingItem> attachingRateRankingList = null;
Vector<CallerRankingItem> renewalRateRankingList = null;
ArrayList<CallerRankingItem> attachingRateRankingList = null;
ArrayList<CallerRankingItem> renewalRateRankingList = null;
try
@ -109,19 +140,12 @@ public class ArchievementQueryController
success = true;
message = "调用成功!";
}
catch ( SQLException error )
catch ( IOException error )
{
success = false;
message = "获取排行榜失败,原因:" + error.getMessage();
error.printStackTrace();
}
catch ( ClassNotFoundException error )
{
success = false;
message = "获取排行榜失败原因oracle驱动加载失败" + error.getMessage();
error.printStackTrace();
logger.error( message, error );
}
RankingListResponse response = new RankingListResponse( success, message, departmentCode,

View File

@ -1,8 +0,0 @@
package com.cpic.xim.web.controllers.archievement;
public class CallerArchievementQueryResult
{
}

View File

@ -9,7 +9,7 @@
*/
package com.cpic.xim.web.controllers.archievement.RankingList;
import java.util.Vector;
import java.util.ArrayList;
import com.cpic.xim.utils.ranking.CallerRankingItem;
import com.cpic.xim.web.controllers.QueryResult;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -22,8 +22,8 @@ public class RankingListResponse extends QueryResult
}
public RankingListResponse( boolean success, String message, String departmentCode, String year,
String month, Vector<CallerRankingItem> attachingRateRankingList,
Vector<CallerRankingItem> renewalRateRankingList)
String month, ArrayList<CallerRankingItem> attachingRateRankingList,
ArrayList<CallerRankingItem> renewalRateRankingList)
{
super( success, message );
@ -64,22 +64,22 @@ public class RankingListResponse extends QueryResult
this.month = month;
}
public Vector<CallerRankingItem> getAttachingRateRankingList()
public ArrayList<CallerRankingItem> getAttachingRateRankingList()
{
return attachingRateRankingList;
}
public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList )
public void setAttachingRateRankingList( ArrayList<CallerRankingItem> attachingRateRankingList )
{
this.attachingRateRankingList = attachingRateRankingList;
}
public Vector<CallerRankingItem> getRenewalRateRankingList()
public ArrayList<CallerRankingItem> getRenewalRateRankingList()
{
return renewalRateRankingList;
}
public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList )
public void setRenewalRateRankingList( ArrayList<CallerRankingItem> renewalRateRankingList )
{
this.renewalRateRankingList = renewalRateRankingList;
}
@ -98,9 +98,9 @@ public class RankingListResponse extends QueryResult
// 车非融合率排行
@JsonProperty( "attachingRateRankingList" )
private Vector<CallerRankingItem> attachingRateRankingList;
private ArrayList<CallerRankingItem> attachingRateRankingList;
// 续保率排行
@JsonProperty( "renewalRateRankingList" )
private Vector<CallerRankingItem> renewalRateRankingList;
private ArrayList<CallerRankingItem> renewalRateRankingList;
}

View File

@ -0,0 +1,43 @@
/*
* @Author: Kane
* @Date: 2023-08-26 13:20:32
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/caller/CallerArchievementQueryRequest.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.archievement.caller;
import com.fasterxml.jackson.annotation.JsonProperty;
public class CallerArchievementQueryRequest
{
public CallerArchievementQueryRequest() {}
public String getCallerCode()
{
return callerCode;
}
public void setCallerCode( String callerCode )
{
this.callerCode = callerCode;
}
public String getCallName()
{
return callName;
}
public void setCallName( String callName )
{
this.callName = callName;
}
@JsonProperty("callerCode")
private String callerCode;
@JsonProperty("callerName")
private String callName;
}

View File

@ -0,0 +1,123 @@
/*
* @Author: Kane
* @Date: 2023-06-06 17:35:54
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/caller/CallerArchievementQueryResult.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.archievement.caller;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.web.controllers.QueryResult;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
public class CallerArchievementQueryResult extends QueryResult
{
/**
*
* @param success
* @param message
* @param callerCode
* @param callerName
* @param totalArchievement
* @param mensualArchievementList
* @param insuranceRenewalRate
* @param attachingRate
*/
public CallerArchievementQueryResult( boolean success, String message, String callerCode,
String callerName, long totalArchievement,
ArrayList<MensualArchievementItem> mensualArchievementList, String insuranceRenewalRate,
String attachingRate)
{
super( success, message );
this.callerCode = callerCode;
this.callerName = callerName;
this.totalArchievement = totalArchievement;
this.mensualArchievementList = mensualArchievementList;
this.insuranceRenewalRate = insuranceRenewalRate;
this.attachingRate = attachingRate;
}
@JsonProperty("callerCode")
String callerCode;
public String getCallerCode()
{
return callerCode;
}
public void setCallerCode( String callerCode )
{
this.callerCode = callerCode;
}
public String getCallerName()
{
return callerName;
}
public void setCallerName( String callerName )
{
this.callerName = callerName;
}
public long getTotalArchievement()
{
return totalArchievement;
}
public void setTotalArchievement( long totalArchievement )
{
this.totalArchievement = totalArchievement;
}
public ArrayList<MensualArchievementItem> getMensualArchievementList()
{
return mensualArchievementList;
}
public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
{
this.mensualArchievementList = mensualArchievementList;
}
public String getInsuranceRenewalRate()
{
return insuranceRenewalRate;
}
public void setInsuranceRenewalRate( String insuranceRenewalRate )
{
this.insuranceRenewalRate = insuranceRenewalRate;
}
public String getAttachingRate()
{
return attachingRate;
}
public void setAttachingRate( String attachingRate )
{
this.attachingRate = attachingRate;
}
@JsonProperty("callerName")
String callerName;
@JsonProperty( "total_archievement" )
private long totalArchievement; // 总业绩
// 每月业绩列表
// 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" )
private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率
@JsonProperty( "attaching_rate" )
private String attachingRate; // 车非渗透率
}

View File

@ -8,7 +8,7 @@
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.archievement;
package com.cpic.xim.web.controllers.archievement.department;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -2,17 +2,20 @@
* @Author: Kane
* @Date: 2023-03-16 09:32:53
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/DepartmentArchievementQueryResult.java
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/department/DepartmentArchievementQueryResult.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.archievement;
package com.cpic.xim.web.controllers.archievement.department;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.web.controllers.QueryResult;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 查询部门业绩返回结果
@ -20,9 +23,9 @@ import com.cpic.xim.web.controllers.QueryResult;
*/
public class DepartmentArchievementQueryResult extends QueryResult
{
DepartmentArchievementQueryResult()
public DepartmentArchievementQueryResult()
{
mensualArchievementList = new Vector<Long>();
mensualArchievementList = new ArrayList<MensualArchievementItem>();
advanceRewardGainers = new Vector<String>();
leadingRewardGainers = new Vector<String>();
backwardList = new Vector<String>();
@ -38,12 +41,12 @@ public class DepartmentArchievementQueryResult extends QueryResult
this.totalArchievement = totalArchievement;
}
public Vector<Long> getMensualArchievementList()
public List<MensualArchievementItem> getMensualArchievementList()
{
return mensualArchievementList;
}
public void setMensualArchievementList( Vector<Long> mensualArchievementList )
public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
{
this.mensualArchievementList = mensualArchievementList;
}
@ -119,7 +122,7 @@ public class DepartmentArchievementQueryResult extends QueryResult
// 每月业绩列表
// 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" )
private Vector<Long> mensualArchievementList;
private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率

View File

@ -11,6 +11,7 @@ package com.cpic.xim.web.controllers.caller;
import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings("all")
public class QueryCallerRequest
{
public QueryCallerRequest() {}

View File

@ -6,11 +6,20 @@
#{a_department_code, mode=IN, jdbcType=VARCHAR},
#{a_attaching_rate, mode=OUT, jdbcType=VARCHAR},
#{a_renewal_rate, mode=OUT, jdbcType=VARCHAR},
#{a_total, mode=OUT, jdbcType=VARCHAR},
#{a_total, mode=OUT, jdbcType=INTEGER, javaType=Integer},
#{a_mensual_cur, mode=OUT, jdbcType=CURSOR, resultMap=MensualArchievementMapper})
</select>
<select id="getCallerArchievement" statementType="CALLABLE" parameterType="java.util.HashMap">
call telsale_archievement_pkg.caller_archievement(
#{a_caller_code, mode=IN, jdbcType=VARCHAR},
#{a_attaching_rate, mode=OUT, jdbcType=VARCHAR},
#{a_renewal_rate, mode=OUT, jdbcType=VARCHAR},
#{a_total, mode=OUT, jdbcType=INTEGER, javaType=Integer},
#{a_mensual_cur, mode=OUT, jdbcType=CURSOR, resultMap=MensualArchievementMapper})
</select>
<resultMap id="MensualArchievementMapper" type="MensualArchievementItem">
<id property="month" column="mm" />
<id property="month" column="mm" javaType="INT"/>
<result property="premium" column="bf" />
</resultMap>
</mapper>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpic.xim.mybatis.mapper.RankingListMapper">
<select id="getRankingList" statementType="CALLABLE" parameterType="java.util.HashMap">
call telsale_archievement_pkg.caller_arch_ranking_list(
#{a_department_code,mode=IN,jdbcType=VARCHAR},
#{a_year,mode=IN,jdbcType=VARCHAR},
#{a_month,mode=IN,jdbcType=VARCHAR},
#{a_attaching_ranking_list,mode=OUT,jdbcType=CURSOR, resultMap=AttachingRateRankingMap},
#{a_renewal_ranking_list,mode=OUT,jdbcType=CURSOR, resultMap=RenewalRateRankingMap})
</select>
<resultMap id="AttachingRateRankingMap" type="CallerRankingItem">
<id property="index" column="rownum" jdbcType="INTEGER" javaType="int"/>
<result property="callerName" column="caller_name" jdbcType="VARCHAR" javaType="String"/>
<result property="appraiseValue" column="attaching_rate" jdbcType="VARCHAR" javaType="String"/>
</resultMap>
<resultMap id="RenewalRateRankingMap" type="CallerRankingItem">
<id property="index" column="rownum" jdbcType="INTEGER" javaType="int"/>
<result property="callerName" column="caller_name" jdbcType="VARCHAR" javaType="String"/>
<result property="appraiseValue" column="renewal_rate" jdbcType="VARCHAR" javaType="String"/>
</resultMap>
</mapper>

View File

@ -6,6 +6,7 @@
<!-- 类型别名 -->
<typeAliases>
<package name="com.cpic.xim.mybatis.pojo" />
<package name="com.cpic.xim.utils.ranking" />
</typeAliases>
<environments default="development">
@ -23,5 +24,6 @@
<mappers>
<!-- <mapper resource="mybatis/mapper/StaffMapper.xml" /> -->
<mapper resource="mybatis/mapper/ArchievementMapper.xml" />
<mapper resource="mybatis/mapper/RankingListMapper.xml" />
</mappers>
</configuration>

View File

@ -13,40 +13,26 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cpic.xim.mybatis.mapper.ArchievementMapper;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.utils.archievement.DepartmentArchievement;
import com.cpic.xim.utils.ranking.CallerRankingList;
import com.cpic.xim.mybatis.utils.MybatisUtils;
@SuppressWarnings( "all" )
public class DesktopArchievementTest
{
private static String configFilePath = "mybatis/mybatis-config.xml";
@Test
public void testQueryArchievement()
{
try
{
DepartmentArchievement.queryDepartmentArchievement( "QDI" );
}
catch ( SQLException error )
{
System.out.println( error.getMessage() );
}
catch ( ClassNotFoundException error )
{
System.out.println( error.getMessage() );
}
}
private static Logger logger = LoggerFactory.getLogger( DesktopArchievementTest.class );
@Test
public void testCallerRankingList()
@ -57,13 +43,11 @@ public class DesktopArchievementTest
{
rankingList = CallerRankingList.getCallerRankingList( "QDI", "2023", "06" );
}
catch ( SQLException error )
catch ( IOException error )
{
error.printStackTrace();
}
catch ( ClassNotFoundException error )
{
error.printStackTrace();
String message = "获取排行榜失败,原因:" + error.getMessage();
logger.error( message, error );
}
assertNotNull( rankingList );
@ -80,19 +64,54 @@ public class DesktopArchievementTest
SqlSession session = factory.openSession();
ArchievementMapper mapper = session.getMapper( ArchievementMapper.class );
HashMap<String,Object> params = new HashMap<>();
params.put("a_department_code", "QDI");
ArrayList<MensualArchievementItem> mensual = null;
HashMap<String, Object> params = new HashMap<>();
params.put( "a_department_code", "QDI" );
mapper.getDepartmentArchievement( params );
System.out.println(params.toString());
mensual = (ArrayList<MensualArchievementItem>) params.get( "a_mensual_cur" );
Integer total = (Integer) params.get( "a_total" );
System.out.println( params.toString() );
System.out.println( mensual.toString() );
assertTrue( params.size() > 1 );
}
catch (IOException error )
{
assert( false );
catch ( IOException error )
{
assert (false);
}
}
@Test
public void testCallerArchievement()
{
try
{
SqlSession session = MybatisUtils.getSqlSession();
ArchievementMapper mapper = session.getMapper( ArchievementMapper.class );
ArrayList<MensualArchievementItem> mensual = null;
HashMap<String, Object> params = new HashMap<>();
params.put( "a_caller_code", "5500065875" );
mapper.getCallerArchievement( params );
Object obj = params.get( "a_mensual_cur" );
mensual = (ArrayList<MensualArchievementItem>)params.get( "a_mensual_cur" );
System.out.println( params.toString() );
System.out.println( mensual.toString() );
System.out.println( obj.getClass());
assertTrue( params.size() > 1 );
}
catch ( IOException error )
{
assert (false);
}
}
}

Binary file not shown.