mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 02:32:20 +09:00
고객 일별 통계
This commit is contained in:
@@ -8,9 +8,9 @@ spring:
|
||||
pool-name: hikari-cp
|
||||
maximum-pool-size: 30
|
||||
minimum-idle: 5
|
||||
connection-timeout: 5000
|
||||
connection-timeout: 1800000
|
||||
connection-init-sql: SELECT 1
|
||||
validation-timeout: 2000
|
||||
validation-timeout: 600000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
datasource-db2:
|
||||
@@ -22,9 +22,9 @@ spring:
|
||||
pool-name: hikari-cp
|
||||
maximum-pool-size: 30
|
||||
minimum-idle: 5
|
||||
connection-timeout: 5000
|
||||
connection-timeout: 1800000
|
||||
connection-init-sql: SELECT 1
|
||||
validation-timeout: 2000
|
||||
validation-timeout: 600000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
|
||||
|
||||
@@ -933,422 +933,345 @@
|
||||
|
||||
<select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int">
|
||||
/* stats-mapper.xml(selectCustDstatListTotalCnt) */
|
||||
SELECT
|
||||
COUNT(*) AS TOTALCNT
|
||||
FROM
|
||||
(
|
||||
<!-- 추가분 시작 -->
|
||||
SELECT
|
||||
COUNT(SUM_YMD) AS TOTALCNT
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD
|
||||
,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
|
||||
S1.SUM_YMD, S1.USER_SEQ
|
||||
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
|
||||
1 = 1
|
||||
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ
|
||||
UNION ALL
|
||||
<!-- 추가분 끝 -->
|
||||
GROUP BY S1.SUM_YMD, S1.USER_SEQ
|
||||
<if test='nowDiv == "Y"'>
|
||||
UNION ALL
|
||||
SELECT
|
||||
SUM_YMD
|
||||
,USER_SEQ
|
||||
,CUST_NM
|
||||
,BIZRNO
|
||||
FROM
|
||||
hubez_common.EZ_CUST_DSTAT
|
||||
WHERE 1=1
|
||||
AND SUM_YMD BETWEEN DATE_FORMAT(#{startDay},'%Y%m%d') AND DATE_FORMAT(#{endDay},'%Y%m%d')
|
||||
GROUP BY SUM_YMD, USER_SEQ
|
||||
) A
|
||||
WHERE 1=1
|
||||
<if test="custNm != null and custNm != ''">
|
||||
AND CUST_NM LIKE CONCAT('%',#{custNm},'%')
|
||||
</if>
|
||||
<if test="bizrno != null and bizrno != ''">
|
||||
AND BIZRNO LIKE CONCAT('%',#{bizrno},'%')
|
||||
</if>
|
||||
S2.SUM_YMD, S2.USER_SEQ
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM_YMD, USER_SEQ
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
|
||||
esu.PRNTS_USER_SEQ AS USER_SEQ,
|
||||
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') 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')
|
||||
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 id="selectCustDstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmDayList">
|
||||
/* stats-mapper.xml(selectCustDstatList) */
|
||||
select DATE_FORMAT(t1.SUM_YMD, '%Y-%m-%d') AS SUM_YMD
|
||||
, t1.CUST_NM AS CUST_NM
|
||||
, t1.BIZRNO AS BIZRNO
|
||||
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS SND_CNT
|
||||
, SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) AS SUCC_CNT
|
||||
, 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
|
||||
, SUM(t2.sndCntS) as SND_CNT_S
|
||||
, SUM(t2.succCntS) as SUCC_CNT_S
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0) as SUCC_RT_S
|
||||
, SUM(t2.sndCntL) as SND_CNT_L
|
||||
, SUM(t2.succCntL) as SUCC_CNT_L
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) as SUCC_RT_L
|
||||
, SUM(t2.sndCntM) as SND_CNT_M
|
||||
, SUM(t2.succCntM) as SUCC_CNT_M
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0) as SUCC_RT_M
|
||||
, SUM(t2.sndCntR) as SND_CNT_R
|
||||
, SUM(t2.succCntR) as SUCC_CNT_R
|
||||
, IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0) as SUCC_RT_R
|
||||
from (
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD
|
||||
,ewm.USER_SEQ
|
||||
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
|
||||
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
select SUM_YMD
|
||||
, USER_SEQ
|
||||
, BIZRNO
|
||||
, CUST_NM
|
||||
from (
|
||||
select ecm.SUM_YMD
|
||||
, ecm.USER_SEQ
|
||||
, ecm.BIZRNO
|
||||
, ecm.CUST_NM
|
||||
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}
|
||||
) t1 inner join (
|
||||
select SUM_YMD
|
||||
, 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_YMD
|
||||
, 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-%d') AS SUM_YMD
|
||||
,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 DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
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
|
||||
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,
|
||||
A.sndCntS, A.succCntS, IFNULL(ROUND((A.succCntS/A.sndCntS)*100,2),0) AS succRtS,
|
||||
A.sndCntL, A.succCntL, IFNULL(ROUND((A.succCntL/A.sndCntL)*100,2),0) AS succRtL,
|
||||
A.sndCntM, A.succCntM, IFNULL(ROUND((A.succCntM/A.sndCntM)*100,2),0) AS succRtM,
|
||||
A.sndCntR, A.succCntR, IFNULL(ROUND((A.succCntR/A.sndCntR)*100,2),0) AS succRtR,
|
||||
A.fbSndCntS, A.fbSuccCntS, IFNULL(ROUND((A.fbSuccCntS/A.fbSndCntS)*100,2),0) AS succFbRtS,
|
||||
A.fbSndCntL, A.fbSuccCntL, IFNULL(ROUND((A.fbSuccCntL/A.fbSndCntL)*100,2),0) AS succFbRtL,
|
||||
A.fbSndCntM, A.fbSuccCntM, IFNULL(ROUND((A.fbSuccCntM/A.fbSndCntM)*100,2),0) AS succFbRtM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
S1.SUM_YMD, S1.USER_SEQ,
|
||||
(SUM(S1.sndCntS) + SUM(S1.sndCntL) + SUM(S1.sndCntM) + SUM(S1.sndCntR)) AS sndCnt,
|
||||
(SUM(S1.succCntS) + SUM(S1.succCntL) +SUM(S1.succCntM) +SUM(S1.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
|
||||
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,
|
||||
SUM(S1.fbSndCntL) AS fbSndCntL, SUM(S1.fbSuccCntL) AS fbSuccCntL, SUM(S1.fbSndCntM) AS fbSndCntM, SUM(S1.fbSuccCntM) AS fbSuccCntM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM_YMD, USER_SEQ,
|
||||
CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntS,
|
||||
CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntS,
|
||||
CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntL,
|
||||
CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntL,
|
||||
CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntM,
|
||||
CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntM,
|
||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntR,
|
||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntR,
|
||||
CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntS,
|
||||
CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntS,
|
||||
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,
|
||||
CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntM,
|
||||
CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntM
|
||||
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
|
||||
1 = 1
|
||||
GROUP BY S1.SUM_YMD, S1.USER_SEQ
|
||||
<if test='nowDiv == "Y"'>
|
||||
UNION ALL
|
||||
SELECT
|
||||
S2.SUM_YMD, S2.USER_SEQ,
|
||||
(SUM(S2.sndCntS) + SUM(S2.sndCntL) + SUM(S2.sndCntM) + SUM(S2.sndCntR)) AS sndCnt,
|
||||
(SUM(S2.succCntS) + SUM(S2.succCntL) +SUM(S2.succCntM) +SUM(S2.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
|
||||
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,
|
||||
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,
|
||||
SUM(S2.fbSndCntL) AS fbSndCntL, SUM(S2.fbSuccCntL) AS fbSuccCntL, SUM(S2.fbSndCntM) AS fbSndCntM, SUM(S2.fbSuccCntM) AS fbSuccCntM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM_YMD, 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
|
||||
DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
|
||||
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 = 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-%d') AS SUM_YMD,
|
||||
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 = 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"/>
|
||||
ORDER BY A.SUM_YMD DESC, C.CUST_NM
|
||||
LIMIT #{page}, #{pagePerRows}
|
||||
</select>
|
||||
|
||||
<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) */
|
||||
select DATE_FORMAT(t1.SUM_YMD, '%Y-%m-%d') AS SUM_YMD
|
||||
, t1.CUST_NM AS CUST_NM
|
||||
, t1.BIZRNO AS BIZRNO
|
||||
, SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS SND_CNT
|
||||
, 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
|
||||
, SUM(t2.sndCntS) as SND_CNT_S
|
||||
, CONCAT(SUM(t2.succCntS), '(', IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0), '%)') as SUCC_CNT_S
|
||||
, SUM(t2.sndCntL) as SND_CNT_L
|
||||
, CONCAT(SUM(t2.succCntL), '(', IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) , '%)') as SUCC_CNT_L
|
||||
, SUM(t2.sndCntM) as SND_CNT_M
|
||||
, CONCAT(SUM(t2.succCntM), '(', IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0), '%)') as SUCC_CNT_M
|
||||
, 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
|
||||
from (
|
||||
<!-- 추가분 (시작) -->
|
||||
SELECT
|
||||
DATE_FORMAT(ewm.REG_DT , '%Y-%m-%d') AS SUM_YMD
|
||||
,ewm.USER_SEQ
|
||||
,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
|
||||
,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
|
||||
FROM
|
||||
hubez_common.EZ_WEB_MSG ewm
|
||||
INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
|
||||
WHERE
|
||||
1 = 1
|
||||
AND DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m-%d') , ewm.USER_SEQ
|
||||
UNION ALL
|
||||
<!-- 추가분 (끝) -->
|
||||
select SUM_YMD
|
||||
, USER_SEQ
|
||||
, BIZRNO
|
||||
, CUST_NM
|
||||
from (
|
||||
select ecm.SUM_YMD
|
||||
, ecm.USER_SEQ
|
||||
, ecm.BIZRNO
|
||||
, ecm.CUST_NM
|
||||
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
|
||||
) t1 inner join (
|
||||
select SUM_YMD
|
||||
, 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_YMD
|
||||
, 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-%d') AS SUM_YMD
|
||||
,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 DATE_FORMAT( #{endDay}, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m-%d') = DATE_FORMAT( NOW(), '%Y-%m-%d')
|
||||
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
|
||||
) 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
|
||||
sumYmd, custNm, bizrno,
|
||||
sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt,
|
||||
sndCntS, CONCAT(succCntS,'(',succRtS,'%)') AS succCntS,
|
||||
sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL,
|
||||
sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM,
|
||||
sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR,
|
||||
fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS,
|
||||
fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL,
|
||||
fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DATE_FORMAT(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,
|
||||
A.sndCntS, A.succCntS, IFNULL(ROUND((A.succCntS/A.sndCntS)*100,2),0) AS succRtS,
|
||||
A.sndCntL, A.succCntL, IFNULL(ROUND((A.succCntL/A.sndCntL)*100,2),0) AS succRtL,
|
||||
A.sndCntM, A.succCntM, IFNULL(ROUND((A.succCntM/A.sndCntM)*100,2),0) AS succRtM,
|
||||
A.sndCntR, A.succCntR, IFNULL(ROUND((A.succCntR/A.sndCntR)*100,2),0) AS succRtR,
|
||||
A.fbSndCntS, A.fbSuccCntS, IFNULL(ROUND((A.fbSuccCntS/A.fbSndCntS)*100,2),0) AS succFbRtS,
|
||||
A.fbSndCntL, A.fbSuccCntL, IFNULL(ROUND((A.fbSuccCntL/A.fbSndCntL)*100,2),0) AS succFbRtL,
|
||||
A.fbSndCntM, A.fbSuccCntM, IFNULL(ROUND((A.fbSuccCntM/A.fbSndCntM)*100,2),0) AS succFbRtM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
S1.SUM_YMD, S1.USER_SEQ,
|
||||
(SUM(S1.sndCntS) + SUM(S1.sndCntL) + SUM(S1.sndCntM) + SUM(S1.sndCntR)) AS sndCnt,
|
||||
(SUM(S1.succCntS) + SUM(S1.succCntL) +SUM(S1.succCntM) +SUM(S1.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
|
||||
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,
|
||||
SUM(S1.fbSndCntL) AS fbSndCntL, SUM(S1.fbSuccCntL) AS fbSuccCntL, SUM(S1.fbSndCntM) AS fbSndCntM, SUM(S1.fbSuccCntM) AS fbSuccCntM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM_YMD, USER_SEQ,
|
||||
CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntS,
|
||||
CASE WHEN SND_CH_CD = 'SMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntS,
|
||||
CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntL,
|
||||
CASE WHEN SND_CH_CD = 'LMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntL,
|
||||
CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntM,
|
||||
CASE WHEN SND_CH_CD = 'MMS' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntM,
|
||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SND_CNT, 0) ELSE 0 END AS sndCntR,
|
||||
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN IFNULL(SUCC_CNT, 0) ELSE 0 END AS succCntR,
|
||||
CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntS,
|
||||
CASE WHEN RPLCSND_CH_CD = 'SMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntS,
|
||||
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,
|
||||
CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_CNT, 0) ELSE 0 END AS fbSndCntM,
|
||||
CASE WHEN RPLCSND_CH_CD = 'MMS' THEN IFNULL(FBACK_SUCC_CNT, 0) ELSE 0 END AS fbSuccCntM
|
||||
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
|
||||
1 = 1
|
||||
GROUP BY S1.SUM_YMD, S1.USER_SEQ
|
||||
<if test='nowDiv == "Y"'>
|
||||
UNION ALL
|
||||
SELECT
|
||||
S2.SUM_YMD, S2.USER_SEQ,
|
||||
(SUM(S2.sndCntS) + SUM(S2.sndCntL) + SUM(S2.sndCntM) + SUM(S2.sndCntR)) AS sndCnt,
|
||||
(SUM(S2.succCntS) + SUM(S2.succCntL) +SUM(S2.succCntM) +SUM(S2.succCntR) + SUM(fbSuccCntS) + SUM(fbSuccCntL)+ SUM(fbSuccCntM)) AS succCnt,
|
||||
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,
|
||||
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,
|
||||
SUM(S2.fbSndCntL) AS fbSndCntL, SUM(S2.fbSuccCntL) AS fbSuccCntL, SUM(S2.fbSndCntM) AS fbSndCntM, SUM(S2.fbSuccCntM) AS fbSuccCntM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM_YMD, 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
|
||||
DATE_FORMAT(ewm.YMD, '%Y-%m-%d') AS SUM_YMD,
|
||||
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 = 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-%d') AS SUM_YMD,
|
||||
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 = 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"/>
|
||||
ORDER BY A.SUM_YMD DESC, C.CUST_NM
|
||||
) M
|
||||
WHERE
|
||||
1 = 1
|
||||
ORDER BY M.sumYmd DESC, M.custNm
|
||||
</select>
|
||||
|
||||
<sql id="custMstatListCondition">
|
||||
|
||||
Reference in New Issue
Block a user