mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-06 22:06:05 +09:00
고객별 통계
This commit is contained in:
@@ -551,230 +551,9 @@
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
SUM_YM, USER_SEQ,
|
SUM_YM, USER_SEQ,
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
|
SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
|
SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS,
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
|
SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
|
|
||||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
SUM_YM,
|
|
||||||
USER_SEQ,
|
|
||||||
SND_CH_CD,
|
|
||||||
IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
|
|
||||||
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
|
|
||||||
0 AS FBACK_CNT,
|
|
||||||
0 AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_CUST_MSTAT
|
|
||||||
WHERE
|
|
||||||
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
|
||||||
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
SUM_YM,
|
|
||||||
USER_SEQ,
|
|
||||||
RPLCSND_CH_CD AS SND_CH_CD,
|
|
||||||
0 AS SND_CNT,
|
|
||||||
0 AS SUCC_CNT,
|
|
||||||
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
|
|
||||||
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_CUST_MSTAT
|
|
||||||
WHERE
|
|
||||||
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
|
||||||
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
|
|
||||||
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
|
||||||
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
|
||||||
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
|
|
||||||
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
|
|
||||||
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
|
|
||||||
0 AS FBACK_CNT,
|
|
||||||
0 AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
|
||||||
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
|
||||||
WHERE
|
|
||||||
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
|
||||||
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
|
||||||
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
|
||||||
FB_CH_STR AS SND_CH_CD,
|
|
||||||
0 AS SND_CNT,
|
|
||||||
0 AS SUCC_CNT,
|
|
||||||
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
|
|
||||||
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
|
||||||
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
|
||||||
WHERE
|
|
||||||
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
|
||||||
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
|
|
||||||
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
|
|
||||||
) T1
|
|
||||||
WHERE
|
|
||||||
1 = 1
|
|
||||||
GROUP BY SUM_YM, USER_SEQ
|
|
||||||
) S1,
|
|
||||||
hubez_common.EZ_SUBS_INFO S2,
|
|
||||||
hubez_common.EZ_CUST_INFO S3
|
|
||||||
WHERE
|
|
||||||
S1.USER_SEQ = S2.USER_SEQ
|
|
||||||
AND S2.CUST_SEQ = S3.CUST_SEQ
|
|
||||||
AND S3.BIZRNO != '1234567890'
|
|
||||||
<include refid="custMstatListCondition"/>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectCustMstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
|
|
||||||
/* stats-mapper.xml(selectCustMstatList) */
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
|
|
||||||
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
|
|
||||||
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
|
|
||||||
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt,
|
|
||||||
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
|
|
||||||
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
|
|
||||||
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
|
|
||||||
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
|
|
||||||
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
|
|
||||||
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
|
|
||||||
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
SUM_YM, USER_SEQ,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
|
|
||||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
|
|
||||||
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
SUM_YM,
|
|
||||||
USER_SEQ,
|
|
||||||
SND_CH_CD,
|
|
||||||
IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
|
|
||||||
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
|
|
||||||
0 AS FBACK_CNT,
|
|
||||||
0 AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_CUST_MSTAT
|
|
||||||
WHERE
|
|
||||||
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
|
||||||
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
SUM_YM,
|
|
||||||
USER_SEQ,
|
|
||||||
RPLCSND_CH_CD AS SND_CH_CD,
|
|
||||||
0 AS SND_CNT,
|
|
||||||
0 AS SUCC_CNT,
|
|
||||||
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
|
|
||||||
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_CUST_MSTAT
|
|
||||||
WHERE
|
|
||||||
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
|
||||||
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
|
|
||||||
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
|
||||||
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
|
||||||
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
|
|
||||||
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
|
|
||||||
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
|
|
||||||
0 AS FBACK_CNT,
|
|
||||||
0 AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
|
||||||
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
|
||||||
WHERE
|
|
||||||
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
|
||||||
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
|
||||||
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
|
||||||
FB_CH_STR AS SND_CH_CD,
|
|
||||||
0 AS SND_CNT,
|
|
||||||
0 AS SUCC_CNT,
|
|
||||||
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
|
|
||||||
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
|
||||||
FROM
|
|
||||||
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
|
||||||
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
|
||||||
WHERE
|
|
||||||
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
|
||||||
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
|
|
||||||
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
|
|
||||||
) T1
|
|
||||||
WHERE
|
|
||||||
1 = 1
|
|
||||||
GROUP BY SUM_YM, USER_SEQ
|
|
||||||
) S1,
|
|
||||||
hubez_common.EZ_SUBS_INFO S2,
|
|
||||||
hubez_common.EZ_CUST_INFO S3
|
|
||||||
WHERE
|
|
||||||
S1.USER_SEQ = S2.USER_SEQ
|
|
||||||
AND S2.CUST_SEQ = S3.CUST_SEQ
|
|
||||||
AND S3.BIZRNO != '1234567890'
|
|
||||||
<include refid="custMstatListCondition"/>
|
|
||||||
ORDER BY S1.SUM_YM DESC, S3.CUST_NM
|
|
||||||
LIMIT #{page}, #{pagePerRows}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectCustMstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
|
|
||||||
/* stats-mapper.xml(selectCustMstatExcelList) */
|
|
||||||
SELECT
|
|
||||||
sumYm, custNm, bizrno,
|
|
||||||
sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt,
|
|
||||||
sndCntS, CONCAT(succCntS,'(',succRtS,'%)') AS succCntS,
|
|
||||||
sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL,
|
|
||||||
sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM,
|
|
||||||
sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR,
|
|
||||||
fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS,
|
|
||||||
fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL,
|
|
||||||
fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
|
|
||||||
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
|
|
||||||
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
|
|
||||||
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt,
|
|
||||||
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
|
|
||||||
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
|
|
||||||
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
|
|
||||||
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
|
|
||||||
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
|
|
||||||
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
|
|
||||||
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
|
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@@ -857,6 +636,260 @@
|
|||||||
) T1
|
) T1
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
||||||
|
) T2
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
GROUP BY SUM_YM, USER_SEQ
|
||||||
|
) S1,
|
||||||
|
hubez_common.EZ_SUBS_INFO S2,
|
||||||
|
hubez_common.EZ_CUST_INFO S3
|
||||||
|
WHERE
|
||||||
|
S1.USER_SEQ = S2.USER_SEQ
|
||||||
|
AND S2.CUST_SEQ = S3.CUST_SEQ
|
||||||
|
AND S3.BIZRNO != '1234567890'
|
||||||
|
<include refid="custMstatListCondition"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustMstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
|
||||||
|
/* stats-mapper.xml(selectCustMstatList) */
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
|
||||||
|
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
|
||||||
|
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
|
||||||
|
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt,
|
||||||
|
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
|
||||||
|
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
|
||||||
|
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
|
||||||
|
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
|
||||||
|
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
|
||||||
|
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
|
||||||
|
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM, USER_SEQ,
|
||||||
|
SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
|
||||||
|
SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS,
|
||||||
|
SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM, USER_SEQ,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
|
||||||
|
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM,
|
||||||
|
USER_SEQ,
|
||||||
|
SND_CH_CD,
|
||||||
|
IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
|
||||||
|
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
|
||||||
|
0 AS FBACK_CNT,
|
||||||
|
0 AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_CUST_MSTAT
|
||||||
|
WHERE
|
||||||
|
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
SUM_YM,
|
||||||
|
USER_SEQ,
|
||||||
|
RPLCSND_CH_CD AS SND_CH_CD,
|
||||||
|
0 AS SND_CNT,
|
||||||
|
0 AS SUCC_CNT,
|
||||||
|
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
|
||||||
|
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_CUST_MSTAT
|
||||||
|
WHERE
|
||||||
|
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||||
|
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
||||||
|
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
||||||
|
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
|
||||||
|
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
|
||||||
|
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
|
||||||
|
0 AS FBACK_CNT,
|
||||||
|
0 AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
||||||
|
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||||
|
WHERE
|
||||||
|
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||||
|
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
||||||
|
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
||||||
|
FB_CH_STR AS SND_CH_CD,
|
||||||
|
0 AS SND_CNT,
|
||||||
|
0 AS SUCC_CNT,
|
||||||
|
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
|
||||||
|
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
||||||
|
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||||
|
WHERE
|
||||||
|
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||||
|
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
|
||||||
|
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
|
||||||
|
) T1
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
||||||
|
) T2
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
GROUP BY SUM_YM, USER_SEQ
|
||||||
|
) S1,
|
||||||
|
hubez_common.EZ_SUBS_INFO S2,
|
||||||
|
hubez_common.EZ_CUST_INFO S3
|
||||||
|
WHERE
|
||||||
|
S1.USER_SEQ = S2.USER_SEQ
|
||||||
|
AND S2.CUST_SEQ = S3.CUST_SEQ
|
||||||
|
AND S3.BIZRNO != '1234567890'
|
||||||
|
<include refid="custMstatListCondition"/>
|
||||||
|
ORDER BY S1.SUM_YM DESC, S3.CUST_NM
|
||||||
|
LIMIT #{page}, #{pagePerRows}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustMstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
|
||||||
|
/* stats-mapper.xml(selectCustMstatExcelList) */
|
||||||
|
SELECT
|
||||||
|
sumYm, custNm, bizrno,
|
||||||
|
sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt,
|
||||||
|
sndCntS, CONCAT(succCntS,'(',succRtS,'%)') AS succCntS,
|
||||||
|
sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL,
|
||||||
|
sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM,
|
||||||
|
sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR,
|
||||||
|
fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS,
|
||||||
|
fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL,
|
||||||
|
fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
|
||||||
|
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
|
||||||
|
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
|
||||||
|
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt,
|
||||||
|
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
|
||||||
|
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
|
||||||
|
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
|
||||||
|
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
|
||||||
|
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
|
||||||
|
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
|
||||||
|
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM, USER_SEQ,
|
||||||
|
SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
|
||||||
|
SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS,
|
||||||
|
SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM, USER_SEQ,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
|
||||||
|
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
|
||||||
|
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM_YM,
|
||||||
|
USER_SEQ,
|
||||||
|
SND_CH_CD,
|
||||||
|
IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
|
||||||
|
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
|
||||||
|
0 AS FBACK_CNT,
|
||||||
|
0 AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_CUST_MSTAT
|
||||||
|
WHERE
|
||||||
|
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
SUM_YM,
|
||||||
|
USER_SEQ,
|
||||||
|
RPLCSND_CH_CD AS SND_CH_CD,
|
||||||
|
0 AS SND_CNT,
|
||||||
|
0 AS SUCC_CNT,
|
||||||
|
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
|
||||||
|
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_CUST_MSTAT
|
||||||
|
WHERE
|
||||||
|
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||||
|
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
||||||
|
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
||||||
|
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
|
||||||
|
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
|
||||||
|
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
|
||||||
|
0 AS FBACK_CNT,
|
||||||
|
0 AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
||||||
|
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||||
|
WHERE
|
||||||
|
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||||
|
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
|
||||||
|
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
||||||
|
FB_CH_STR AS SND_CH_CD,
|
||||||
|
0 AS SND_CNT,
|
||||||
|
0 AS SUCC_CNT,
|
||||||
|
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
|
||||||
|
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
||||||
|
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||||
|
WHERE
|
||||||
|
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||||
|
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
|
||||||
|
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
|
||||||
|
) T1
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
|
||||||
|
) T2
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
GROUP BY SUM_YM, USER_SEQ
|
GROUP BY SUM_YM, USER_SEQ
|
||||||
) S1,
|
) S1,
|
||||||
hubez_common.EZ_SUBS_INFO S2,
|
hubez_common.EZ_SUBS_INFO S2,
|
||||||
|
|||||||
Reference in New Issue
Block a user