Merge branch 'master_tolag3'

알림톡 발송결과 수정
This commit is contained in:
leejunho 2025-04-14 09:53:42 +09:00
parent a132cd8be4
commit 6c9d77cc6e
10 changed files with 1200 additions and 91 deletions

View File

@ -45,5 +45,14 @@ public interface MjonKakaoATService {
//알림톡 지연문자 리스트 조회
List<KakaoVO> selectKakaoATDelaySentList(String userId) throws Exception;
//알림톡 전체 발송 리스트(대시보드용)
List<KakaoVO> selectMjonKakaoATGroupCompleteByUserList_advc(KakaoVO searchVO) throws Exception;
//알림톡 발송 상세 리스트
List<KakaoVO> selectMjonKakaoATGroupDtList_advc(KakaoVO searchVO) throws Exception;
//알림톡 전송내역 상세
KakaoVO selectMjonKakaoATVO_advc(KakaoVO mjonKakaoATVO) throws Exception;
}

View File

@ -97,4 +97,18 @@ public class MjonKakaoATDAO extends EgovAbstractDAO {
public List<KakaoVO> selectKakaoATDelaySentList(String userId) throws Exception{
return (List<KakaoVO>)list("mjonKakaoATDAO.selectKakaoATDelaySentList", userId);
}
@SuppressWarnings("unchecked")
public List<KakaoVO> selectMjonKakaoATGroupCompleteByUserList_advc(KakaoVO p_mjonKakaoATVO) throws Exception{
return (List<KakaoVO>)list("mjonKakaoATDAO.selectMjonKakaoATGroupCompleteByUserList_advc", p_mjonKakaoATVO);
}
@SuppressWarnings("unchecked")
public List<KakaoVO> selectMjonKakaoATGroupDtList_advc(KakaoVO p_mjonKakaoATVO) throws Exception{
return (List<KakaoVO>)list("mjonKakaoATDAO.selectMjonKakaoATGroupDtList_advc", p_mjonKakaoATVO);
}
public KakaoVO selectMjonKakaoATVO_advc(KakaoVO p_mjonKakaoATVO) throws Exception{
return (KakaoVO) select("mjonKakaoATDAO.selectMjonKakaoATVO_advc", p_mjonKakaoATVO);
}
}

View File

@ -199,4 +199,55 @@ public class MjonKakaoATServiceImpl extends EgovAbstractServiceImpl implements M
public List<KakaoVO> selectKakaoATDelaySentList(String userId) throws Exception {
return mjonKakaoATDAO.selectKakaoATDelaySentList(userId);
}
@Override
public List<KakaoVO> selectMjonKakaoATGroupCompleteByUserList_advc(KakaoVO p_mjonKakaoATVO) throws Exception {
List<KakaoVO> result = new ArrayList<KakaoVO>();
try {
result = mjonKakaoATDAO.selectMjonKakaoATGroupCompleteByUserList_advc(p_mjonKakaoATVO);
} catch (Exception e) {
System.out.println("selectMjonKakaoATGroupCompleteByUserList ServiceImpl Error ::: " + e);
}
return result;
}
@Override
public List<KakaoVO> selectMjonKakaoATGroupDtList_advc(KakaoVO p_mjonKakaoATVO) throws Exception {
List<KakaoVO> resultList = new ArrayList<KakaoVO>();
try {
resultList = mjonKakaoATDAO.selectMjonKakaoATGroupDtList_advc(p_mjonKakaoATVO);
} catch (Exception e) {
System.out.println("selectMjonKakaoATGroupDtList ServiceImpl Error ::: " + e);
}
return resultList;
}
@Override
public KakaoVO selectMjonKakaoATVO_advc(KakaoVO p_mjonKakaoATVO) throws Exception {
KakaoVO result = new KakaoVO();
try {
result = mjonKakaoATDAO.selectMjonKakaoATVO_advc(p_mjonKakaoATVO);
} catch (Exception e) {
System.out.println("selectMjonKakaoATVO Service Impl Error !!! " + e);
}
return result;
}
}

View File

@ -241,7 +241,8 @@ public class MjonKakaoATController {
kakaoVO.setNtceBgnde(beforeMonthDay);
}
resultList = mjonKakaoATService.selectMjonKakaoATGroupCompleteByUserList(kakaoVO);
// resultList = mjonKakaoATService.selectMjonKakaoATGroupCompleteByUserList(kakaoVO);
resultList = mjonKakaoATService.selectMjonKakaoATGroupCompleteByUserList_advc(kakaoVO);
model.addAttribute("resultList", resultList);
@ -331,7 +332,8 @@ public class MjonKakaoATController {
}
List<KakaoVO> resultList = new ArrayList<KakaoVO>();
resultList = mjonKakaoATService.selectMjonKakaoATGroupDtList(searchVO);
// resultList = mjonKakaoATService.selectMjonKakaoATGroupDtList(searchVO);
resultList = mjonKakaoATService.selectMjonKakaoATGroupDtList_advc(searchVO);
model.addAttribute("resultList", resultList);
model.addAttribute("searchVO", searchVO);
@ -377,7 +379,8 @@ public class MjonKakaoATController {
KakaoVO mjonKakaoATDetailVO = new KakaoVO();
if(null != searchVO.getUserData() && !"".equals(searchVO.getUserData())) { //수정
mjonKakaoATDetailVO = mjonKakaoATService.selectMjonKakaoATVO(searchVO);
// mjonKakaoATDetailVO = mjonKakaoATService.selectMjonKakaoATVO(searchVO);
mjonKakaoATDetailVO = mjonKakaoATService.selectMjonKakaoATVO_advc(searchVO);
}

View File

@ -3,6 +3,8 @@ package itn.let.kakao.user.sent.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import itn.let.kakao.admin.kakaoAt.service.MjonKakaoATVO;
public interface KakaoSentService {
@ -39,4 +41,5 @@ public interface KakaoSentService {
//발송 관리 문자발송 내용 상세보기 팝업
public MjonKakaoATVO selectKakaoSentDetailViewPhoneAjax(MjonKakaoATVO kakaoSentVO) throws Exception;
public void kakaoExcelDown(KakaoSentVO kakaoSentVO, HttpServletResponse response) throws Exception;
}

View File

@ -115,4 +115,8 @@ public class KakaoSentVO extends UserDefaultVO{
private String divideYn;
private String sendKind;
private String yellowId;
}

View File

@ -1,18 +1,35 @@
package itn.let.kakao.user.sent.service.impl;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.stereotype.Service;
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
@ -21,6 +38,7 @@ import itn.let.kakao.admin.kakaoAt.service.MjonKakaoATVO;
import itn.let.kakao.user.sent.service.KakaoSentDetailVO;
import itn.let.kakao.user.sent.service.KakaoSentService;
import itn.let.kakao.user.sent.service.KakaoSentVO;
import itn.let.mjo.msgsent.service.MjonMsgSentVO;
@Service("KakaoSentService")
public class KakaoSentServiceImpl extends EgovAbstractServiceImpl implements KakaoSentService{
@ -437,5 +455,272 @@ public class KakaoSentServiceImpl extends EgovAbstractServiceImpl implements Ka
return String.format("%,d건씩 %d분 간격", batchSize, intervalMinutes);
}
@Override
public void kakaoExcelDown(
KakaoSentVO kakaoSentVO
, HttpServletResponse response
) throws Exception {
kakaoSentVO.setRecordCountPerPage(100000);
kakaoSentVO.setFirstIndex(0);
if(StringUtils.isEmpty(kakaoSentVO.getSearchSortOrd())) {
kakaoSentVO.setSearchSortOrd("desc");
// kakaoSentVO.setSearchSortCnd("B.REQ_DATE");
}
//예약 관리 리스트 불러오기
List<KakaoSentVO> resultList = kakaoSentDAO.selectAllKakaoSentList_advc(kakaoSentVO);
// long startTime = System.nanoTime(); // 시작 시간 측정
// resultAllSentList = makeDetailFunction(resultAllSentList);
resultList = resultList.stream().map(t -> setPriceNCode(t)).collect(Collectors.toList());
// long endTime = System.nanoTime(); // 끝난 시간 측정
// double executionTimeInSeconds = (endTime - startTime) / 1_000_000_000.0;
// System.out.println("Execution time: " + executionTimeInSeconds + " seconds");
SXSSFWorkbook workbook = null; // SXSSFWorkbook 변수 선언
try{
// Workbook 생성
workbook = new SXSSFWorkbook();
Sheet sheet = workbook.createSheet("발송 내역");
// 너비 설정
sheet.setColumnWidth(0, 3000); // 번호
sheet.setColumnWidth(1, 4000); // 발송일시
sheet.setColumnWidth(2, 5000); // 구분
sheet.setColumnWidth(3, 5000); //채널 ID
sheet.setColumnWidth(4, 3000); // 형태
sheet.setColumnWidth(5, 10000); // 내용
sheet.setColumnWidth(6, 4000); // 발송건수
sheet.setColumnWidth(7, 3000); // 대기
sheet.setColumnWidth(8, 3000); // 카카오톡 성공
sheet.setColumnWidth(9, 3000); // 카카오톡 실패
sheet.setColumnWidth(10, 3000); // 대체문자 성공
sheet.setColumnWidth(11, 3000); // 대체문자 실패
sheet.setColumnWidth(12, 4000); // 금액
sheet.setColumnWidth(13, 5000); // 진행상황
// 헤더 스타일 설정
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setAlignment(HorizontalAlignment.CENTER);
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
headerStyle.setBorderTop(BorderStyle.THIN);
headerStyle.setBorderBottom(BorderStyle.THIN);
headerStyle.setBorderLeft(BorderStyle.THIN);
headerStyle.setBorderRight(BorderStyle.THIN);
headerStyle.setTopBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
headerStyle.setBottomBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
headerStyle.setLeftBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
headerStyle.setRightBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
Font font = workbook.createFont();
font.setBold(true); // 글씨체 굵게
font.setFontHeightInPoints((short) 12); // 글씨 크기
headerStyle.setFont(font);
// 데이터 스타일 설정 (가운데 정렬)
CellStyle centerStyle = workbook.createCellStyle();
centerStyle.setAlignment(HorizontalAlignment.CENTER);
centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
centerStyle.setBorderTop(BorderStyle.THIN);
centerStyle.setBorderBottom(BorderStyle.THIN);
centerStyle.setBorderLeft(BorderStyle.THIN);
centerStyle.setBorderRight(BorderStyle.THIN);
centerStyle.setTopBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
centerStyle.setBottomBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
centerStyle.setLeftBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
centerStyle.setRightBorderColor(IndexedColors.GREY_25_PERCENT.getIndex());
// 번째 헤더 작성 (상단 병합)
Row headerRow = sheet.createRow(0);
// 번호 추가
Cell cell = headerRow.createCell(0);
cell.setCellValue("번호");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); // 번호 병합
// 구분 추가
cell = headerRow.createCell(1);
cell.setCellValue("발송일시");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); // 구분 병합
// 구분 추가
cell = headerRow.createCell(2);
cell.setCellValue("구분");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); // 구분 병합
cell = headerRow.createCell(3);
cell.setCellValue("채널ID");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3)); // 발송일시 병합
cell = headerRow.createCell(4);
cell.setCellValue("형태");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); // 형태 병합
cell = headerRow.createCell(5);
cell.setCellValue("내용");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5)); // 내용 병합
cell = headerRow.createCell(6);
cell.setCellValue("발송건수");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 6, 6)); // 발송건수 병합
cell = headerRow.createCell(7);
cell.setCellValue("대기");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 7, 7)); // 발송건수 병합
cell = headerRow.createCell(8);
cell.setCellValue("카카오톡 결과");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 8, 9)); // 카카오톡 결과 병합
cell = headerRow.createCell(10);
cell.setCellValue("대체문자 결과");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 10, 11)); // 대체문자 결과 병합
cell = headerRow.createCell(12);
cell.setCellValue("금액(원)");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 12, 12)); // 금액() 병합
cell = headerRow.createCell(13);
cell.setCellValue("진행상황");
cell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 13, 13)); // 진행상황 병합
// 번째 헤더 작성 (카카오톡 결과 하위 )
Row subHeaderRow = sheet.createRow(1);
String[] subHeadersKakao = {"성공", "실패"};
for (int i = 0; i < subHeadersKakao.length; i++) {
cell = subHeaderRow.createCell(8 + i); // 결과 시작점(6번 )부터 순차적으로 설정
cell.setCellValue(subHeadersKakao[i]);
cell.setCellStyle(headerStyle);
}
// 번째 헤더 작성 (대체문자 결과 하위 )
String[] subHeadersKakaoDaeChae = {"성공", "실패"};
for (int i = 0; i < subHeadersKakaoDaeChae.length; i++) {
cell = subHeaderRow.createCell(10 + i); // 결과 시작점(6번 )부터 순차적으로 설정
cell.setCellValue(subHeadersKakaoDaeChae[i]);
cell.setCellStyle(headerStyle);
}
// Object[][] 변환
Object[][] data = new Object[resultList.size()][14]; // 14은 필드
for (int i = 0; i < resultList.size(); i++) {
KakaoSentVO vo = resultList.get(i);
//번호
data[i][0] = i+1;
//발송일시
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
data[i][1] = sdf.format(vo.getReqdate());
//구분
data[i][2] = "H".equals(vo.getSendKind()) ? "WEB" : "API";
//채널ID
data[i][3] = vo.getYellowId();
//형태
data[i][4] = "8".equals(vo.getMsgType()) ? "알림톡" : "친구톡";
String reserveTxt = "";
if("Y".equals(vo.getReserveYn())) {reserveTxt="[예약]";}
if("Y".equals(vo.getDivideYn())) {reserveTxt+="[분할]";}
data[i][5] = reserveTxt + (StringUtils.isEmpty(vo.getSmsTxt()) ? "-" : vo.getSmsTxt());
data[i][6] = vo.getMsgGroupCnt();
data[i][7] = vo.getWaitCount();
data[i][8] = vo.getSuccessCount();
data[i][9] = vo.getFailCount();
data[i][10] = vo.getKakaoResendSuccCount();
data[i][11] = vo.getKakaoResendFailCount();
data[i][12] = vo.getTotPrice();
String statusTxt="진행중";
if ("04".equals(vo.getStatusCd())) {
statusTxt = "예약취소"; // 예약취소 코드
} else if ("03".equals(vo.getStatusCd())) {
statusTxt = "예약대기"; // 예약대기 코드 ( 예약취소 버튼 노출 )
} else if ("02".equals(vo.getStatusCd())) {
statusTxt = "완료"; // 완료 코드
}
data[i][13] = statusTxt;
}
int rowNum = 2; // 데이터 시작
for (Object[] rowData : data) {
Row row = sheet.createRow(rowNum++);
for (int col = 0; col < rowData.length; col++) {
cell = row.createCell(col);
// "내용" 열만 제외하고 가운데 정렬
if (col == 5) { // 내용
cell.setCellValue((String) rowData[col]);
} else if (rowData[col] instanceof String) {
cell.setCellValue((String) rowData[col]);
cell.setCellStyle(centerStyle);
} else if (rowData[col] instanceof Integer) {
cell.setCellValue((Integer) rowData[col]);
cell.setCellStyle(centerStyle);
}
}
}
// 파일 다운로드 응답 설정
String fileName ="발송결과_리스트"; // 저장 파일명
SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyyMMdd_HHmmss", Locale.KOREA );
Date currentTime = new Date ();
String mTime = mSimpleDateFormat.format ( currentTime );
fileName = fileName+"("+mTime+")";
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
response.setHeader("Content-Disposition", String.format("attachment; filename=\""+new String((fileName).getBytes("KSC5601"),"8859_1")+".xlsx"));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
// 파일 출력
workbook.write(response.getOutputStream());
workbook.close();
} catch (Exception e) {
// 에러 처리 로직
response.setHeader("Set-Cookie", "fileDownload=false; path=/");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setHeader("Content-Type", "text/html; charset=utf-8");
try (OutputStream out = response.getOutputStream()) {
byte[] data = "fail..".getBytes();
out.write(data, 0, data.length);
} catch (Exception ignore) {
ignore.printStackTrace();
}
} finally {
if (workbook != null) {
try {
workbook.dispose(); // SXSSFWorkbook 임시 파일 제거
workbook.close();
} catch (Exception ignore) {
ignore.printStackTrace();
}
}
}
}
}

View File

@ -507,10 +507,7 @@ public class KakaoSentController {
@RequestMapping(value= {"/web/mjon/msgsent/kakaoSentExcelDownLoadAjax.do"})
public void kakaoSentExcelDownLoadAjax(
KakaoSentVO kakaoSentVO,
RedirectAttributes redirectAttributes,
HttpServletRequest request,
HttpServletResponse response ,
ModelMap model) throws Exception{
HttpServletResponse response) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
@ -518,89 +515,91 @@ public class KakaoSentController {
if(!userId.equals("")) {
kakaoSentVO.setUserId(userId);
//
// String stateType = kakaoSentVO.getStateType();
// String tabType = kakaoSentVO.getTabType();
//
// // 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
// SXSSFWorkbook wb = new SXSSFWorkbook(100);
// String fileName ="발송관리 엑셀 리스트"; // 저장 파일명
// String sheetTitle = "문자 발송 내역" ; // 제목
// Sheet sheet = wb.createSheet(sheetTitle);
// Cell cell = null;
// Row row = null;
//
// CellStyle style = wb.createCellStyle();
// style.setBorderBottom(CellStyle.BORDER_THIN); //테두리 두껍게
// style.setBorderLeft(CellStyle.BORDER_THIN);
// style.setBorderRight(CellStyle.BORDER_THIN);
// style.setBorderTop(CellStyle.BORDER_THIN);
//
// CellStyle styleLastCell = wb.createCellStyle();
// styleLastCell.setBorderLeft(CellStyle.BORDER_THIN);
//
// // 정렬
// style.setAlignment(CellStyle.ALIGN_CENTER); //가운데 정렬
// style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
//
// Font font = wb.createFont();
// font.setBoldweight(Font.BOLDWEIGHT_BOLD); //글씨 bold
//
//
// String type = "";
// String fCnt = "";
//
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
//
// try{
//
//
// kakaoSentVO.setRecordCountPerPage(100000);
// kakaoSentVO.setFirstIndex(0);
//
// if("".equals(kakaoSentVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
// kakaoSentVO.setSearchSortCnd("regdate");
// kakaoSentVO.setSearchSortOrd("desc");
// }
// kakaoSentVO.setReserveCYn("N");
// //발송결과-카카오톡 리스트 불러오기
// List<KakaoSentVO> resultAllSentList = kakaoSentService.selectAllKakaoSentList(kakaoSentVO);
// if("groupList".equals(kakaoSentVO.getListType())) {
// //받는사람(전송건별)
// kakaoSentExcelGroup(resultAllSentList, row, sheet, cell, style, styleLastCell, type, fCnt, sdf);
// }else {
// kakaoSentExcelPrivate(resultAllSentList, row, sheet, cell, style, styleLastCell, type, fCnt, sdf);
// }
//
//
// response.setHeader("Set-Cookie", "fileDownload=true; path=/");
// SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyyMMdd_HHmmss", Locale.KOREA );
// Date currentTime = new Date ();
// String mTime = mSimpleDateFormat.format ( currentTime );
// fileName = fileName+"("+mTime+")";
//
// response.setHeader("Content-Disposition", String.format("attachment; filename=\""+new String((fileName).getBytes("KSC5601"),"8859_1")+".xlsx"));
// wb.write(response.getOutputStream());
// }catch(Exception e) {
// response.setHeader("Set-Cookie", "fileDownload=false; path=/");
// response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
// response.setHeader("Content-Type","text/html; charset=utf-8");
// OutputStream out = null;
// try {
// out = response.getOutputStream();
// byte[] data = new String("fail..").getBytes();
// out.write(data, 0, data.length);
// } catch(Exception ignore) {
// ignore.printStackTrace();
// } finally {
// if(out != null) try { out.close(); } catch(Exception ignore) {}
// }
// }finally {
// // 디스크 적었던 임시파일을 제거합니다.
// wb.dispose();
// try { wb.close(); } catch(Exception ignore) {}
// }
kakaoSentService.kakaoExcelDown(kakaoSentVO, response);
String stateType = kakaoSentVO.getStateType();
String tabType = kakaoSentVO.getTabType();
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
SXSSFWorkbook wb = new SXSSFWorkbook(100);
String fileName ="발송관리 엑셀 리스트"; // 저장 파일명
String sheetTitle = "문자 발송 내역" ; // 제목
Sheet sheet = wb.createSheet(sheetTitle);
Cell cell = null;
Row row = null;
CellStyle style = wb.createCellStyle();
style.setBorderBottom(CellStyle.BORDER_THIN); //테두리 두껍게
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
CellStyle styleLastCell = wb.createCellStyle();
styleLastCell.setBorderLeft(CellStyle.BORDER_THIN);
// 정렬
style.setAlignment(CellStyle.ALIGN_CENTER); //가운데 정렬
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD); //글씨 bold
String type = "";
String fCnt = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try{
kakaoSentVO.setRecordCountPerPage(100000);
kakaoSentVO.setFirstIndex(0);
if("".equals(kakaoSentVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
kakaoSentVO.setSearchSortCnd("regdate");
kakaoSentVO.setSearchSortOrd("desc");
}
kakaoSentVO.setReserveCYn("N");
//발송결과-카카오톡 리스트 불러오기
List<KakaoSentVO> resultAllSentList = kakaoSentService.selectAllKakaoSentList(kakaoSentVO);
if("groupList".equals(kakaoSentVO.getListType())) {
//받는사람(전송건별)
kakaoSentExcelGroup(resultAllSentList, row, sheet, cell, style, styleLastCell, type, fCnt, sdf);
}else {
kakaoSentExcelPrivate(resultAllSentList, row, sheet, cell, style, styleLastCell, type, fCnt, sdf);
}
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyyMMdd_HHmmss", Locale.KOREA );
Date currentTime = new Date ();
String mTime = mSimpleDateFormat.format ( currentTime );
fileName = fileName+"("+mTime+")";
response.setHeader("Content-Disposition", String.format("attachment; filename=\""+new String((fileName).getBytes("KSC5601"),"8859_1")+".xlsx"));
wb.write(response.getOutputStream());
}catch(Exception e) {
response.setHeader("Set-Cookie", "fileDownload=false; path=/");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setHeader("Content-Type","text/html; charset=utf-8");
OutputStream out = null;
try {
out = response.getOutputStream();
byte[] data = new String("fail..").getBytes();
out.write(data, 0, data.length);
} catch(Exception ignore) {
ignore.printStackTrace();
} finally {
if(out != null) try { out.close(); } catch(Exception ignore) {}
}
}finally {
// 디스크 적었던 임시파일을 제거합니다.
wb.dispose();
try { wb.close(); } catch(Exception ignore) {}
}
}else {
response.sendRedirect("/web/kakao/sent/selectKakaoSentView.do");
}

View File

@ -2406,4 +2406,742 @@
reqDate DESC
,sentDate DESC
</select>
<select id="mjonKakaoATDAO.selectMjonKakaoATGroupCompleteByUserList_advc" parameterClass="kakaoVO" resultClass="kakaoVO">
SELECT
M2.totCnt ,
M2.userId ,
M2.msgGroupId ,
M2.msgGroupCnt ,
M2.smsTxt ,
M2.subject ,
M2.regDate ,
M2.reqDate ,
M2.rsltDate ,
M2.callFrom ,
M2.callTo ,
M2.totPrice ,
M2.eachPrice ,
M2.curState ,
M2.rsltCode ,
M2.rsltCode2 ,
M2.orderByrsltCode ,
M2.delFlag ,
M2.msgType ,
M2.fileCnt ,
M2.agentCode ,
M2.reserveYn ,
M2.reserveCYn ,
M2.cancelDate ,
M2.msgTypeName ,
M2.orderByCode ,
M2.msgResult ,
M2.msgNoticetalkSenderKey ,
M2.msgNoticetalkTmpKey ,
M2.yellowId ,
M2.userNm ,
M2.atSmishingYn ,
M2.atDelayCompleteYn,
M2.atDelayYn,
( SELECT COUNT(0)
FROM MJ_MSG_DATA C
WHERE C.RESERVE_C_YN = 'N'
AND C.MSG_GROUP_ID = M2.msgGroupId
AND C.RSLT_CODE = '7000'
) AS successCount ,
( SELECT COUNT(0)
FROM MJ_MSG_DATA C
WHERE C.RESERVE_C_YN = 'N'
AND C.MSG_GROUP_ID = M2.msgGroupId
AND C.RSLT_CODE = '7000'
AND C.MSG_TYPE = '8'
) AS atSuccessCount ,
( SELECT COUNT(0)
FROM MJ_MSG_DATA C
WHERE C.RESERVE_C_YN = 'N'
AND C.MSG_GROUP_ID = M2.msgGroupId
AND C.RSLT_CODE != '7000'
AND C.MSG_TYPE = '8'
) AS atFailCount ,
( SELECT COUNT(0)
FROM MJ_MSG_DATA C
WHERE C.DEL_FLAG = 'N'
AND C.RESERVE_C_YN = 'N'
AND C.MSG_GROUP_ID = M2.msgGroupId
AND C.RSLT_CODE = '7000'
AND C.MSG_TYPE = '9'
) AS ftSuccessCount ,
( SELECT COUNT(0)
FROM MJ_MSG_DATA C
WHERE C.DEL_FLAG = 'N'
AND C.RESERVE_C_YN = 'N'
AND C.MSG_GROUP_ID = M2.msgGroupId
AND C.RSLT_CODE != '7000'
AND C.MSG_TYPE = '9'
) AS ftFailCount ,
<!-- '0' AS ftSuccessCount,
'0' AS ftFailCount, -->
M2.bizUmid,
M2.callStatus,
M2.bizKakaoResendYn,
( SELECT COUNT(0)
FROM BIZ_LOG BL1,
MJ_MSG_DATA MMD1
WHERE M2.bizKakaoResendYn = 'Y'
AND M2.msgGroupId = MMD1.MSG_GROUP_ID
AND MMD1.BIZ_UMID = BL1.CMID
AND (
CASE
WHEN BL1.CALL_STATUS in ('6600','4100')
THEN 'S'
ELSE 'F'
END ) = 'S'
) kakaoResendSuccCount,
( SELECT COUNT(0)
FROM BIZ_LOG BL1,
MJ_MSG_DATA MMD1
WHERE M2.bizKakaoResendYn = 'Y'
AND M2.msgGroupId = MMD1.MSG_GROUP_ID
AND MMD1.BIZ_UMID = BL1.CMID
AND (
CASE
WHEN BL1.CALL_STATUS in ('6600','4100')
THEN 'S'
ELSE 'F'
END ) = 'F'
) kakaoResendFailCount
FROM (
SELECT
COUNT(M.USER_ID) OVER() AS totCnt ,
M.USER_ID AS userId ,
MSG_GROUP_ID AS msgGroupId ,
MSG_GROUP_CNT AS msgGroupCnt ,
SMS_TXT AS smsTxt ,
M.SUBJECT AS subject ,
DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regDate ,
DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqDate ,
DATE_FORMAT(RSLT_DATE, '%Y-%m-%d %T') AS rsltDate ,
CALL_FROM AS callFrom ,
CALL_TO AS callTo ,
TOT_PRICE AS totPrice ,
EACH_PRICE AS eachPrice ,
CUR_STATE AS curState ,
RSLT_CODE AS rsltCode ,
RSLT_CODE2 AS rsltCode2 ,
IF((RSLT_CODE != '7000'),'1','0') AS orderByrsltCode ,
DEL_FLAG AS delFlag ,
M.MSG_TYPE AS msgType ,
FILE_CNT AS fileCnt ,
AGENT_CODE AS agentCode ,
RESERVE_YN AS reserveYn ,
RESERVE_C_YN AS reserveCYn ,
DATE_FORMAT(CANCELDATE, '%Y-%m-%d %T') AS cancelDate ,
msgTypeName AS msgTypeName ,
orderByCode AS orderByCode ,
RESULT AS msgResult ,
MSG_NOTICETALK_SENDER_KEY AS msgNoticetalkSenderKey ,
MSG_NOTICETALK_TMP_KEY AS msgNoticetalkTmpKey ,
MKPI.YELLOW_ID AS yellowId ,
LTM.MBER_NM AS userNm ,
LTM.AT_SMISHING_YN AS atSmishingYn,
BIZ_UMID AS bizUmid,
BL.CALL_STATUS AS callStatus,
M.BIZ_KAKAO_RESEND_YN AS bizKakaoResendYn,
M.AT_DELAY_COMPLETE_YN AS atDelayCompleteYn,
M.AT_DELAY_YN AS atDelayYn
FROM
(SELECT
MG.USER_ID
, MG.MSG_GROUP_ID
, MG.MSG_GROUP_CNT
, MG.SMS_TXT
, MG.SUBJECT
, MG.REGDATE
, MG.REQ_DATE
, MD.RSLT_DATE
, MG.CALL_FROM
, MG.TOT_PRICE
, MG.EACH_PRICE
, MG.DEL_FLAG
, MG.MSG_TYPE
, MG.FILE_CNT
, MG.AGENT_CODE
, MG.RESERVE_YN
, MG.RESERVE_C_YN
, MG.CANCELDATE
, MD.MSG_SEQ
, MD.CALL_TO
, MD.CUR_STATE
, MD.RSLT_CODE
, MD.RSLT_CODE2
, CASE
WHEN MG.MSG_TYPE = '8'
THEN '알림톡'
WHEN MG.MSG_TYPE = '9'
THEN '친구톡'
END msgTypeName
, CASE
WHEN MG.MSG_TYPE = '8'
THEN '1'
ELSE '2'
END orderByCode
, (
CASE
WHEN MD.RSLT_CODE = '7000'
THEN 'S'
WHEN (MD.RSLT_CODE IS NULL AND MD.SENT_DATE IS NULL AND MD.RSLT_DATE IS NULL)
THEN 'W'
ELSE 'F'
END
) AS result
, MSG_NOTICETALK_SENDER_KEY
, MSG_NOTICETALK_TMP_KEY
, MD.BIZ_UMID
, MD.BIZ_KAKAO_RESEND_YN
, MG.AT_DELAY_COMPLETE_YN
, MG.AT_DELAY_YN
FROM
MJ_MSG_DATA MD
, MJ_MSG_GROUP_DATA MG
WHERE 1=1
AND MD.MSG_GROUP_ID = MG.MSG_GROUP_ID
<!-- AND IFNULL(MG.DEL_FLAG, 'N') = 'N' -->
<!-- AND MD.DEL_FLAG = 'N' -->
<!-- JSPark 2023.07.10 알림톡 전송완료 목록은 (즉시 + 예약 발송완료 + 처리안된 지연문자(즉시,예약) 노출 -->
<![CDATA[
AND CASE
WHEN MG.RESERVE_YN = 'N'
THEN (MG.REQ_DATE <= DATE_ADD(NOW(), INTERVAL 60 MINUTE))
WHEN MG.RESERVE_YN = 'Y'
THEN (MG.REQ_DATE <= NOW() OR (MG.AT_DELAY_YN = 'Y' AND MG.AT_DELAY_COMPLETE_YN = 'N'))
END
]]>
<isNotEmpty property="userId">
AND MG.USER_ID = #userId#
</isNotEmpty>
<!-- AND MG.DEL_FLAG ='N' -->
AND MG.RESERVE_C_YN = 'N'
AND MG.MSG_TYPE IN ('8', '9')
)M
LEFT JOIN MJ_KAKAO_PROFILE_INFO MKPI
ON M.MSG_NOTICETALK_SENDER_KEY = MKPI.SENDER_KEY
AND MKPI.USER_ID = M.USER_ID
LEFT JOIN LETTNGNRLMBER LTM
ON M.USER_ID = LTM.MBER_ID
LEFT JOIN BIZ_LOG BL
ON M.BIZ_UMID = BL.CMID
WHERE 1=1
<isNotEmpty property="searchKeyword">
<isEqual property="searchCondition" compareValue="" >
AND (
M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
OR MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
OR M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
)
</isEqual>
<isEqual property="searchCondition" compareValue="1">
AND M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2">
AND MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition" compareValue="3">
AND M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition2" compareValue="" >
AND IFNULL(M.RESERVE_YN, 'N') IN ('Y','N')
</isEqual>
<isEqual property="searchCondition2" compareValue="N">
AND IFNULL(M.RESERVE_YN, 'N') = 'N'
</isEqual>
<isEqual property="searchCondition2" compareValue="Y">
AND IFNULL(M.RESERVE_YN, 'N') = 'Y'
</isEqual>
</isNotEmpty>
<isEmpty property="searchKeyword">
<isNotEmpty property="searchCondition">
<isEqual property="searchCondition" compareValue="" >
AND (
M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
OR MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
OR M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
)
</isEqual>
<isEqual property="searchCondition" compareValue="1">
AND M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2">
AND MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition" compareValue="3">
AND M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchCondition2">
<isEqual property="searchCondition2" compareValue="" >
AND IFNULL(M.RESERVE_YN, 'N') IN ('Y','N')
</isEqual>
<isEqual property="searchCondition2" compareValue="N">
AND IFNULL(M.RESERVE_YN, 'N') = 'N'
</isEqual>
<isEqual property="searchCondition2" compareValue="Y">
AND IFNULL(M.RESERVE_YN, 'N') = 'Y'
</isEqual>
</isNotEmpty>
</isEmpty>
<isNotEmpty property="pageType">
<isEqual property="pageType" compareValue="sand">
AND M.CUR_STATE = '3'
</isEqual>
</isNotEmpty>
<isNotEmpty property="msgType">
<isEqual property="msgType" compareValue="8">
AND M.MSG_TYPE = '8'
</isEqual>
<isEqual property="msgType" compareValue="9">
AND M.MSG_TYPE = '9'
</isEqual>
</isNotEmpty>
<isEmpty property="msgType">
AND M.MSG_TYPE IN ('8','9')
</isEmpty>
<isNotEmpty property="ntceBgnde">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') >= DATE_FORMAT(#ntceBgnde#, '%Y-%m-%d')
]]>
</isNotEmpty>
<isNotEmpty property="ntceEndde">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') <= DATE_FORMAT(#ntceEndde#, '%Y-%m-%d')
]]>
</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$
</isNotEqual>
</isNotEmpty>
<isNotEmpty property="searchSortOrd">
$searchSortOrd$
</isNotEmpty>
LIMIT #recordCountPerPage# OFFSET #firstIndex#
) M2
</select>
<!-- 알림톡 상세 리스트 조회 -->
<select id="mjonKakaoATDAO.selectMjonKakaoATGroupDtList_advc" parameterClass="kakaoVO" resultClass="kakaoVO">
/* mjonKakaoATDAO.selectMjonKakaoATGroupDtList_advc - 알림톡 전송 개별 리스트 */
SELECT
COUNT(M.USER_ID) OVER() AS totCnt
, M.USER_ID AS userId
, MSG_GROUP_ID AS msgGroupId
, MSG_GROUP_CNT AS msgGroupCnt
, MSG_ID AS msgId
, USERDATA AS userData
, 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
, DATE_FORMAT(RSLT_DATE, '%Y-%m-%d %T') AS rsltDate
, CALL_FROM AS callFrom
, CALL_TO AS callTo
, TOT_PRICE AS totPrice
, EACH_PRICE AS eachPrice
, CUR_STATE AS curStateTxt
, RSLT_CODE AS rsltCode
, RSLT_CODE2 AS rsltCode2
, IF((RSLT_CODE != '7000'),'1','0') AS orderByrsltCode
, DEL_FLAG AS delFlag
, MSG_TYPE AS msgType
, FILE_CNT AS fileCnt
, AGENT_CODE AS agentCode
, RESERVE_YN AS reserveYn
, RESERVE_C_YN AS reserveCYn
, CANCELDATE AS cancelDate
, msgTypeName AS msgTypeName
, orderByCode AS orderByCode
, RESULT AS resultCodeTxt
, MSG_NOTICETALK_SENDER_KEY AS msgNoticetalkSenderKey
, MSG_NOTICETALK_TMP_KEY AS msgNoticetalkTmpKey
, MKPI.YELLOW_ID AS yellowId
, LTM.MBER_NM AS userNm
, BIZ_KAKAO_RESEND_YN AS subMsgSendYn
, BIZ_KAKAO_RESEND_TYPE AS subMsgType
, BIZ_KAKAO_RESEND_DATA AS subMsgTxt
, BIZ_KAKAO_JSON_FILE AS bizJsonName
, BIZ_UMID AS bizUmid
FROM
( SELECT
B.USER_ID
, B.MSG_GROUP_ID
, B.MSG_GROUP_CNT
, A.MSG_ID
, A.USERDATA
, B.SMS_TXT
, B.SUBJECT
, B.REGDATE
, A.REQ_DATE
, A.RSLT_DATE
, B.CALL_FROM
, B.TOT_PRICE
, B.EACH_PRICE
, CASE
WHEN B.DEL_FLAG = 'Y'
THEN '삭제'
ELSE '미삭제'
END DEL_FLAG
, B.MSG_TYPE
, B.FILE_CNT
, B.AGENT_CODE
, B.RESERVE_YN
, B.RESERVE_C_YN
, B.CANCELDATE
, A.MSG_SEQ
, A.CALL_TO
, CASE
WHEN A.CUR_STATE = '0'
THEN '전송대기'
WHEN A.CUR_STATE = '3'
THEN '전송완료'
END CUR_STATE
, A.RSLT_CODE
, A.RSLT_CODE2
, CASE
WHEN B.MSG_TYPE = '8'
THEN '알림톡'
WHEN B.MSG_TYPE = '9'
THEN '친구톡'
END msgTypeName
, CASE
WHEN B.MSG_TYPE = '8'
THEN '1'
ELSE '2'
END orderByCode
, (<include refid="KakaoSentDAO.selectAgentResultQuery_A"/>) AS RESULT
, A.MSG_NOTICETALK_SENDER_KEY
, A.MSG_NOTICETALK_TMP_KEY
, CASE
WHEN A.BIZ_KAKAO_RESEND_YN = 'Y'
THEN '발송'
ELSE '미발송'
END BIZ_KAKAO_RESEND_YN
, CASE
WHEN A.BIZ_KAKAO_RESEND_TYPE = 'SMS'
THEN '단문'
ELSE '장문'
END BIZ_KAKAO_RESEND_TYPE
, A.BIZ_KAKAO_RESEND_DATA
, A.BIZ_KAKAO_JSON_FILE
, A.BIZ_UMID
FROM
MJ_MSG_DATA A
, MJ_MSG_GROUP_DATA B
WHERE
A.MSG_GROUP_ID = B.MSG_GROUP_ID
<isNotEmpty property="userId">
AND B.USER_ID = #userId#
</isNotEmpty>
AND A.MSG_GROUP_ID = #msgGroupId#
AND B.RESERVE_C_YN = 'N'
<isNotEmpty property="msgType">
<isEqual property="msgType" compareValue="8">
AND A.MSG_TYPE = '8'
</isEqual>
<isEqual property="msgType" compareValue="9">
AND A.MSG_TYPE = '9'
</isEqual>
</isNotEmpty>
<isEmpty property="msgType">
AND A.MSG_TYPE IN ('8','9')
</isEmpty>
<![CDATA[
AND CASE
WHEN B.RESERVE_YN = 'N'
THEN (B.REQ_DATE <= DATE_ADD(NOW(), INTERVAL 60 MINUTE))
WHEN B.RESERVE_YN = 'Y'
THEN (B.REQ_DATE <= NOW() OR (B.AT_DELAY_YN = 'Y' AND B.AT_DELAY_COMPLETE_YN = 'N'))
END
]]>
)M
LEFT JOIN MJ_KAKAO_PROFILE_INFO MKPI
ON M.MSG_NOTICETALK_SENDER_KEY = MKPI.SENDER_KEY AND MKPI.USER_ID = M.USER_ID
LEFT JOIN LETTNGNRLMBER LTM
ON M.USER_ID = LTM.MBER_ID
WHERE 1=1
<isNotEmpty property="userId">
AND M.USER_ID = #userId#
</isNotEmpty>
<isNotEmpty property="searchKeyword">
<isEqual property="searchCondition" compareValue="" >
AND (
M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
OR MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
OR M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
)
</isEqual>
<isEqual property="searchCondition" compareValue="1">
AND M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2">
AND MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition" compareValue="3">
AND M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition2" compareValue="" >
AND M.RESERVE_YN IN ('Y','N')
</isEqual>
<isEqual property="searchCondition2" compareValue="N">
AND M.RESERVE_YN = 'N'
</isEqual>
<isEqual property="searchCondition2" compareValue="Y">
AND M.RESERVE_YN = 'Y'
</isEqual>
</isNotEmpty>
<isEmpty property="searchKeyword">
<isNotEmpty property="searchCondition">
<isEqual property="searchCondition" compareValue="" >
AND (
M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
OR MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
OR M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
)
</isEqual>
<isEqual property="searchCondition" compareValue="1">
AND M.USER_ID LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2">
AND MKPI.YELLOW_ID LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
<isEqual property="searchCondition" compareValue="3">
AND M.SMS_TXT LIKE CONCAT ('%', #searchKeyword#,'%')
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchCondition2">
<isEqual property="searchCondition2" compareValue="" >
AND M.RESERVE_YN IN ('Y','N')
</isEqual>
<isEqual property="searchCondition2" compareValue="N">
AND M.RESERVE_YN = 'N'
</isEqual>
<isEqual property="searchCondition2" compareValue="Y">
AND M.RESERVE_YN = 'Y'
</isEqual>
</isNotEmpty>
</isEmpty>
<isNotEmpty property="msgType">
<isEqual property="msgType" compareValue="8">
AND MSG_TYPE = '8'
</isEqual>
<isEqual property="msgType" compareValue="9">
AND MSG_TYPE = '9'
</isEqual>
</isNotEmpty>
<isEmpty property="msgType">
AND MSG_TYPE IN ('8','9')
</isEmpty>
<isNotEmpty property="ntceBgnde">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') >= DATE_FORMAT(#ntceBgnde#, '%Y-%m-%d')
]]>
</isNotEmpty>
<isNotEmpty property="ntceEndde">
<![CDATA[
AND DATE_FORMAT(REGDATE, '%Y-%m-%d') <= DATE_FORMAT(#ntceEndde#, '%Y-%m-%d')
]]>
</isNotEmpty>
ORDER BY 1=1
<isNotEmpty property="searchSortCnd">
<isEqual property="searchSortCnd" compareValue="curState">
, curState $searchSortOrd$
, orderByrsltCode
</isEqual>
<isNotEqual property="searchSortCnd" compareValue="curState">
,$searchSortCnd$
</isNotEqual>
</isNotEmpty>
<isNotEmpty property="searchSortOrd">
$searchSortOrd$
</isNotEmpty>
LIMIT #recordCountPerPage# OFFSET #firstIndex#
</select>
<!-- 알림톡 상세 내용 -->
<select id="mjonKakaoATDAO.selectMjonKakaoATVO_advc" parameterClass="kakaoVO" resultClass="kakaoVO">
/* mjonKakaoATDAO.selectMjonKakaoATGroupDtList_advc - 알림톡 전송 상세정보 */
SELECT
COUNT(M.USER_ID) OVER() AS totCnt
, M.USER_ID AS userId
, MSG_GROUP_ID AS msgGroupId
, MSG_GROUP_CNT AS msgGroupCnt
, MSG_ID AS msgId
, USERDATA AS userData
, SMS_TXT AS smsTxt
, M.SUBJECT AS subject
, DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regDate
, DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqDate
, DATE_FORMAT(RSLT_DATE, '%Y-%m-%d %T') AS rsltDate
, CALL_FROM AS callFrom
, CALL_TO AS callTo
, TOT_PRICE AS totPrice
, EACH_PRICE AS eachPrice
, CUR_STATE AS curStateTxt
, RSLT_CODE AS rsltCode
, RSLT_CODE2 AS rsltCode2
, RSLT_NET AS rsltNet
, IF((RSLT_CODE != '7000'),'1','0') AS orderByrsltCode
, DEL_FLAG AS delFlag
, M.MSG_TYPE AS msgType
, FILE_CNT AS fileCnt
, M.AGENT_CODE AS agentCode
, MMRC.RESULT_CODE_TXT AS agentCodeTxt
, RESERVE_YN AS reserveYn
, RESERVE_C_YN AS reserveCYn
, CANCELDATE AS cancelDate
, REFUND_YN AS refundYn
, msgTypeName AS msgTypeName
, orderByCode AS orderByCode
, RESULT AS resultCodeTxt
, MSG_NOTICETALK_SENDER_KEY AS msgNoticetalkSenderKey
, MSG_NOTICETALK_TMP_KEY AS msgNoticetalkTmpKey
, MKPI.YELLOW_ID AS yellowId
, MTHD.CODE_NM AS conectMthdTxt
, LTM.MBER_NM AS userNm
<!-- , successCount -->
, BIZ_KAKAO_RESEND_YN AS subMsgSendYn
, BIZ_KAKAO_RESEND_TYPE AS subMsgType
, BIZ_KAKAO_RESEND_DATA AS subMsgTxt
, BIZ_KAKAO_JSON_FILE AS bizJsonName
, BIZ_UMID AS bizUmid
, CASE
WHEN
BL.CALL_STATUS = '6600' OR BL.CALL_STATUS = '4100'
THEN 'S'
WHEN
(
BL.CALL_STATUS IS NULL
AND BL.STATUS = 0
)
THEN 'W'
ELSE 'F'
END bizLogCallStatusCode
, BL.CALL_STATUS AS bizLogCallStatus
, MMRC2.RESULT_CODE_TXT AS bizLogCallStatusTxt
FROM
( SELECT
B.USER_ID
, B.MSG_GROUP_ID
, B.MSG_GROUP_CNT
, A.MSG_ID
, A.USERDATA
, A.SMS_TXT
, B.SUBJECT
, B.REGDATE
, B.REQ_DATE
, A.RSLT_DATE
, A.RSLT_NET
, B.CALL_FROM
, B.TOT_PRICE
, B.EACH_PRICE
, CASE
WHEN B.DEL_FLAG = 'Y'
THEN '삭제'
ELSE '미삭제'
END DEL_FLAG
, B.MSG_TYPE
, B.FILE_CNT
, B.AGENT_CODE
, B.RESERVE_YN
, B.RESERVE_C_YN
, B.CANCELDATE
, A.REFUND_YN
, A.MSG_SEQ
, A.CALL_TO
, A.CONECT_MTHD
, CASE
WHEN A.CUR_STATE = '0'
THEN '전송대기'
WHEN A.CUR_STATE = '3'
THEN '전송완료'
END CUR_STATE
, A.RSLT_CODE
, A.RSLT_CODE2
, CASE
WHEN B.MSG_TYPE = '8'
THEN '알림톡'
WHEN B.MSG_TYPE = '9'
THEN '친구톡'
END msgTypeName
, CASE
WHEN B.MSG_TYPE = '8'
THEN '1'
ELSE '2'
END orderByCode
, (<include refid="KakaoSentDAO.selectAgentResultQuery_A"/>) AS RESULT
<!-- , (<include refid="mjonKakaoATDAO.selectSuccessResultQuery_C"/>) AS successCount -->
, A.MSG_NOTICETALK_SENDER_KEY
, A.MSG_NOTICETALK_TMP_KEY
, CASE
WHEN A.BIZ_KAKAO_RESEND_YN = 'Y'
THEN '대체문자 발송'
ELSE '대체문자 미발송'
END BIZ_KAKAO_RESEND_YN
, CASE
WHEN A.BIZ_KAKAO_RESEND_TYPE = 'SMS'
THEN '단문'
ELSE '장문'
END BIZ_KAKAO_RESEND_TYPE
, A.BIZ_KAKAO_RESEND_DATA
, A.BIZ_KAKAO_JSON_FILE
, A.BIZ_UMID
FROM
MJ_MSG_DATA A
, MJ_MSG_GROUP_DATA B
WHERE
A.MSG_GROUP_ID = B.MSG_GROUP_ID
<isNotEmpty property="userId">
AND B.USER_ID = #userId#
</isNotEmpty>
AND A.MSG_GROUP_ID = #msgGroupId#
AND B.RESERVE_C_YN = 'N'
)M
LEFT JOIN MJ_KAKAO_PROFILE_INFO MKPI
ON M.MSG_NOTICETALK_SENDER_KEY = MKPI.SENDER_KEY AND MKPI.USER_ID = M.USER_ID AND MKPI.DELETE_YN = 'N'
LEFT JOIN LETTNGNRLMBER LTM
ON M.USER_ID = LTM.MBER_ID
LEFT JOIN MJ_MSG_RESULT_CODE MMRC
ON M.RSLT_CODE = MMRC.RESULT_CODE
AND MMRC.AGENT_CODE = '04'
LEFT JOIN BIZ_LOG BL
ON M.BIZ_UMID = BL.CMID
LEFT JOIN MJ_MSG_RESULT_CODE MMRC2
ON BL.CALL_STATUS = MMRC2.RESULT_CODE
AND MMRC2.AGENT_CODE = '04'
LEFT JOIN(
SELECT CODE_NM, CODE, CODE_DC
FROM LETTCCMMNDETAILCODE
WHERE USE_AT = 'Y'
AND CODE_ID = 'ITN020'
) MTHD ON M.CONECT_MTHD = MTHD.CODE /** 접속기기 */
WHERE 1=1
AND M.USER_ID = #userId#
AND M.USERDATA = #userData#
</select>
</sqlMap>

View File

@ -1385,7 +1385,8 @@
t1.msgNoticetalkSenderKey,
t1.bizKakaoResendYn,
t1.atDelayOrgTime,
t1.divideYN
t1.divideYN,
t1.yellowId
FROM (
SELECT COUNT(B.USER_ID) OVER() AS totMsgCnt,
B.USER_ID AS userId ,
@ -1422,10 +1423,12 @@
A.MSG_NOTICETALK_SENDER_KEY AS msgNoticetalkSenderKey,
A.BIZ_KAKAO_RESEND_YN AS bizKakaoResendYn,
IF(B.AT_DELAY_YN = 'Y' and B.AT_DELAY_COMPLETE_YN = 'N', DATE_ADD(B.REQ_DATE, INTERVAL -30 MINUTE), B.REQ_DATE) AS atDelayOrgTime,
CASE WHEN COUNT(DISTINCT A.REQ_DATE) > 1 THEN 'Y' ELSE 'N' END AS divideYN
CASE WHEN COUNT(DISTINCT A.REQ_DATE) > 1 THEN 'Y' ELSE 'N' END AS divideYN,
C.YELLOW_ID as yellowId
FROM MJ_MSG_DATA A
JOIN MJ_MSG_GROUP_DATA B
ON A.MSG_GROUP_ID = B.MSG_GROUP_ID
left outer join mj_kakao_profile_info C on A.MSG_NOTICETALK_SENDER_KEY = C.SENDER_KEY
WHERE (
B.DEL_FLAG = 'N' OR B.DEL_FLAG IS NULL
)