사업자별 월별 통계

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 SUM_YM, USER_SEQ
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM FROM
,ewm.USER_SEQ (
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM SELECT
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO SUM_YM,
FROM USER_SEQ,
hubez_common.EZ_WEB_MSG ewm SND_CH_CD,
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
WHERE IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
1 = 1 0 AS FBACK_CNT,
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') 0 AS FBACK_SUCC_CNT
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m') FROM
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ hubez_common.EZ_CUST_MSTAT
UNION ALL WHERE
<!-- 추가분 (끝) --> SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
SELECT GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
SUM_YM UNION ALL
,USER_SEQ SELECT
,CUST_NM SUM_YM,
,BIZRNO USER_SEQ,
FROM hubez_common.EZ_CUST_MSTAT RPLCSND_CH_CD AS SND_CH_CD,
WHERE 1=1 0 AS SND_CNT,
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') 0 AS SUCC_CNT,
GROUP BY SUM_YM, USER_SEQ IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
) A IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
WHERE 1=1 FROM
<include refid="custMstatListCondition"/> 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>
<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 SELECT
, t1.CUST_NM AS custNm DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno,
, t1.BIZRNO AS bizrno (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt,
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt (S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt,
, SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) 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,
, 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 S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS,
, SUM(t2.sndCntS) AS sndCntS S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL,
, SUM(t2.succCntS) AS succCntS S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM,
, IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0) AS succRtS S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR,
, SUM(t2.sndCntL) AS sndCntL S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS,
, SUM(t2.succCntL) AS succCntL S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL,
, IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) AS succRtL S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM
, SUM(t2.sndCntM) AS sndCntM FROM
, SUM(t2.succCntM) AS succCntM (
, IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0) AS succRtM SELECT
, SUM(t2.sndCntR) AS sndCntR SUM_YM, USER_SEQ,
, SUM(t2.succCntR) AS succCntR SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM,
, IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0) AS succRtR SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS,
from ( SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM
<!-- 추가분 (시작) --> FROM
SELECT (
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM SELECT
,ewm.USER_SEQ SUM_YM, USER_SEQ,
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
FROM CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
hubez_common.EZ_WEB_MSG ewm CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
WHERE CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
1 = 1 CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m') CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
UNION ALL 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,
select SUM_YM CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
, USER_SEQ CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
, BIZRNO FROM
, CUST_NM (
from ( SELECT
select ecm.SUM_YM SUM_YM,
, ecm.USER_SEQ USER_SEQ,
, ecm.BIZRNO SND_CH_CD,
, ecm.CUST_NM IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
from hubez_common.EZ_CUST_MSTAT ecm IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
where 1=1 0 AS FBACK_CNT,
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') 0 AS FBACK_SUCC_CNT
<include refid="custMstatListCondition"/> FROM
group by ecm.SUM_YM , ecm.USER_SEQ <!-- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ --> hubez_common.EZ_CUST_MSTAT
) list WHERE
LIMIT #{page}, #{pagePerRows} SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
) t1 inner join ( GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
select SUM_YM UNION ALL
, USER_SEQ SELECT
, sum(smsSndCnt) AS sndCntS SUM_YM,
, sum(smsSuccCnt) AS succCntS USER_SEQ,
, sum(smsSuccRt) AS succRtS RPLCSND_CH_CD AS SND_CH_CD,
, sum(lmsSndCnt) AS sndCntL 0 AS SND_CNT,
, sum(lmsSuccCnt) AS succCntL 0 AS SUCC_CNT,
, sum(lmsSuccRt) AS succRtL IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
, sum(mmsSndCnt) AS sndCntM IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
, sum(mmsSuccCnt) AS succCntM FROM
, sum(mmsSuccRt) AS succRtM hubez_common.EZ_CUST_MSTAT
, sum(alimtSndCnt) AS sndCntR WHERE
, sum(alimtSuccCnt) AS succCntR SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
, sum(alimtSuccRt) AS succRtR AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
from ( GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
select SUM_YM UNION ALL
, USER_SEQ SELECT
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT) DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
else 0 esu.PRNTS_USER_SEQ AS USER_SEQ,
end as smsSndCnt REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
else 0 SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
end as smsSuccCnt 0 AS FBACK_CNT,
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) 0 AS FBACK_SUCC_CNT
else 0 FROM
end as smsSuccRt hubez_common.EZ_WEB_MSG ewm INNER JOIN
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT) hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
else 0 WHERE
end as lmsSndCnt ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
else 0 UNION ALL
end as lmsSuccCnt SELECT
, case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
else 0 esu.PRNTS_USER_SEQ AS USER_SEQ,
end as lmsSuccRt FB_CH_STR AS SND_CH_CD,
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT) 0 AS SND_CNT,
else 0 0 AS SUCC_CNT,
end as mmsSndCnt SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
else 0 FROM
end as mmsSuccCnt hubez_common.EZ_WEB_MSG ewm INNER JOIN
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
else 0 WHERE
end as mmsSuccRt ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT) AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
else 0 GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
end as alimtSndCnt ) T1
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) WHERE
else 0 1 = 1
end as alimtSuccCnt GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
, case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) ) T2
else 0 WHERE
end as alimtSuccRt 1 = 1
from ( GROUP BY SUM_YM, USER_SEQ
<!-- 추가분 (시작) --> ) S1,
SELECT hubez_common.EZ_SUBS_INFO S2,
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM hubez_common.EZ_CUST_INFO S3
,ewm.USER_SEQ WHERE
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd S1.USER_SEQ = S2.USER_SEQ
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT AND S2.CUST_SEQ = S3.CUST_SEQ
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT AND S3.BIZRNO != '1234567890'
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT <include refid="custMstatListCondition"/>
,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT ORDER BY S1.SUM_YM DESC, S3.CUST_NM
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT LIMIT #{page}, #{pagePerRows}
,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> </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
UNION ALL FROM
SELECT (
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM SELECT
,ewm.USER_SEQ SUM_YM, USER_SEQ,
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
FROM CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
hubez_common.EZ_WEB_MSG ewm CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
WHERE CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
1 = 1 CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m') CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ 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,
) t1 inner join ( CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
select SUM_YM CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
, USER_SEQ CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
, sum(smsSndCnt) AS sndCntS FROM
, sum(smsSuccCnt) AS succCntS (
, sum(smsSuccRt) AS succRtS SELECT
, sum(lmsSndCnt) AS sndCntL SUM_YM,
, sum(lmsSuccCnt) AS succCntL USER_SEQ,
, sum(lmsSuccRt) AS succRtL SND_CH_CD,
, sum(mmsSndCnt) AS sndCntM IFNULL(SUM(SND_CNT), 0) AS SND_CNT,
, sum(mmsSuccCnt) AS succCntM IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT,
, sum(mmsSuccRt) AS succRtM 0 AS FBACK_CNT,
, sum(alimtSndCnt) AS sndCntR 0 AS FBACK_SUCC_CNT
, sum(alimtSuccCnt) AS succCntR FROM
, sum(alimtSuccRt) AS succRtR hubez_common.EZ_CUST_MSTAT
from ( WHERE
select SUM_YM SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
, USER_SEQ GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT) UNION ALL
else 0 SELECT
end as smsSndCnt SUM_YM,
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) USER_SEQ,
else 0 RPLCSND_CH_CD AS SND_CH_CD,
end as smsSuccCnt 0 AS SND_CNT,
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) 0 AS SUCC_CNT,
else 0 IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT,
end as smsSuccRt IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT) FROM
else 0 hubez_common.EZ_CUST_MSTAT
end as lmsSndCnt WHERE
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
else 0 AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
end as lmsSuccCnt GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
, case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) UNION ALL
else 0 SELECT
end as lmsSuccRt DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT) esu.PRNTS_USER_SEQ AS USER_SEQ,
else 0 REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
end as mmsSndCnt SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
else 0 0 AS FBACK_CNT,
end as mmsSuccCnt 0 AS FBACK_SUCC_CNT
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) FROM
else 0 hubez_common.EZ_WEB_MSG ewm INNER JOIN
end as mmsSuccRt hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT) WHERE
else 0 ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
end as alimtSndCnt GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) UNION ALL
else 0 SELECT
end as alimtSuccCnt DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
, case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) esu.PRNTS_USER_SEQ AS USER_SEQ,
else 0 FB_CH_STR AS SND_CH_CD,
end as alimtSuccRt 0 AS SND_CNT,
from ( 0 AS SUCC_CNT,
<!-- 추가분 (시작) --> SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
SELECT SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM FROM
,ewm.USER_SEQ hubez_common.EZ_WEB_MSG ewm INNER JOIN
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT WHERE
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT ) T1
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT WHERE
FROM 1 = 1
hubez_common.EZ_WEB_MSG ewm GROUP BY SUM_YM, USER_SEQ, SND_CH_CD
WHERE ) T2
1 = 1 WHERE
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m') 1 = 1
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m') GROUP BY SUM_YM, USER_SEQ
GROUP BY ) S1,
DATE_FORMAT(ewm.REG_DT, '%Y-%m'), ewm.USER_SEQ , ewm.CH_STR hubez_common.EZ_SUBS_INFO S2,
UNION ALL hubez_common.EZ_CUST_INFO S3
<!-- 추가분 (끝) --> WHERE
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd S1.USER_SEQ = S2.USER_SEQ
, ifnull(sum(SND_CNT) , 0) as SND_CNT AND S2.CUST_SEQ = S3.CUST_SEQ
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT AND S3.BIZRNO != '1234567890'
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT <include refid="custMstatListCondition"/>
, 0 as FBACK_CNT ) M
, 0 as FBACK_SUCC_CNT WHERE
, 0 as FBACK_FAIL_CNT 1 = 1
from hubez_common.EZ_CUST_MSTAT ecm ORDER BY M.sumYm DESC, M.custNm
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> </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">