문자 재전송 쿼리 변경

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 callFromComma;
private String callToComma; private String callToComma;
private String msgSentType; private String msgSentType;
private String successCount;
public String getSuccessCount() {
return successCount;
}
public void setSuccessCount(String successCount) {
this.successCount = successCount;
}
public String getMsgSentType() { public String getMsgSentType() {
return msgSentType; return msgSentType;
} }

View File

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

View File

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