사업자별 월별 통계

This commit is contained in:
kubo8
2022-12-20 18:00:52 +09:00
parent 330553b25e
commit 0608f69115
2 changed files with 421 additions and 419 deletions

View File

@@ -155,21 +155,19 @@ export default {
{ header: 'LMS', childNames: ['sndCntL', 'succCntRtL'] }, { header: 'LMS', childNames: ['sndCntL', 'succCntRtL'] },
{ header: 'MMS', childNames: ['sndCntM', 'succCntRtM'] }, { header: 'MMS', childNames: ['sndCntM', 'succCntRtM'] },
{ header: '알림톡', childNames: ['sndCntR', 'succCntRtR'] }, { header: '알림톡', childNames: ['sndCntR', 'succCntRtR'] },
{ header: '대체발송SMS', childNames: ['fbSndCntS', 'fbSuccCntRtS'] },
{ header: '대체발송LMS', childNames: ['fbSndCntL', 'fbSuccCntRtL'] },
{ header: '대체발송MMS', childNames: ['fbSndCntM', 'fbSuccCntRtM'] },
], ],
], ],
columns: [ columns: [
{ name: 'sumYm', header: '날짜', align: 'center', width: '8%' }, { name: 'sumYm', header: '날짜', align: 'center', width: '5%' },
{ name: 'custNm', header: '고객사명', align: 'center', width: '12%' }, { name: 'custNm', header: '고객사명', align: 'center', width: '9%' },
{ {
name: 'bizrno', name: 'bizrno',
header: '사업자번호', header: '사업자번호',
align: 'center', align: 'center',
width: '8%', width: '6%',
// , formatter: props => {
// let result = props.bizrno.substring(0, 3) + '-' + props.bizrno.substring(3, 5) + '-' + props.bizrno.substring(5, 10)
// return result;
// }
}, },
{ {
name: 'sndCnt', name: 'sndCnt',
@@ -180,7 +178,7 @@ export default {
let result = props.sndCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); let result = props.sndCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result; return result;
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'succCntRt', name: 'succCntRt',
@@ -196,7 +194,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntS', name: 'sndCntS',
@@ -207,7 +205,7 @@ export default {
let result = props.sndCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); let result = props.sndCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result; return result;
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'succCntRtS', name: 'succCntRtS',
@@ -223,7 +221,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntL', name: 'sndCntL',
@@ -234,7 +232,7 @@ export default {
let result = props.sndCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); let result = props.sndCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result; return result;
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'succCntRtL', name: 'succCntRtL',
@@ -250,7 +248,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntM', name: 'sndCntM',
@@ -261,7 +259,7 @@ export default {
let result = props.sndCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); let result = props.sndCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result; return result;
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'succCntRtM', name: 'succCntRtM',
@@ -277,7 +275,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntR', name: 'sndCntR',
@@ -288,7 +286,7 @@ export default {
let result = props.sndCntR.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); let result = props.sndCntR.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result; return result;
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'succCntRtR', name: 'succCntRtR',
@@ -304,7 +302,88 @@ export default {
')</p>' ')</p>'
); );
}, },
width: '7%', width: '5%',
},
{
name: 'fbSndCntS',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.fbSndCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
},
width: '5%',
},
{
name: 'fbSuccCntRtS',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: (props) => {
return (
'<p>' +
props.fbSuccCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succFbRtS +
')</p>'
);
},
width: '5%',
},
{
name: 'fbSndCntL',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.fbSndCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
},
width: '5%',
},
{
name: 'fbSuccCntRtL',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: (props) => {
return (
'<p>' +
props.fbSuccCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succFbRtL +
')</p>'
);
},
width: '5%',
},
{
name: 'fbSndCntM',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.fbSndCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
},
width: '5%',
},
{
name: 'fbSuccCntRtL',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: (props) => {
return (
'<p>' +
props.fbSuccCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succFbRtM +
')</p>'
);
},
width: '5%',
}, },
], ],
noDataStr: '검색 결과가 없습니다.', noDataStr: '검색 결과가 없습니다.',

View File

@@ -546,415 +546,338 @@
<select id="selectCustMstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="int"> <select id="selectCustMstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="int">
/* stats-mapper.xml(selectCustMstatListTotalCnt) */ /* stats-mapper.xml(selectCustMstatListTotalCnt) */
SELECT SELECT
COUNT(*) AS TOTALCNT COUNT(S1.SUM_YM) AS TOTALCNT
FROM FROM
( (
<!-- 추가분 (시작) -->
SELECT SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM SUM_YM, USER_SEQ
,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 FROM
hubez_common.EZ_WEB_MSG ewm (
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ 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 WHERE
1 = 1 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 GROUP BY SUM_YM, USER_SEQ
) A ) S1,
WHERE 1=1 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"/> <include refid="custMstatListCondition"/>
</select> </select>
<select id="selectCustMstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList"> <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) */ /* 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 SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
,ewm.USER_SEQ (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO (S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM 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
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 SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM SUM_YM, USER_SEQ,
,ewm.USER_SEQ SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS,
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT FROM
,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 SELECT
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT SUM_YM, USER_SEQ,
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT 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 FROM
hubez_common.EZ_WEB_MSG ewm INNER JOIN hubez_common.EZ_WEB_MSG ewm INNER JOIN
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
WHERE WHERE
1 = 1 ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
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 UNION ALL
<!-- 추가분 (끝) --> SELECT
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
, ifnull(sum(SND_CNT) , 0) as SND_CNT esu.PRNTS_USER_SEQ AS USER_SEQ,
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT FB_CH_STR AS SND_CH_CD,
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT 0 AS SND_CNT,
, 0 as FBACK_CNT 0 AS SUCC_CNT,
, 0 as FBACK_SUCC_CNT SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
, 0 as FBACK_FAIL_CNT SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
from hubez_common.EZ_CUST_MSTAT ecm FROM
inner join ( hubez_common.EZ_WEB_MSG ewm INNER JOIN
select SUM_YM hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
, USER_SEQ WHERE
from ( ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
select ecm.SUM_YM AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
, ecm.USER_SEQ GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
from hubez_common.EZ_CUST_MSTAT ecm ) T1
where 1=1 WHERE
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') 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"/> <include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ ORDER BY S1.SUM_YM DESC, S3.CUST_NM
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
) list
LIMIT #{page}, #{pagePerRows} 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> </select>
<select id="selectCustMstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList"> <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) */ /* stats-mapper.xml(selectCustMstatExcelList) */
select DATE_FORMAT(t1.SUM_YM, '%Y-%m') AS sumYm SELECT
, t1.CUST_NM AS custNm sumYm, custNm, bizrno,
, t1.BIZRNO AS bizrno sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt,
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt sndCntS, CONCAT(succCntS,'(',succRtS,'%)') AS succCntS,
, 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 sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL,
, SUM(t2.sndCntS) sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM,
, CONCAT(SUM(t2.succCntS), '(', IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0), '%)') AS succCntS sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR,
, SUM(t2.sndCntL) fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS,
, CONCAT(SUM(t2.succCntL), '(', IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) , '%)') AS succCntL fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL,
, SUM(t2.sndCntM) fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM
, CONCAT(SUM(t2.succCntM), '(', IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0), '%)') AS succCntM FROM
, SUM(t2.sndCntR) (
, CONCAT(SUM(t2.succCntR), '(', IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0), '%)') AS succCntR SELECT
from ( DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
select SUM_YM (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
, USER_SEQ (S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
, BIZRNO 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,
, CUST_NM S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
from ( S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
select ecm.SUM_YM S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
, ecm.USER_SEQ S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
, ecm.BIZRNO S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
, ecm.CUST_NM S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
from hubez_common.EZ_CUST_MSTAT ecm S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
where 1=1 FROM
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"/> SELECT
group by ecm.SUM_YM , ecm.USER_SEQ SUM_YM, USER_SEQ,
-- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
) list 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 UNION ALL
SELECT SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM SUM_YM,
,ewm.USER_SEQ USER_SEQ,
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO RPLCSND_CH_CD AS SND_CH_CD,
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM 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 FROM
hubez_common.EZ_WEB_MSG ewm hubez_common.EZ_CUST_MSTAT
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
WHERE WHERE
1 = 1 SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m') GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
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 UNION ALL
<!-- 추가분 (끝) --> SELECT
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
, ifnull(sum(SND_CNT) , 0) as SND_CNT esu.PRNTS_USER_SEQ AS USER_SEQ,
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
, 0 as FBACK_CNT SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
, 0 as FBACK_SUCC_CNT 0 AS FBACK_CNT,
, 0 as FBACK_FAIL_CNT 0 AS FBACK_SUCC_CNT
from hubez_common.EZ_CUST_MSTAT ecm FROM
inner join ( hubez_common.EZ_WEB_MSG ewm INNER JOIN
select SUM_YM hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
, USER_SEQ WHERE
from ( ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
select ecm.SUM_YM GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
, ecm.USER_SEQ UNION ALL
from hubez_common.EZ_CUST_MSTAT ecm SELECT
where 1=1 DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') 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"/> <include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ ) M
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ WHERE
) list 1 = 1
) list ORDER BY M.sumYm DESC, M.custNm
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> </select>
<select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int"> <select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int">