문자 재전송 쿼리 변경

This commit is contained in:
itn 2023-10-20 12:18:15 +09:00
parent 45807ed23a
commit 05e63e18c5
3 changed files with 150 additions and 196 deletions

View File

@ -82,7 +82,14 @@ public class MjonMsgSentVO extends UserDefaultVO{
private String callFromComma;
private String callToComma;
private String msgSentType;
private String successCount;
public String getSuccessCount() {
return successCount;
}
public void setSuccessCount(String successCount) {
this.successCount = successCount;
}
public String getMsgSentType() {
return msgSentType;
}

View File

@ -433,188 +433,143 @@
<!-- 전체 발송결과 조회 (전송사별) => 주소록 조인 제거버전-->
<select id="MjonMsgSentDAO.selectAllMsgSentSimpleList" parameterClass="mjonMsgSentVO" resultClass="mjonMsgSentVO">
SELECT
COUNT(USER_ID) OVER() AS totMsgCnt
, USER_ID AS userId
, MSG_GROUP_ID AS msgGroupId
, MSG_GROUP_CNT AS msgGroupCnt
, SMS_TXT AS smsTxt
, SUBJECT AS subject
, DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regdate
, DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqdate
, CALL_FROM AS callFrom
, CALL_TO AS callTo
, FN_GETHYPHEN(CALL_FROM) AS callFromComma
, FN_GETHYPHEN(CALL_TO) AS callToComma
, '' AS addrNm
, TOT_PRICE AS totPrice
, EACH_PRICE AS eachPrice
, CUR_STATE AS curState
, RSLT_CODE AS rsltCode
, RSLT_CODE2 AS rsltCode2
, DEL_FLAG AS delFlag
, MSG_TYPE AS msgType
, FILE_CNT AS fileCnt
, AGENT_CODE AS agentCode
, RESERVE_C_YN AS reserveCYn
, CANCELDATE AS cancelDate
, '' AS msgId
, orderByCode AS orderByCode
, sendKind AS sendKind
, MSG_KIND AS msgKind
FROM
( SELECT
B.USER_ID
, B.MSG_GROUP_ID
, B.MSG_GROUP_CNT
, B.SMS_TXT
, B.SUBJECT
, B.REGDATE
, B.REQ_DATE
, B.CALL_FROM
, B.TOT_PRICE
, B.EACH_PRICE
, B.DEL_FLAG
, B.MSG_TYPE
, B.FILE_CNT
, B.AGENT_CODE
, B.RESERVE_C_YN
, B.CANCELDATE
, A.MSG_SEQ
, A.CALL_TO
, A.CUR_STATE
, A.RSLT_CODE
, A.RSLT_CODE2
, B.SEND_KIND as sendKind
, B.MSG_KIND
, CASE
WHEN B.MSG_TYPE = '6'
AND B.FILE_CNT > 0
THEN '3'
WHEN B.MSG_TYPE = '6'
AND B.FILE_CNT = 0
THEN '2'
ELSE '1'
END orderByCode
<include refid="MjonMsgSentDAO.selectJoinQuery"/>
AND B.USER_ID = #userId#
AND B.DEL_FLAG ='N'
AND B.RESERVE_C_YN = 'N'
<![CDATA[
AND B.REQ_DATE <= DATE_ADD(NOW(), INTERVAL 60 MINUTE)
]]>
<isNotEmpty property="msgSentType">
<isEqual property="msgSentType" compareValue="01" >
AND B.MSG_KIND != 'C'
</isEqual>
<isEqual property="msgSentType" compareValue="02" >
AND B.MSG_KIND = 'C'
</isEqual>
</isNotEmpty>
)M
WHERE 1=1
<isNotEmpty property="stateType">
<isEqual property="stateType" compareValue="all">
AND CUR_STATE IN ('0','1','2','3')
</isEqual>
<isEqual property="stateType" compareValue="ready">
AND CUR_STATE = '0'
AND RESERVE_C_YN = 'N'
</isEqual>
<isEqual property="stateType" compareValue="complete">
AND CUR_STATE IN ('2','3')
AND (RSLT_CODE IN ('0','100','101','110','4100','6600','1000','1001') OR RSLT_CODE2 IN ('0') )
AND RESERVE_C_YN = 'N'
</isEqual>
<isEqual property="stateType" compareValue="fail">
AND RESERVE_C_YN = 'N'
AND (RSLT_CODE NOT IN ('0','100','101','110','4100','6600','1000','1001') OR RSLT_CODE2 NOT IN ('0') )
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchMsgType">
<isEqual property="searchMsgType" compareValue="S">
AND MSG_TYPE = '4'
</isEqual>
<isEqual property="searchMsgType" compareValue="L">
AND MSG_TYPE = '6'
AND FILE_CNT = '0'
</isEqual>
<isEqual property="searchMsgType" compareValue="M">
<![CDATA[
AND MSG_TYPE = '6'
AND FILE_CNT > '0'
]]>
</isEqual>
</isNotEmpty>
<isEmpty property="searchMsgType">
<isEmpty property="tabType">
AND MSG_TYPE IN ('4','6')
</isEmpty>
</isEmpty>
<isNotEmpty property="tabType">
<isEqual property="tabType" compareValue="all">
AND MSG_TYPE IN ('4','6')
</isEqual>
<isEqual property="tabType" compareValue="S">
AND MSG_TYPE = '4'
</isEqual>
<isEqual property="tabType" compareValue="L">
AND MSG_TYPE = '6'
AND FILE_CNT = '0'
</isEqual>
<isEqual property="tabType" compareValue="M">
<![CDATA[
AND MSG_TYPE = '6'
AND FILE_CNT > '0'
]]>
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchKeyword">
<isEqual property="searchCondition" compareValue="1" >
AND SUBJECT LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2" >
AND CALL_FROM LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="3" >
AND CALL_TO LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchCondition_01">
AND sendKind = #searchCondition_01#
</isNotEmpty>
<isNotEmpty property="startDate">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') >= DATE_FORMAT(#startDate#, '%Y-%m-%d')
]]>
</isNotEmpty>
<isNotEmpty property="endDate">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') <= DATE_FORMAT(#endDate#, '%Y-%m-%d')
]]>
</isNotEmpty>
<isNotEmpty property="msgSentType">
<isEqual property="msgSentType" compareValue="01" >
AND MSG_KIND != 'C'
</isEqual>
<isEqual property="msgSentType" compareValue="02" >
AND MSG_KIND = 'C'
</isEqual>
</isNotEmpty>
GROUP BY MSG_GROUP_ID
ORDER BY 1=1
<isNotEmpty property="searchSortCnd">
<isEqual property="searchSortCnd" compareValue="curState">
, curState $searchSortOrd$
, orderByrsltCode
</isEqual>
<isNotEqual property="searchSortCnd" compareValue="curState">
M2.totMsgCnt
, M2.userId
, M2.msgGroupId
, M2.msgGroupCnt
, M2.smsTxt
, M2.subject
, M2.regdate
, M2.reqdate
, M2.callFrom
, M2.callFromComma
, (
SELECT FN_GETHYPHEN(CALL_TO) FROM MJ_MSG_DATA A
WHERE A.MSG_GROUP_ID = M2.msgGroupId
LIMIT 1
) AS callToComma
, (
SELECT
COUNT(0)
FROM
MJ_MSG_DATA A
WHERE
A.MSG_GROUP_ID = M2.msgGroupId
AND (CASE
WHEN A.AGENT_CODE = '01' AND (A.RSLT_CODE = '100' AND (A.RSLT_CODE2 = '0'))
THEN 'S'
WHEN A.AGENT_CODE = '02' AND (A.RSLT_CODE = '0')
THEN 'S'
WHEN A.AGENT_CODE = '03' AND (A.RSLT_CODE = '100' OR A.RSLT_CODE = '101' OR A.RSLT_CODE = '110' OR A.RSLT_CODE = '800')
THEN 'S'
WHEN A.AGENT_CODE = '04' AND (A.RSLT_CODE = '4100' OR A.RSLT_CODE = '6600')
THEN 'S'
WHEN A.AGENT_CODE = '05' AND (A.RSLT_CODE = '1000' OR A.RSLT_CODE = '1001')
THEN 'S'
WHEN A.AGENT_CODE = '07' AND (A.RSLT_CODE = '6' OR A.RSLT_CODE = '1000')
THEN 'S'
WHEN A.AGENT_CODE = '08' AND (A.RSLT_CODE = '1000' OR A.RSLT_CODE = '1001')
THEN 'S'
WHEN A.AGENT_CODE = '09' AND (A.RSLT_CODE = '1000' OR A.RSLT_CODE = '1001')
THEN 'S'
ELSE 'F'
END) = 'S'
) AS successCount
, M2.addrNm
, M2.totPrice
, M2.eachPrice
, M2.delFlag
, M2.msgType
, M2.fileCnt
, M2.agentCode
, M2.reserveCYn
, M2.cancelDate
, M2.msgId
, M2.orderByCode
, M2.sendKind
, M2.msgKind
FROM (
SELECT
COUNT(USER_ID) OVER() AS totMsgCnt
, USER_ID AS userId
, MSG_GROUP_ID AS msgGroupId
, MSG_GROUP_CNT AS msgGroupCnt
, SMS_TXT AS smsTxt
, SUBJECT AS subject
, DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regdate
, DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqdate
, CALL_FROM AS callFrom
, FN_GETHYPHEN(CALL_FROM) AS callFromComma
, '' AS addrNm
, TOT_PRICE AS totPrice
, EACH_PRICE AS eachPrice
, DEL_FLAG AS delFlag
, MSG_TYPE AS msgType
, FILE_CNT AS fileCnt
, AGENT_CODE AS agentCode
, RESERVE_C_YN AS reserveCYn
, CANCELDATE AS cancelDate
, '' AS msgId
, orderByCode AS orderByCode
, sendKind AS sendKind
, MSG_KIND AS msgKind
FROM
( SELECT
B.USER_ID
, B.MSG_GROUP_ID
, B.MSG_GROUP_CNT
, B.SMS_TXT
, B.SUBJECT
, B.REGDATE
, B.REQ_DATE
, B.CALL_FROM
, B.TOT_PRICE
, B.EACH_PRICE
, B.DEL_FLAG
, B.MSG_TYPE
, B.FILE_CNT
, B.AGENT_CODE
, B.RESERVE_C_YN
, B.CANCELDATE
, B.SEND_KIND as sendKind
, B.MSG_KIND
, CASE
WHEN B.MSG_TYPE = '6'
AND B.FILE_CNT > 0
THEN '3'
WHEN B.MSG_TYPE = '6'
AND B.FILE_CNT = 0
THEN '2'
ELSE '1'
END orderByCode
FROM MJ_MSG_GROUP_DATA B
WHERE
B.USER_ID = #userId#
AND B.DEL_FLAG ='N'
AND B.RESERVE_C_YN = 'N'
AND B.MSG_TYPE IN ('4','6')
<![CDATA[
AND B.REQ_DATE <= DATE_ADD(NOW(), INTERVAL 60 MINUTE)
]]>
<isNotEmpty property="msgSentType">
<isEqual property="msgSentType" compareValue="01" >
AND B.MSG_KIND != 'C'
</isEqual>
<isEqual property="msgSentType" compareValue="02" >
AND B.MSG_KIND = 'C'
</isEqual>
</isNotEmpty>
)M
WHERE 1=1
ORDER BY 1=1
<isNotEmpty property="searchSortCnd">
,$searchSortCnd$
</isNotEqual>
</isNotEmpty>
<isNotEmpty property="searchSortOrd">
$searchSortOrd$
</isNotEmpty>
LIMIT #recordCountPerPage# OFFSET #firstIndex#
</isNotEmpty>
<isNotEmpty property="searchSortOrd">
$searchSortOrd$
</isNotEmpty>
LIMIT #recordCountPerPage# OFFSET #firstIndex#
) M2
</select>
<!-- 전체 발송결과 조회 (개인별)-->

View File

@ -137,12 +137,12 @@ function fnRevDetailPop(msgGroupId, msgId, fileCnt){
<colgroup>
<col style="width: 17%;">
<col style="width: 7%;">
<col style="width: 7%;">
<col style="width: 11%;">
<col style="width: 6%;">
<col style="width: 10%;">
<col style="width: *%;">
<col style="width: 15%;">
<col style="width: 8%;">
<col style="width: 12%;">
<col style="width: 10%;">
</colgroup>
<thead>
<tr>
@ -156,23 +156,15 @@ function fnRevDetailPop(msgGroupId, msgId, fileCnt){
<input type="button" class="sort sortBtn" id="sort_orderByCode">
</div>
</th>
<th>방식
<div class="sort_wrap">
<input type="button" class="sort sortBtn" id="sort_sendKind">
</div>
</th>
<th>방식</th>
<th>내용</th>
<th>받는사람
<div class="sort_wrap">
<input type="button" class="sort sortBtn" id="sort_callTo">
</div>
</th>
<th>받는사람</th>
<th>발신번호
<div class="sort_wrap">
<input type="button" class="sort sortBtn" id="sort_callFrom">
</div>
</th>
<th>건수
<th title="발송건수(성공률)">발송건수
<div class="sort_wrap">
<input type="button" class="sort sortBtn" id="sort_msgGroupCnt">
</div>
@ -256,7 +248,7 @@ function fnRevDetailPop(msgGroupId, msgId, fileCnt){
<c:out value="${result.callFromComma}"/>
</td>
<td>
<c:out value="${result.msgGroupCnt}"/>
<fmt:formatNumber value="${result.msgGroupCnt}" pattern="#,###" />(<fmt:formatNumber value="${(result.successCount / result.msgGroupCnt) * 100}" pattern="#,###" />%)
</td>
<td>
<button class="btnType btnType24" onClick="javascript:fnMjMsgReSendAll('${result.msgGroupId}','${replaceCnt}','${electionCnt}','${advertisementCnt}'); return false;">재전송</button>