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_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 PROCEDURE department_archievement
( (
@ -19,6 +22,15 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
a_mensual_cur OUT cur_type 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 PROCEDURE caller_arch_ranking_list
( (
a_department_code IN VARCHAR2, a_department_code IN VARCHAR2,
@ -30,147 +42,233 @@ CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
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 DEPARTMENT_ARCHIEVEMENT
PROCEDURE department_archievement
( (
a_department_code IN VARCHAR2, 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);
BEGIN
L_THIS_MONTH := TO_CHAR(SYSDATE,
'mm');
L_THIS_YEAR := TO_CHAR(SYSDATE,
'yyyy');
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;
EXCEPTION
-- 如果没有找到部门名称,说明代码错误,抛出异常
WHEN NO_DATA_FOUND THEN
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_attaching_rate OUT VARCHAR2,
a_renewal_rate OUT VARCHAR2, a_renewal_rate OUT VARCHAR2,
a_total OUT INTEGER, a_total OUT INTEGER,
a_mensual_cur OUT cur_type a_mensual_cur OUT cur_type
) IS ) IS
l_caller_name VARCHAR2(100);
l_this_month VARCHAR2(4); l_this_month VARCHAR2(4);
l_this_year VARCHAR2(4); l_this_year VARCHAR2(4);
l_firstday DATE; l_firstday DATE;
l_department_name VARCHAR2(100);
BEGIN 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;
l_this_month := to_char(SYSDATE, l_this_month := to_char(SYSDATE,
'mm'); 'mm');
l_this_year := to_char(SYSDATE, l_this_year := to_char(SYSDATE,
'yyyy'); 'yyyy');
l_firstday := to_date(to_char(SYSDATE, l_firstday := to_date(l_this_year || '-01-01 00:00:00',
'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss'); '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;
EXCEPTION
-- 如果没有找到部门名称,说明代码错误,抛出异常
WHEN NO_DATA_FOUND THEN
raise_application_error(DEPARTMENTCODE_EXCEPTION_CODE,
DEPARTMENTCODE_EXCEPTION_MSG);
END; --总车险保费
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(SUM(cf.车险个人客户保费), SELECT decode(nvl(SUM(cf.车险个人客户保费),
0),
0, 0,
0, 0,
round((SUM(cf.车非融合保费) / SUM(cf.车险个人客户保费) * 100), round(SUM(cf.车非融合保费) / SUM(cf.车险个人客户保费) * 100,
2)) 2))
INTO a_attaching_rate INTO a_attaching_rate
FROM 坐席车非每日保费 cf FROM 坐席车非每日保费 cf
WHERE cf.月份 = l_this_month WHERE cf.坐席工号 = a_caller_code
AND cf.年份 = l_this_year AND cf.年份 = l_this_year
AND 部门代码 = a_department_code; AND cf.月份 = l_this_month;
--续保率 --续保率
SELECT decode(SUM(到期数), SELECT decode(nvl(SUM(xb.到期数),
0,
0,
round(SUM(已续保累计) / SUM(到期数) * 100,
2))
INTO a_renewal_rate
FROM 坐席续保统计
WHERE 部门 = l_department_name;
--总业绩
SELECT round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费),
0), 0),
0) 0,
INTO a_total 0,
FROM 坐席车非每日保费 cf round(SUM(xb.已续保累计) / SUM(xb.到期数) * 100,
WHERE 部门代码 = a_department_code 2)) xbl
AND 签单日期 >= l_firstday INTO a_renewal_rate
AND 签单日期 <= SYSDATE; FROM 坐席续保统计 xb
WHERE xb.坐席工号 = a_caller_code;
--每月业绩 --每月业绩
OPEN a_mensual_cur FOR OPEN A_MENSUAL_CUR FOR
SELECT cf.月份 mm, SELECT CF.月份 MM,
round(nvl(SUM(cf.车险个人客户保费 + cf.车非融合保费) / 10000, ROUND(NVL(SUM(CF.车险个人客户保费 + CF.车非融合保费),
0), 0),
0) bf 0) BF
FROM 坐席车非每日保费 cf FROM 坐席车非每日保费 CF
WHERE 部门代码 = a_department_code WHERE cf.坐席工号 = a_caller_code
AND 签单日期 >= to_date(to_char(SYSDATE, AND 签单日期 >= TO_DATE(TO_CHAR(SYSDATE,
'yyyy') || '-01-01 00:00:00', 'yyyy') || '-01-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss') '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') || '-01 00:00:00',
'yyyy-mm-dd hh24:mi:ss') 'yyyy-mm-dd hh24:mi:ss')
GROUP BY cf.月份 GROUP BY CF.月份
ORDER BY cf.月份; ORDER BY CF.月份;
END; END;
/*******************************************************/ /*******************************************************/
-- 坐席排行榜 -- 坐席排行榜
PROCEDURE caller_arch_ranking_list PROCEDURE CALLER_ARCH_RANKING_LIST
( (
a_department_code IN VARCHAR2, A_DEPARTMENT_CODE IN VARCHAR2,
a_year IN VARCHAR2, A_YEAR IN VARCHAR2,
a_month IN VARCHAR2, A_MONTH IN VARCHAR2,
a_attaching_ranking_list OUT cur_type, A_ATTACHING_RANKING_LIST OUT CUR_TYPE,
a_renewal_ranking_list OUT cur_type A_RENEWAL_RANKING_LIST OUT CUR_TYPE
) IS ) IS
l_department_name VARCHAR2(100); L_DEPARTMENT_NAME VARCHAR2(100);
BEGIN BEGIN
-- 获取部门名称 -- 获取部门名称
BEGIN BEGIN
SELECT department_name SELECT DEPARTMENT_NAME
INTO l_department_name INTO L_DEPARTMENT_NAME
FROM idst0.bm_t bm FROM IDST0.BM_T BM
WHERE bm.department_code = a_department_code; WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
EXCEPTION EXCEPTION
-- 如果没有找到部门名称,说明代码错误,抛出异常 -- 如果没有找到部门名称,说明代码错误,抛出异常
WHEN NO_DATA_FOUND THEN WHEN NO_DATA_FOUND THEN
raise_application_error(DEPARTMENTCODE_EXCEPTION_CODE, RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
DEPARTMENTCODE_EXCEPTION_MSG); DEPARTMENTCODE_EXCEPTION_MSG);
END; END;
-- 车非融合率排行榜 -- 车非融合率排行榜
OPEN a_attaching_ranking_list FOR OPEN A_ATTACHING_RANKING_LIST FOR
SELECT 坐席名称, SELECT ROWNUM,
round(decode(SUM(车险个人客户保费), 坐席名称 AS CALLER_NAME,
车非渗透率 AS ATTACHING_RATE
FROM (SELECT 坐席名称,
ROUND(DECODE(nvl(SUM(车险个人客户保费),
0),
0, 0,
0, 0,
(SUM(车非融合保费) / SUM(车险个人客户保费)) * 100), (SUM(车非融合保费) / SUM(车险个人客户保费)) * 100),
2) 车非渗透率 2) 车非渗透率
FROM 坐席车非每日保费 FROM 坐席车非每日保费
WHERE 月份 = a_month WHERE 月份 = A_MONTH
AND 年份 = a_year AND 年份 = A_YEAR
AND 部门代码 = a_department_code AND 部门代码 = A_DEPARTMENT_CODE
GROUP BY 坐席名称 GROUP BY 坐席名称
ORDER BY 车非渗透率 DESC; ORDER BY 车非渗透率 DESC);
-- 续保率排行榜 -- 续保率排行榜
OPEN a_renewal_ranking_list FOR OPEN A_RENEWAL_RANKING_LIST FOR
SELECT 坐席名称, SELECT ROWNUM,
round(nvl((SUM(已续保累计) / SUM(到期数)) * 100, 坐席名称 AS CALLER_NAME,
续保率 AS RENEWAL_RATE
FROM (SELECT 坐席名称,
decode(nvl(SUM(xb.到期数),
0), 0),
2) 续保率 0,
FROM 坐席续保统计 xb 0,
WHERE xb.部门 = l_department_name round(SUM(xb.已续保累计) / SUM(xb.到期数) * 100,
2)) 续保率
FROM 坐席续保统计 XB
WHERE XB.部门 = L_DEPARTMENT_NAME
GROUP BY 坐席名称 GROUP BY 坐席名称
ORDER BY 续保率 DESC; ORDER BY 续保率 DESC);
END; END;
BEGIN BEGIN
NULL; 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; drop table _T;
create global temporary table _T create global temporary table _T
( (
DATE not null, DATE not null,
VARCHAR2(10) not null, VARCHAR2(10) not null,
VARCHAR2(100) not null, VARCHAR2(100) not null,
varchar2(100) not null, varchar2(100) not null,
n VARCHAR2(100) not null, n VARCHAR2(100) not null,
n VARCHAR2(100), n VARCHAR2(100),
VARCHAR2(20), VARCHAR2(20),
VARCHAR2(30), VARCHAR2(30),
VARCHAR2(100), VARCHAR2(100),
NUMBER(16,2), NUMBER(16,2),
NUMBER(16,2) NUMBER(16,2)
) )
on commit preserve rows; on commit preserve rows;
-- Grant/Revoke object privileges -- 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,6 +67,8 @@ module.exports = {
js: "espree", js: "espree",
"<template>": "espree", "<template>": "espree",
}, },
// project: "./tsconfig.json",
extraFileExtensions: [".vue",],
}, },
plugins: ["eslint-plugin-vue",], plugins: ["eslint-plugin-vue",],
extends: [ extends: [
@ -79,13 +81,14 @@ module.exports = {
], ],
rules: { rules: {
indent: ["warn", 4,], indent: ["warn", 4,],
"no-trailing-spaces": ["error", {"ignoreComments": true,},],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn", "no-unused-vars": "warn",
semi: ["error", "always",], // 控制行尾部分号 "semi-spacing": ["error", {"before": false, "after": true,},], // 控制行尾部分号
quotes: ["error", "double",], "quotes": ["error", "double",],
"comma-dangle": ["error", { "comma-dangle": ["error", {
arrays: "always", arrays: "always",
objects: "always", objects: "always",
@ -144,11 +147,12 @@ module.exports = {
plugins: ["@typescript-eslint",], plugins: ["@typescript-eslint",],
extends: [ extends: [
"eslint:recommended", "eslint:recommended",
// "standard-with-typescript", "standard-with-typescript",
"plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
], ],
rules: { rules: {
"no-trailing-spaces": ["error", {"ignoreComments": true,},],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
@ -189,6 +193,7 @@ module.exports = {
"prefer-const": "warn", "prefer-const": "warn",
"spaced-comment": "error", "spaced-comment": "error",
"space-before-function-paren": "off", "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" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@babel/eslint-parser": "^7.22.9", "@babel/eslint-parser": "^7.22.11",
"@element-plus/icons-vue": "^2.1.0", "@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", "babel": "^6.23.0",
"echarts": "^5.4.3", "echarts": "^5.4.3",
"element-plus": "^2.3.8", "element-plus": "^2.3.12",
"moment": "^2.29.4", "moment": "^2.29.4",
"sass-loader": "^13.3.2", "sass-loader": "^13.3.2",
"ts-node": "^10.9.1",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-router": "^4.2.4", "vue-router": "^4.2.4",
"vuex": "^4.1.0" "vuex": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.22.9", "@babel/eslint-parser": "^7.22.11",
"@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/eslint-plugin": "^6.5.0",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.3.3",
"@vue/cli-plugin-eslint": "^5.0.8", "@vue/cli-plugin-eslint": "^5.0.8",
"axios": "~1.5.0",
"eslint-config-recommended": "^4.1.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", "node-sass": "^9.0.0",
"sass": "^1.64.1", "sass": "^1.66.1",
"style-loader": "^3.3.3", "style-loader": "^3.3.3",
"typescript": "^5.1.6",
"vue-eslint-parser": "^9.3.1" "vue-eslint-parser": "^9.3.1"
} }
} }

View File

@ -2,7 +2,7 @@
* @Author: Kane * @Author: Kane
* @Date: 2023-02-15 09:25:52 * @Date: 2023-02-15 09:25:52
* @LastEditors: Kane * @LastEditors: Kane
* @LastEditTime: 2023-03-17 14:31:14 * @LastEditTime: 2023-08-25 10:53:30
* @FilePath: /task_schedule/src/App.vue * @FilePath: /task_schedule/src/App.vue
* @Description: * @Description:
* 应用的框架 * 应用的框架
@ -17,7 +17,7 @@
</template> </template>
<script lang="ts"> <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 { export default {
name: "App", name: "App",

View File

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

View File

@ -8,6 +8,8 @@
* Copyright (c) ${2022} by Kane, All Rights Reserved. * 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", "target": "ESNext",
"module": "ESNext", "module": "ESNext",
// "module": "CommonJS", // "module": "CommonJS",
// "moduleResolution": "node",
"moduleResolution": "node", "moduleResolution": "node",
"strict": true, "strict": true,
"jsx": "preserve", "jsx": "preserve",
"sourceMap": true, "sourceMap": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": false, "esModuleInterop": true,
"baseUrl": "./", // paths "baseUrl": "./", // paths
"paths": { // "paths": { //
"@/*": [ "@/*": [
@ -46,5 +45,8 @@
], ],
"exclude": [ "exclude": [
"./node_modules", "./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://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_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 * @Date: 2023-03-17 15:17:44
* @LastEditors: Kane * @LastEditors: Kane
* @FilePath: /task_schedule/src/utils/archievement.ts * @FilePath: /task_schedule/src/utils/archievement.ts
* @Description: * @Description:
* *
* Copyright (c) ${2022} by Kane, All Rights Reserved. * Copyright (c) ${2022} by Kane, All Rights Reserved.
*/ */
import { service as instance } from "./api/request.js"; import { service as instance } from "./api/request.js";
import { API_URL } from "./api/config.js"; import { API_URL } from "./api/config.js";
import { type Department } from "@/types/cpicxim/Department.js"; import { type Department } from "../types/cpicxim/Department.js";
// import { type AxiosResponse } from "axios"; import { type TelSaler } from "../types/cpicxim/TelSaler.js";
import { type AxiosResponse } from "axios";
interface Archievement interface DepartmentArchievement // 定义业绩对象的结构
{ {
success: boolean; success: boolean;
message: string; message: string;
@ -25,20 +26,31 @@ interface Archievement
backward_list: string[]; 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 function queryDepartmentArchievement( departmentInfo: Department, render: any ): void
{ {
instance.request({ // 默认的部门业绩对象
method: "post", const archievement: DepartmentArchievement = {
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
data: departmentInfo,
})
.then(( response ) =>
{
const archievement: Archievement = {
success: false, success: false,
message: "", message: "",
total_archievement: 0, total_archievement: 0,
@ -50,23 +62,187 @@ function queryDepartmentArchievement( departmentInfo: Department, render: any ):
backward_list: [], backward_list: [],
}; };
instance.request({
method: "post",
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
data: departmentInfo,
})
// 请求结束,将请求的结果写入业绩对象,然后调用功能渲染函数。
.then(( response ) =>
{
const data = response.data ?? {}; const data = response.data ?? {};
archievement.success = data.success ?? false; archievement.success = data.success ?? false;
archievement.message = data.message ?? ""; archievement.message = data.message ?? "服务器没有返回调用结果消息,请检查日志!";
archievement.mensual_archievement_list = data.mensual_archievement_list ?? []; archievement.total_archievement = data.total_archievement;
archievement.mensual_archievement_list = [];
archievement.insurance_renewal_rate = data.insurance_renewal_rate ?? "0.0"; archievement.insurance_renewal_rate = data.insurance_renewal_rate ?? "0.0";
archievement.attaching_rate = data.attaching_rate ?? "0.0"; archievement.attaching_rate = data.attaching_rate ?? "0.0";
archievement.leading_reward_gainers = data.leading_reward_gainers ?? []; archievement.leading_reward_gainers = data.leading_reward_gainers ?? [];
archievement.advance_reward_gainers = data.advance_reward_gainers ?? []; archievement.advance_reward_gainers = data.advance_reward_gainers ?? [];
archievement.backward_list = data.backward_list ?? []; 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 ) => .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[]; renewalRateRankingList: RankingListItem[];
} }
// 判断用的正则表达式
const regexMonth = "(0[1-9])|(1[0-2])";
/** /**
* *
* @param reqParam * @param reqParam
@ -53,6 +56,9 @@ function requestRankingList( reqParam: RankingListRequest, rander: any ): void /
renewalRateRankingList: [], renewalRateRankingList: [],
}; };
// 检查请求参数
// TODO: 这里要加一个对month的正则表达式验证。
instance.request( instance.request(
{ {
method: "post", method: "post",

View File

@ -17,7 +17,7 @@
<div class="center-wrapper"> <div class="center-wrapper">
<span class="slogan">对标先进&nbsp;比学赶超</span> <span class="slogan">对标先进&nbsp;比学赶超</span>
<div class="total-archievement-wrapper"> <div class="total-archievement-wrapper">
<span>业绩</span> <span>我的车险业绩</span>
<span>{{ getTotalArchievement }}</span> <span>{{ getTotalArchievement }}</span>
</div> </div>
<div class="archievement-wrapper"> <div class="archievement-wrapper">
@ -55,9 +55,7 @@
indicator-position="none" indicator-position="none"
:interval="4000" :interval="4000"
> >
<el-carousel-item <el-carousel-item :key="1">
:key="1"
>
<RankingListComponent :ranking-list="ui.attachingRankingList" /> <RankingListComponent :ranking-list="ui.attachingRankingList" />
</el-carousel-item> </el-carousel-item>
<el-carousel-item :key="2"> <el-carousel-item :key="2">
@ -88,9 +86,20 @@ import { computed, reactive, onBeforeMount, onUnmounted } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { getCallerInfo } from "@/utils/api/localStorage.js"; import { getCallerInfo } from "@/utils/api/localStorage.js";
import { ElMessage } from "element-plus"; 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 { 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 { type Department } from "@/types/cpicxim/Department";
import ArchievementChart from "@/components/ArchievementChartComponent.vue"; import ArchievementChart from "@/components/ArchievementChartComponent.vue";
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue"; import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
@ -127,7 +136,24 @@ export default {
setup() setup()
{ {
const monthIndex = new Date(); 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 router = useRouter();
const callerInfo: TelSaler = getCallerInfo(); const callerInfo: TelSaler = getCallerInfo();
const ui: ui = reactive({ const ui: ui = reactive({
@ -145,10 +171,9 @@ export default {
}); });
let timerHandler = 0; let timerHandler = 0;
const getTotalArchievement = computed(() => const getTotalArchievement = computed(():string =>
{
const cnyFormat = new Intl.NumberFormat( "zh-cn",
{ {
const cnyFormat = new Intl.NumberFormat( "zh-cn", {
style: "currency", style: "currency",
currency: "CNY", currency: "CNY",
minimumFractionDigits: 0, minimumFractionDigits: 0,
@ -158,13 +183,28 @@ export default {
return archievement; 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.attaching_rate = data.attaching_rate;
ui.insurance_renewal_rate = data.insurance_renewal_rate; ui.insurance_renewal_rate = data.insurance_renewal_rate;
ui.leading_reward_gainers = data.leading_reward_gainers; ui.leading_reward_gainers = data.leading_reward_gainers;
@ -175,7 +215,36 @@ export default {
// vue // vue
ui.showUI = false; 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 => const applyRankingListData = ( data: RankingListResponse ): void =>
@ -189,7 +258,10 @@ export default {
console.log( "获取排行榜后的ui:", data ); console.log( "获取排行榜后的ui:", data );
setTimeout(() => { ui.showUI = true; }, 0 ); setTimeout(() =>
{
ui.showUI = true;
}, 0 );
}; };
// 退 // 退
@ -214,24 +286,23 @@ export default {
} }
/** /**
* 刷新页面 * 用于定时对页面进行刷新其中会请求最新的业绩数据
*/ */
const refresh = () => const refresh = () =>
{ {
const deparmentInfo: Department = const deparmentInfo: Department = {
{
departmentCode: callerInfo.departmentCode, departmentCode: callerInfo.departmentCode,
departmentName: callerInfo.departmentName, departmentName: callerInfo.departmentName,
}; };
const rankinglistRequest: RankingListRequest = const rankinglistRequest: RankingListRequest = {
{
departmentCode: callerInfo.departmentCode, departmentCode: callerInfo.departmentCode,
year: "2023", year: thisYearString,
month: "06", month: thisMonthString,
}; };
queryDepartmentArchievement( deparmentInfo, applyArchievementData ); queryDepartmentArchievement( deparmentInfo, applyDepartmentArchievementData );
queryCallerArchievement( callerInfo, applyCallerArchievementData );
requestRankingList( rankinglistRequest, applyRankingListData ); requestRankingList( rankinglistRequest, applyRankingListData );
}; };
@ -255,7 +326,15 @@ export default {
clearInterval( timerHandler ); clearInterval( timerHandler );
}); });
return { ui, callerInfo, timerHandler, getTotalArchievement, renderData: applyArchievementData, refresh, logoutDesktopArchievement, }; return {
ui,
callerInfo,
timerHandler,
getTotalArchievement,
renderData: applyDepartmentArchievementData,
refresh,
logoutDesktopArchievement,
};
}, },
}; };
</script> </script>
@ -394,6 +473,7 @@ export default {
weight: 100; weight: 100;
size: 30px; size: 30px;
} }
color: $color-bg-04; color: $color-bg-04;
text-align: center; text-align: center;

View File

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

View File

@ -1,5 +1,6 @@
{ {
"java.configuration.updateBuildConfiguration": "automatic", "java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "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 * @Author: Kane
* @Date: 2023-07-27 11:05:53 * @Date: 2023-07-27 11:05:53
* @LastEditors: Kane * @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: * @Description:
* *
* Copyright (c) ${2022} by Kane, All Rights Reserved. * Copyright (c) ${2022} by Kane, All Rights Reserved.
@ -14,4 +14,6 @@ import java.util.HashMap;
public interface ArchievementMapper 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()
{} {}
public MensualArchievementItem( String month, String premium) public MensualArchievementItem( int month, String premium)
{ {
this.month = month; this.month = month;
this.premium = premium; this.premium = premium;
} }
public String getMonth() public int getMonth()
{ {
return month; return month;
} }
public void setMonth( String month ) public void setMonth( int month )
{ {
this.month = month; this.month = month;
} }
@ -42,18 +42,14 @@ public class MensualArchievementItem
this.premium = premium; this.premium = premium;
} }
@Override
public String toString()
{
return "MensualArchievementItem [month=" + month + ", premium=" + premium + "]";
}
@Override @Override
public int hashCode() public int hashCode()
{ {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((month == null) ? 0 : month.hashCode()); result = prime * result + month;
result = prime * result + ((premium == null) ? 0 : premium.hashCode()); result = prime * result + ((premium == null) ? 0 : premium.hashCode());
return result; return result;
} }
@ -68,11 +64,7 @@ public class MensualArchievementItem
if ( getClass() != obj.getClass() ) if ( getClass() != obj.getClass() )
return false; return false;
MensualArchievementItem other = (MensualArchievementItem) obj; MensualArchievementItem other = (MensualArchievementItem) obj;
if ( month == null ) if ( month != other.month )
{
if ( other.month != null )
return false;
} else if ( !month.equals( other.month ) )
return false; return false;
if ( premium == null ) if ( premium == null )
{ {
@ -83,9 +75,17 @@ public class MensualArchievementItem
return true; return true;
} }
@Override
public String toString()
{
return "MensualArchievementItem [month=" + month + ", premium=" + premium + "]";
}
// 月份 // 月份
@JsonProperty( "month" ) @JsonProperty( "month" )
private String month; private int month;
// 月总保费 // 月总保费
@JsonProperty( "premium" ) @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

@ -9,3 +9,199 @@
*/ */
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; package com.cpic.xim.utils.archievement;
import java.sql.Connection; import java.io.IOException;
import java.sql.DriverManager; import java.util.ArrayList;
import java.sql.ResultSet; import java.util.HashMap;
import java.sql.SQLException; import org.apache.ibatis.session.SqlSession;
import java.util.Vector; 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 com.fasterxml.jackson.annotation.JsonProperty;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes;
public class DepartmentArchievement public class DepartmentArchievement
{ {
// log4j2
// 以后要改 private static Logger logger = LoggerFactory.getLogger(DepartmentArchievement.class);
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";
/** /**
* 默认的构造函数提供给json使用 * 默认的构造函数提供给json使用
@ -32,21 +31,24 @@ public class DepartmentArchievement
public DepartmentArchievement() public DepartmentArchievement()
{ {
this.totalArchievement = 0; this.totalArchievement = 0;
this.mensualArchievementList = new Vector<>(); this.mensualArchievementList = null;
this.insuranceRenewalRate = ""; this.insuranceRenewalRate = "";
this.attachingRate = ""; this.attachingRate = "";
this.departmentCode = "";
} }
/** /**
* @brief 构造函数提供所有成员对象的值 * @brief 构造函数提供所有成员对象的值
* @param totalArchievement * @param departmentCode 部门代码
* @param mensualArchievementList * @param totalArchievement 总业绩
* @param insuranceRenewalRate * @param mensualArchievementList 每月业绩表
* @param attachingRate * @param insuranceRenewalRate 续保率
* @param attachingRate 车非渗透率
*/ */
public DepartmentArchievement( long totalArchievement, Vector<Long> mensualArchievementList, public DepartmentArchievement( String departmentCode, long totalArchievement,
String insuranceRenewalRate, String attachingRate) ArrayList<MensualArchievementItem> mensualArchievementList, String insuranceRenewalRate, String attachingRate)
{ {
this.departmentCode = departmentCode;
this.totalArchievement = totalArchievement; this.totalArchievement = totalArchievement;
this.mensualArchievementList = mensualArchievementList; this.mensualArchievementList = mensualArchievementList;
this.insuranceRenewalRate = insuranceRenewalRate; this.insuranceRenewalRate = insuranceRenewalRate;
@ -57,86 +59,45 @@ public class DepartmentArchievement
* 静态方法用于根据部门代码查询部门业绩生成一个 DepartmentArchievement 对象 * 静态方法用于根据部门代码查询部门业绩生成一个 DepartmentArchievement 对象
* @param departmentCode 部门代码 * @param departmentCode 部门代码
* @return * @return
* @throws SQLException * @throws IOException
* @throws ClassNotFoundException
*/ */
public static DepartmentArchievement queryDepartmentArchievement( String departmentCode ) @SuppressWarnings("unchecked")
throws SQLException, ClassNotFoundException public static DepartmentArchievement getDepartmentArchievement( String departmentCode )
throws IOException
{ {
Connection connection = null;
java.sql.CallableStatement statement = null;
ResultSet menusual_cursor = null;
DepartmentArchievement archievement = null; DepartmentArchievement archievement = null;
String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?,?,?)}";
try try
{ {
Class.forName( "oracle.jdbc.driver.OracleDriver" ); SqlSession session = MybatisUtils.getSqlSession();
connection = DriverManager.getConnection( jdbcURL, userName, password ); ArchievementMapper mapper = session.getMapper(ArchievementMapper.class);
statement = connection.prepareCall( sql );
statement.setString( 1, departmentCode ); // 参数集合
statement.registerOutParameter( 2, java.sql.Types.VARCHAR ); HashMap<String, Object> params = new HashMap<>(5);
statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
statement.registerOutParameter( 4, java.sql.Types.INTEGER );
statement.registerOutParameter( 5, OracleTypes.CURSOR );
statement.execute(); params.put("a_department_code", departmentCode);
Vector<Long> menusual_list = new Vector<Long>(); mapper.getDepartmentArchievement(params);
String attach_rate = statement.getString( 2 );
String renewal_rate = statement.getString( 3 );
long totalArchievement = statement.getInt( 4 );
menusual_cursor = ((OracleCallableStatement) statement).getCursor( 5 ); 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");
while ( menusual_cursor.next()) archievement = new DepartmentArchievement(
{ departmentCode,
menusual_list.add( menusual_cursor.getLong( 2 ) ); totalArchievement.intValue(),
mensual,
renewalRate,
attachingRate);
} }
catch ( IOException error )
{
String errorMessage = "查询" + departmentCode + "业绩时出现错误。";
archievement = new DepartmentArchievement( totalArchievement, menusual_list, logger.error(errorMessage, error);
renewal_rate, attach_rate );
}
finally
{
try
{
if ( menusual_cursor != null )
{
menusual_cursor.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try throw error;
{
if ( statement != null )
{
statement.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try
{
if ( connection != null )
{
connection.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
} }
return archievement; return archievement;
@ -152,12 +113,12 @@ public class DepartmentArchievement
this.totalArchievement = totalArchievement; this.totalArchievement = totalArchievement;
} }
public Vector<Long> getMensualArchievementList() public ArrayList<MensualArchievementItem> getMensualArchievementList()
{ {
return mensualArchievementList; return mensualArchievementList;
} }
public void setMensualArchievementList( Vector<Long> mensualArchievementList ) public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
{ {
this.mensualArchievementList = mensualArchievementList; this.mensualArchievementList = mensualArchievementList;
} }
@ -182,13 +143,26 @@ public class DepartmentArchievement
this.attachingRate = attachingRate; 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" ) @JsonProperty( "total_archievement" )
private long totalArchievement; // 总业绩 private long totalArchievement; // 总业绩
// 每月业绩列表 // 每月业绩列表
// 要保证数据是按照月份排序 // 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" ) @JsonProperty( "mensual_archievement_list" )
private Vector<Long> mensualArchievementList; private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" ) @JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率 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; package com.cpic.xim.utils.ranking;
import java.io.IOException;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; 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.OracleCallableStatement;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
@ -26,8 +31,8 @@ public class CallerRankingList
private static String password = "Cpic123456"; private static String password = "Cpic123456";
private CallerRankingList( String departmentCode, String year, String month, private CallerRankingList( String departmentCode, String year, String month,
Vector<CallerRankingItem> attachingRateRankingList, ArrayList<CallerRankingItem> attachingRateRankingList,
Vector<CallerRankingItem> renewalRateRankingList) ArrayList<CallerRankingItem> renewalRateRankingList)
{ {
this.departmentCode = departmentCode; this.departmentCode = departmentCode;
this.year = year; this.year = year;
@ -36,6 +41,33 @@ public class CallerRankingList
this.renewalRateRankingList = renewalRateRankingList; 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方法用于查询部门坐席排行榜 * @brief static方法用于查询部门坐席排行榜
* @param departmentCode 部门代码 * @param departmentCode 部门代码
@ -43,7 +75,7 @@ public class CallerRankingList
* @param month 排行榜月份 * @param month 排行榜月份
* @return CallerRankingList的实例对象 * @return CallerRankingList的实例对象
*/ */
public static CallerRankingList getCallerRankingList( String departmentCode, String year, public static CallerRankingList getCallerRankingList2( String departmentCode, String year,
String month ) throws ClassNotFoundException, SQLException String month ) throws ClassNotFoundException, SQLException
{ {
CallerRankingList rankingList = null; CallerRankingList rankingList = null;
@ -55,11 +87,11 @@ public class CallerRankingList
String sql = """ String sql = """
{call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?,?,?)} {call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?,?,?)}
"""; """;
String monthRegx = "(0[1-9])|(1[0-2])"; // String monthRegx = "(0[1-9])|(1[0-2])";
String yearRegx = "20[0-2][0-0]"; // String yearRegx = "20[0-2][0-0]";
Vector<CallerRankingItem> attachingRateRankingList = new Vector<>(); ArrayList<CallerRankingItem> attachingRateRankingList = new ArrayList<>();
Vector<CallerRankingItem> renewalRateRankingList = new Vector<>(); ArrayList<CallerRankingItem> renewalRateRankingList = new ArrayList<>();
int index = 1; int index = 1;
@ -153,7 +185,6 @@ public class CallerRankingList
} }
} }
return rankingList; return rankingList;
} }
@ -187,22 +218,22 @@ public class CallerRankingList
this.month = month; this.month = month;
} }
public Vector<CallerRankingItem> getAttachingRateRankingList() public ArrayList<CallerRankingItem> getAttachingRateRankingList()
{ {
return attachingRateRankingList; return attachingRateRankingList;
} }
public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList ) public void setAttachingRateRankingList( ArrayList<CallerRankingItem> attachingRateRankingList )
{ {
this.attachingRateRankingList = attachingRateRankingList; this.attachingRateRankingList = attachingRateRankingList;
} }
public Vector<CallerRankingItem> getRenewalRateRankingList() public ArrayList<CallerRankingItem> getRenewalRateRankingList()
{ {
return renewalRateRankingList; return renewalRateRankingList;
} }
public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList ) public void setRenewalRateRankingList( ArrayList<CallerRankingItem> renewalRateRankingList )
{ {
this.renewalRateRankingList = renewalRateRankingList; this.renewalRateRankingList = renewalRateRankingList;
} }
@ -217,9 +248,9 @@ public class CallerRankingList
private String month; 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 java.sql.SQLException;
import org.springframework.stereotype.Controller; 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;

View File

@ -13,31 +13,41 @@
package com.cpic.xim.web.controllers.archievement; package com.cpic.xim.web.controllers.archievement;
import java.sql.SQLException; import java.io.IOException;
import java.util.Vector; import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; 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.archievement.DepartmentArchievement;
import com.cpic.xim.utils.ranking.CallerRankingItem; import com.cpic.xim.utils.ranking.CallerRankingItem;
import com.cpic.xim.utils.ranking.CallerRankingList; import com.cpic.xim.utils.ranking.CallerRankingList;
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListRequest; 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.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 @Controller
@RequestMapping( "/archievement" ) @RequestMapping( "/archievement" )
public class ArchievementQueryController public class ArchievementQueryController
{ {
// 日志
private static Logger logger = LoggerFactory.getLogger( ArchievementQueryController.class );
/** /**
* 查询坐席业绩 * 查询坐席业绩
*/ */
@PostMapping( "/query_caller_archievement.do" ) // @PostMapping( "/query_caller_archievement.do" )
public void queryCallerArchievement() // public void queryCallerArchievement()
{ // {
} // }
/** /**
* 查询部门业绩 * 查询部门业绩
@ -55,8 +65,8 @@ public class ArchievementQueryController
try try
{ {
// 查询业绩 // 查询业绩
departmentArch = DepartmentArchievement departmentArch =
.queryDepartmentArchievement( request.getDepartmentCode() ); DepartmentArchievement.getDepartmentArchievement( request.getDepartmentCode() );
result.setTotalArchievement( departmentArch.getTotalArchievement() ); result.setTotalArchievement( departmentArch.getTotalArchievement() );
result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() ); result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() );
@ -67,11 +77,7 @@ public class ArchievementQueryController
result.addBackwardStaff( "王炜" ); result.addBackwardStaff( "王炜" );
result.setMensualArchievementList( departmentArch.getMensualArchievementList() ); result.setMensualArchievementList( departmentArch.getMensualArchievementList() );
} }
catch ( SQLException error ) catch ( IOException error )
{
}
catch ( ClassNotFoundException error )
{ {
} }
@ -82,6 +88,31 @@ public class ArchievementQueryController
return result; 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" ) @RequestMapping( "/query_ranking_list.do" )
@ResponseBody @ResponseBody
public RankingListResponse queryCallerArchievementRankingList( public RankingListResponse queryCallerArchievementRankingList(
@ -94,8 +125,8 @@ public class ArchievementQueryController
boolean success = false; boolean success = false;
String message = ""; String message = "";
Vector<CallerRankingItem> attachingRateRankingList = null; ArrayList<CallerRankingItem> attachingRateRankingList = null;
Vector<CallerRankingItem> renewalRateRankingList = null; ArrayList<CallerRankingItem> renewalRateRankingList = null;
try try
@ -109,19 +140,12 @@ public class ArchievementQueryController
success = true; success = true;
message = "调用成功!"; message = "调用成功!";
} }
catch ( SQLException error ) catch ( IOException error )
{ {
success = false; success = false;
message = "获取排行榜失败,原因:" + error.getMessage(); message = "获取排行榜失败,原因:" + error.getMessage();
error.printStackTrace(); logger.error( message, error );
}
catch ( ClassNotFoundException error )
{
success = false;
message = "获取排行榜失败原因oracle驱动加载失败" + error.getMessage();
error.printStackTrace();
} }
RankingListResponse response = new RankingListResponse( success, message, departmentCode, 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; 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.utils.ranking.CallerRankingItem;
import com.cpic.xim.web.controllers.QueryResult; import com.cpic.xim.web.controllers.QueryResult;
import com.fasterxml.jackson.annotation.JsonProperty; 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, public RankingListResponse( boolean success, String message, String departmentCode, String year,
String month, Vector<CallerRankingItem> attachingRateRankingList, String month, ArrayList<CallerRankingItem> attachingRateRankingList,
Vector<CallerRankingItem> renewalRateRankingList) ArrayList<CallerRankingItem> renewalRateRankingList)
{ {
super( success, message ); super( success, message );
@ -64,22 +64,22 @@ public class RankingListResponse extends QueryResult
this.month = month; this.month = month;
} }
public Vector<CallerRankingItem> getAttachingRateRankingList() public ArrayList<CallerRankingItem> getAttachingRateRankingList()
{ {
return attachingRateRankingList; return attachingRateRankingList;
} }
public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList ) public void setAttachingRateRankingList( ArrayList<CallerRankingItem> attachingRateRankingList )
{ {
this.attachingRateRankingList = attachingRateRankingList; this.attachingRateRankingList = attachingRateRankingList;
} }
public Vector<CallerRankingItem> getRenewalRateRankingList() public ArrayList<CallerRankingItem> getRenewalRateRankingList()
{ {
return renewalRateRankingList; return renewalRateRankingList;
} }
public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList ) public void setRenewalRateRankingList( ArrayList<CallerRankingItem> renewalRateRankingList )
{ {
this.renewalRateRankingList = renewalRateRankingList; this.renewalRateRankingList = renewalRateRankingList;
} }
@ -98,9 +98,9 @@ public class RankingListResponse extends QueryResult
// 车非融合率排行 // 车非融合率排行
@JsonProperty( "attachingRateRankingList" ) @JsonProperty( "attachingRateRankingList" )
private Vector<CallerRankingItem> attachingRateRankingList; private ArrayList<CallerRankingItem> attachingRateRankingList;
// 续保率排行 // 续保率排行
@JsonProperty( "renewalRateRankingList" ) @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. * 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; import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -2,17 +2,20 @@
* @Author: Kane * @Author: Kane
* @Date: 2023-03-16 09:32:53 * @Date: 2023-03-16 09:32:53
* @LastEditors: Kane * @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: * @Description:
* *
* Copyright (c) ${2022} by Kane, All Rights Reserved. * 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 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.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 public class DepartmentArchievementQueryResult extends QueryResult
{ {
DepartmentArchievementQueryResult() public DepartmentArchievementQueryResult()
{ {
mensualArchievementList = new Vector<Long>(); mensualArchievementList = new ArrayList<MensualArchievementItem>();
advanceRewardGainers = new Vector<String>(); advanceRewardGainers = new Vector<String>();
leadingRewardGainers = new Vector<String>(); leadingRewardGainers = new Vector<String>();
backwardList = new Vector<String>(); backwardList = new Vector<String>();
@ -38,12 +41,12 @@ public class DepartmentArchievementQueryResult extends QueryResult
this.totalArchievement = totalArchievement; this.totalArchievement = totalArchievement;
} }
public Vector<Long> getMensualArchievementList() public List<MensualArchievementItem> getMensualArchievementList()
{ {
return mensualArchievementList; return mensualArchievementList;
} }
public void setMensualArchievementList( Vector<Long> mensualArchievementList ) public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
{ {
this.mensualArchievementList = mensualArchievementList; this.mensualArchievementList = mensualArchievementList;
} }
@ -119,7 +122,7 @@ public class DepartmentArchievementQueryResult extends QueryResult
// 每月业绩列表 // 每月业绩列表
// 要保证数据是按照月份排序 // 要保证数据是按照月份排序
@JsonProperty( "mensual_archievement_list" ) @JsonProperty( "mensual_archievement_list" )
private Vector<Long> mensualArchievementList; private ArrayList<MensualArchievementItem> mensualArchievementList;
@JsonProperty( "insurance_renewal_rate" ) @JsonProperty( "insurance_renewal_rate" )
private String insuranceRenewalRate; // 续保率 private String insuranceRenewalRate; // 续保率

View File

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

View File

@ -6,11 +6,20 @@
#{a_department_code, mode=IN, jdbcType=VARCHAR}, #{a_department_code, mode=IN, jdbcType=VARCHAR},
#{a_attaching_rate, mode=OUT, jdbcType=VARCHAR}, #{a_attaching_rate, mode=OUT, jdbcType=VARCHAR},
#{a_renewal_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}) #{a_mensual_cur, mode=OUT, jdbcType=CURSOR, resultMap=MensualArchievementMapper})
</select> </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"> <resultMap id="MensualArchievementMapper" type="MensualArchievementItem">
<id property="month" column="mm" /> <id property="month" column="mm" javaType="INT"/>
<result property="premium" column="bf" /> <result property="premium" column="bf" />
</resultMap> </resultMap>
</mapper> </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> <typeAliases>
<package name="com.cpic.xim.mybatis.pojo" /> <package name="com.cpic.xim.mybatis.pojo" />
<package name="com.cpic.xim.utils.ranking" />
</typeAliases> </typeAliases>
<environments default="development"> <environments default="development">
@ -23,5 +24,6 @@
<mappers> <mappers>
<!-- <mapper resource="mybatis/mapper/StaffMapper.xml" /> --> <!-- <mapper resource="mybatis/mapper/StaffMapper.xml" /> -->
<mapper resource="mybatis/mapper/ArchievementMapper.xml" /> <mapper resource="mybatis/mapper/ArchievementMapper.xml" />
<mapper resource="mybatis/mapper/RankingListMapper.xml" />
</mappers> </mappers>
</configuration> </configuration>

View File

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

Binary file not shown.