고객 일별 통계

This commit is contained in:
kubo8
2022-12-22 14:03:20 +09:00
parent b20ca86875
commit 68b3b540ee
8 changed files with 504 additions and 420 deletions

View File

@@ -36,6 +36,18 @@
{ {
"name": "알림톡", "name": "알림톡",
"colspan": 2 "colspan": 2
},
{
"name": "대체발송SMS",
"colspan": 2
},
{
"name": "대체발송LMS",
"colspan": 2
},
{
"name": "대체발송MMS",
"colspan": 2
} }
], ],
[ [
@@ -83,6 +95,33 @@
{ {
"key": "succCntR", "key": "succCntR",
"name": "성공건수" "name": "성공건수"
},
{
"key": "fbSndCntS",
"name": "발송건수",
"format": "Format_00"
},
{
"key": "fbSuccCntS",
"name": "성공건수"
},
{
"key": "fbSndCntL",
"name": "발송건수",
"format": "Format_00"
},
{
"key": "fbSuccCntL",
"name": "성공건수"
},
{
"key": "fbSndCntM",
"name": "발송건수",
"format": "Format_00"
},
{
"key": "fbSuccCntM",
"name": "성공건수"
} }
] ]
] ]

View File

@@ -155,13 +155,16 @@ 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: 'sumYmd', header: '날짜', align: 'center', width: '8%' }, { name: 'sumYmd', header: '날짜', align: 'center', width: '5%' },
{ name: 'custNm', header: '고객사명', align: 'center', width: '12%' }, { name: 'custNm', header: '고객사명', align: 'center', width: '9%' },
{ name: 'bizrno', header: '사업자번호', align: 'center', width: '8%' }, { name: 'bizrno', header: '사업자번호', align: 'center', width: '6%' },
{ {
name: 'sndCnt', name: 'sndCnt',
header: '발송건수', header: '발송건수',
@@ -171,7 +174,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',
@@ -187,7 +190,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntS', name: 'sndCntS',
@@ -198,7 +201,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',
@@ -214,7 +217,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntL', name: 'sndCntL',
@@ -225,7 +228,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',
@@ -241,7 +244,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntM', name: 'sndCntM',
@@ -252,7 +255,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',
@@ -268,7 +271,7 @@ export default {
'%)</p>' '%)</p>'
); );
}, },
width: '7%', width: '5%',
}, },
{ {
name: 'sndCntR', name: 'sndCntR',
@@ -279,7 +282,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',
@@ -295,7 +298,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

@@ -217,6 +217,12 @@ public class StatsService {
StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class); StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class);
String nowPage = String.valueOf(bsnmDayListReqDto.getPage()); String nowPage = String.valueOf(bsnmDayListReqDto.getPage());
//오늘 날짜 조회인지 확인
if(DateUtils.date2strYMD().equals(bsnmDayListReqDto.getEndDay())) {
bsnmDayListReqDto.setNowDiv("Y");
}
int totalCnt = statsMapper.selectCustDstatListTotalCnt(bsnmDayListReqDto); int totalCnt = statsMapper.selectCustDstatListTotalCnt(bsnmDayListReqDto);
if (totalCnt == 0) { if (totalCnt == 0) {
@@ -261,6 +267,11 @@ public class StatsService {
StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class); StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class);
//오늘 날짜 조회인지 확인
if(DateUtils.date2strYMD().equals(bsnmDayListExcelReqDto.getEndDay())) {
bsnmDayListExcelReqDto.setNowDiv("Y");
}
List<BsnmDayList> bsnmDayLists = statsMapper.selectCustDstatExcelList(bsnmDayListExcelReqDto); List<BsnmDayList> bsnmDayLists = statsMapper.selectCustDstatExcelList(bsnmDayListExcelReqDto);
BsnmDayListExcelRes bsnmDayListExcelRes = new BsnmDayListExcelRes(); BsnmDayListExcelRes bsnmDayListExcelRes = new BsnmDayListExcelRes();

View File

@@ -45,4 +45,23 @@ public class BsnmDayList implements Serializable {
private String succCntR; private String succCntR;
@ApiModelProperty(example = "알림톡 성공율", name = "알림톡 성공율", dataType = "String") @ApiModelProperty(example = "알림톡 성공율", name = "알림톡 성공율", dataType = "String")
private String succRtR; private String succRtR;
@ApiModelProperty(example = "대체발송SMS 발송건수", name = "대체발송SMS 발송건수", dataType = "String")
private String fbSndCntS;
@ApiModelProperty(example = "대체발송SMS 성공건수", name = "대체발송SMS 성공건수", dataType = "String")
private String fbSuccCntS;
@ApiModelProperty(example = "대체발송SMS 성공율", name = "대체발송SMS 성공율", dataType = "String")
private String succFbRtS;
@ApiModelProperty(example = "대체발송LMS 발송건수", name = "대체발송LMS 발송건수", dataType = "String")
private String fbSndCntL;
@ApiModelProperty(example = "대체발송LMS 성공건수", name = "대체발송LMS 성공건수", dataType = "String")
private String fbSuccCntL;
@ApiModelProperty(example = "대체발송LMS 성공율", name = "대체발송LMS 성공율", dataType = "String")
private String succFbRtL;
@ApiModelProperty(example = "대체발송MMS 발송건수", name = "대체발송MMS 발송건수", dataType = "String")
private String fbSndCntM;
@ApiModelProperty(example = "대체발송MMS 성공건수", name = "대체발송MMS 성공건수", dataType = "String")
private String fbSuccCntM;
@ApiModelProperty(example = "대체발송MMS 성공율", name = "대체발송MMS 성공율", dataType = "String")
private String succFbRtM;
} }

View File

@@ -24,4 +24,8 @@ public class BsnmDayListExcelReqDto implements Serializable {
@ApiModelProperty(example = "사업자등록번호", name = "사업자등록번호", dataType = "String") @ApiModelProperty(example = "사업자등록번호", name = "사업자등록번호", dataType = "String")
private String bizrno; private String bizrno;
@NotNull
@ApiModelProperty(example = "당일 조회 여부", name = "당일 조회 여부", dataType = "String")
private String nowDiv = "N";
} }

View File

@@ -32,4 +32,8 @@ public class BsnmDayListReqDto implements Serializable {
@ApiModelProperty(example = "현재 페이지", name = "현재 페이지", dataType = "int") @ApiModelProperty(example = "현재 페이지", name = "현재 페이지", dataType = "int")
private int page; private int page;
@NotNull
@ApiModelProperty(example = "당일 조회 여부", name = "당일 조회 여부", dataType = "String")
private String nowDiv = "N";
} }

View File

@@ -8,9 +8,9 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 5000 connection-timeout: 1800000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 2000 validation-timeout: 600000
idle-timeout: 600000 idle-timeout: 600000
max-lifetime: 1800000 max-lifetime: 1800000
datasource-db2: datasource-db2:
@@ -22,9 +22,9 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 5000 connection-timeout: 1800000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 2000 validation-timeout: 600000
idle-timeout: 600000 idle-timeout: 600000
max-lifetime: 1800000 max-lifetime: 1800000

View File

@@ -934,421 +934,344 @@
<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">
/* stats-mapper.xml(selectCustDstatListTotalCnt) */ /* stats-mapper.xml(selectCustDstatListTotalCnt) */
SELECT SELECT
COUNT(*) AS TOTALCNT COUNT(SUM_YMD) AS TOTALCNT
FROM FROM
( (
<!-- 추가분 시작 -->
SELECT SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD S1.SUM_YMD, S1.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_YMD, USER_SEQ
FROM
hubez_common.EZ_CUST_DSTAT
WHERE
SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
AND BIZRNO != '1234567890'
) S1
WHERE WHERE
1 = 1 1 = 1
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') GROUP BY S1.SUM_YMD, S1.USER_SEQ
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') <if test='nowDiv == "Y"'>
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ
UNION ALL UNION ALL
<!-- 추가분 끝 -->
SELECT SELECT
SUM_YMD S2.SUM_YMD, S2.USER_SEQ
,USER_SEQ FROM
,CUST_NM (
,BIZRNO SELECT
FROM SUM_YMD, USER_SEQ
hubez_common.EZ_CUST_DSTAT FROM
WHERE 1=1 (
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d') SELECT
GROUP BY SUM_YMD, USER_SEQ DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
) A esu.PRNTS_USER_SEQ AS USER_SEQ,
WHERE 1=1 REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD
<if test="custNm != null and custNm != ''"> FROM
AND CUST_NM LIKE CONCAT('%',#{custNm},'%') hubez_common.EZ_WEB_MSG ewm INNER JOIN
</if> hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
<if test="bizrno != null and bizrno != ''"> WHERE
AND BIZRNO LIKE CONCAT('%',#{bizrno},'%') ewm.YMD = DATE_FORMAT( NOW(), '%Y-%m-%d')
</if> GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
UNION ALL
SELECT
DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
esu.PRNTS_USER_SEQ AS USER_SEQ,
FB_CH_STR AS SND_CH_CD
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 = 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_YMD, USER_SEQ, SND_CH_CD
) S2
WHERE
1 = 1
GROUP BY S2.SUM_YMD, S2.USER_SEQ
</if>
) A,
hubez_common.EZ_SUBS_INFO B,
hubez_common.EZ_CUST_INFO C
WHERE
A.USER_SEQ = B.USER_SEQ
AND B.CUST_SEQ = C.CUST_SEQ
AND C.BIZRNO != '1234567890'
<include refid="custMstatListCondition"/>
</select> </select>
<select id="selectCustDstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmDayList"> <select id="selectCustDstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmDayList">
/* stats-mapper.xml(selectCustDstatList) */ /* stats-mapper.xml(selectCustDstatList) */
select DATE_FORMAT(t1.SUM_YMD, '%Y-%m-%d') AS SUM_YMD SELECT
, t1.CUST_NM AS CUST_NM DATE_FORMAT(A.SUM_YMD, '%Y-%m-%d') AS sumYmd, C.CUST_NM AS custNm, C.BIZRNO AS bizrno,
, t1.BIZRNO AS BIZRNO A.sndCnt, A.succCnt, IFNULL(ROUND((A.succCnt/A.sndCnt)*100,2),0) AS succRt,
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS SND_CNT A.sndCntS, A.succCntS, IFNULL(ROUND((A.succCntS/A.sndCntS)*100,2),0) AS succRtS,
, SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) AS SUCC_CNT A.sndCntL, A.succCntL, IFNULL(ROUND((A.succCntL/A.sndCntL)*100,2),0) AS succRtL,
, IFNULL(TRUNCATE(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) / SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) * 100, 2),0) as SUCC_RT A.sndCntM, A.succCntM, IFNULL(ROUND((A.succCntM/A.sndCntM)*100,2),0) AS succRtM,
, SUM(t2.sndCntS) as SND_CNT_S A.sndCntR, A.succCntR, IFNULL(ROUND((A.succCntR/A.sndCntR)*100,2),0) AS succRtR,
, SUM(t2.succCntS) as SUCC_CNT_S A.fbSndCntS, A.fbSuccCntS, IFNULL(ROUND((A.fbSuccCntS/A.fbSndCntS)*100,2),0) AS succFbRtS,
, IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0) as SUCC_RT_S A.fbSndCntL, A.fbSuccCntL, IFNULL(ROUND((A.fbSuccCntL/A.fbSndCntL)*100,2),0) AS succFbRtL,
, SUM(t2.sndCntL) as SND_CNT_L A.fbSndCntM, A.fbSuccCntM, IFNULL(ROUND((A.fbSuccCntM/A.fbSndCntM)*100,2),0) AS succFbRtM
, SUM(t2.succCntL) as SUCC_CNT_L FROM
, IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) as SUCC_RT_L (
, SUM(t2.sndCntM) as SND_CNT_M SELECT
, SUM(t2.succCntM) as SUCC_CNT_M S1.SUM_YMD, S1.USER_SEQ,
, IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0) as SUCC_RT_M (SUM(S1.sndCntS) + SUM(S1.sndCntL) + SUM(S1.sndCntM) + SUM(S1.sndCntR)) AS sndCnt,
, SUM(t2.sndCntR) as SND_CNT_R (SUM(S1.succCntS) + SUM(S1.succCntL) +SUM(S1.succCntM) +SUM(S1.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
, SUM(t2.succCntR) as SUCC_CNT_R SUM(S1.sndCntS) AS sndCntS, SUM(S1.succCntS) AS succCntS, SUM(S1.sndCntL) AS sndCntL, SUM(S1.succCntL) AS succCntL, SUM(S1.sndCntM) AS sndCntM,
, IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0) as SUCC_RT_R SUM(S1.succCntM) AS succCntM, SUM(S1.sndCntR) AS sndCntR, SUM(S1.succCntR) AS succCntR, SUM(S1.fbSndCntS) AS fbSndCntS, SUM(S1.fbSuccCntS) AS fbSuccCntS,
from ( SUM(S1.fbSndCntL) AS fbSndCntL, SUM(S1.fbSuccCntL) AS fbSuccCntL, SUM(S1.fbSndCntM) AS fbSndCntM, SUM(S1.fbSuccCntM) AS fbSuccCntM
<!-- 추가분 (시작) --> FROM
SELECT (
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD SELECT
,ewm.USER_SEQ SUM_YMD, 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 IFNULL(SND_CNT, 0) 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 IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntS,
FROM CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntL,
hubez_common.EZ_WEB_MSG ewm CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SUCC_CNT, 0) 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 IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntM,
WHERE CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntM,
1 = 1 CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntR,
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntR,
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntS,
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntS,
UNION ALL CASE WHEN RPLCSND_CH_CD = 'LMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntL,
<!-- 추가분 (끝) --> CASE WHEN RPLCSND_CH_CD = 'LMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntL,
select SUM_YMD CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntM,
, USER_SEQ CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntM
, BIZRNO FROM
, CUST_NM hubez_common.EZ_CUST_DSTAT
from ( WHERE
select ecm.SUM_YMD SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
, ecm.USER_SEQ AND BIZRNO != '1234567890'
, ecm.BIZRNO ) S1
, ecm.CUST_NM WHERE
from hubez_common.EZ_CUST_DSTAT ecm 1 = 1
where 1=1 GROUP BY S1.SUM_YMD, S1.USER_SEQ
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d') <if test='nowDiv == "Y"'>
<include refid="custDstatListCondition"/> UNION ALL
group by ecm.SUM_YMD, ecm.USER_SEQ SELECT
ORDER BY ecm.SUM_YMD DESC, ecm.USER_SEQ S2.SUM_YMD, S2.USER_SEQ,
) list (SUM(S2.sndCntS) + SUM(S2.sndCntL) + SUM(S2.sndCntM) + SUM(S2.sndCntR)) AS sndCnt,
LIMIT #{page}, #{pagePerRows} (SUM(S2.succCntS) + SUM(S2.succCntL) +SUM(S2.succCntM) +SUM(S2.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
) t1 inner join ( SUM(S2.sndCntS) AS sndCntS, SUM(S2.succCntS) AS succCntS, SUM(S2.sndCntL) AS sndCntL, SUM(S2.succCntL) AS succCntL, SUM(S2.sndCntM) AS sndCntM,
select SUM_YMD SUM(S2.succCntM) AS succCntM, SUM(S2.sndCntR) AS sndCntR, SUM(S2.succCntR) AS succCntR, SUM(S2.fbSndCntS) AS fbSndCntS, SUM(S2.fbSuccCntS) AS fbSuccCntS,
, USER_SEQ SUM(S2.fbSndCntL) AS fbSndCntL, SUM(S2.fbSuccCntL) AS fbSuccCntL, SUM(S2.fbSndCntM) AS fbSndCntM, SUM(S2.fbSuccCntM) AS fbSuccCntM
, sum(smsSndCnt) AS sndCntS FROM
, sum(smsSuccCnt) AS succCntS (
, sum(smsSuccRt) AS succRtS SELECT
, sum(lmsSndCnt) AS sndCntL SUM_YMD, USER_SEQ,
, sum(lmsSuccCnt) AS succCntL CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
, sum(lmsSuccRt) AS succRtL CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
, sum(mmsSndCnt) AS sndCntM CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
, sum(mmsSuccCnt) AS succCntM CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
, sum(mmsSuccRt) AS succRtM CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
, sum(alimtSndCnt) AS sndCntR CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
, sum(alimtSuccCnt) AS succCntR CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
, sum(alimtSuccRt) AS succRtR CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
from ( CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
select SUM_YMD CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
, USER_SEQ CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT) CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
else 0 CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
end as smsSndCnt CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) FROM
else 0 (
end as smsSuccCnt SELECT
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
else 0 esu.PRNTS_USER_SEQ AS USER_SEQ,
end as smsSuccRt REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT) SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
else 0 SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
end as lmsSndCnt 0 AS FBACK_CNT,
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) 0 AS FBACK_SUCC_CNT
else 0 FROM
end as lmsSuccCnt hubez_common.EZ_WEB_MSG ewm INNER JOIN
, case when sndChCd = 'LMS' 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 lmsSuccRt ewm.YMD = DATE_FORMAT( NOW(), '%Y-%m-%d')
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT) GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
else 0 UNION ALL
end as mmsSndCnt SELECT
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
else 0 esu.PRNTS_USER_SEQ AS USER_SEQ,
end as mmsSuccCnt FB_CH_STR AS SND_CH_CD,
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) 0 AS SND_CNT,
else 0 0 AS SUCC_CNT,
end as mmsSuccRt SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT) SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
else 0 FROM
end as alimtSndCnt hubez_common.EZ_WEB_MSG ewm INNER JOIN
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
else 0 WHERE
end as alimtSuccCnt ewm.YMD = DATE_FORMAT( NOW(), '%Y-%m-%d')
, case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) 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 alimtSuccRt ) T1
from ( WHERE
<!-- 추가분 (시작) --> 1 = 1
SELECT GROUP BY SUM_YMD, USER_SEQ, SND_CH_CD
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD ) S2
,ewm.USER_SEQ WHERE
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd 1 = 1
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT GROUP BY S2.SUM_YMD, S2.USER_SEQ
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT </if>
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT ) A,
,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT hubez_common.EZ_SUBS_INFO B,
,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT hubez_common.EZ_CUST_INFO C
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT WHERE
FROM A.USER_SEQ = B.USER_SEQ
hubez_common.EZ_WEB_MSG ewm AND B.CUST_SEQ = C.CUST_SEQ
WHERE AND C.BIZRNO != '1234567890'
1 = 1 <include refid="custMstatListCondition"/>
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') ORDER BY A.SUM_YMD DESC, C.CUST_NM
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') LIMIT #{page}, #{pagePerRows}
GROUP BY
DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d'), ewm.USER_SEQ , ewm.CH_STR
UNION ALL
<!-- 추가분 (끝) -->
select ecm.SUM_YMD, 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_DSTAT ecm
inner join (
select SUM_YMD
, USER_SEQ
from (
select ecm.SUM_YMD
, ecm.USER_SEQ
from hubez_common.EZ_CUST_DSTAT ecm
where 1=1
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
<include refid="custDstatListCondition"/>
group by ecm.SUM_YMD , ecm.USER_SEQ
ORDER BY ecm.SUM_YMD DESC , ecm.USER_SEQ
) list
LIMIT #{page}, #{pagePerRows}
) list
on list.SUM_YMD = ecm.SUM_YMD and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
group by ecm.SUM_YMD , ecm.USER_SEQ, SND_CH_CD
union all
select ecm.SUM_YMD, 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_DSTAT ecm
inner join (
select SUM_YMD
, USER_SEQ
from (
select ecm.SUM_YMD
, ecm.USER_SEQ
from hubez_common.EZ_CUST_DSTAT ecm
where 1=1
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
<include refid="custDstatListCondition"/>
group by ecm.SUM_YMD , ecm.USER_SEQ
ORDER BY ecm.SUM_YMD DESC, ecm.USER_SEQ
) list
LIMIT #{page}, #{pagePerRows}
) list
on list.SUM_YMD = ecm.SUM_YMD and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
and RPLCSND_CH_CD in ('SMS', 'LMS', 'MMS', 'ALIMTALK')
group by ecm.SUM_YMD, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
) t1 group by SUM_YMD, USER_SEQ, sndChCd order by null
) t2 group by SUM_YMD, USER_SEQ order by null
) t2 on t2.SUM_YMD = t1.SUM_YMD and t2.USER_SEQ = t1.USER_SEQ
WHERE 1=1
<include refid="custMstatListCondition"/>
GROUP BY t1.BIZRNO, t1.SUM_YMD
order by SUM_YMD DESC, t1.USER_SEQ
</select> </select>
<select id="selectCustDstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmDayList"> <select id="selectCustDstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmDayList">
/* stats-mapper.xml(selectCustDstatExcelList) */ /* stats-mapper.xml(selectCustDstatExcelList) */
select DATE_FORMAT(t1.SUM_YMD, '%Y-%m-%d') AS SUM_YMD SELECT
, t1.CUST_NM AS CUST_NM sumYmd, custNm, bizrno,
, t1.BIZRNO AS BIZRNO sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt,
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS SND_CNT 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 SUCC_CNT sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL,
, SUM(t2.sndCntS) as SND_CNT_S sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM,
, CONCAT(SUM(t2.succCntS), '(', IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0), '%)') as SUCC_CNT_S sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR,
, SUM(t2.sndCntL) as SND_CNT_L fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS,
, CONCAT(SUM(t2.succCntL), '(', IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) , '%)') as SUCC_CNT_L fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL,
, SUM(t2.sndCntM) as SND_CNT_M fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM
, CONCAT(SUM(t2.succCntM), '(', IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0), '%)') as SUCC_CNT_M FROM
, SUM(t2.sndCntR) as SND_CNT_R (
, CONCAT(SUM(t2.succCntR), '(', IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0), '%)') as SUCC_CNT_R SELECT
from ( DATE_FORMAT(A.SUM_YMD, '%Y-%m-%d') AS sumYmd, C.CUST_NM AS custNm, C.BIZRNO AS bizrno,
<!-- 추가분 (시작) --> A.sndCnt, A.succCnt, IFNULL(ROUND((A.succCnt/A.sndCnt)*100,2),0) AS succRt,
SELECT A.sndCntS, A.succCntS, IFNULL(ROUND((A.succCntS/A.sndCntS)*100,2),0) AS succRtS,
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD A.sndCntL, A.succCntL, IFNULL(ROUND((A.succCntL/A.sndCntL)*100,2),0) AS succRtL,
,ewm.USER_SEQ A.sndCntM, A.succCntM, IFNULL(ROUND((A.succCntM/A.sndCntM)*100,2),0) AS succRtM,
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO A.sndCntR, A.succCntR, IFNULL(ROUND((A.succCntR/A.sndCntR)*100,2),0) AS succRtR,
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM A.fbSndCntS, A.fbSuccCntS, IFNULL(ROUND((A.fbSuccCntS/A.fbSndCntS)*100,2),0) AS succFbRtS,
FROM A.fbSndCntL, A.fbSuccCntL, IFNULL(ROUND((A.fbSuccCntL/A.fbSndCntL)*100,2),0) AS succFbRtL,
hubez_common.EZ_WEB_MSG ewm A.fbSndCntM, A.fbSuccCntM, IFNULL(ROUND((A.fbSuccCntM/A.fbSndCntM)*100,2),0) AS succFbRtM
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ FROM
WHERE (
1 = 1 SELECT
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') S1.SUM_YMD, S1.USER_SEQ,
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') (SUM(S1.sndCntS) + SUM(S1.sndCntL) + SUM(S1.sndCntM) + SUM(S1.sndCntR)) AS sndCnt,
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ (SUM(S1.succCntS) + SUM(S1.succCntL) +SUM(S1.succCntM) +SUM(S1.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
UNION ALL SUM(S1.sndCntS) AS sndCntS, SUM(S1.succCntS) AS succCntS, SUM(S1.sndCntL) AS sndCntL, SUM(S1.succCntL) AS succCntL, SUM(S1.sndCntM) AS sndCntM,
<!-- 추가분 (끝) --> SUM(S1.succCntM) AS succCntM, SUM(S1.sndCntR) AS sndCntR, SUM(S1.succCntR) AS succCntR, SUM(S1.fbSndCntS) AS fbSndCntS, SUM(S1.fbSuccCntS) AS fbSuccCntS,
select SUM_YMD SUM(S1.fbSndCntL) AS fbSndCntL, SUM(S1.fbSuccCntL) AS fbSuccCntL, SUM(S1.fbSndCntM) AS fbSndCntM, SUM(S1.fbSuccCntM) AS fbSuccCntM
, USER_SEQ FROM
, BIZRNO (
, CUST_NM SELECT
from ( SUM_YMD, USER_SEQ,
select ecm.SUM_YMD CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntS,
, ecm.USER_SEQ CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntS,
, ecm.BIZRNO CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntL,
, ecm.CUST_NM CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntL,
from hubez_common.EZ_CUST_DSTAT ecm CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntM,
where 1=1 CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntM,
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d') CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntR,
<include refid="custDstatListCondition"/> CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntR,
group by ecm.SUM_YMD , ecm.USER_SEQ CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntS,
ORDER BY ecm.SUM_YMD DESC, ecm.USER_SEQ CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntS,
) list CASE WHEN RPLCSND_CH_CD = 'LMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntL,
) t1 inner join ( CASE WHEN RPLCSND_CH_CD = 'LMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntL,
select SUM_YMD CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntM,
, USER_SEQ CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntM
, sum(smsSndCnt) AS sndCntS FROM
, sum(smsSuccCnt) AS succCntS hubez_common.EZ_CUST_DSTAT
, sum(smsSuccRt) AS succRtS WHERE
, sum(lmsSndCnt) AS sndCntL SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
, sum(lmsSuccCnt) AS succCntL AND BIZRNO != '1234567890'
, sum(lmsSuccRt) AS succRtL ) S1
, sum(mmsSndCnt) AS sndCntM WHERE
, sum(mmsSuccCnt) AS succCntM 1 = 1
, sum(mmsSuccRt) AS succRtM GROUP BY S1.SUM_YMD, S1.USER_SEQ
, sum(alimtSndCnt) AS sndCntR <if test='nowDiv == "Y"'>
, sum(alimtSuccCnt) AS succCntR UNION ALL
, sum(alimtSuccRt) AS succRtR SELECT
from ( S2.SUM_YMD, S2.USER_SEQ,
select SUM_YMD (SUM(S2.sndCntS) + SUM(S2.sndCntL) + SUM(S2.sndCntM) + SUM(S2.sndCntR)) AS sndCnt,
, USER_SEQ (SUM(S2.succCntS) + SUM(S2.succCntL) +SUM(S2.succCntM) +SUM(S2.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
, case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT) SUM(S2.sndCntS) AS sndCntS, SUM(S2.succCntS) AS succCntS, SUM(S2.sndCntL) AS sndCntL, SUM(S2.succCntL) AS succCntL, SUM(S2.sndCntM) AS sndCntM,
else 0 SUM(S2.succCntM) AS succCntM, SUM(S2.sndCntR) AS sndCntR, SUM(S2.succCntR) AS succCntR, SUM(S2.fbSndCntS) AS fbSndCntS, SUM(S2.fbSuccCntS) AS fbSuccCntS,
end as smsSndCnt SUM(S2.fbSndCntL) AS fbSndCntL, SUM(S2.fbSuccCntL) AS fbSuccCntL, SUM(S2.fbSndCntM) AS fbSndCntM, SUM(S2.fbSuccCntM) AS fbSuccCntM
, case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) FROM
else 0 (
end as smsSuccCnt SELECT
, case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) SUM_YMD, USER_SEQ,
else 0 CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS,
end as smsSuccRt CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS,
, case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT) CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL,
else 0 CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL,
end as lmsSndCnt CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM,
, case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM,
else 0 CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR,
end as lmsSuccCnt CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR,
, case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS,
else 0 CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS,
end as lmsSuccRt CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL,
, case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT) CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL,
else 0 CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM,
end as mmsSndCnt CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM
, case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) FROM
else 0 (
end as mmsSuccCnt SELECT
, case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2) DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
else 0 esu.PRNTS_USER_SEQ AS USER_SEQ,
end as mmsSuccRt REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
, case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT) SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
else 0 SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
end as alimtSndCnt 0 AS FBACK_CNT,
, case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT) 0 AS FBACK_SUCC_CNT
else 0 FROM
end as alimtSuccCnt hubez_common.EZ_WEB_MSG ewm INNER JOIN
, case when sndChCd = 'ALIMTALK' 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 alimtSuccRt ewm.YMD = DATE_FORMAT( NOW(), '%Y-%m-%d')
from ( GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
<!-- 추가분 (시작) --> UNION ALL
SELECT SELECT
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
,ewm.USER_SEQ esu.PRNTS_USER_SEQ AS USER_SEQ,
,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd FB_CH_STR AS SND_CH_CD,
,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT 0 AS SND_CNT,
,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT 0 AS SUCC_CNT,
,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_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_SUCC_CNT, 0)) AS FBACK_SUCC_CNT FROM
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT hubez_common.EZ_WEB_MSG ewm INNER JOIN
FROM hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
hubez_common.EZ_WEB_MSG ewm WHERE
WHERE ewm.YMD = DATE_FORMAT( NOW(), '%Y-%m-%d')
1 = 1 AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d') ) T1
GROUP BY WHERE
DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d'), ewm.USER_SEQ , ewm.CH_STR 1 = 1
UNION ALL GROUP BY SUM_YMD, USER_SEQ, SND_CH_CD
<!-- 추가분 (끝) --> ) S2
select ecm.SUM_YMD, ecm.USER_SEQ, SND_CH_CD as sndChCd WHERE
, ifnull(sum(SND_CNT) , 0) as SND_CNT 1 = 1
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT GROUP BY S2.SUM_YMD, S2.USER_SEQ
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT </if>
, 0 as FBACK_CNT ) A,
, 0 as FBACK_SUCC_CNT hubez_common.EZ_SUBS_INFO B,
, 0 as FBACK_FAIL_CNT hubez_common.EZ_CUST_INFO C
from hubez_common.EZ_CUST_DSTAT ecm WHERE
inner join ( A.USER_SEQ = B.USER_SEQ
select SUM_YMD AND B.CUST_SEQ = C.CUST_SEQ
, USER_SEQ AND C.BIZRNO != '1234567890'
from ( <include refid="custMstatListCondition"/>
select ecm.SUM_YMD ORDER BY A.SUM_YMD DESC, C.CUST_NM
, ecm.USER_SEQ ) M
from hubez_common.EZ_CUST_DSTAT ecm WHERE
where 1=1 1 = 1
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d') ORDER BY M.sumYmd DESC, M.custNm
<include refid="custDstatListCondition"/>
group by ecm.SUM_YMD , ecm.USER_SEQ
ORDER BY ecm.SUM_YMD DESC , ecm.USER_SEQ
) list
) list
on list.SUM_YMD = ecm.SUM_YMD and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
group by ecm.SUM_YMD , ecm.USER_SEQ, SND_CH_CD
union all
select ecm.SUM_YMD, 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_DSTAT ecm
inner join (
select SUM_YMD
, USER_SEQ
from (
select ecm.SUM_YMD
, ecm.USER_SEQ
from hubez_common.EZ_CUST_DSTAT ecm
where 1=1
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
<include refid="custDstatListCondition"/>
group by ecm.SUM_YMD , ecm.USER_SEQ
ORDER BY ecm.SUM_YMD DESC, ecm.USER_SEQ
) list
) list
on list.SUM_YMD = ecm.SUM_YMD and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
and RPLCSND_CH_CD in ('SMS', 'LMS', 'MMS', 'ALIMTALK')
group by ecm.SUM_YMD, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
) t1 group by SUM_YMD, USER_SEQ, sndChCd order by null
) t2 group by SUM_YMD, USER_SEQ order by null
) t2 on t2.SUM_YMD = t1.SUM_YMD and t2.USER_SEQ = t1.USER_SEQ
WHERE 1=1
<include refid="custMstatListCondition"/>
GROUP BY t1.BIZRNO, t1.SUM_YMD
order by SUM_YMD DESC, t1.USER_SEQ
</select> </select>
<sql id="custMstatListCondition"> <sql id="custMstatListCondition">