mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 02:32:20 +09:00
사업자별 월별 통계
This commit is contained in:
@@ -546,415 +546,330 @@
|
||||
<select id="selectCustMstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="int">
|
||||
/* stats-mapper.xml(selectCustMstatListTotalCnt) */
|
||||
SELECT
|
||||
COUNT(*) AS TOTALCNT
|
||||
FROM
|
||||
(
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
|
||||
,ewm.USER_SEQ
|
||||
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
|
||||
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
SELECT
|
||||
SUM_YM
|
||||
,USER_SEQ
|
||||
,CUST_NM
|
||||
,BIZRNO
|
||||
FROM hubez_common.EZ_CUST_MSTAT
|
||||
WHERE 1=1
|
||||
AND 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
|
||||
) A
|
||||
WHERE 1=1
|
||||
<include refid="custMstatListCondition"/>
|
||||
COUNT(S1.SUM_YM) AS TOTALCNT
|
||||
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"/>
|
||||
</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(t1.SUM_YM, '%Y-%m') AS sumYm
|
||||
, t1.CUST_NM AS custNm
|
||||
, t1.BIZRNO AS bizrno
|
||||
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt
|
||||
, SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) AS succCnt
|
||||
, IFNULL(TRUNCATE(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) / SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) * 100, 2),0) as succRt
|
||||
, SUM(t2.sndCntS) AS sndCntS
|
||||
, SUM(t2.succCntS) AS succCntS
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0) AS succRtS
|
||||
, SUM(t2.sndCntL) AS sndCntL
|
||||
, SUM(t2.succCntL) AS succCntL
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) AS succRtL
|
||||
, SUM(t2.sndCntM) AS sndCntM
|
||||
, SUM(t2.succCntM) AS succCntM
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0) AS succRtM
|
||||
, SUM(t2.sndCntR) AS sndCntR
|
||||
, SUM(t2.succCntR) AS succCntR
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0) AS succRtR
|
||||
from (
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
|
||||
,ewm.USER_SEQ
|
||||
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
|
||||
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, BIZRNO
|
||||
, CUST_NM
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
, ecm.BIZRNO
|
||||
, ecm.CUST_NM
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ <!-- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ -->
|
||||
) list
|
||||
LIMIT #{page}, #{pagePerRows}
|
||||
) t1 inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, sum(smsSndCnt) AS sndCntS
|
||||
, sum(smsSuccCnt) AS succCntS
|
||||
, sum(smsSuccRt) AS succRtS
|
||||
, sum(lmsSndCnt) AS sndCntL
|
||||
, sum(lmsSuccCnt) AS succCntL
|
||||
, sum(lmsSuccRt) AS succRtL
|
||||
, sum(mmsSndCnt) AS sndCntM
|
||||
, sum(mmsSuccCnt) AS succCntM
|
||||
, sum(mmsSuccRt) AS succRtM
|
||||
, sum(alimtSndCnt) AS sndCntR
|
||||
, sum(alimtSuccCnt) AS succCntR
|
||||
, sum(alimtSuccRt) AS succRtR
|
||||
from (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as smsSndCnt
|
||||
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as smsSuccCnt
|
||||
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as smsSuccRt
|
||||
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as lmsSndCnt
|
||||
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as lmsSuccCnt
|
||||
, case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as lmsSuccRt
|
||||
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as mmsSndCnt
|
||||
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as mmsSuccCnt
|
||||
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as mmsSuccRt
|
||||
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as alimtSndCnt
|
||||
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as alimtSuccCnt
|
||||
, case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as alimtSuccRt
|
||||
from (
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
|
||||
,ewm.USER_SEQ
|
||||
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd
|
||||
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT
|
||||
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT
|
||||
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT
|
||||
,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT
|
||||
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
||||
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm INNER JOIN
|
||||
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
|
||||
GROUP BY
|
||||
DATE_FORMAT(ewm.REG_DT, '%Y-%m'), ewm.USER_SEQ , ewm.CH_STR
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd
|
||||
, ifnull(sum(SND_CNT) , 0) as SND_CNT
|
||||
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT
|
||||
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT
|
||||
, 0 as FBACK_CNT
|
||||
, 0 as FBACK_SUCC_CNT
|
||||
, 0 as FBACK_FAIL_CNT
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ
|
||||
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
|
||||
) list
|
||||
LIMIT #{page}, #{pagePerRows}
|
||||
) list
|
||||
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
|
||||
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
group by ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD -- , RPLCSND_CH_CD
|
||||
union all
|
||||
select ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD as sndChCd
|
||||
, 0 as SND_CNT
|
||||
, 0 as SUCC_CNT
|
||||
, 0 as FAIL_CNT
|
||||
, ifnull(sum(FBACK_CNT) , 0) as FBACK_CNT
|
||||
, ifnull(sum(FBACK_SUCC_CNT) , 0) as FBACK_SUCC_CNT
|
||||
, ifnull(sum(FBACK_FAIL_CNT) , 0) as FBACK_FAIL_CNT
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ
|
||||
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
|
||||
) list
|
||||
LIMIT #{page}, #{pagePerRows}
|
||||
) list
|
||||
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
|
||||
where ecm.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', 'ALIMTALK')
|
||||
group by ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
|
||||
) t1 group by SUM_YM, USER_SEQ, sndChCd order by null
|
||||
) t2 group by SUM_YM, USER_SEQ order by null
|
||||
) t2 on t2.SUM_YM = t1.SUM_YM and t2.USER_SEQ = t1.USER_SEQ
|
||||
WHERE 1=1
|
||||
<include refid="custMstatListCondition"/>
|
||||
GROUP BY t1.BIZRNO, t1.SUM_YM
|
||||
ORDER BY t1.SUM_YM desc, t1.CUST_NM
|
||||
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 DATE_FORMAT(t1.SUM_YM, '%Y-%m') AS sumYm
|
||||
, t1.CUST_NM AS custNm
|
||||
, t1.BIZRNO AS bizrno
|
||||
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt
|
||||
, CONCAT(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR),'(',(TRUNCATE(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) / SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) * 100, 2)),'%)') AS succCnt
|
||||
, SUM(t2.sndCntS)
|
||||
, CONCAT(SUM(t2.succCntS), '(', IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0), '%)') AS succCntS
|
||||
, SUM(t2.sndCntL)
|
||||
, CONCAT(SUM(t2.succCntL), '(', IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) , '%)') AS succCntL
|
||||
, SUM(t2.sndCntM)
|
||||
, CONCAT(SUM(t2.succCntM), '(', IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0), '%)') AS succCntM
|
||||
, SUM(t2.sndCntR)
|
||||
, CONCAT(SUM(t2.succCntR), '(', IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0), '%)') AS succCntR
|
||||
from (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, BIZRNO
|
||||
, CUST_NM
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
, ecm.BIZRNO
|
||||
, ecm.CUST_NM
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ
|
||||
-- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
|
||||
) list
|
||||
<!-- 추가분 (시작) -->
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
|
||||
,ewm.USER_SEQ
|
||||
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
|
||||
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
|
||||
<!-- 추가분 (끝) -->
|
||||
) t1 inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, sum(smsSndCnt) AS sndCntS
|
||||
, sum(smsSuccCnt) AS succCntS
|
||||
, sum(smsSuccRt) AS succRtS
|
||||
, sum(lmsSndCnt) AS sndCntL
|
||||
, sum(lmsSuccCnt) AS succCntL
|
||||
, sum(lmsSuccRt) AS succRtL
|
||||
, sum(mmsSndCnt) AS sndCntM
|
||||
, sum(mmsSuccCnt) AS succCntM
|
||||
, sum(mmsSuccRt) AS succRtM
|
||||
, sum(alimtSndCnt) AS sndCntR
|
||||
, sum(alimtSuccCnt) AS succCntR
|
||||
, sum(alimtSuccRt) AS succRtR
|
||||
from (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as smsSndCnt
|
||||
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as smsSuccCnt
|
||||
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as smsSuccRt
|
||||
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as lmsSndCnt
|
||||
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as lmsSuccCnt
|
||||
, case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as lmsSuccRt
|
||||
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as mmsSndCnt
|
||||
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as mmsSuccCnt
|
||||
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as mmsSuccRt
|
||||
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT)
|
||||
else 0
|
||||
end as alimtSndCnt
|
||||
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
|
||||
else 0
|
||||
end as alimtSuccCnt
|
||||
, case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
|
||||
else 0
|
||||
end as alimtSuccRt
|
||||
from (
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
|
||||
,ewm.USER_SEQ
|
||||
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd
|
||||
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT
|
||||
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT
|
||||
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT
|
||||
,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT
|
||||
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
|
||||
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
WHERE
|
||||
1 = 1
|
||||
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
|
||||
GROUP BY
|
||||
DATE_FORMAT(ewm.REG_DT, '%Y-%m'), ewm.USER_SEQ , ewm.CH_STR
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd
|
||||
, ifnull(sum(SND_CNT) , 0) as SND_CNT
|
||||
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT
|
||||
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT
|
||||
, 0 as FBACK_CNT
|
||||
, 0 as FBACK_SUCC_CNT
|
||||
, 0 as FBACK_FAIL_CNT
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ
|
||||
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
|
||||
) list
|
||||
) list
|
||||
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
|
||||
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
group by ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD -- , RPLCSND_CH_CD
|
||||
union all
|
||||
select ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD as sndChCd
|
||||
, 0 as SND_CNT
|
||||
, 0 as SUCC_CNT
|
||||
, 0 as FAIL_CNT
|
||||
, ifnull(sum(FBACK_CNT) , 0) as FBACK_CNT
|
||||
, ifnull(sum(FBACK_SUCC_CNT) , 0) as FBACK_SUCC_CNT
|
||||
, ifnull(sum(FBACK_FAIL_CNT) , 0) as FBACK_FAIL_CNT
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
inner join (
|
||||
select SUM_YM
|
||||
, USER_SEQ
|
||||
from (
|
||||
select ecm.SUM_YM
|
||||
, ecm.USER_SEQ
|
||||
from hubez_common.EZ_CUST_MSTAT ecm
|
||||
where 1=1
|
||||
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
|
||||
<include refid="custMstatListCondition"/>
|
||||
group by ecm.SUM_YM , ecm.USER_SEQ
|
||||
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
|
||||
) list
|
||||
) list
|
||||
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
|
||||
where ecm.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', 'ALIMTALK')
|
||||
group by ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
|
||||
) t1 group by SUM_YM, USER_SEQ, sndChCd order by null
|
||||
) t2 group by SUM_YM, USER_SEQ order by null
|
||||
) t2 on t2.SUM_YM = t1.SUM_YM and t2.USER_SEQ = t1.USER_SEQ
|
||||
WHERE 1=1
|
||||
<include refid="custMstatListCondition"/>
|
||||
GROUP BY t1.BIZRNO, t1.SUM_YM
|
||||
ORDER BY t1.SUM_YM desc, t1.CUST_NM
|
||||
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,
|
||||
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"/>
|
||||
) M
|
||||
WHERE
|
||||
1 = 1
|
||||
ORDER BY M.sumYm DESC, M.custNm
|
||||
</select>
|
||||
|
||||
<select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int">
|
||||
|
||||
Reference in New Issue
Block a user