package itn.let.mjo.msgsent.web;

import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
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.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
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.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import itn.com.cmm.EgovMessageSource;
import itn.com.cmm.LoginVO;
import itn.com.cmm.service.EgovFileMngService;
import itn.com.cmm.service.EgovFileMngUtil;
import itn.com.cmm.util.DateUtils;
import itn.com.utl.fcc.service.EgovStringUtil;
import itn.let.kakao.user.sent.service.KakaoSentService;
import itn.let.mail.service.StatusResponse;
import itn.let.mjo.addr.service.AddrGroupService;
import itn.let.mjo.addr.service.AddrGroupVO;
import itn.let.mjo.addr.service.AddrService;
import itn.let.mjo.addr.service.AddrVO;
import itn.let.mjo.apikey.service.ApiKeyMngService;
import itn.let.mjo.apikey.service.ApiKeyVO;
import itn.let.mjo.msgsent.service.MjonMsgDetailSentVO;
import itn.let.mjo.msgsent.service.MjonMsgSentCntVO;
import itn.let.mjo.msgsent.service.MjonMsgSentService;
import itn.let.mjo.msgsent.service.MjonMsgSentVO;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
public class MjonMsgSentController {

	@Resource(name = "MjonMsgSentService")
    private MjonMsgSentService mjonMsgSentService;
	
	@Resource (name = "AddrGroupService")
	private AddrGroupService addrGroupService;
	
	@Resource (name = "AddrService")
	private AddrService addrService;
	
	/** EgovMessageSource */
    @Resource(name="egovMessageSource")
    EgovMessageSource egovMessageSource;
    
    @Resource(name="EgovFileMngUtil")
	private EgovFileMngUtil fileUtil;
    
    @Resource(name="EgovFileMngService")
    private EgovFileMngService fileMngService;
    
    @Resource(name = "KakaoSentService")
	private KakaoSentService kakaoSentService;
	
	//api key 정보
	@Resource(name = "apiKeyMngService")
    private ApiKeyMngService apiKeyMngService;

    
private static final Logger logger = LoggerFactory.getLogger(MjonMsgSentController.class);
	
    /**
     * 발송관리 화면 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/msgtxt/selectMsgTxtView.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSentView.do"})
	public String selectMsgSentView(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO,
			RedirectAttributes redirectAttributes,	ModelMap model) throws Exception{
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	if(loginVO == null) {
			//redirectAttributes.addFlashAttribute("message", "문자온 서비스는 로그인 후 이용 가능합니다.");
			return "redirect:/web/user/login/login.do";
		}
    	
//    	mjonMsgSentVO.setUserId(userId);
//    	ApiKeyVO apiKeyVO = new ApiKeyVO();
//    	apiKeyVO.setMberId(userId);
//		model.addAttribute("appMgmt", apiKeyMngService.selectMberApiKeyChk(apiKeyVO) > 0 ? true : false);
    	
    	
    	
    	
    	// 검색 리스트 불러오기
		if(mjonMsgSentVO.getPageUnit() != 10) {
			mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
		}
		
    	//기본 내림차순 정렬
    	if(mjonMsgSentVO.getSearchSortOrd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortOrd("desc");
    		
    	}
    	
    	//기본 등록일자 정렬
    	if(mjonMsgSentVO.getSearchSortCnd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortCnd("regdate");
    	
    	}
    	
//    	log.info(" + mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
//    	log.info(" + mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
//    	log.info(" + mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
//    	log.info(" + mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
//    	log.info(" + mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
    	String startDate = mjonMsgSentVO.getSearchStartDate();
    	String endDate = mjonMsgSentVO.getSearchEndDate();
    	
    	if(StringUtils.isEmpty(startDate) 
    			&& StringUtils.isEmpty(endDate)) 
    	{
    		
        	mjonMsgSentVO.setSearchStartDate(DateUtils.getDateMonthsAgo(3));
        	mjonMsgSentVO.setSearchEndDate(DateUtils.getCurrentDate());
        	
    	}

    	log.info("pageIndex :: [{}]", mjonMsgSentVO.getPageIndex());
    	model.addAttribute("searchKeyword", mjonMsgSentVO.getSearchKeyword());
    	model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
    	model.addAttribute("siteId", mjonMsgSentVO.getSiteId());
    	
		return "web/msgsent/MsgSentView";
	}
	

    /**
     * 발송관리 화면 
     * @param searchVO
     * @param model/web/user/login/login.do
     * @return	"/web/mjon/msgtxt/selectMsgTxtView.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/msgSentDetailView.do"})
	public String selectMsgSentDetailView(@ModelAttribute("searchVO") MjonMsgDetailSentVO mjonMsgDetailSentVO
			, ModelMap model) throws Exception{
		

			//로그인 권한정보 불러오기
			LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
			String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
			if(loginVO == null) {
				return "redirect:/web/user/login/login.do";
			}
		
			Map<String, Object> resultMap = mjonMsgSentService.selectAllMsgSentDetailView(mjonMsgDetailSentVO);
			model.addAttribute("result", resultMap.get("result"));
		
		return "web/msgsent/MsgSentDetailView";
	}

    // 팩스 금일 발송통계 갱신
	@RequestMapping(value= {"/web/mjon/msgsent/findByMsgDetailListAjax.do"})
 	public ResponseEntity<StatusResponse> findByMsgDetailListAjax(MjonMsgDetailSentVO mjonMsgDetailSentVO) throws Exception {

			
		List<MjonMsgDetailSentVO> resultList = mjonMsgSentService.findByMsgDetailListAjax(mjonMsgDetailSentVO);
		

		return ResponseEntity.ok().body(new StatusResponse(HttpStatus.OK, "", resultList));
 	}

    /**
     * 마이페이지 - 이용내역	-	ajax
     * @param mjonMsgVO
     * @param model
     * @return	"/web/member/pay/PayUserListAjax.do"
     * @throws Exception
     */
	@RequestMapping(value="/web/msgsent/subcontent/MsgSentView_HA_allSentAjax.do")
    public String mberInfo_cash_pointAjax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO,
    		HttpServletRequest request,
    		ModelMap model) throws Exception{
    	
		
    	LoginVO	loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());

    	
    	mjonMsgSentVO.setUserId(userId);
    	
    	log.info("+ mjonMsgSentVO.getSearchStartDate() :: [{}]", mjonMsgSentVO.getSearchStartDate());
    	log.info("+ mjonMsgSentVO.getSearchEndDate() :: [{}]", mjonMsgSentVO.getSearchEndDate());
    	//전체 발송 건수 통계 불러오기
    	mjonMsgSentVO.setMsgType("");
    	long startTime = System.nanoTime(); // 시작 시간 측정
    	List<MjonMsgSentVO> totalMsgCnt = mjonMsgSentService.selectDetailMsgSentCntMix(mjonMsgSentVO);

    	long endTime = System.nanoTime(); // 종료 시간 측정
    	double executionTimeInSeconds = (endTime - startTime) / 1_000_000_000.0;
    	System.out.println("Execution time: " + executionTimeInSeconds + " seconds");
    	
    	
    	// H:홈페이지, A:API 로 sms, lms, mms 나누는 영역
    	List<MjonMsgSentVO> H_smsMsgCnt = new ArrayList<MjonMsgSentVO>();
    	List<MjonMsgSentVO> H_lmsMsgCnt = new ArrayList<MjonMsgSentVO>();
    	List<MjonMsgSentVO> H_mmsMsgCnt = new ArrayList<MjonMsgSentVO>();
    	
    	totalMsgCnt.forEach(t->{
    		if (Integer.parseInt(t.getFilePath1())>0) {
    			H_smsMsgCnt.add(t);
    		} else if (Integer.parseInt(t.getFilePath2())>0) {
    			H_lmsMsgCnt.add(t);
    		} else if (Integer.parseInt(t.getFilePath3())>0) {
    			H_mmsMsgCnt.add(t);
    		}
    	});
    	
    	 //* 홈페이지에서 보낸 데이터 LIST
    	 //* SEND_KIND = "H"

    	// 전체 영역
    	log.info("all");
    	model.addAttribute("H_allSentCntVO", this.getResultCntProc(totalMsgCnt));
    	// 전체 단문(SMS)
    	log.info("sms");
    	model.addAttribute("H_smsSentCntVO", this.getResultCntProc(H_smsMsgCnt));
    	// 전체 장문(LMS)
    	log.info("lms");
    	model.addAttribute("H_lmsSentCntVO", this.getResultCntProc(H_lmsMsgCnt));
    	// 전체 그림(MMS)
    	log.info("mms");
    	model.addAttribute("H_mmsSentCntVO", this.getResultCntProc(H_mmsMsgCnt));
    	
    	
    	
    	return "/web/msgsent/subcontent/MsgSentView_HA_allSentAjax";
    }
	
    /** 
     * @methodName	: getResultCntProc 
     * @author		: 이호영
     * @date		: 2023.07.26 
     * @description	: MsgSentView.jsp에서 JSTL로 계산하는 것을 JAVA로 분리 
     * @param msgCnt
     * @param smsMsgCnt
     * @param lmsMsgCnt
     * @param mmsMsgCnt
     * @return 
     */
    private MjonMsgSentCntVO getResultCntProc(List<MjonMsgSentVO> msgCnt) {
//    	MjonMsgSentCntVO mjonSentCntVO = new MjonMsgSentCntVO();
    	MjonMsgSentCntVO cntVO = new MjonMsgSentCntVO();
    	

		/*    	 
		 * 전체 통계
		 * */
    	// 전체 대기 갯수
    	cntVO.setWaitCnt(msgCnt.stream()
    			.filter(f->"W".equals(f.getMsgResultSts()))
    			.mapToInt(t -> Integer.parseInt(t.getMsgResultCnt())).sum());
    	log.info(" :: cntVO.getWaitCnt() :: [{}]", cntVO.getWaitCnt());
    	// 전체 성공 갯수
    	cntVO.setSuccCnt(msgCnt.stream()
    			.filter(f->"S".equals(f.getMsgResultSts()))
    			.mapToInt(t -> Integer.parseInt(t.getMsgResultCnt())).sum());
    	log.info(" :: cntVO.getSuccCnt() :: [{}]", cntVO.getSuccCnt());
    	// 전체 실패 갯수
    	cntVO.setFailCnt(msgCnt.stream()
    			.filter(f->"F".equals(f.getMsgResultSts()))
    			.mapToInt(t -> Integer.parseInt(t.getMsgResultCnt())).sum());
    	log.info(" :: cntVO.getFailCnt() :: [{}]", cntVO.getFailCnt());

    	// 전체 갯수 구하기
    	cntVO.setTotCnt(cntVO.getWaitCnt() + cntVO.getSuccCnt() + cntVO.getFailCnt());

    	
		return cntVO;
	}

	/**
     * 발송관리 탭 리스트 화면 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/reservmsg/selectReservMsgListViewAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSentListViewAjax.do"})
	public String selectMsgSentListViewAjax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
		String pageUrl = "";
		try {
			

	    	log.info(" ListView pageIndex :: [{}]", mjonMsgSentVO.getPageIndex());
	    	log.info(" ListView pageUnit :: [{}]", mjonMsgSentVO.getPageUnit());
				
				
			//로그인 권한정보 불러오기
	    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
	    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
	    	
	    	mjonMsgSentVO.setUserId(userId);
	    	
	    	// 검색 리스트 불러오기
//			if(mjonMsgSentVO.getPageUnit() != 10) {
//				mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
//			}
			
	    	//기본 내림차순 정렬
	    	if(StringUtils.isEmpty(mjonMsgSentVO.getSearchSortOrd())) {
	    		
	    		mjonMsgSentVO.setSearchSortOrd("desc");
	    		mjonMsgSentVO.setSearchSortCnd("B.REQ_DATE");
	    	}
	    	
	    	
	    	//선택 탭 정보 저장
	    	//mjonResvMsgVO.setSearchMsgType(mjonResvMsgVO.getTabType());
	    	
			/** pageing */
			PaginationInfo paginationInfo = new PaginationInfo();
			paginationInfo.setCurrentPageNo(mjonMsgSentVO.getPageIndex());
			paginationInfo.setRecordCountPerPage(mjonMsgSentVO.getPageUnit());
			paginationInfo.setPageSize(mjonMsgSentVO.getPageSize());
	
			mjonMsgSentVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
			mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
			mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
			
			if(!DateUtils.dateChkAndValueChk(mjonMsgSentVO.getSearchStartDate(),mjonMsgSentVO.getSearchEndDate(), 3 )) {
				mjonMsgSentVO.setSearchStartDate(DateUtils.getDateMonthsAgo(3));
				mjonMsgSentVO.setSearchEndDate(DateUtils.getCurrentDate());
			};
	
			model.addAttribute("searchStartDate", mjonMsgSentVO.getSearchStartDate());
			model.addAttribute("searchEndDate", mjonMsgSentVO.getSearchEndDate());
			
			//전체 발송 리스트 불러오기
			Map<String, Object> resultMap = mjonMsgSentService.selectAllMsgSentList_advc(mjonMsgSentVO);
			
			
			model.addAttribute("resultAllSentList", resultMap.get("resultList"));
			
			
			paginationInfo.setTotalRecordCount((Integer)resultMap.get("totalCnt"));
			model.addAttribute("paginationInfo", paginationInfo);
			model.addAttribute("totalRecordCount", paginationInfo.getTotalRecordCount());
	
			model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
			
			String stateType = mjonMsgSentVO.getStateType();
			
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
		}
    	
		return "web/msgsent/MsgSentAllListAjax";
	}
	
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSentListViewAjax_backup.do"})
	public String selectMsgSentListViewAjax_backup(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
			
			
		
		//로그인 권한정보 불러오기
		LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
		String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
		
		mjonMsgSentVO.setUserId(userId);
		
		// 검색 리스트 불러오기
		if(mjonMsgSentVO.getPageUnit() != 10) {
			mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
		}
		
		//기본 내림차순 정렬
		if(mjonMsgSentVO.getSearchSortOrd().equals("")) {
			
			mjonMsgSentVO.setSearchSortOrd("desc");
			mjonMsgSentVO.setSearchSortCnd("regdate");
		}
		
		if(mjonMsgSentVO.getListType().equals("")) {
			
			mjonMsgSentVO.setListType("groupList");
			
		}
		
		//선택 탭 정보 저장
		//mjonResvMsgVO.setSearchMsgType(mjonResvMsgVO.getTabType());
		
		/** pageing */
		PaginationInfo paginationInfo = new PaginationInfo();
		paginationInfo.setCurrentPageNo(mjonMsgSentVO.getPageIndex());
		paginationInfo.setRecordCountPerPage(mjonMsgSentVO.getPageUnit());
		paginationInfo.setPageSize(mjonMsgSentVO.getPageSize());
		
		mjonMsgSentVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
		mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
		mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
		
		
		
		if(!DateUtils.dateChkAndValueChk(mjonMsgSentVO.getStartDate(),mjonMsgSentVO.getEndDate(), 3 )) {
			mjonMsgSentVO.setStartDate(DateUtils.getDateMonthsAgo(3));
			mjonMsgSentVO.setEndDate(DateUtils.getCurrentDate());
		};
		
		model.addAttribute("startDate", mjonMsgSentVO.getStartDate());
		model.addAttribute("endDate", mjonMsgSentVO.getEndDate());
		
		//전체 발송 리스트 불러오기
		List<MjonMsgSentVO> resultAllSentList = mjonMsgSentService.selectAllMsgSentList(mjonMsgSentVO);
		
		
		model.addAttribute("resultAllSentList", resultAllSentList);
		model.addAttribute("resultAllSentCnt", resultAllSentList.size());
		
		model.addAttribute("searchKeyword", mjonMsgSentVO.getSearchKeyword());
		paginationInfo.setTotalRecordCount( resultAllSentList.size()> 0 ? (Integer.parseInt((resultAllSentList.get(0)).getTotMsgCnt())) : 0);
		model.addAttribute("paginationInfo", paginationInfo);
		model.addAttribute("totalRecordCount", paginationInfo.getTotalRecordCount());
		
		//발송 결과 성공 실패 건수 리스트 불러오기
		List<MjonMsgSentVO> resultMsgSucFailList = new ArrayList<MjonMsgSentVO>(); 
		
		if(resultAllSentList.size() > 0) {
			System.out.println("=====resultMsgSucFailList=====");
			resultMsgSucFailList = mjonMsgSentService.selectAllMsgSentSucFailList(resultAllSentList, mjonMsgSentVO);
			System.out.println("//=====resultMsgSucFailList=====");
		}
		model.addAttribute("resultMsgSucFailList", resultMsgSucFailList);
		
		model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
		
		String stateType = mjonMsgSentVO.getStateType();
		//    	String pageUrl = "web/msgsent/MsgSentAllListAjax";
		String pageUrl = "web/msgsent/MsgSentAllListAjax";
		
		if(stateType.equals("ready")) {
			
			pageUrl = "web/msgsent/MsgSentReadyListAjax";
			
		}else if(stateType.equals("complete")) {
			
			pageUrl = "web/msgsent/MsgSentCompleteListAjax";
			
		}else if(stateType.equals("fail")) {
			
			pageUrl = "web/msgsent/MsgSentFailListAjax";
			
		}	
		
		log.info(" :: pageUrl   [{}]", pageUrl);
		return pageUrl;
	}
	
    /**
     * 발송관리  건수별 상세 리스트 조회(전송건별) 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/msgsent/selectMsgSFDetailListAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSFDetailListAjax.do"})
	public String selectMsgSFDetailListAjax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	mjonMsgSentVO.setUserId(userId);
    	
    	// 검색 리스트 불러오기
		if(mjonMsgSentVO.getPageUnit() != 10) {
			mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
		}
		
    	//기본 내림차순 정렬
    	if(mjonMsgSentVO.getSearchSortOrd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortOrd("desc");
    		mjonMsgSentVO.setSearchSortCnd("regdate");
    	}
    	
    	mjonMsgSentVO.setListType("privateList");
    	
		/** pageing */
		PaginationInfo paginationInfo = new PaginationInfo();
		paginationInfo.setCurrentPageNo(mjonMsgSentVO.getPageIndex());
		paginationInfo.setRecordCountPerPage(mjonMsgSentVO.getPageUnit());
		paginationInfo.setPageSize(mjonMsgSentVO.getPageSize());

		mjonMsgSentVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
		mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
		mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
    	
    	//전체 발송 리스트 불러오기
    	List<MjonMsgSentVO> resultAllSentList = mjonMsgSentService.selectAllMsgSentDetailList(mjonMsgSentVO);
    	model.addAttribute("resultAllSentList", resultAllSentList);
    	model.addAttribute("resultAllSentCnt", resultAllSentList.size());
    	
    	model.addAttribute("searchKeyword", mjonMsgSentVO.getSearchKeyword());
    	paginationInfo.setTotalRecordCount( resultAllSentList.size()> 0 ? (Integer.parseInt((resultAllSentList.get(0)).getTotMsgCnt())) : 0);
    	model.addAttribute("paginationInfo", paginationInfo);
    	model.addAttribute("totalRecordCount", paginationInfo.getTotalRecordCount());
    	
    	// JSPark 2023.02.28 => 위 쿼리에 문자결과 항목추가로 아래 데이터 불필요
    	//발송 결과 성공 실패 건수 리스트 불러오기
    	//List<MjonMsgSentVO> resultMsgSucFailList = mjonMsgSentService.selectAllMsgSentSFDetailList(mjonMsgSentVO);
    	//model.addAttribute("resultMsgSucFailList", resultMsgSucFailList);
    	
    	model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
    	
		return "web/msgsent/MsgSentSFDetailListAjax";
	}	
		
		
    /**
     * 발송관리 문자 상세보기 내용 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/msgsent/selectMsgSentDetailDataAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSentDetailDataAjax.do"})
	public String selectMsgSentDetailDataAjax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	mjonMsgSentVO.setUserId(userId);
    	
    	//발송 관리 문자발송 내용 상세보기 팝업 => 문자내용(MJ_MSG_DATA)
    	MjonMsgSentVO resultMsgDetail = mjonMsgSentService.selectMsgSentDetailDataAjax(mjonMsgSentVO);
    	
    	if(resultMsgDetail.getFileCnt() != "0") {
    		if(resultMsgDetail.getFilePath1() != null) {
    			String filePathId1 = resultMsgDetail.getFilePath1().substring(resultMsgDetail.getFilePath1().lastIndexOf("/")+1);
    			int idx = filePathId1.lastIndexOf(".");
    			String fileId = filePathId1.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId1", info.getAtchFileId());
    			model.addAttribute("fileSn1", info.getFileSn());
    		}
    		
    		if(resultMsgDetail.getFilePath2() != null) {
    			String filePathId2 = resultMsgDetail.getFilePath2().substring(resultMsgDetail.getFilePath2().lastIndexOf("/")+1);
    			int idx = filePathId2.lastIndexOf(".");
    			String fileId = filePathId2.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId2", info.getAtchFileId());
    			model.addAttribute("fileSn2", info.getFileSn());
    		}
    		
    		if(resultMsgDetail.getFilePath3() != null) {
    			String filePathId3 = resultMsgDetail.getFilePath3().substring(resultMsgDetail.getFilePath3().lastIndexOf("/")+1);
    			int idx = filePathId3.lastIndexOf(".");
    			String fileId = filePathId3.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId3", info.getAtchFileId());
    			model.addAttribute("fileSn3", info.getFileSn());
    		}
    	}
    	
    	
    	model.addAttribute("resultMsgDetail", resultMsgDetail);
    	
		return "web/msgsent/MsgSentDetailPopAjax";
	}
	
	
	
	
    /**
     * 발송관리 문자 상세보기 내용 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/msgsent/selectMsgSentDetailDataAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/selectMsgSentDetailData2Ajax.do"})
	public String selectMsgSentDetailData2Ajax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	mjonMsgSentVO.setUserId(userId);
    	
    	//발송 관리 문자발송 내용 상세보기 팝업 => 문자내용(MJ_MSG_DATA)
    	MjonMsgSentVO resultMsgDetail = mjonMsgSentService.selectMsgSentDetailDataAjax2(mjonMsgSentVO);
    	
    	if(resultMsgDetail.getFileCnt() != "0") {
    		if(resultMsgDetail.getFilePath1() != null) {
    			String filePathId1 = resultMsgDetail.getFilePath1().substring(resultMsgDetail.getFilePath1().lastIndexOf("/")+1);
    			int idx = filePathId1.lastIndexOf(".");
    			String fileId = filePathId1.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId1", info.getAtchFileId());
    			model.addAttribute("fileSn1", info.getFileSn());
    		}
    		
    		if(resultMsgDetail.getFilePath2() != null) {
    			String filePathId2 = resultMsgDetail.getFilePath2().substring(resultMsgDetail.getFilePath2().lastIndexOf("/")+1);
    			int idx = filePathId2.lastIndexOf(".");
    			String fileId = filePathId2.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId2", info.getAtchFileId());
    			model.addAttribute("fileSn2", info.getFileSn());
    		}
    		
    		if(resultMsgDetail.getFilePath3() != null) {
    			String filePathId3 = resultMsgDetail.getFilePath3().substring(resultMsgDetail.getFilePath3().lastIndexOf("/")+1);
    			int idx = filePathId3.lastIndexOf(".");
    			String fileId = filePathId3.substring(0, idx);
    			MjonMsgSentVO info = mjonMsgSentService.selectFileInfo(fileId);
    			model.addAttribute("atchFileId3", info.getAtchFileId());
    			model.addAttribute("fileSn3", info.getFileSn());
    		}
    	}
    	
    	
    	model.addAttribute("resultMsgDetail", resultMsgDetail);
    	
		return "web/msgsent/MsgSentDetailPop2Ajax";
	}	
	
    /**
     * 발송 관리 문자 선택 삭제 기능 
     * @param searchVO
     * @param model
     * @return	"web/mjon/msgsent/deleteMsgSentDataAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/deleteMsgSentDataAjax.do"})
	public String deleteMsgSentDataAjax(@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, ModelMap model) throws Exception{
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	mjonMsgSentVO.setUserId(userId);
    	
    	//선택 문자 삭제 처리
    	int resultCnt = mjonMsgSentService.deleteMsgSentDataAjax(mjonMsgSentVO);
    	
    	/*
    	 * 
    	 * 리스트 화면 불러오기
    	 * 
    	 * */
    	
    	// 검색 리스트 불러오기
		if(mjonMsgSentVO.getPageUnit() != 10) {
			mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
		}
		
    	//기본 내림차순 정렬
    	if(mjonMsgSentVO.getSearchSortOrd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortOrd("desc");
    		
    	}
    	
    	//기본 등록일자 정렬
    	if(mjonMsgSentVO.getSearchSortCnd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortCnd("regdate");
    		
    	}

		/** pageing */
		PaginationInfo paginationInfo = new PaginationInfo();
		paginationInfo.setCurrentPageNo(mjonMsgSentVO.getPageIndex());
		paginationInfo.setRecordCountPerPage(mjonMsgSentVO.getPageUnit());
		paginationInfo.setPageSize(mjonMsgSentVO.getPageSize());

		mjonMsgSentVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
		mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
		mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
    	
    	//전체 발송 리스트 불러오기
    	List<MjonMsgSentVO> resultAllSentList = mjonMsgSentService.selectAllMsgSentList(mjonMsgSentVO);
    	model.addAttribute("resultAllSentList", resultAllSentList);
    	model.addAttribute("resultAllSentCnt", resultAllSentList.size());
    	
    	model.addAttribute("searchKeyword", mjonMsgSentVO.getSearchKeyword());
    	paginationInfo.setTotalRecordCount( resultAllSentList.size()> 0 ? (Integer.parseInt((resultAllSentList.get(0)).getTotMsgCnt())) : 0);
    	model.addAttribute("paginationInfo", paginationInfo);
    	model.addAttribute("totalRecordCount", paginationInfo.getTotalRecordCount());
    	
    	model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
    	
    	String stateType = mjonMsgSentVO.getStateType();
    	String pageUrl = "web/msgsent/MsgSentAllListAjax";
    	
    	if(stateType.equals("ready")) {
    		
    		pageUrl = "web/msgsent/MsgSentReadyListAjax";
    		
    	}else if(stateType.equals("complete")) {
    		
    		pageUrl = "web/msgsent/MsgSentCompleteListAjax";
    		
    	}else if(stateType.equals("fail")) {
    		
    		pageUrl = "web/msgsent/MsgSentFailListAjax";
    		
    	}
		return pageUrl;
	}
	
	/**
	 * 발송문자 수신번호 주소록에서 삭제 하기 
	 *
	 * @param MjonMsgSentVO
	 * @param 
	 * @param sessionVO
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value= {"/web/mjon/msgsent/deleteAddrNoDataAjax.do"})
	public ModelAndView deleteAddrNoDataAjax(
			@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, 
			ModelMap model) throws Exception {

		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("jsonView");
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	if(userId.equals("")) {
    		
    		modelAndView.addObject("status", "loginFail");
    		modelAndView.addObject("message", "로그인이 필요합니다.");
    		return modelAndView;
    		
    	}else {
    		
    		mjonMsgSentVO.setUserId(userId);
    		
    	}
		
		String listType = mjonMsgSentVO.getListType();
		
		if(listType.equals("")) {
			
			mjonMsgSentVO.setListType("groupList");
			
		}
		
		try {

			//문자 발송 테이블에서 수신자 목록 리스트 불러오기
			List<String> resultCallToList = mjonMsgSentService.selectCallToListData(mjonMsgSentVO);
			
			MjonMsgSentVO mjonMsgCallListVO = new MjonMsgSentVO();
			
			//디비에서 불러온 수신자 번호 리스트 저장
			mjonMsgCallListVO.setCallToList(resultCallToList);
			
			//아이디 저장
			mjonMsgCallListVO.setUserId(userId);
			
			//주소록 디비에서 연락처 정보를 delete 시킴
			int resultCnt = mjonMsgSentService.deleteAddrPhoneNo(mjonMsgCallListVO);
				
			modelAndView.addObject("status", "success");
			modelAndView.addObject("message", "총 " + resultCnt + "건의 주소록을 삭제하였습니다.");
			modelAndView.addObject("resultCnt", resultCnt);
				
			
		} catch (Exception e) {
			modelAndView.addObject("status", "fail");
			modelAndView.addObject("message", "주소록 삭제 중 오류가 발생하였습니다.");
		}
		
		return modelAndView;
	}
	
	
	/**
	 * 발송문자 수신거부번호 등록 하기 
	 *
	 * @param MjonMsgSentVO
	 * @param 
	 * @param sessionVO
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value= {"/web/mjon/msgsent/insertAddBlockNoDataAjax.do"})
	public ModelAndView insertAddBlockNoDataAjax(
			@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, 
			ModelMap model) throws Exception {

		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("jsonView");
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	if(userId.equals("")) {
    		
    		modelAndView.addObject("status", "loginFail");
    		modelAndView.addObject("message", "로그인이 필요합니다.");
    		return modelAndView;
    		
    	}else {
    		
    		mjonMsgSentVO.setUserId(userId);
    		
    	}
		
		String listType = mjonMsgSentVO.getListType();
		
		if(listType.equals("")) {
			
			mjonMsgSentVO.setListType("groupList");
			
		}
		
		try {
			
			if("fail".equals(mjonMsgSentVO.getStateType())) {
				mjonMsgSentVO.setListType("privateList");
			}
			
			//문자 발송 테이블에서 수신자 목록 리스트 불러오기
			List<String> resultCallToList = mjonMsgSentService.selectCallToListData(mjonMsgSentVO);
			
			MjonMsgSentVO mjonMsgCallListVO = new MjonMsgSentVO();
			
			//디비에서 불러온 수신자 번호 리스트 저장
			mjonMsgCallListVO.setCallToList(resultCallToList);
			
			//아이디 저장
			mjonMsgCallListVO.setUserId(userId);
			
			//주소록 디비에서 연락처 정보를 delete 시킴
			int resultCnt = mjonMsgSentService.insertAddBlockNoDataAjax(mjonMsgCallListVO);
				
			modelAndView.addObject("status", "success");
			modelAndView.addObject("message", "총 " + resultCnt + "건의 수신거부번호를 등록하였습니다.");
			modelAndView.addObject("resultCnt", resultCnt);
				
			
		} catch (Exception e) {
			modelAndView.addObject("status", "fail");
			modelAndView.addObject("message", "수신거부번호 등록 중 오류가 발생하였습니다.");
		}
		
		return modelAndView;
	}
	
	
	/**
	 * 발송문자 주소록 그룹 등록 하기 
	 *
	 * @param MjonMsgSentVO
	 * @param 
	 * @param sessionVO
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value= {"/web/mjon/msgsent/insertAddAddrGrpDataAjax.do"})
	public ModelAndView insertAddAddrGrpDataAjax(
			@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, 
			ModelMap model) throws Exception {

		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("jsonView");
		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	
    	if(userId.equals("")) {
    		
    		modelAndView.addObject("status", "loginFail");
    		modelAndView.addObject("message", "로그인이 필요합니다.");
    		return modelAndView;
    		
    	}else {
    		
    		mjonMsgSentVO.setUserId(userId);
    		
    	}
		
		String listType = mjonMsgSentVO.getListType();
		
		if(listType.equals("")) {
			
			mjonMsgSentVO.setListType("groupList");
			
		}
		
		try {

			//문자 발송 테이블에서 수신자 목록 리스트 불러오기
			List<String> resultCallToList = mjonMsgSentService.selectCallToListData(mjonMsgSentVO);
			
			MjonMsgSentVO mjonMsgCallListVO = new MjonMsgSentVO();
			
			//디비에서 불러온 수신자 번호 리스트 저장
			mjonMsgCallListVO.setCallToList(resultCallToList);
			
			//아이디 저장
			mjonMsgCallListVO.setUserId(userId);
			
			int resultCnt = 0;
			
			AddrGroupVO addrGroupVO = new AddrGroupVO();
			
			//신규 그룹 등록
			addrGroupVO.setAddrGrpNm(mjonMsgSentVO.getAddrGrpNm());
			addrGroupVO.setMberId(userId);
			addrGroupVO.setFrstRegisterId(userId);
			
			String addrGrpId = addrGroupService.insertAddrGroup(addrGroupVO);
			
			if(addrGrpId != null) {

				List<AddrVO> addrDataInfo = new ArrayList<AddrVO>();

				for(String phone : resultCallToList) {
					AddrVO addrVO = new AddrVO();
					addrVO.setAddrPhoneNo(phone);
					addrVO.setAddrGrpId(addrGrpId);
					addrVO.setBookmark("N"); //북마크 : N
					addrVO.setFrstRegisterId(userId);
					addrVO.setMberId(userId);
					addrDataInfo.add(addrVO);
				}

				resultCnt = addrService.insertAddrList(addrDataInfo);

			}
			
			//주소록 디비에서 연락처 정보를 delete 시킴
			//int resultCnt = mjonMsgSentService.insertAddBlockNoDataAjax(mjonMsgCallListVO);
				
			modelAndView.addObject("status", "success");
			modelAndView.addObject("message", "총 " + resultCnt + "건의 수신번호를 등록하였습니다.");
			modelAndView.addObject("resultCnt", resultCnt);
			
			
				
			
		} catch (Exception e) {
			modelAndView.addObject("status", "fail");
			modelAndView.addObject("message", "주소록 등록 중 오류가 발생하였습니다.");
		}
		
		return modelAndView;
	}
	
	
	/**
	 * 발송관리 출력하기 팝업화면 
	 *
	 * @param MjonMsgSentVO
	 * @param 
	 * @param sessionVO
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value= {"/web/mjon/msgsent/printMsgSentDataAjax.do"})
	public String printMsgSentDataAjax(
			@ModelAttribute("searchVO") MjonMsgSentVO mjonMsgSentVO, 
			ModelMap model) throws Exception {

		
		//로그인 권한정보 불러오기
    	LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
    	String userNm = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getName());
    	
    	if(userId.equals("")) {
    		
    		/*modelAndView.addObject("status", "loginFail");
    		modelAndView.addObject("message", "로그인이 필요합니다.");
    		return modelAndView;*/
    		
    	}else {
    		
    		mjonMsgSentVO.setUserId(userId);
    		
    	}
    	
    	// 검색 리스트 불러오기
		if(mjonMsgSentVO.getPageUnit() != 10) {
			mjonMsgSentVO.setPageUnit(mjonMsgSentVO.getPageUnit());
		}
		
    	//기본 내림차순 정렬
    	if(mjonMsgSentVO.getSearchSortOrd().equals("")) {
    		
    		mjonMsgSentVO.setSearchSortOrd("desc");
    		mjonMsgSentVO.setSearchSortCnd("regdate");
    	}
    	
    	if(mjonMsgSentVO.getListType().equals("")) {
    		
    		mjonMsgSentVO.setListType("groupList");
    		
    	}
    	
    	//선택 탭 정보 저장
    	//mjonResvMsgVO.setSearchMsgType(mjonResvMsgVO.getTabType());
    	
		/** pageing */
		PaginationInfo paginationInfo = new PaginationInfo();
		paginationInfo.setCurrentPageNo(mjonMsgSentVO.getPageIndex());
		paginationInfo.setRecordCountPerPage(mjonMsgSentVO.getPageUnit());
		paginationInfo.setPageSize(mjonMsgSentVO.getPageSize());

		mjonMsgSentVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
		mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
		mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
    	
    	//전체 발송 리스트 불러오기
    	List<MjonMsgSentVO> resultAllSentList = mjonMsgSentService.selectAllMsgSentList(mjonMsgSentVO);
    	model.addAttribute("resultAllSentList", resultAllSentList);
    	model.addAttribute("resultAllSentCnt", resultAllSentList.size());
    	
    	model.addAttribute("searchKeyword", mjonMsgSentVO.getSearchKeyword());
    	paginationInfo.setTotalRecordCount( resultAllSentList.size()> 0 ? (Integer.parseInt((resultAllSentList.get(0)).getTotMsgCnt())) : 0);
    	model.addAttribute("paginationInfo", paginationInfo);
    	model.addAttribute("totalRecordCount", paginationInfo.getTotalRecordCount());
    	
    	//발송 결과 성공 실패 건수 리스트 불러오기
    	List<MjonMsgSentVO> resultMsgSucFailList = mjonMsgSentService.selectAllMsgSentSucFailList(resultAllSentList, mjonMsgSentVO);
    	model.addAttribute("resultMsgSucFailList", resultMsgSucFailList);
    	
    	model.addAttribute("mjonMsgSentVO", mjonMsgSentVO);
    	model.addAttribute("userNm", userNm);
    	
    	Calendar cal = Calendar.getInstance();

    	int year = cal.get(Calendar.YEAR);
    	int month = cal.get(Calendar.MONTH) + 1;
    	int day = cal.get(Calendar.DAY_OF_MONTH);
    	
    	model.addAttribute("year", year);
    	model.addAttribute("month", month);
    	model.addAttribute("day", day);
    	
		
		return "web/msgsent/MsgSentPrintListPopUp";
	}
	
	/**
     * 발송관리 엑셀다운로드 기능 
     * @param searchVO
     * @param model
     * @return	"/web/mjon/msgsent/msgSentExcelDownLoadAjax.do"
     * @throws Exception
     */
	@RequestMapping(value= {"/web/mjon/msgsent/msgSentExcelDownLoadAjax.do"})
	public void msgSentExcelDownLoadAjax(MjonMsgSentVO mjonMsgSentVO,
			RedirectAttributes redirectAttributes, 
			HttpServletRequest request,
			HttpServletResponse response ,
			ModelMap model) throws Exception{
	
		//로그인 권한정보 불러오기
		LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
    	String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());

    	if(!userId.equals("")) {
    		
    		mjonMsgSentVO.setUserId(userId);
    		
    	}else {
    		
    		/*modelAndView.addObject("message", "로그인 후 이용이 가능합니다.");
    		modelAndView.addObject("result", "fail");
    		
    		return modelAndView;*/
    		
    	}
    	
    	
    	mjonMsgSentService.msgSentExcelDownLoad(mjonMsgSentVO, response);
    	
    	
		
	}

}
