File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package itn.let.mjo.msg.web;
import java.io.OutputStream;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
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.Random;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.hanju.util.Authentication;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import itn.com.cmm.ComDefaultCodeVO;
import itn.com.cmm.EgovMessageSource;
import itn.com.cmm.LoginVO;
import itn.com.cmm.service.EgovCmmUseService;
import itn.com.cmm.service.EgovFileMngService;
import itn.com.cmm.service.EgovFileMngUtil;
import itn.com.cmm.service.FileVO;
import itn.com.cmm.util.MJUtil;
import itn.com.cmm.util.PdfUtil;
import itn.com.cmm.util.RedirectUrlMaker;
import itn.com.cmm.util.StringUtil;
import itn.com.utl.fcc.service.EgovStringUtil;
import itn.let.mjo.cert.service.CertService;
import itn.let.mjo.cert.service.CertVO;
import itn.let.mjo.mjocommon.MjonCommon;
import itn.let.mjo.msg.service.MjPhoneMemberVO;
import itn.let.mjo.msg.service.MjonMapAddressVO;
import itn.let.mjo.msg.service.MjonMsgResultCodeVO;
import itn.let.mjo.msg.service.MjonMsgService;
import itn.let.mjo.msg.service.MjonMsgStatVO;
import itn.let.mjo.msg.service.MjonMsgVO;
import itn.let.mjo.msg.service.MjonSwearWordVO;
import itn.let.mjo.msgdata.service.MjonMsgDataService;
import itn.let.mjo.msgdata.service.MjonMsgReturnVO;
import itn.let.mjo.msgsent.service.MjonMsgRecvTestService;
import itn.let.mjo.msgsent.service.MjonMsgRecvTestVO;
import itn.let.mjo.msgsent.service.MjonMsgSentTestService;
import itn.let.mjo.msgsent.service.MjonMsgSentTestVO;
import itn.let.mjo.pay.service.MjonPayService;
import itn.let.mjo.reservmsg.service.MjonReservMsgService;
import itn.let.mjo.reservmsg.service.MjonResvMsgVO;
import itn.let.sts.com.StatsVO;
import itn.let.uat.uia.service.AuthCertVO;
import itn.let.uat.uia.web.ClientIP;
import itn.let.uat.uia.web.EmailVO;
import itn.let.uat.uia.web.SendLogVO;
import itn.let.uat.uia.web.SendMail;
import itn.let.uss.umt.service.EgovMberCmpHstService;
import itn.let.uss.umt.service.EgovMberManageService;
import itn.let.uss.umt.service.EgovUserManageService;
import itn.let.uss.umt.service.MberCmpHstVO;
import itn.let.uss.umt.service.MberManageVO;
import itn.let.uss.umt.service.UserDefaultVO;
import itn.let.uss.umt.service.UserManageVO;
/**
*
* 문자온의 번호관리를 처리하는 비즈니스 구현 클래스
* @author 공통서비스 개발팀 신명섭
* @since 2021.03.20
* @version 1.0
* @see
*
*
* 수정일 수정자 수정내용
* ------- -------- ---------------------------
* 2021.03.20 신명섭 최초 생성
* </pre>
*/
@Controller
public class MjonMsgController {
@Resource(name = "mjonMsgService")
private MjonMsgService mjonMsgService;
//문자발송테스트
@Resource(name = "mjonMsgSentTestService")
private MjonMsgSentTestService mjonMsgSentTestService;
//문자수신테스트
@Resource(name = "mjonMsgRecvTestService")
private MjonMsgRecvTestService mjonMsgRecvTestService;
/** EgovMessageSource */
@Resource(name="egovMessageSource")
EgovMessageSource egovMessageSource;
@Resource(name = "mjonPayService")
private MjonPayService mjonPayService;
@Resource(name = "certService")
private CertService certService;
//문자발송 서비스
@Resource(name = "MjonMsgDataService")
private MjonMsgDataService mjonMsgDataService;
@Resource(name = "MjonReservMsgService")
private MjonReservMsgService mjonReservMsgService;
@Resource(name="EgovFileMngUtil")
private EgovFileMngUtil fileUtil;
@Resource(name="EgovFileMngService")
private EgovFileMngService fileMngService;
/** mberManageService */
@Resource(name = "mberManageService")
private EgovMberManageService mberManageService;
/** 첨부파일 저장경로 */
@Value("#{globalSettings['Globals.file.saveDir']}")
private String fileSaveDir;
/** userManageService */
@Resource(name = "userManageService")
private EgovUserManageService userManageService;
@Resource(name = "EgovCmmUseService")
private EgovCmmUseService cmmUseService;
@Resource(name = "egovMberCmpHstService")
private EgovMberCmpHstService egovMberCmpHstService;
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileService;
//배열 정의{"컬럼순차번호, 컬럼이름, 컬럼내용, 컬럼이름에 붙여야할 내용(엑셀코드양식다운로드시 필요)"}
private String[][] sendMsgExcelValue ={
{"0" ,"번호" , "1" , "" },
{"1", "아이디" , "itn" , ""},
{"2", "발신번호" , "01012345678", ""},
{"3", "발송건수" , "3", ""},
{"4", "요청시간" , "2021-06-01 19:05:12", ""},
{"5", "내용" , "문자메시지 내용", ""},
{"6", "메시지타입" , "SMS전송", ""},
{"7", "접속기기" , "", ""},
{"8", "메시지타입" , "NPRO(아이하트)", ""}
};
//배열 정의{"컬럼순차번호, 컬럼이름, 컬럼내용, 컬럼이름에 붙여야할 내용(엑셀코드양식다운로드시 필요)"}
private String[][] sendMsgDtlExcelValue ={
{"0" ,"번호" , "1" , "" },
{"1", "아이디" , "itn" , ""},
{"2", "발신번호" , "01012345678", ""},
{"3", "수신번호" , "01012345678", ""},
{"4", "전송시간" , "2021-06-01 19:19:57", ""},
{"5", "내용" , "문자메시지 내용", ""},
{"6", "현재상태" , "결과수신", ""},
{"7", "처리결과" , "410/i", ""},
{"8", "메시지타입" , "SMS전송", ""},
{"9", "접속기기" , "", ""},
{"10", "메시지타입" , "NPRO(아이하트)", ""},
{"11", "통신사" , "ETC", ""} ,
{"12", "삭제여부" , "미삭제", ""}
} ;
//회원정보 팝업 최근 발송 문자 리스트 엑셀 다운로드
private String[][] sendMsgUsrExcelValue ={
{"0" ,"번호" , "1" , "" },
{"1", "아이디" , "itn" , ""},
{"2", "발신번호" , "01012345678", ""},
{"3", "요청시간" , "2021-06-01 19:05:12", ""},
{"4", "내용" , "문자메시지 내용", ""},
{"5", "문자종류" , "SMS전송", ""},
{"6", "건수" , "", ""},
{"7", "금액" , "", ""},
{"8", "발송결과" , "", ""},
{"9", "전송사" , "", ""}
};
/**
* 문자전송 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/SendMsgList.do"})
public String sendMsgList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("reqFullDate");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
//searchVO.setReserveYn("N");//예약건은 제외하기
searchVO.setReserveCYn("N");//예약취소건은 제외하기
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
String beforeMonthDay = MJUtil.getBefore1MonthDate(); //한달 전
if (null == searchVO.getNtceBgnde() || searchVO.getNtceBgnde().equals("")) {
searchVO.setNtceBgnde(beforeMonthDay);
//searchVO.setNtceEndde(toDay);
}
// 문자발송 완료건은 모두 보이도록 처리
resultList = mjonMsgService.selectMjonMsgGroupCompleteList(searchVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/SendMsgList";
}
/**
* 문자전송 리스트 스미싱 on off 처리
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestList.do"
* @throws Exception
*/
@RequestMapping("/uss/ion/msg/MsgUsersSmishingUpdate.do")
public String msgUsersSmishingUpdate(@RequestParam("checkedIdForDel") String checkedIdForUpt, @ModelAttribute("userManageVO") UserManageVO userManageVO, RedirectAttributes redirectAttributes, Model model) throws Exception {
// 미인증 사용자에 대한 보안처리
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
if(!isAuthenticated) {
model.addAttribute("message", egovMessageSource.getMessage("fail.common.login"));
return "uat/uia/EgovLoginUsr";
}
userManageService.updateUserSmishingYn(userManageVO, checkedIdForUpt);
redirectAttributes.addFlashAttribute("message", "스미싱의심 여부가 정상적으로 수정되었습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendMsgList.do?pageIndex="+userManageVO.getPageIndex());
return redirectUrlMaker.getRedirectUrl();
}
/**
* 알림톡 리스트 스미싱 on off 처리
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestList.do"
* @throws Exception
*/
@RequestMapping("/uss/ion/msg/MsgUsersAtSmishingUpdate.do")
public String msgUsersAtSmishingUpdate(@RequestParam("checkedIdForDel") String checkedIdForUpt, @ModelAttribute("userManageVO") UserManageVO userManageVO, RedirectAttributes redirectAttributes, Model model) throws Exception {
// 미인증 사용자에 대한 보안처리
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
if(!isAuthenticated) {
model.addAttribute("message", egovMessageSource.getMessage("fail.common.login"));
return "uat/uia/EgovLoginUsr";
}
userManageService.updateUserAtSmishingYn(userManageVO, checkedIdForUpt);
//redirectAttributes.addFlashAttribute("message", "알림톡 스미싱의심 여부가 정상적으로 수정되었습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/kakaoat/SendKakaoATList.do?pageIndex="+userManageVO.getPageIndex());
return redirectUrlMaker.getRedirectUrl();
}
/**
* 문자전송 테스트 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/SendMsgTestList.do"})
public String sendMsgTestList(@ModelAttribute("searchVO") MjonMsgSentTestVO mjonMsgSentTestVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgSentTestVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgSentTestVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgSentTestVO.getPageSize());
mjonMsgSentTestVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgSentTestVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgSentTestVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
try {
if (mjonMsgSentTestVO.getSearchKeyword().indexOf("MSGGID")>-1) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getSearchKeyword()+"' ");
}
}catch(Exception ex)
{
ex.printStackTrace();
}
/*
if (!"".equals(mjonMsgSentTestVO.getMsgGroupId()) && mjonMsgSentTestVO.getMsgGroupId() !=null) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getMsgGroupId()+"' ");
}
*/
if("".equals(mjonMsgSentTestVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgSentTestVO.setSearchSortCnd("test_no");
mjonMsgSentTestVO.setSearchSortOrd("desc");
}
List<MjonMsgSentTestVO> resultList = new ArrayList<MjonMsgSentTestVO>();
resultList = mjonMsgSentTestService.selectList(mjonMsgSentTestVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgSentTestVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/SendMsgTestList";
}
/**
* 문자전송 테스트 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/SendMsgTestListRead.do","/uss/ion/msg/SendMsgTestListRead1.do"})
public String sendMsgTestListRead1(@ModelAttribute("searchVO") MjonMsgSentTestVO mjonMsgSentTestVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgSentTestVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgSentTestVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgSentTestVO.getPageSize());
mjonMsgSentTestVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgSentTestVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgSentTestVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
try {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='MSGGID_0000000002830' ");
if (mjonMsgSentTestVO.getSearchKeyword().indexOf("MSGGID")>-1) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getSearchKeyword()+"' ");
}
}catch(Exception ex)
{
ex.printStackTrace();
}
/*
if (!"".equals(mjonMsgSentTestVO.getMsgGroupId()) && mjonMsgSentTestVO.getMsgGroupId() !=null) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getMsgGroupId()+"' ");
}
*/
if("".equals(mjonMsgSentTestVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgSentTestVO.setSearchSortCnd("test_no");
mjonMsgSentTestVO.setSearchSortOrd("desc");
}
List<MjonMsgSentTestVO> resultList = new ArrayList<MjonMsgSentTestVO>();
resultList = mjonMsgSentTestService.selectListRead1(mjonMsgSentTestVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgSentTestVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/SendMsgTestListRead";
}
/**
* 문자전송 테스트 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/SendMsgTestListRead2.do"})
public String sendMsgTestListRead2(@ModelAttribute("searchVO") MjonMsgSentTestVO mjonMsgSentTestVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgSentTestVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgSentTestVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgSentTestVO.getPageSize());
mjonMsgSentTestVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgSentTestVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgSentTestVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
try {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='MSGGID_0000000002830' ");
if (mjonMsgSentTestVO.getSearchKeyword().indexOf("MSGGID")>-1) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getSearchKeyword()+"' ");
}
}catch(Exception ex)
{
ex.printStackTrace();
}
/*
if (!"".equals(mjonMsgSentTestVO.getMsgGroupId()) && mjonMsgSentTestVO.getMsgGroupId() !=null) {
mjonMsgSentTestVO.setListQuery(" AND a.msg_group_id='"+mjonMsgSentTestVO.getMsgGroupId()+"' ");
}
*/
if("".equals(mjonMsgSentTestVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgSentTestVO.setSearchSortCnd("test_no");
mjonMsgSentTestVO.setSearchSortOrd("desc");
}
List<MjonMsgSentTestVO> resultList = new ArrayList<MjonMsgSentTestVO>();
resultList = mjonMsgSentTestService.selectListRead2(mjonMsgSentTestVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgSentTestVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/SendMsgTestListRead";
}
/**
* 문자전송 테스트 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgTestModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendMsgTestModify.do"})
public String sendMsgTestModify(
@ModelAttribute("searchVO") MjonMsgSentTestVO mjonMsgSentTestVO,
HttpServletRequest request ,
Model model) throws Exception {
/*
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
MjonMsgVO mjonMsgVO = new MjonMsgVO();
if(null != searchVO.getUserData() && !"".equals(searchVO.getUserData())) { //수정
mjonMsgVO = mjonMsgService.selectMjonMsgVO(searchVO);
//문자 상세보기 이미지 아이디 받아오기
String atchFileId1 ="";
String atchFileId2 ="";
String atchFileId3 ="";
String path1 = mjonMsgVO.getFilePath1();
String path2 = mjonMsgVO.getFilePath2();
String path3 = mjonMsgVO.getFilePath3();
FileVO fileVO1 = new FileVO();
FileVO fileVO2 = new FileVO();
FileVO fileVO3 = new FileVO();
if(StringUtil.isNotEmpty(path1)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO1 = getFilePathToAtchFileId(path1);
model.addAttribute("fileVO1", fileVO1);
}
if(StringUtil.isNotEmpty(path2)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO2 = getFilePathToAtchFileId(path2);
model.addAttribute("fileVO2", fileVO2);
}
if(StringUtil.isNotEmpty(path3)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO3 = getFilePathToAtchFileId(path3);
model.addAttribute("fileVO3", fileVO3);
}
}
if(request.getHeader("REFERER").contains("ReceiveNumberList") ) { //수신번호 조회에서 넘김
mjonMsgVO.setBeforeUrl("ReceiveNumberList");
}
if(pattern.equals("/uss/ion/msg/CampaignMsgModify.do")) { //사용자 발신
searchVO.setSearchCampaignYn("Y");
}
model.addAttribute("mjonMsgVO", mjonMsgVO);
*/
return "/uss/ion/msg/SendMsgTestModify";
}
/**
* 발신테스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value="/uss/ion/msg/SendMsgTestSendAjax.do")
public ModelAndView SendMsgTestSendAjax(
MjonMsgSentTestVO mjonMsgSentTestVO
//, @RequestParam("testNo") String p_testNo
, ModelMap model
, HttpServletRequest request
) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//step0.저장값 가져오기
mjonMsgSentTestVO = mjonMsgSentTestService.selectDetail(mjonMsgSentTestVO);
//step1.기본값 설정
String resultSts = "0";
String resultBlockSts = "0";
//문자열
String charset = "euc-kr"; //문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산
String smsCont = mjonMsgSentTestVO.getSmsTxt();
//문자 종류
String msgType = "S"; //우선은 단문만 지원
/*
<option value="S">단문문자</option>
<option value="L">장문문자</option>
<option value="P">그림문자</option>
* */
//장문 메세지일 경우 1이상으로 설정
int fileCount = 0;
// 전송사 전송 배분
//전송사 구분 코드 - 01 : 아이하트, 02 : 현대 퓨쳐넷, 03 : 아이엠오 //비율로 계산 필요
//String sendAgent = sendRateList.get(0).getAgentCode();
String sendAgent = "01";
//String neoType = "";
/*
if(sendAgent.equals("03")) { //아이엠오 전송사 문자 타입 설정해 주기 - 장문인 경우
// 단순 장문 문자는 neoType : 2, 그림 포함 : 4
if(fileCount>0) { // 그림포함 문자인경우
neoType = "4";
}else{ // 단순 장문 문자
neoType = "2";
}
}
*/
//변환문자여부
//String txtReplYn = "N";
//내문자저장함에 저장후 문자를 발송하는경우 문자 타입이 숫자가 아닌 문자로 넘어와서 변경 처리함- 20220520 우영두
if(msgType.equals("P") || msgType.equals("L")) {
msgType = "6";
}else if(msgType.equals("S")) {
msgType = "4";
}
MjonMsgVO mjonMsgVO = new MjonMsgVO();
//mjonMsgVO.setMsgId(msgId);
//mjonMsgVO.setMsgGroupId(msgGroupId);
mjonMsgVO.setUserId(mjonMsgSentTestVO.getUserId());
mjonMsgVO.setMsgType(msgType);
mjonMsgVO.setReserveYn("N");
mjonMsgVO.setCallFrom(mjonMsgSentTestVO.getCallFrom());
mjonMsgVO.setSubject(mjonMsgSentTestVO.getSubject());
mjonMsgVO.setSmsTxt(mjonMsgSentTestVO.getSmsTxt());
//자동 분배 해야 함
mjonMsgVO.setAgentCode(sendAgent);
//수신 번호 배열로 넣어야 함.
int i_call_cnt = Integer.parseInt(mjonMsgSentTestVO.getMsgCnt());
String[] a_callToList = new String[i_call_cnt];
for (int i=0;i<i_call_cnt;i++) {
a_callToList[i] = mjonMsgSentTestVO.getCallTo();
}
mjonMsgVO.setCallToList(a_callToList);
//mjonMsgVO.setCallTo(callTo);
//mjonMsgVO.setRegDate(regDate);
mjonMsgSentTestVO.setUpdateQuery(" SEND_STRT_DT= date_format(now(), '%Y%m%d%H%i%s') ");
mjonMsgSentTestService.update(mjonMsgSentTestVO);
//문자 발송 처리
//MjonMsgReturnVO returnVO = new MjonMsgReturnVO();
String[] tempPhoneList = new String[200]; //임시 수신번호 리스트 저장용 배열
String[] phoneList = mjonMsgVO.getCallToList();
int callToListCnt = mjonMsgVO.getCallToList().length;
MjonMsgReturnVO mjonMsgReturnVO = null;
String s_getMsgGroupId = "";
//서비스 단으로 특정 문자 건수 이상으로 한번에 보내지 않기 위해서 처리함
if(callToListCnt > 200) {
int sendCnt = 0;
for(int i=0; i< callToListCnt; i++) {
if((i < callToListCnt -1) && sendCnt == 199) {
System.out.println("sendCnt" + sendCnt);
//sendCnt 4번째 값을 추가해준다.
tempPhoneList[sendCnt] = phoneList[i];
List<String> arrPhoneList = new ArrayList<String>();
for(String temp : tempPhoneList) {
if(temp != null) {
arrPhoneList.add(temp);
}
}
String[] sendPhoneList = new String[arrPhoneList.size()];
for(int j=0; j< arrPhoneList.size(); j++) {
sendPhoneList[j] = arrPhoneList.get(j);
//System.out.println("+++++++++++++++ sendPhoneList ;:: "+sendPhoneList[j]);
}
mjonMsgVO.setCallToList(sendPhoneList);
sendCnt = 0;
mjonMsgReturnVO = this.fncSendMsgTest(mjonMsgVO
, Integer.parseInt(mjonMsgSentTestVO.getnRate())
, Integer.parseInt(mjonMsgSentTestVO.gethRate())
, Integer.parseInt(mjonMsgSentTestVO.getiRate())
, s_getMsgGroupId
);
s_getMsgGroupId = mjonMsgReturnVO.getMsgGroupId();
//MjonMsgReturnVO returnVO = mjonMsgDataService.insertMsgDataInfo(mjonMsgVO);
//resultSts = resultSts + Integer.parseInt(returnVO.getSendMsgCnt());
//resultBlockSts = resultBlockSts + Integer.parseInt(returnVO.getSendMsgBlockCnt());
//발송 처리후 배열 초기화
Arrays.fill(tempPhoneList, null);
}else if((i == callToListCnt -1) && sendCnt < 200){
//System.out.println("+++++++++++++++ last sendCnt" + sendCnt);
//마지막 리스트의 수신번호를 추가해 준다.
tempPhoneList[sendCnt] = phoneList[i];
List<String> arrPhoneList2 = new ArrayList<String>();
for(String temp : tempPhoneList) {
if(temp != null) {
arrPhoneList2.add(temp);
}
}
String[] sendPhoneList2 = new String[arrPhoneList2.size()];
for(int j=0; j< arrPhoneList2.size(); j++) {
sendPhoneList2[j] = arrPhoneList2.get(j);
//System.out.println("+++++++++++++++ last sendPhoneList ;:: "+sendPhoneList2[j]);
}
mjonMsgVO.setCallToList(sendPhoneList2);
sendCnt = 0;
mjonMsgReturnVO = this.fncSendMsgTest(mjonMsgVO
, Integer.parseInt(mjonMsgSentTestVO.getnRate())
, Integer.parseInt(mjonMsgSentTestVO.gethRate())
, Integer.parseInt(mjonMsgSentTestVO.getiRate())
, s_getMsgGroupId
);
s_getMsgGroupId = mjonMsgReturnVO.getMsgGroupId();
/*
MjonMsgReturnVO returnVO = mjonMsgDataService.insertMsgDataInfo(mjonMsgVO);
resultSts = resultSts + Integer.parseInt(returnVO.getSendMsgCnt());
resultBlockSts = resultBlockSts + Integer.parseInt(returnVO.getSendMsgBlockCnt());
*/
}else {
tempPhoneList[sendCnt] = phoneList[i];
//System.out.println("++++++++++++++++++++ i ::: " + i);
//System.out.println("++++++++++++++++++++ sendCnt ::: " + sendCnt);
//System.out.println("++++++++++++++++++++ tempPhoneList[sendCnt] ::: " + tempPhoneList[sendCnt]);
sendCnt++;
}
}
}
mjonMsgSentTestVO.setUpdateQuery(" SEND_END_DT= date_format(now(), '%Y%m%d%H%i%s') , MSG_GROUP_ID='"+mjonMsgReturnVO.getMsgGroupId()+"' ");
mjonMsgSentTestService.update(mjonMsgSentTestVO);
//로그인 처리====================================
//로그인 정보 가져오기
/*
mjPhoneMemberVO.setUserId(userId);
mjPhoneMemberVO.setPhmType("01");
List<MjPhoneMemberVO> resultList = mjonMsgService.selectSendNumberList(mjPhoneMemberVO);
modelAndView.addObject("sendNumberCnt", resultList.size());
*/
return modelAndView;
}
/*
* 문자발송테스트처리 서비스만 분리하였음
* param : MjonMsgVO
* return : String
*
* */
private MjonMsgReturnVO fncSendMsgTest(MjonMsgVO mjonMsgVO
, int i_nRate
, int i_hRate
, int i_iRate
, String p_getMsgGroupId
) {
//ModelAndView modelAndView = new ModelAndView();
//modelAndView.setViewName("jsonView");
String resultSts = "0"; //발송결과 건수
String resultBlockSts = "0"; //수신거부 등록번호로 발송을 안한 건수
MjonMsgReturnVO returnVO = null;
try {
//현재 고객의 보유 캐시가 문자 발송이 가능한 금액인지 체크
//String userMoney = mjonMsgDataService.selectBeforeCashData(mjonMsgVO);
//String userPoint = mjonMsgDataService.selectBeforePointData(mjonMsgVO);
//mjonMsgVO.setBefPoint(userPoint); //현재 보유 포인트 정보 저장
//String totPrice = mjonMsgVO.getTotPrice();
//BigDecimal befCash = new BigDecimal(userMoney).setScale(2, RoundingMode.HALF_EVEN);
//BigDecimal totMsgPrice = new BigDecimal(totPrice).setScale(2, RoundingMode.HALF_EVEN);
returnVO = mjonMsgDataService.insertMsgTestDataInfo(mjonMsgVO
, i_nRate
, i_hRate
, i_iRate
, p_getMsgGroupId
);
resultSts = returnVO.getSendMsgCnt();
resultBlockSts = returnVO.getSendMsgBlockCnt();
}catch(Exception e) {
e.printStackTrace();
}
return returnVO;
}
/**
* 수신테스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value="/uss/ion/msg/SendMsgTestRecvAjax.do")
public ModelAndView SendMsgTestRecvAjax(
MjonMsgRecvTestVO mjonMsgRecvTestVO
//, @RequestParam("testNo") String p_testNo
, ModelMap model
, HttpServletRequest request
) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//step1.아이하트 수신 처리
//step1-1.아이하트 미처리 대상 가져오기
List<MjonMsgRecvTestVO> resultList = mjonMsgRecvTestService.selectListN(mjonMsgRecvTestVO);
//step2.현대퓨처넷 수신 처리
//step2-1.현대퓨처넷 미처리 대상 가져오기
List<MjonMsgRecvTestVO> resultListH = mjonMsgRecvTestService.selectListH(mjonMsgRecvTestVO);
//step3.IMO 수신 처리
//step3-1.IMO 미처리 대상 가져오기
List<MjonMsgRecvTestVO> resultListI = mjonMsgRecvTestService.selectListI(mjonMsgRecvTestVO);
//step1-2.아이하트 순차적으로 데이터 넣어주기(msg_log)
for (int i=0;i<resultList.size();i++) {
mjonMsgRecvTestVO = resultList.get(i);
mjonMsgRecvTestVO.setCurState("3");
mjonMsgRecvTestVO.setRsltCode("100");
mjonMsgRecvTestVO.setRsltCode2("0");
mjonMsgRecvTestVO.setRsltNet("KTF");
mjonMsgRecvTestVO.setMsgPayCode("SMS");
mjonMsgRecvTestVO.setMsgResendCount("1");
mjonMsgRecvTestService.insertN(mjonMsgRecvTestVO);
if (i % 1000 == 0 ) {
System.out.println("i=====");
System.out.println(i);
}
}
//step2-2.현대퓨처넷 순차적으로 데이터 넣어주기(msg_log)
for (int i=0;i<resultListH.size();i++) {
mjonMsgRecvTestVO = resultListH.get(i);
mjonMsgRecvTestVO.setTrSendstat("3");
mjonMsgRecvTestService.insertH(mjonMsgRecvTestVO);
if (i % 1000 == 0 ) {
System.out.println("i=====");
System.out.println(i);
}
}
//step3-2.IMO 순차적으로 데이터 넣어주기(msg_log)
for (int i=0;i<resultListI.size();i++) {
mjonMsgRecvTestVO = resultListI.get(i);
mjonMsgRecvTestVO.setStatus("3");
mjonMsgRecvTestService.insertI(mjonMsgRecvTestVO);
if (i % 1000 == 0 ) {
System.out.println("i=====");
System.out.println(i);
}
}
//로그인 처리====================================
//로그인 정보 가져오기
/*
mjPhoneMemberVO.setUserId(userId);
mjPhoneMemberVO.setPhmType("01");
List<MjPhoneMemberVO> resultList = mjonMsgService.selectSendNumberList(mjPhoneMemberVO);
modelAndView.addObject("sendNumberCnt", resultList.size());
*/
return modelAndView;
}
/**
* 문자전송 등록 프로세서
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendMsgTestInsert.do"})
public String sendMsgTestInsert(
@ModelAttribute("searchVO") MjonMsgSentTestVO mjonMsgSentTestVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
HttpSession httpSession,
Model model) throws Exception {
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
System.out.println("mjonMsgSentTestVO.toString()");
System.out.println(mjonMsgSentTestVO.getUserId());
System.out.println(mjonMsgSentTestVO.getCallFrom());
System.out.println(mjonMsgSentTestVO.getCallTo());
System.out.println(mjonMsgSentTestVO.toString());
//mjonMsgVO.setUserId(userId);
//mjonMsgService.insertMsgData(mjonMsgVO);
mjonMsgSentTestService.insert(mjonMsgSentTestVO);
}catch(Exception e) {
//redirectAttributes.addFlashAttribute("message", "전송이 완료되지 않았습니다.");
//RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendMsgTestList.do");
//return redirectUrlMaker.getRedirectUrl();
e.printStackTrace();
}
redirectAttributes.addFlashAttribute("message", "등록이 완료되었습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendMsgTestList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 문자전송 리스트
* @param searchVO
* @param model
* @return
* uss/ion/msg/SendMsgDetailList.do(개별 문자리스트)
* @throws Exception
*/
@RequestMapping(value= { "/uss/ion/msg/SendMsgDetailList.do"})
public String sendMsgDetailList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("msgGroupId");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
resultList = mjonMsgService.selectMjonMsgGroupDtList(searchVO);
model.addAttribute("resultList", resultList);
model.addAttribute("searchVO", searchVO);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/SendMsgDetailList";
}
/**
* 문자전송 리스트
* @param searchVO
* @param model
* @return uss/ion/msg/ReceiveNumberList.do(수신 문자리스트)
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/ReceiveNumberList.do"})
public String receiveNumberList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("msgGroupId");
searchVO.setSearchSortOrd("desc");
}
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
String beforeMonthDay = MJUtil.getBefore1MonthDate(); //한달 전
if (null == searchVO.getNtceBgnde() || searchVO.getNtceBgnde().equals("")) {
searchVO.setNtceBgnde(beforeMonthDay);
//searchVO.setNtceEndde(toDay);
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
resultList = mjonMsgService.selectMjonMsgGroupDtList(searchVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/ReceiveNumberList";
}
/**
* 문자전송 리스트
* @param searchVO
* @param model
* @return uss/ion/msg/ReserveNumberList.do(에약 문자리스트)
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/ReserveNumberList.do"})
public String reserveNumberList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("reqFullDate");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
searchVO.setReserveYn("Y");
searchVO.setReserveCYn("N");//예약 취소건은 보여주지 않는다.
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
String beforeMonthDay = MJUtil.getBefore1MonthDate(); //한달 전
if (null == searchVO.getNtceBgnde() || searchVO.getNtceBgnde().equals("")) {
searchVO.setNtceBgnde(beforeMonthDay);
//searchVO.setNtceEndde(toDay);
}
resultList = mjonMsgService.selectMjonMsgGroupList(searchVO);
model.addAttribute("resultList", resultList);
// 금일 예약발송 대기건수
int msgGroupCntSum = 0;
String todayYn = "N";
if (null != searchVO.getTodayYn() && searchVO.getTodayYn().equals("Y")) {
todayYn = "Y";
msgGroupCntSum = mjonMsgService.selectMjonMsgGroupCntSum(searchVO);
}
model.addAttribute("todayYn", todayYn);
model.addAttribute("msgGroupCntSum", msgGroupCntSum);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/ReserveNumberList";
}
/**
* 문자전송 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/CampaignMsgList.do"(선거문자리스트)
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/CampaignMsgList.do"})
public String campaignMsgList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("msgGroupId");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
searchVO.setSearchCampaignYn("Y");
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
String beforeMonthDay = MJUtil.getBefore1MonthDate(); //한달 전
if (null == searchVO.getNtceBgnde() || searchVO.getNtceBgnde().equals("")) {
searchVO.setNtceBgnde(beforeMonthDay);
//searchVO.setNtceEndde(toDay);
}
resultList = mjonMsgService.selectMjonMsgGroupList(searchVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/CampaignMsgList";
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendMsgModify.do","/uss/ion/msg/CampaignMsgModify.do"})
public String sendMsgModify(
@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
Model model) throws Exception {
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
MjonMsgVO mjonMsgVO = new MjonMsgVO();
if(null != searchVO.getUserData() && !"".equals(searchVO.getUserData())) { //수정
mjonMsgVO = mjonMsgService.selectMjonMsgVO(searchVO);
//문자 상세보기 이미지 아이디 받아오기
String atchFileId1 ="";
String atchFileId2 ="";
String atchFileId3 ="";
String path1 = mjonMsgVO.getFilePath1();
String path2 = mjonMsgVO.getFilePath2();
String path3 = mjonMsgVO.getFilePath3();
FileVO fileVO1 = new FileVO();
FileVO fileVO2 = new FileVO();
FileVO fileVO3 = new FileVO();
if(StringUtil.isNotEmpty(path1)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO1 = getFilePathToAtchFileId(path1);
model.addAttribute("fileVO1", fileVO1);
}
if(StringUtil.isNotEmpty(path2)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO2 = getFilePathToAtchFileId(path2);
model.addAttribute("fileVO2", fileVO2);
}
if(StringUtil.isNotEmpty(path3)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO3 = getFilePathToAtchFileId(path3);
model.addAttribute("fileVO3", fileVO3);
}
}
if(request.getHeader("REFERER").contains("ReceiveNumberList") ) { //수신번호 조회에서 넘김
mjonMsgVO.setBeforeUrl("ReceiveNumberList");
}
if(pattern.equals("/uss/ion/msg/CampaignMsgModify.do")) { //사용자 발신
searchVO.setSearchCampaignYn("Y");
}
model.addAttribute("mjonMsgVO", mjonMsgVO);
return "/uss/ion/msg/SendMsgModify";
}
/**
* 번호관리 > 수신번호관리 > 상세화면
* @param searchVO
* @param model
* @return "/uss/ion/msg/ReceiveMsgModify.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/ReceiveMsgModify.do"})
public String receiveMsgModify(
@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
Model model) throws Exception {
MjonMsgVO mjonMsgVO = new MjonMsgVO();
if(null != searchVO.getUserData() && !"".equals(searchVO.getUserData())) { //수정
mjonMsgVO = mjonMsgService.selectMjonMsgVO(searchVO);
}
if(request.getHeader("REFERER").contains("ReceiveNumberList") ) { //수신번호 조회에서 넘김
mjonMsgVO.setBeforeUrl("ReceiveNumberList");
}
model.addAttribute("searchVO", searchVO);
model.addAttribute("mjonMsgVO", mjonMsgVO);
return "/uss/ion/msg/ReceiveMsgModify";
}
/**
* 문자전송 등록 프로세서
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendMsgInsert.do"})
public String sendMsgInsert(
@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
HttpSession httpSession,
Model model) throws Exception {
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
mjonMsgVO.setUserId(userId);
//mjonMsgService.insertMsgData(mjonMsgVO);
mjonMsgService.insertMjMsgData(mjonMsgVO);
}catch(Exception e) {
redirectAttributes.addFlashAttribute("message", "전송이 완료되지 않았습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendMsgList.do");
return redirectUrlMaker.getRedirectUrl();
}
redirectAttributes.addFlashAttribute("message", "전송이 완료되었습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendMsgList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 문자전송 삭제 프로세서(del_flag : Y로 업데이트)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgDelete"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendMsgDelete.do","/uss/ion/msg/ReceiveNumberMsgDelete.do","/uss/ion/msg/CampaignMsgDelete.do",})
public String SendMsgDelete(
@RequestParam("del") String[] del,
@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
Model model) throws Exception {
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
for(String id: del) {
mjonMsgVO.setMsgId(id);
mjonMsgService.deleteSendMsg(mjonMsgVO);
}
}catch(Exception e) {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("fail.common.update"));
}
if(mjonMsgVO.getDelFlag().equals("Y")) {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.delete"));
}else {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.update"));
}
//value 값 가져오기
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
String returnUrl = "";
if(pattern.contains("/uss/ion/msg/SendMsgDelete.do")) { // 문자관리 > 문자전송 리스트 > 문자 상세화면에서 삭제/복구하였을 경우 리스트로 이동
returnUrl = "/uss/ion/msg/SendMsgList.do";
}else if (pattern.contains("/uss/ion/msg/CampaignMsgDelete.do")) {
returnUrl = "/uss/ion/msg/CampaignMsgList.do";
} else { // 번호관리 > 수신번호조회 > 문자 상세에서 삭제/복구하였을 경우
returnUrl = "/uss/ion/msg/ReceiveNumberList.do";
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker(returnUrl);
return redirectUrlMaker.getRedirectUrl();
}
/**
* 발신/수신/거부 번호 리스트 조회
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendNumberList"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/SendNumberList.do" , "/web/msg/SendNumberList.do","/uss/ion/msg/BlockNumberList.do" , "/web/msg/SendNumberList.do"})
public String MjonNumberList(@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
String certType = request.getParameter("certType");
model.addAttribute("certType", certType);
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("frstRegistPnttm");
searchVO.setSearchSortOrd("desc");
}
if(pattern.equals("/web/msg/SendNumberList.do")) { //사용자
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
searchVO.setUserId(userId);
}
if(pattern.equals("/uss/ion/msg/SendNumberList.do")) { //관리자 발신번호 정보 - 인증요청 데이터 우선순위
searchVO.setSearchSortAuthYN("Y");
}
if(pattern.equals("/uss/ion/msg/SendNumberList.do") || pattern.equals("/web/msg/SendNumberList.do")) {
searchVO.setPhmType("01"); //발신조회
}else {
searchVO.setPhmType("03"); //거부조회
}
List<MjPhoneMemberVO> resultList = mjonMsgService.selectSendNumberList(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjPhoneMemberVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
if(pattern.equals("/web/msg/SendNumberList.do")) { //사용자 발신
return "/web/msg/SendNumberList";
}
if(pattern.equals("/uss/ion/msg/BlockNumberList.do")) { //관리자 블럭
return "/uss/ion/msg/BlockNumberList";
}
if(pattern.equals("/web/msg/SendNumberList.do")) { //사용자 블럭
return "/web/msg/BlockNumberList";
}
return "/uss/ion/msg/SendNumberList"; //관리자 발신
}
/**
* 발신/수신/거부 번호 등록/수정
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendNumberModify.do" ,
"/uss/ion/msg/BlockNumberModify.do"})
public String MjonNumberModify(
@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request ,
Model model) throws Exception {
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
MjPhoneMemberVO mjPhoneMemberVO = new MjPhoneMemberVO();
if(null != searchVO.getPhmId() && !"".equals(searchVO.getPhmId())) { //수정
mjPhoneMemberVO = mjonMsgService.selectPhoneMemberVO(searchVO);
}
model.addAttribute("mjPhoneMemberVO", mjPhoneMemberVO);
if(pattern.equals("/uss/ion/msg/SendNumberModify.do")) { //관리자 발신등록/수정
//인증테스트버튼
//본인인증
String referer = (String)request.getHeader("REFERER");
URL newURL = new URL(referer);
String protocol = newURL.getProtocol() + "://";
String host = newURL.getHost();
String succUrl = protocol + host + "/uss/umt/user/niceCheckAjax.do";
String failUrl = protocol + host + "/uss/umt/user/EgovGnrlUserManage.do";
UserDefaultVO userSearchVO = new UserDefaultVO();
userSearchVO.setNiceSuccUrl(succUrl);
userSearchVO.setNiceFailUrl(failUrl);
model.addAttribute("userSearchVO", userSearchVO);
}else { //블럭
return "/uss/ion/msg/BlockNumberModify";
}
String certId = "";
if(mjPhoneMemberVO != null) {
certId = mjPhoneMemberVO.getCertId();
}
List<CertVO> certFileList = new ArrayList<CertVO>();
List<CertVO> fileList = new ArrayList<>();
if(StringUtil.isNotEmpty(certId)) {
CertVO certVO = new CertVO();
certVO.setCertId(certId);
if(null != certVO.getCertId() && !"".equals(certVO.getCertId())) { //수정
certFileList = certService.selectCertFileList(certVO);
}
model.addAttribute("certFileList", certFileList); //CertFile파일정보
//첨부파일정보
if(certFileList !=null){
if(1==certFileList.size() && ((CertVO)certFileList.get(0)).getOrignlFileNm() == null) {
}else {
fileList.addAll(certFileList);
}
}
}
//첨부파일 리스트
model.addAttribute("fileList", fileList);
//본인인증 끝
return "/uss/ion/msg/SendNumberModify";
}
/**
* 발신번호 등록 개수 조회 - 3개 이상 시 더 등록 불가능
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value="/uss/ion/msg/SendNumberCntAjax.do")
public ModelAndView selectSendNumberCntAjaxt(
MjPhoneMemberVO mjPhoneMemberVO
, @RequestParam("userId") String userId
, ModelMap model
, HttpServletRequest request
) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//로그인 처리====================================
//로그인 정보 가져오기
mjPhoneMemberVO.setUserId(userId);
mjPhoneMemberVO.setPhmType("01");
List<MjPhoneMemberVO> resultList = mjonMsgService.selectSendNumberList(mjPhoneMemberVO);
modelAndView.addObject("sendNumberCnt", resultList.size());
return modelAndView;
}
/**
* 발신번호 목록에서 상태변경 처리Ajax
* @param searchVO
* @param model
* @return "/uss/ion/msg/updateAuthYnAjax"
* @throws Exception
*/
@RequestMapping("/uss/ion/msg/updateAuthYnAjax.do")
public ModelAndView updateAuthYnAjax(@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO
) throws Exception{
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String msg = "";
boolean result = true;
//이미 처리되었는지 확인
MjPhoneMemberVO statusChkVO = mjonMsgService.selectPhoneMemberVO(mjPhoneMemberVO);
if(!"H".equals(statusChkVO.getAuthYn())) {
if("Y".equals(statusChkVO.getAuthYn())) {
msg = "이미 인증 완료했습니다.";
}else if("C".equals(statusChkVO.getAuthYn())) {
msg = "이미 반려했습니다.";
}
modelAndView.addObject("result", result);
modelAndView.addObject("msg", msg);
return modelAndView;
}
try {
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
mjPhoneMemberVO.setLastUpdusrId(userId);
mjonMsgService.updateAuthYn(mjPhoneMemberVO);
msg = "정상적으로 수정되었습니다.";
result = true;
}
catch(Exception e) {
msg = "수정에 실패했습니다.";
result = false;
}
try {
if(result) {
String authYn = mjPhoneMemberVO.getAuthYn();
MjonCommon mjCommon = new MjonCommon();
MjonMsgVO mjonMsgVO = new MjonMsgVO();
//발신번호 등록(관리자에게 알림이기에 발신번호도 법인폰 번호로 한다. 01084329333 )
mjonMsgVO.setCallFrom("01084329333");
String smsTxt = "";
//발송 문자 내용 등록
//문자 발송 문구 변경 - 221117, 승인, 반려를 제외한 인증 타입 삭제(미인증, 심사중, 추가인증필요)
/*if(authYn.equals("Y")) {
smsTxt = "[문자온] 회원님의 발신번호 승인이 완료 되었으며, 즉시 문자 발송 가능합니다.";
}else if(authYn.equals("H")){
smsTxt = "[문자온] 회원님의 발신번호를 심사 중 입니다. 발신번호 심사 후 문자로 안내해 드리겠습니다.";
}else {
smsTxt = "[문자온] 회원님의 발신번호 승인이 보류 되었습니다. 문자온-마이페이지-발신번호 관리에서 제출서류 보완 부탁드립니다.";
}*/
if(authYn.equals("Y")) {
smsTxt = "[문자온] 회원님의 발신번호 승인이 완료되었으며, 즉시 문자 발송 가능합니다.";
}else {
smsTxt = mjPhoneMemberVO.getRejectReason();
}
mjonMsgVO.setSmsTxt(smsTxt);
//발송 문자 타입(단/장문) 등록
//문자열 길이 체크 해주기
String charset = "euc-kr"; //문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산
smsTxt = smsTxt.replace("\r\n", "\n");
int FrBytes = smsTxt.getBytes(charset).length;
String msgType = "4";
//90바이트를 초과하는 경우 장문으로 발송
if(FrBytes > 90){
msgType = "6";
}
mjonMsgVO.setMsgType(msgType);
//그림이미지 첨부파일 갯수 0으로 셋팅
mjonMsgVO.setFileCnt("0");
// 문자타입 구분
if (mjonMsgVO.getMsgType().equals("4")) {
mjonMsgVO.setMsgDiv("S"); // 단문
}
else if (mjonMsgVO.getMsgType().equals("6")) {
if (mjonMsgVO.getFileCnt().equals("0")) {
mjonMsgVO.setMsgDiv("L"); // 장문
}
else {
mjonMsgVO.setMsgDiv("P"); // 그림
}
}
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
// 전송사 구분 코드 - 01 : 아이하트, 02 : 현대 퓨쳐넷, 03 : 아이엠오, 04 : 다우기술
mjonMsgVO.setAgentCode(mjonMsgVO2.getAgentCode()); //전송사 선택
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
MberManageVO mberManageVO = mberManageService.selectMber(mjPhoneMemberVO.getUserId());
if(mberManageVO != null && !mberManageVO.getMberSttus().equals("B")) {//회원 정보가 있는 경우만 발송, 회원이 이용정지 상태이면 발송 금지.
String callTo = mberManageVO.getMoblphonNo();
mjonMsgVO.setCallTo(callTo);
//혹시 문자 내용이 없으면 문자 발송이 안되도록 처리
if(smsTxt.length() > 0 && callTo.length() > 0) {//문자내용 및 수신자 번호가 없는 경우 발송 금지.
//문자발송을 위한 데이터 셋팅 함수 호출해주기
MjonMsgVO resultCom = mjCommon.getAdminToMberPhoneSendMsgDataComm(mjonMsgVO);
//발신으로 문자 발송 처리
mjonMsgDataService.insertAdmToMberMsgDataInfo(resultCom);
}
}
}
msg = msg += (System.lineSeparator()+"안내문자 발송 성공했습니다.");
}catch (Exception e){
msg = msg += (System.lineSeparator() +"안내문자 발송 실패했습니다.");
}
modelAndView.addObject("result", result);
modelAndView.addObject("msg", msg);
return modelAndView;
}
/**
* 발신번호 신청 반려 팝업
* @param searchVO
* @param request
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/uss/ion/msg/sendNumberReturnPop.do")
public String sendNumberReturnPop(@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO,
HttpServletRequest request,
Model model) throws Exception {
mjPhoneMemberVO = mjonMsgService.selectSendPhoneNumberByPhmId(mjPhoneMemberVO.getPhmId());
model.addAttribute("mjPhoneMemberVO", mjPhoneMemberVO);
return "/uss/ion/msg/sendNumberReturnPop";
}
/**
* 문자전송 등록 프로세서
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendNumberInsert.do" , "/uss/ion/msg/BlockNumberInsert.do"})
public String MjonNumberInsert(
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
Model model) throws Exception {
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(pattern.equals("/uss/ion/msg/BlockNumberInsert.do")) { //차단의 경우 ID 미입력시 로그인 아이디로 세팅
if("".equals(mjPhoneMemberVO.getUserId())) {
mjPhoneMemberVO.setUserId(userId);
}
}
mjonMsgService.insertSendNumber(mjPhoneMemberVO);
}catch(Exception e) {
}
redirectAttributes.addFlashAttribute("message", "등록이 완료되었습니다.");
if(pattern.equals("/uss/ion/msg/BlockNumberInsert.do")) {
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/BlockNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}
// 발신번호 전체차단/해지
@RequestMapping(value = {"/uss/ion/msg/updateSendNumberBlockAll.do"})
public String updateSendNumberBlockAll(
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
Model model) throws Exception {
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
mjPhoneMemberVO.setPhmType("03"); // 01:발신, 02:수신 , 03:거부
mjPhoneMemberVO.setLastUpdusrId(userId);
mjPhoneMemberVO.setMemo("발신번호 차단");
mjPhoneMemberVO.setPhoneNumber(mjPhoneMemberVO.getPhoneNumber().replaceAll(" ", "").replaceAll("-", "").replaceAll("/", ""));
mjonMsgService.updateSendNumberBlockAll(mjPhoneMemberVO);
}catch(Exception e) {
}
redirectAttributes.addFlashAttribute("message", "발신번호 차단이 완료되었습니다.");
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/BlockNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 발신번호 삭제 프로세서(del_flag : Y로 업데이트)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgDelete"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/SendNumberDelete.do" , "/uss/ion/msg/BlockNumberDelete.do"})
public String SendNumberDelete(
@RequestParam("del") String[] del,
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
Model model) throws Exception {
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
try {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
for(String id: del) {
mjPhoneMemberVO.setPhmId(id);
mjonMsgService.deleteSendNumberDelete(mjPhoneMemberVO);
}
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.delete"));
if(pattern.equals("/uss/ion/msg/BlockNumberDelete.do")) {
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/BlockNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}catch(Exception e) {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("fail.common.delete"));
}
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.delete"));
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendNumberList.do");
return redirectUrlMaker.getRedirectUrl();
}
// 차단해지
@RequestMapping(value = "/uss/ion/msg/BlockNumberUnblockAjax.do")
public ModelAndView saveMainTagAjax(
@RequestParam("del") String[] del,
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO,
HttpServletRequest request , RedirectAttributes redirectAttributes,
Model model) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
try{
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
for(String id: del) {
mjPhoneMemberVO.setPhmId(id);
mjPhoneMemberVO.setPhmType("01");
mjPhoneMemberVO.setLastUpdusrId(userId);
mjPhoneMemberVO.setMemo("발신번호 차단해제");
mjonMsgService.updateSendNumberUnblock(mjPhoneMemberVO);
}
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
return modelAndView;
}
/**
* 발신번호를 수정한다.
* @param searchVO
* @param hpcmVO
* @param bindingResult
* @return "forward:/uss/olh/hpc/selectHpcmList.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/UpdateBlockNumber.do"})
public String UpdateSendNumber(
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO, HttpServletRequest request ,
RedirectAttributes redirectAttributes
)
throws Exception {
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
try {
mjPhoneMemberVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID
mjonMsgService.updateSendNumberDenyType(mjPhoneMemberVO);
}catch(Exception e) {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("fail.common.update"));
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/BlockNumberList.do"+setBlockNumberMakeParamUrl(mjPhoneMemberVO));
return redirectUrlMaker.getRedirectUrl();
}
/**
* 발신번호를 수정한다.
* @param searchVO
* @param hpcmVO
* @param bindingResult
* @return "forward:/uss/olh/hpc/selectHpcmList.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/UpdateSendNumber.do"})
public String UpdateSendNumber2(
@ModelAttribute("searchVO") MjPhoneMemberVO mjPhoneMemberVO, HttpServletRequest request ,
RedirectAttributes redirectAttributes
)
throws Exception {
boolean errStatus = true;
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
//회원정보 불러오기
MberManageVO mberManageVO = mberManageService.selectMber(mjPhoneMemberVO.getUserId());
String authYnOrigin = "";
try {
authYnOrigin = mjPhoneMemberVO.getAuthYnOrigin();
if(mberManageVO != null && !mberManageVO.getMberSttus().equals("B")) {
mjPhoneMemberVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID
mjonMsgService.updateSendNumberAddNameType(mjPhoneMemberVO);
}else {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("fail.common.update"));
errStatus = false;
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendNumberList.do"+setSendNumberMakeParamUrl(mjPhoneMemberVO));
return redirectUrlMaker.getRedirectUrl();
}
}catch(Exception e) {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("fail.common.update"));
errStatus = false;
}
/**
* 발신번호 등록시 반려후 재승인 심사가 필요한 경우
* 관리자에게 재승인 신청 접수 내역을 알리는
* 메일 발송 및 문자 발송을 진행한다.
* 2022.09.26 우영두 수정
*
* 에러가 발생시 오류 메세지만 로그 기록하고 완료 처리함
* */
try {
// 즉시승인이 아닌경우 문자온 법인폰으로 알림 문자 발송하기.
if (errStatus) {
// 인증여부 변경시에만 문자발송
if (!mjPhoneMemberVO.getAuthYn().equals(authYnOrigin)) {
String userNm = mjPhoneMemberVO.getUserName();
String userId = mjPhoneMemberVO.getUserId();
String phoneNum = mjPhoneMemberVO.getPhoneNumber();
String authYn = mjPhoneMemberVO.getAuthYn();
MjonCommon mjCommon = new MjonCommon();
MjonMsgVO mjonMsgVO = new MjonMsgVO();
//발신번호 등록(관리자에게 알림이기에 발신번호도 법인폰 번호로 한다. 01084329333 )
mjonMsgVO.setCallFrom("01084329333");
String smsTxt = "";
//발송 문자 내용 등록
//문자 발송 문구 변경 - 221117, 승인, 반려를 제외한 인증 타입 삭제(미인증, 심사중, 추가인증필요)
/* if(authYn.equals("Y")) {
smsTxt = "[문자온] 회원님의 발신번호 승인이 완료 되었으며, 즉시 문자 발송 가능합니다.";
}else if(authYn.equals("H")){
smsTxt = "[문자온] 회원님의 발신번호를 심사 중 입니다. 발신번호 심사 후 문자로 안내해 드리겠습니다.";
}else {
smsTxt = "[문자온] 회원님의 발신번호 승인이 보류 되었습니다. 문자온-마이페이지-발신번호 관리에서 제출서류 보완 부탁드립니다.";
}*/
if(authYn.equals("Y")) {
smsTxt = "[문자온] 회원님의 발신번호 승인이 완료되었으며, 즉시 문자 발송 가능합니다.";
}else {
smsTxt = mjPhoneMemberVO.getRejectReason();
}
mjonMsgVO.setSmsTxt(smsTxt);
//발송 문자 타입(단/장문) 등록
//문자열 길이 체크 해주기
String charset = "euc-kr"; //문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산
smsTxt = smsTxt.replace("\r\n", "\n");
int FrBytes = smsTxt.getBytes(charset).length;
String msgType = "4";
//90바이트를 초과하는 경우 장문으로 발송
if(FrBytes > 90){
msgType = "6";
}
mjonMsgVO.setMsgType(msgType);
//그림이미지 첨부파일 갯수 0으로 셋팅
mjonMsgVO.setFileCnt("0");
// 문자타입 구분
if (mjonMsgVO.getMsgType().equals("4")) {
mjonMsgVO.setMsgDiv("S"); // 단문
}
else if (mjonMsgVO.getMsgType().equals("6")) {
if (mjonMsgVO.getFileCnt().equals("0")) {
mjonMsgVO.setMsgDiv("L"); // 장문
}
else {
mjonMsgVO.setMsgDiv("P"); // 그림
}
}
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
// 전송사 구분 코드 - 01 : 아이하트, 02 : 현대 퓨쳐넷, 03 : 아이엠오, 04 : 다우기술
mjonMsgVO.setAgentCode(mjonMsgVO2.getAgentCode()); //전송사 선택
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
if(mberManageVO != null && !mberManageVO.getMberSttus().equals("B")) {//회원 정보가 있는 경우만 발송, 회원이 이용정지 상태이면 발송 금지.
String callTo = mberManageVO.getMoblphonNo();
mjonMsgVO.setCallTo(callTo);
//혹시 문자 내용이 없으면 문자 발송이 안되도록 처리
if(smsTxt.length() > 0 && callTo.length() > 0) {//문자내용 및 수신자 번호가 없는 경우 발송 금지.
//문자발송을 위한 데이터 셋팅 함수 호출해주기
MjonMsgVO resultCom = mjCommon.getAdminToMberPhoneSendMsgDataComm(mjonMsgVO);
//발신으로 문자 발송 처리
mjonMsgDataService.insertAdmToMberMsgDataInfo(resultCom);
}
}
}
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++ 발신번호 승인 / 반려 등에 대한 사용자에게 문자발송 Function Error !!!" + e);
}
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.update"));
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/uss/ion/msg/SendNumberList.do"+setSendNumberMakeParamUrl(mjPhoneMemberVO));
return redirectUrlMaker.getRedirectUrl();
}
/**
* 지도를 불러온다
* @param
* @param
* @param
* @return "letter/map/MapInsert.jsp"
* @throws Exception
*/
@RequestMapping("/MapUrlInsert.do")
public String testmap2(HttpServletRequest request, ModelMap model) throws Exception {
return "letter/map/MapInsert";
}
/**
* 지도의 위도 경도를 DB에 입력하고 mapId를 불러온다
* @param mapLat
* @param mapLng
* @param
* @return modelAndView
* @throws Exception
*/
@RequestMapping("/MapUrlInsertAjax.do")
public ModelAndView testmapajax(HttpServletRequest request, ModelMap model,
@RequestParam("mapLat") String mapLat, @RequestParam("mapLng") String mapLng) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
MjonMapAddressVO mjonMapAddressVO = new MjonMapAddressVO();
mjonMapAddressVO.setMapLat(mapLat);
mjonMapAddressVO.setMapLng(mapLng);
mjonMapAddressVO = mjonMsgService.insertMapAddress(mjonMapAddressVO);
String url = request.getRequestURL().toString();
url = url.substring(0, url.lastIndexOf("/"));
model.addAttribute("url",url);
modelAndView.addObject("url", url);
modelAndView.addObject("seq", mjonMapAddressVO.getMapId());
return modelAndView;
}
/**
* 지도의 mapId를 전달 받아 DB에서 해당 mapId의 위도 경도를 지도에 표시한다.
* @param seq
* @param
* @param
* @return modelAndView
* @throws Exception
*/
@RequestMapping("/MapUrl.do")
public String testmapreceive(HttpServletRequest request, ModelMap model) throws Exception {
String seq = request.getParameter("seq");
MjonMapAddressVO mjonMapAddressVO = new MjonMapAddressVO();
mjonMapAddressVO.setMapId(Integer.valueOf(seq));
mjonMapAddressVO = mjonMsgService.selectMapAddress(mjonMapAddressVO);
model.addAttribute("lat", mjonMapAddressVO.getMapLat());
model.addAttribute("lng", mjonMapAddressVO.getMapLng());
return "letter/map/MapReceive";
}
/**
* 실시간 문자전송 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/RealTimeMsgList.do", "/uss/ion/msg/RealTimeMsgListAjax.do"})
public String RealTimeMsgList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
if(pattern.equals("/uss/ion/msg/RealTimeMsgListAjax.do")) {
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("reqDate");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
resultList = mjonMsgService.selectMjonRealTimeMsgList(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/RealTimeMsgListAjax";
}
return "/uss/ion/msg/RealTimeMsgList";
}
/**
* 문자전송 순위
* @param searchVO
* @param model
* @return "/uss/ion/msg/LankSendNumber"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/RankNumberList.do"})
public String LankSendNumber(@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("rank");
searchVO.setSearchSortOrd("asc");
}
if(pattern.equals("/uss/ion/msg/SendNumberList.do") || pattern.equals("/web/msg/SendNumberList.do")) {
searchVO.setPhmType("01"); //발신조회
}else {
searchVO.setPhmType("03"); //거부조회
}
List<MjPhoneMemberVO> resultList = mjonMsgService.selectRankNumberList(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjPhoneMemberVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/RankNumberList"; //문자전송순위
}
/**
* 문자전송 순위
* @param searchVO
* @param model
* @return "/uss/ion/msg/LankSendNumber"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/RankNumberList_230125.do"})
public String LankSendNumber_230125(@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("rank");
searchVO.setSearchSortOrd("asc");
}
if(pattern.equals("/uss/ion/msg/SendNumberList.do") || pattern.equals("/web/msg/SendNumberList.do")) {
searchVO.setPhmType("01"); //발신조회
}else {
searchVO.setPhmType("03"); //거부조회
}
List<MjPhoneMemberVO> resultList = mjonMsgService.selectRankNumberList_230125(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjPhoneMemberVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
try {
if (resultList.size()>0) {
model.addAttribute("sttstDate", resultList.get(0).getFrstRegistPnttm());
}
}catch(Exception ex) {
ex.printStackTrace();
}
return "/uss/ion/msg/RankNumberList_230125"; //문자전송순위
}
/**
* 문자수신 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/ReceiveNumberListBackup.do"})
public String ReceiveNumberListBackup(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
String pattern = (String) request.getAttribute(
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("msgGroupId");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
//resultList = mjonMsgService.selectMjonMsgGroupList(searchVO);
resultList = mjonMsgService.selectMjonMsgGroupDtList(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/ReceiveNumberList";
}
/**
* 전화인증
* @param searchVO
* @param model
* @return "/uss/ion/msg/LankSendNumber"
* @throws Exception
*/
@RequestMapping(value= {"/web/mjon/ArsAuthAjax.do"})
public ModelAndView ArsAuthAjax(@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request,
HttpSession session,
ModelMap model) throws Exception{
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
String result ="";
String userid = "itn0202"; //ARS 관리자 가입 Id
String type = "0"; //0=음성인증 : 인증번호를 듣고 화면에 입력, 1=SMS 문자인증 : 기존 문자인증과 동일한 기능, 2=음성인증(단순확인):음성안내 후 폰에 1자리 번호 입력, 3=음성인증(인증번호):인증번호를 화면 또는 전화 음성 확인 후 폰에 인증번호 입력
String callee = searchVO.getPhoneNumber(); //고객 전화번호
String code = ""; //4~6자리 인증번호(음성 ARS 에서 인증하라고 하는 번호: ITN에서 임의로 생성)
String svcnumber = "221"; //개통 후 별도 안내 ( hjhauth.jar JDK 1.8 사용조건)
String command = "API_101000"; //요청코드 고정값
boolean is1MinutePass = true;
// Start
SendLogVO sendLogVO2 = new SendLogVO();
sendLogVO2.setReceive(callee);
sendLogVO2 = mjonMsgDataService.selectSysMsgLog(sendLogVO2);
if (sendLogVO2 == null) {
// Pass : 1분 경과
} else {
// 시간 비교
Date nowDate = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date compareDate = format.parse(sendLogVO2.getFrstSendPnttm());
Calendar cal = Calendar.getInstance();
cal.setTime(compareDate);
// 1분 추가
cal.add(Calendar.MINUTE, +1);
compareDate = cal.getTime();
if (compareDate.compareTo(nowDate) < 0) {
// Pass : 1분 경과
} else if (compareDate.compareTo(nowDate) > 0) {
// 제한 : 1분 미만
is1MinutePass = false;
}
}
// 1분 경과
if (is1MinutePass == true) {
//인증번호 랜덤 생성
long seed = System.currentTimeMillis();
Random random = new Random(seed);
//code = Integer.toString(random.nextInt(4));
StringBuffer randomCode = new StringBuffer();
for(int i=0; i<6; i++) {
code = randomCode.append(Integer.toString(random.nextInt(10))).toString();
}
try{
Authentication auth = new Authentication();
auth.setUserid(userid);
auth.setType("0");
auth.setCallee(callee);
auth.setCode(code);
auth.setSvcnumber(svcnumber); //jdk 1.8 버전부터 적용
//boolean bool_rtn = auth.send_Auth_Seed();
//전달 받은 전화번호로 전화를 걸어준다.
boolean bool_rtn = auth.send_Auth_Stan();
result = auth.getResult();
//접속 아이피 정보를 받아온다.
ClientIP clientIp = new ClientIP();
String ip = clientIp.getClientIP(request);
//세션에 인증 정보를 저장해 준다.
AuthCertVO certVO = new AuthCertVO();
certVO.setCertPhone(callee);
certVO.setCertCode(code);
certVO.setCertIpaddr(ip);
certVO.setCertType("ARS전화인증");
certVO.setCertResult(result);
Date now = new Date();
SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
//현재 날짜 저장하기
certVO.setCertDate(transFormat.format(now));
request.getSession().setAttribute("AuthARSCertVO", certVO);
// 본인인증 확인용
/*session = request.getSession();
AuthCertVO certArsVO = (AuthCertVO) session.getAttribute("AuthARSCertVO");
System.out.println("++++++++++++++++ code ::: "+certArsVO.getCertCode());
System.out.println("++++++++++++++++ phone ::: "+certArsVO.getCertPhone());
System.out.println("++++++++++++++++ ip ::: "+certArsVO.getCertIpaddr());*/
model.addAttribute("result", result);
model.addAttribute("certCode", code);
// Step1. 문자발송
Map<String, Object> mapInfo = new HashMap<String, Object>();
mapInfo = sendMsgData("system", code, "01084329333", callee);
isSuccess = Boolean.parseBoolean((mapInfo.get("IsSuccess").toString()));
msg = mapInfo.get("Msg").toString();
}catch(Exception e) {
//throw new AppException(new ErrorHandler("AuthVoice",e.getMessage()).getMessage());
System.out.print(e);
}
}
else {
isSuccess = false;
msg = "1분후 인증번호 발송해주세요.";
}
model.addAttribute("result", result);
model.addAttribute("certCode", code);
model.addAttribute("isSuccess", isSuccess);
model.addAttribute("msg", msg);
return modelAndView;
}
// 문자발송
public Map<String, Object> sendMsgData(String userId, String code, String fromMobile, String toMobile) throws Exception{
boolean isSuccess = true;
String msg = "인증번호 문자 전송이 완료되었습니다.";
String resultSts = "0";
String resultBlockSts = "0";
boolean is1MinutePass = true;
String smsTxt = "[문자온] 인증번호 : " + code;
try {
Date nowDate = new Date();
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
MjonMsgVO mjonMsgVO = new MjonMsgVO();
mjonMsgVO.setUserId("system");
String msgType = "4";
// 전송사 전송 배분
MjonMsgVO pramVO = new MjonMsgVO();
List<MjonMsgVO> sendRateList = mjonMsgService.selectTodayAgentSendCntList(pramVO); // 전송사 전송 배분률 및 현재 전송건수
// 조회
for (MjonMsgVO tmpVO : sendRateList) {
float cnt = Float.parseFloat(tmpVO.getMsgGroupCnt());
float totCnt = tmpVO.getTotCnt();
tmpVO.setSendRateInfo(Float.parseFloat(tmpVO.getSendRate()) - (cnt / totCnt * 100)); // 배분률 - 현재전송 비율
}
String sendAgent = sendRateList.get(0).getAgentCode();
float maxRate = sendRateList.get(0).getSendRateInfo();
for (MjonMsgVO tmpVO : sendRateList) { // 배분률 대비 현재전송 비율이 가장 적은거 찾기
if (maxRate < tmpVO.getSendRateInfo()) {
maxRate = tmpVO.getSendRateInfo();
sendAgent = tmpVO.getAgentCode();
}
}
mjonMsgVO.setMsgDiv("S"); // 단문
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
// 전송사 구분 코드 - 01 : 아이하트, 02 : 현대 퓨쳐넷, 03 : 아이엠오, 04 : 다우기술
mjonMsgVO.setAgentCode(mjonMsgVO2.getAgentCode()); //전송사 선택
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
mjonMsgVO.setMsgType("4");
mjonMsgVO.setSmsTxt(smsTxt);
mjonMsgVO.setCallFrom(fromMobile);
mjonMsgVO.setCallTo(toMobile);
mjonMsgVO.setReserveYn("N"); // 즉시 전송
mjonMsgVO.setMsgGroupCnt("0");
mjonMsgVO.setUserId(userId);
mjonMsgVO.setMsgPayCode("SMS");
mjonMsgVO.setReqDate(simpleDateFormat2.format(nowDate));
MjonMsgReturnVO returnVO = mjonMsgDataService.insertSysMsgDataInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(returnVO.getAgentCode());
resultSts = returnVO.getSendMsgCnt();
resultBlockSts = returnVO.getSendMsgBlockCnt();
// 시스템 발송 로그
SendLogVO sendLogVO = new SendLogVO();
// SendType 1:문자로 발송 2:이메일로 발송
sendLogVO.setSendId(returnVO.getMsgGroupId());
sendLogVO.setSendType("1");
sendLogVO.setFrstSendInfo(mjonMsgVO.getCallFrom());
sendLogVO.setReceive(mjonMsgVO.getCallTo());
sendLogVO.setCheckNo(code);
sendLogVO.setContents(smsTxt);
mjonMsgDataService.insertSysMsgLog(sendLogVO);
if (!resultSts.equals("0")) {
isSuccess = true;
msg = "문자 전송이 완료되었습니다.";
} else {
isSuccess = false;
msg = "문자 전송에 오류가 발생하였습니다.";
}
} catch (Exception e) {
isSuccess = false;
msg = e.getMessage();
}
Map<String, Object> mapInfo = new HashMap<String, Object>();
mapInfo.put("IsSuccess", isSuccess);
mapInfo.put("Msg", msg);
return mapInfo;
}
/**
* 전송사 발송 결과 코드 리스트
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/MsgResultCodeList.do"})
public String MsgResultCodeList(@ModelAttribute("searchVO") MjonMsgResultCodeVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
/*
if(StringUtil.isEmpty(searchVO.getAgentCode())){ //최초 전송사 코드가 없는 경우 아이하트로 설정함
searchVO.setAgentCode("01");
}
*/
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
List<MjonMsgResultCodeVO> resultList = mjonMsgService.selectMsgResultCodeListPageing(searchVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgResultCodeVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/MsgResultCodeList"; //문자결과 리스트
}
/**
* 전송사 발송 결과 코드 등록 화면
* @param MjonMsgResultCodeVO
* @param model
* @return ""
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/addMsgResultCode.do"})
public String addMsgResultCode(@ModelAttribute("searchVO") MjonMsgResultCodeVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
return "/uss/ion/msg/MsgResultCodeRegist";
}
/**
* 전송사 발송 결과 코드 등록 처리
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeModify.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/insertMsgResultCode.do"})
public String insertMsgResultCode(@ModelAttribute("searchVO") MjonMsgResultCodeVO searchVO,
HttpServletRequest request,
ModelMap model,
RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
searchVO.setFrstRegisterId(lastUpdusrId);
searchVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.insertMsgResultCode(searchVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "등록이 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "등록이 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/msg/MsgResultCodeList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 전송사 발송 결과 코드 수정
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeModify.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/MsgResultCodeModify.do"})
public String MsgResultCodeModify(@ModelAttribute("searchVO") MjonMsgResultCodeVO searchVO,
HttpServletRequest request,
ModelMap model) throws Exception{
MjonMsgResultCodeVO result = mjonMsgService.selectMsgResultCodeModify(searchVO);
model.addAttribute("result", result);
model.addAttribute("searchVO", searchVO);
return "/uss/ion/msg/MsgResultCodeModify";
}
/**
* 전송사 발송 결과 코드 수정
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeModify.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/updateMsgResultCode.do"})
public String updateMsgResultCode(MjonMsgResultCodeVO searchVO, ModelMap model, RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
//수정 아이디 입력
searchVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.updateMsgResultCode(searchVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "수정이 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "수정이 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/msg/MsgResultCodeList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 전송사 발송 결과 코드 삭제
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeModify.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/deleteMsgResultCode.do"})
public String deleteMsgResultCode(MjonMsgResultCodeVO searchVO, ModelMap model, RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
//수정 아이디 입력
searchVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.deleteMsgResultCode(searchVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "삭제가 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "삭제가 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/msg/MsgResultCodeList.do");
return redirectUrlMaker.getRedirectUrl();
}
//회원정보 팝업 문자 전송 리스트(전체) 엑셀 다운로드
@RequestMapping(value= {"/uss/ion/msg/selectMberSendMsgExcelDownload.do"})
public void selectMberSendMsgExcelDownload( MjonMsgVO mjonMsgVO,
@ModelAttribute MberManageVO reqMberManageVO,
HttpServletRequest request,
HttpServletResponse response ,
ModelMap model) throws Exception {
mjonMsgVO.setRecordCountPerPage(100000);
mjonMsgVO.setFirstIndex(0);
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
if(null != loginVO && !"super".equals(loginVO.getSiteId())){
mjonMsgVO.setSiteId(loginVO.getSiteId());
}
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
SXSSFWorkbook wb = new SXSSFWorkbook(100);
CellStyle style = wb.createCellStyle();
style.setBorderBottom(CellStyle.BORDER_THIN); //테두리 두껍게
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD); //글씨 bold
Cell cell = null;
Row row = null;
String fileName ="문자 전송 리스트(전체)";
String sheetTitle = "";
try{
mjonMsgVO.setUserId(reqMberManageVO.getMberId());
if(StringUtil.isEmpty(mjonMsgVO.getNtceBgnde())) {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;
cal.set(year,month,1);
String firstDay = Integer.toString(cal.getActualMinimum(Calendar.DAY_OF_MONTH));
String lastDay = Integer.toString(cal.getActualMaximum(Calendar.DAY_OF_MONTH));
String repMonth = "";
String repfirstDay = "";
if(month < 10) {
repMonth = "0" + Integer.toString(month);
}else {
repMonth = Integer.toString(month);
}
if(Integer.parseInt(firstDay) < 10) {
repfirstDay = "0" + firstDay;
}else {
repfirstDay = firstDay;
}
String ntceBgnde = Integer.toString(year) + "-" + repMonth + "-" + repfirstDay;
String ntceEndde = Integer.toString(year) + "-" + repMonth + "-" + lastDay;
mjonMsgVO.setNtceBgnde(ntceBgnde);
mjonMsgVO.setNtceEndde(ntceEndde);
}
mjonMsgVO.setMsgType("");
List<MjonMsgVO> resultList = mjonMsgService.selectUserMsgDataListByMbrId(mjonMsgVO);
{ //화면 리스트
sheetTitle = "문자 전송 리스트(전체)" ; //제목
Sheet sheet = wb.createSheet(sheetTitle);
row = sheet.createRow(0);
for(int i=0 ; i < sendMsgUsrExcelValue.length ; i++) {
cell = row.createCell(i);
cell.setCellStyle(style);
cell.setCellValue(sendMsgUsrExcelValue[i][1]);
}
for(int i=0; i < resultList.size(); i++){
row = sheet.createRow(i+1);
for(int j=0 ; j < sendMsgUsrExcelValue.length ; j++) {
cell = row.createCell(j);
cell.setCellStyle(style);
if(j==0) cell.setCellValue(i+1); //번호
if(j==1) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getUserId()); //아이디
if(j==2) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getCallFrom()); //발신자
if(j==3) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getReqDate()); //요청시간
if(j==4) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getSmsTxt()); //문자내용
if(j==5) {
String msgType = ((MjonMsgVO)resultList.get(i)).getMsgType();
String fileCnt = ((MjonMsgVO)resultList.get(i)).getFileCnt();
String msgTypeTxt = "";
if(msgType.equals("4")) {
msgTypeTxt = "단문";
}else if(msgType.equals("6")) {
if(fileCnt.equals("0")) {
msgTypeTxt = "장문";
}else {
msgTypeTxt = "그림 " + fileCnt + "장";;
}
}
cell.setCellValue(msgTypeTxt); //메시지타입
}
if(j==6) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getMsgGroupCnt()); //건수
String resultCodeTxt = ((MjonMsgVO)resultList.get(i)).getResultCodeTxt();
if(j==7) {
if(resultCodeTxt.equals("S")) {
cell.setCellValue(((MjonMsgVO)resultList.get(i)).getTotSPrice()); //정상성공 발송 금액
}else {
cell.setCellValue(((MjonMsgVO)resultList.get(i)).getTotFWPrice()); //실패대기 발송 금액
}
}
if(j==8) {
String resultTxt = "";
if(resultCodeTxt.equals("W")) {
resultTxt = "결과대기";
}else if(resultCodeTxt.equals("F")) {
resultTxt = "수신오류";
}else {
resultTxt = "정상수신";
}
cell.setCellValue(resultTxt); //발송결과
}
if(j==9) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getAgentCodeTxt()); //전송사
}
}
}
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyy_MM_dd_HH_mm_ss", 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) {}
}
}
//문자 전송 리스트(전체) 엑셀 다운로드
@RequestMapping(value= {"/uss/ion/msg/SendMsgExcelDownload.do"})
public void sendMsgExcelDownload( MjonMsgVO mjonMsgVO,
HttpServletRequest request,
HttpServletResponse response ,
ModelMap model) throws Exception {
mjonMsgVO.setRecordCountPerPage(mjonMsgVO.getPageUnit());
mjonMsgVO.setFirstIndex(0);
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
if(null != loginVO && !"super".equals(loginVO.getSiteId())){
mjonMsgVO.setSiteId(loginVO.getSiteId());
}
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
SXSSFWorkbook wb = new SXSSFWorkbook(100);
CellStyle style = wb.createCellStyle();
style.setBorderBottom(CellStyle.BORDER_THIN); //테두리 두껍게
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD); //글씨 bold
Cell cell = null;
Row row = null;
String fileName ="문자 전송 리스트(전체)";
String sheetTitle = "";
try{
List<MjonMsgVO> resultList = mjonMsgService.selectMjonMsgGroupList(mjonMsgVO);
{ //화면 리스트
sheetTitle = "문자 전송 리스트(전체)" ; //제목
Sheet sheet = wb.createSheet(sheetTitle);
row = sheet.createRow(0);
for(int i=0 ; i < sendMsgExcelValue.length ; i++) {
cell = row.createCell(i);
cell.setCellStyle(style);
cell.setCellValue(sendMsgExcelValue[i][1]);
}
for(int i=0; i < resultList.size(); i++){
row = sheet.createRow(i+1);
for(int j=0 ; j < sendMsgExcelValue.length ; j++) {
cell = row.createCell(j);
cell.setCellStyle(style);
if(j==0) cell.setCellValue(i+1); //번호
if(j==1) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getUserId()); //아이디
if(j==2) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getCallFrom()); //발신자
if(j==3) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getMsgGroupCnt()); //발송건수
if(j==4) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getReqDate()); //요청시간
if(j==5) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getSmsTxt()); //문자내용
if(j==6) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getMsgTypeTxt()); //메시지타입
if(j==7) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getConectMthdTxt()); //접속기기
if(j==8) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getAgentCodeTxt()); //전송사
}
}
}
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyy_MM_dd_HH_mm_ss", 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) {}
}
}
//문자 전송 리스트(전체) 엑셀 다운로드
@RequestMapping(value="/uss/ion/msg/SendMsgDtlExcelDownload.do")
public void sendMsgDtlExcelDownload( MjonMsgVO mjonMsgVO,
HttpServletRequest request,
HttpServletResponse response ,
ModelMap model) throws Exception {
mjonMsgVO.setRecordCountPerPage(100000);
mjonMsgVO.setFirstIndex(0);
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
if(null != loginVO && !"super".equals(loginVO.getSiteId())){
mjonMsgVO.setSiteId(loginVO.getSiteId());
}
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
SXSSFWorkbook wb = new SXSSFWorkbook(100);
CellStyle style = wb.createCellStyle();
style.setBorderBottom(CellStyle.BORDER_THIN); //테두리 두껍게
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD); //글씨 bold
Cell cell = null;
Row row = null;
String fileName ="문자 전송 리스트(상세)";
String sheetTitle = "";
try{
List<MjonMsgVO> resultList = mjonMsgService.selectMjonMsgGroupDtList(mjonMsgVO);
{ //화면 리스트
sheetTitle = "문자 전송 리스트(상세)" ; //제목
Sheet sheet = wb.createSheet(sheetTitle);
row = sheet.createRow(0);
for(int i=0 ; i < sendMsgDtlExcelValue.length ; i++) {
cell = row.createCell(i);
cell.setCellStyle(style);
cell.setCellValue(sendMsgDtlExcelValue[i][1]);
}
for(int i=0; i < resultList.size(); i++){
row = sheet.createRow(i+1);
for(int j=0 ; j < sendMsgDtlExcelValue.length ; j++) {
cell = row.createCell(j);
cell.setCellStyle(style);
if(j==0) cell.setCellValue(i+1); //번호
if(j==1) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getUserId()); //아이디
if(j==2) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getCallFrom()); //발신자
if(j==3) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getCallTo()); //수신자
if(j==4) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getSentDateTxt()); //전송시간
if(j==5) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getSmsTxt()); //문자내용
if(j==6) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getCurStateTxt()); //현재상태
if(j==7) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getRsltCode() + "/" + ((MjonMsgVO)resultList.get(i)).getRsltCode2()); //처리결과
if(j==8) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getMsgTypeTxt()); //메시지타입
if(j==9) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getConectMthdTxt()); //접속기기
if(j==10) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getAgentCodeTxt()); //전송사
if(j==11) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getRsltNet()); //통신사
if(j==12) cell.setCellValue(((MjonMsgVO)resultList.get(i)).getDelFlagTxt()); //삭제여부
}
}
}
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyy_MM_dd_HH_mm_ss", 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) {}
}
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/insertAdminToMemberSendMsgDataAjax.do"})
public ModelAndView insertMemberSendMsgDataAjax(MjonMsgVO mjonMsgVO
, final MultipartHttpServletRequest multiRequest
, HttpServletRequest request) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
String resultSts = "0";
String resultBlockSts = "0";
if(userId.equals("")) {
modelAndView.addObject("message", "로그인이 필요합니다.");
modelAndView.addObject("result", "LoginFail");
return modelAndView;
}
try {
//첨부파일 체크 해주기
String atchFileId = "";
String imgFilePath = "";
String isThumbFile = "";
String KeyStr = "PHO_";
int fileCount = 0;
final Map<String, MultipartFile> files = multiRequest.getFileMap();
if (!files.isEmpty()){
if ("".equals(atchFileId)) {//신규 첨부파일 처리
String imagePath = "";
Date now = new Date();
SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
String fdlDate = formatDate.format(now);
//로컬 과 개발서버의 이미지 저장 경로 분기처리
if(request.getServerName().equals("localhost")) {
imagePath = fileSaveDir + "/file/MMS/" + fdlDate;
}else {
imagePath = fileSaveDir+"/file/MMS/" + fdlDate;
}
//별도 이미지 저장 함수로 파일 처리함
//List<FileVO> result = fileUtil.parseImageFileInf(files, KeyStr, 0, atchFileId , imagePath, isThumbFile);
//이미지 리사이징 처리하여 첨부되도록 처리
List<FileVO> result = fileUtil.parseImageFileResizeInf(files, KeyStr, 0, atchFileId , imagePath, isThumbFile);
atchFileId = fileMngService.insertFileInfs(result);
for(int i = 0; i < result.size(); i++) {
String fileStreCours = result.get(i).getFileStreCours();
String streFileNm = result.get(i).getStreFileNm();
String fileExtSn = result.get(i).getFileExtsn();
imgFilePath = fileStreCours+ "/" + streFileNm + "." + fileExtSn;
if(i == 0) {
mjonMsgVO.setFileName1(imgFilePath);
}else if(i == 1) {
mjonMsgVO.setFileName2(imgFilePath);
}else {
mjonMsgVO.setFileName3(imgFilePath);
}
fileCount ++;
}
//첨부파일 갯수 셋팅해주기
if(fileCount > 0) {
mjonMsgVO.setFileCnt(Integer.toString(fileCount));
mjonMsgVO.setMsgType("6");
}
}
}
//문자종류 관리자가 발송하는 것은 msgKind : S 로 셋팅
mjonMsgVO.setMsgKind("S");
//회원 발신번호 받아오기
String callTo = mjonMsgVO.getCallTo();
//mjonMsgVO.setCallTo(vaMsgLogVO.getCallTo()); //수신자 번호
//mjonMsgVO.setUserId(userId); //회원아이디
//JSPark 2023.01.13 : 시스템 발송 문자로 처리 => 전송사별 발송통계시 필요, 발송한 관리자 확인필요시 관리자 로그시간과 발송시간 확인요망
mjonMsgVO.setUserId("system"); // 문자전송 ID
mjonMsgVO.setReserveYn("N"); //즉시전송
if(mjonMsgVO.getFileCnt() == null) {//첨부이미지 갯수가 없는 경우
mjonMsgVO.setFileCnt("0");
}
//수신번호가 배열로 되어있어서 배열에 담아준다.
String[] phone = new String[1];
for(int j=0; j< 1; j++) {
phone[j] = callTo;
}
mjonMsgVO.setCallToList(phone);
// 문자타입 구분
if (mjonMsgVO.getMsgType().equals("4")) {
mjonMsgVO.setMsgDiv("S"); // 단문
}
else if (mjonMsgVO.getMsgType().equals("6")) {
if (fileCount > 0) {
mjonMsgVO.setMsgDiv("P"); // 그림
}
else {
mjonMsgVO.setMsgDiv("L"); // 장문
}
}
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(mjonMsgVO2.getAgentCode()); //전송사 선택
if (mjonMsgVO.getAgentCode().equals("03")) { //아이엠오 전송사 문자 타입 설정해 주기
// 단순 장문 문자는 neoType : 2, 그림 포함 : 4
if (mjonMsgVO.getFileCnt().equals("0")) { // 단순 장문 문자
mjonMsgVO.setNeoType("2");
}
else { // 그림포함 문자인경우
mjonMsgVO.setNeoType("4");
}
}
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
//현재 고객의 보유 캐시가 문자 발송이 가능한 금액인지 체크
String userPoint = "0.0";
mjonMsgVO.setBefPoint(userPoint); //현재 보유 포인트 정보 저장
mjonMsgVO.setBefCash("0.0"); //관리자가 발송하는 것이라서 0원으로 입력
//문자 발송 처리
MjonMsgReturnVO returnVO = mjonMsgDataService.insertAdmToMberMsgDataInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(returnVO.getAgentCode());
resultSts = returnVO.getSendMsgCnt();
resultBlockSts = returnVO.getSendMsgBlockCnt();
if (!resultSts.equals("")) {
modelAndView.addObject("message", "문자 발송에 성공 하였습니다.");
modelAndView.addObject("result", "success");
modelAndView.addObject("resultSts", resultSts);
modelAndView.addObject("resultBlockSts", resultBlockSts);
}
else {
modelAndView.addObject("message", "문자 발송에 실패 하였습니다.");
modelAndView.addObject("result", "fail");
}
} catch (Exception e) {
throw new Exception("관리자가 사용자에게 문자 발송 오류 ::: " + e);
}
return modelAndView;
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/insertAdminToMemberSendMsgData2Ajax.do"})
public ModelAndView insertMemberSendMsgData2Ajax(MjonMsgVO mjonMsgVO
, final MultipartHttpServletRequest multiRequest
, HttpServletRequest request) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
String resultSts = "0";
String resultBlockSts = "0";
if(userId.equals("")) {
modelAndView.addObject("message", "로그인이 필요합니다.");
modelAndView.addObject("result", "LoginFail");
return modelAndView;
}
try {
//첨부파일 체크 해주기
String atchFileId = "";
String imgFilePath = "";
String isThumbFile = "";
String KeyStr = "PHO_";
int fileCount = 0;
final Map<String, MultipartFile> files = multiRequest.getFileMap();
if (!files.isEmpty()){
if ("".equals(atchFileId)) {//신규 첨부파일 처리
String imagePath = "";
Date now = new Date();
SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
String fdlDate = formatDate.format(now);
//로컬 과 개발서버의 이미지 저장 경로 분기처리
if(request.getServerName().equals("localhost")) {
imagePath = fileSaveDir + "/file/MMS/" + fdlDate;
}else {
imagePath = fileSaveDir+"/file/MMS/" + fdlDate;
}
//별도 이미지 저장 함수로 파일 처리함
//List<FileVO> result = fileUtil.parseImageFileInf(files, KeyStr, 0, atchFileId , imagePath, isThumbFile);
//이미지 리사이징 처리하여 첨부되도록 처리
List<FileVO> result = fileUtil.parseImageFileResizeInf(files, KeyStr, 0, atchFileId , imagePath, isThumbFile);
atchFileId = fileMngService.insertFileInfs(result);
for(int i = 0; i < result.size(); i++) {
String fileStreCours = result.get(i).getFileStreCours();
String streFileNm = result.get(i).getStreFileNm();
String fileExtSn = result.get(i).getFileExtsn();
imgFilePath = fileStreCours+ "/" + streFileNm + "." + fileExtSn;
if(i == 0) {
mjonMsgVO.setFileName1(imgFilePath);
}else if(i == 1) {
mjonMsgVO.setFileName2(imgFilePath);
}else {
mjonMsgVO.setFileName3(imgFilePath);
}
fileCount ++;
}
//첨부파일 갯수 셋팅해주기
if(fileCount > 0) {
mjonMsgVO.setFileCnt(Integer.toString(fileCount));
mjonMsgVO.setMsgType("6");
}
}
}
//문자종류 관리자가 발송하는 것은 msgKind : S 로 셋팅
mjonMsgVO.setMsgKind("S");
//회원 발신번호 받아오기
String callTo = mjonMsgVO.getCallTo();
//mjonMsgVO.setCallTo(vaMsgLogVO.getCallTo()); //수신자 번호
//mjonMsgVO.setUserId(userId); //회원아이디
//JSPark 2023.01.13 : 시스템 발송 문자로 처리 => 전송사별 발송통계시 필요, 발송한 관리자 확인필요시 관리자 로그시간과 발송시간 확인요망
mjonMsgVO.setUserId("system"); // 문자전송 ID
mjonMsgVO.setReserveYn("N"); //즉시전송
if(mjonMsgVO.getFileCnt() == null) {//첨부이미지 갯수가 없는 경우
mjonMsgVO.setFileCnt("0");
}
//수신번호가 배열로 되어있어서 배열에 담아준다.
String[] phone = new String[1];
for(int j=0; j< 1; j++) {
phone[j] = callTo;
}
mjonMsgVO.setCallToList(phone);
// 문자타입 구분
if (mjonMsgVO.getMsgType().equals("4")) {
mjonMsgVO.setMsgDiv("S"); // 단문
}
else if (mjonMsgVO.getMsgType().equals("6")) {
if (fileCount > 0) {
mjonMsgVO.setMsgDiv("P"); // 그림
}
else {
mjonMsgVO.setMsgDiv("L"); // 장문
}
}
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
if (mjonMsgVO.getAgentCode().equals("00")) {
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(mjonMsgVO2.getAgentCode());
}
else {
mjonMsgVO2 = mjonMsgService.selectChoiMsgAgetnInfo(mjonMsgVO);
}
if (mjonMsgVO.getAgentCode().equals("03")) { //아이엠오 전송사 문자 타입 설정해 주기
// 단순 장문 문자는 neoType : 2, 그림 포함 : 4
if (mjonMsgVO.getFileCnt().equals("0")) { // 단순 장문 문자
mjonMsgVO.setNeoType("2");
}
else { // 그림포함 문자인경우
mjonMsgVO.setNeoType("4");
}
}
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
//현재 고객의 보유 캐시가 문자 발송이 가능한 금액인지 체크
String userPoint = "0.0";
mjonMsgVO.setBefPoint(userPoint); //현재 보유 포인트 정보 저장
mjonMsgVO.setBefCash("0.0"); //관리자가 발송하는 것이라서 0원으로 입력
//문자 발송 처리
MjonMsgReturnVO returnVO = mjonMsgDataService.insertAdmToMberMsgDataInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(returnVO.getAgentCode());
resultSts = returnVO.getSendMsgCnt();
resultBlockSts = returnVO.getSendMsgBlockCnt();
if (!resultSts.equals("")) {
modelAndView.addObject("message", "문자 발송에 성공 하였습니다.");
modelAndView.addObject("result", "success");
modelAndView.addObject("resultSts", resultSts);
modelAndView.addObject("resultBlockSts", resultBlockSts);
}
else {
modelAndView.addObject("message", "문자 발송에 실패 하였습니다.");
modelAndView.addObject("result", "fail");
}
} catch (Exception e) {
throw new Exception("관리자가 사용자에게 문자 발송 오류 ::: " + e);
}
return modelAndView;
}
/**
* 스팸 및 스미싱 30분 지연문자 전송 취소 처리
* @param mjonMsgVO
* @param model
* @return "/uss/ion/msg/deleteMsgDelaySendCancelDataAjax.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/deleteMsgDelaySendCancelDataAjax.do"})
public ModelAndView deleteMsgDelaySendCancelDataAjax(MjonMsgVO mjonMsgVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String isStatus = "";
String msg = "";
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("isStatus", "loginFail");
modelAndView.addObject("msg", "로그인이 필요합니다.");
return modelAndView;
}
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(mjonMsgVO.getUserId());//회원 아이디
String[] arrMsgGroupId = mjonMsgVO.getMsgGroupId().split(",");
int resultSts = 0;
//문자 발송요청일자 체크해주기
boolean compareReqDate = getCompareReqDateList(arrMsgGroupId, mjonMsgVO.getUserId());
if(!compareReqDate) {
modelAndView.addObject("isStatus", "dateFail");
modelAndView.addObject("msg", "발송시간이 지난 문자가 있습니다. 문자 발송예정 시간을 확인해 주세요.");
return modelAndView;
}
for(String temp : arrMsgGroupId) {
mjonResvMsgVO.setMsgGroupId(temp);//취소 문자 그룹 아이디
int count = mjonMsgService.deleteMsgDelaySendCancelData(mjonResvMsgVO);
resultSts = resultSts + count;
}
if(resultSts > 0) {
modelAndView.addObject("isStatus", "success");
modelAndView.addObject("msg", "발송취소가 정상적으로 처리되었습니다.");
}else {
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "발송취소에 오류가 발생하였습니다.");
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ deleteMsgDelaySendCancelDataAjax Controller Error !!!! "+e);
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "오류가 발생하였습니다.");
return modelAndView;
}
return modelAndView;
}
/**
* 스팸 및 스미싱 30분 지연문자 즉시 전송 처리
* @param mjonMsgVO
* @param model
* @return "/uss/ion/msg/updateMsgDelaySendRealTimeDataAjax.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/updateMsgDelaySendRealTimeDataAjax.do"})
public ModelAndView updateMsgDelaySendRealTimeDataAjax(MjonMsgVO mjonMsgVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String isStatus = "";
String msg = "";
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("isStatus", "loginFail");
modelAndView.addObject("msg", "로그인이 필요합니다.");
return modelAndView;
}
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(mjonMsgVO.getUserId());//회원 아이디
String[] arrMsgGroupId = mjonMsgVO.getMsgGroupId().split(",");
int resultSts = 0;
//문자 발송요청일자 체크해주기
boolean compareReqDate = getCompareReqDateList(arrMsgGroupId, mjonMsgVO.getUserId());
if(!compareReqDate) {
modelAndView.addObject("isStatus", "dateFail");
modelAndView.addObject("msg", "발송시간이 지난 문자가 있습니다. 문자 발송예정 시간을 확인해 주세요.");
return modelAndView;
}
for(String temp : arrMsgGroupId) {
mjonResvMsgVO.setMsgGroupId(temp);//취소 문자 그룹 아이디
//문자 발송 지연 데이터 즉시 발송처리
int count = mjonMsgService.updateMsgDelaySendRealTimeData(mjonResvMsgVO);
resultSts = resultSts + count;
}
if(resultSts > 0) {
modelAndView.addObject("isStatus", "success");
modelAndView.addObject("msg", "즉시 발송 처리가 완료되었습니다.");
}else {
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "즉시 발송 처리에 오류가 발생하였습니다.");
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ updateMsgDelaySendRealTimeDataAjax Controller Error !!!! "+e);
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "오류가 발생하였습니다.");
return modelAndView;
}
return modelAndView;
}
/**
* 문자 즉시 전송 처리
* @param mjonMsgVO
* @param model
* @return "/uss/ion/msg/updateMsgDirectSendAjax.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/updateMsgDirectSendAjax.do"})
public ModelAndView updateMsgDirectSendAjax(MjonMsgVO mjonMsgVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String isStatus = "";
String msg = "";
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("isStatus", "loginFail");
modelAndView.addObject("msg", "로그인이 필요합니다.");
return modelAndView;
}
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(mjonMsgVO.getUserId());//회원 아이디
String[] arrMsgGroupId = mjonMsgVO.getMsgGroupId().split(",");
int resultSts = 0;
//문자 발송요청일자 체크해주기
/*boolean compareReqDate = getCompareReqDateList(arrMsgGroupId, mjonMsgVO.getUserId());
if(!compareReqDate) {
modelAndView.addObject("isStatus", "dateFail");
modelAndView.addObject("msg", "발송시간이 지난 문자가 있습니다. 문자 발송예정 시간을 확인해 주세요.");
return modelAndView;
}*/
for(String temp : arrMsgGroupId) {
mjonResvMsgVO.setMsgGroupId(temp);//취소 문자 그룹 아이디
//문자 발송 지연 데이터 즉시 발송처리
int count = mjonMsgService.updateMsgDirectSend(mjonResvMsgVO);
resultSts = resultSts + count;
}
if(resultSts > 0) {
modelAndView.addObject("isStatus", "success");
modelAndView.addObject("msg", "즉시 발송 처리가 완료되었습니다.");
}else {
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "즉시 발송 처리에 오류가 발생하였습니다.");
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ updateMsgDelaySendRealTimeDataAjax Controller Error !!!! "+e);
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "오류가 발생하였습니다.");
return modelAndView;
}
return modelAndView;
}
/**
* 스팸 및 스미싱 30분 지연알림톡 전송 취소 처리
* @param mjonMsgVO
* @param model
* @return "/uss/ion/msg/deleteKakaoATDelaySendCancelDataAjax.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/deleteKakaoATDelaySendCancelDataAjax.do"})
public ModelAndView deleteKakaoATDelaySendCancelDataAjax(MjonMsgVO mjonMsgVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String isStatus = "";
String msg = "";
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("isStatus", "loginFail");
modelAndView.addObject("msg", "로그인이 필요합니다.");
return modelAndView;
}
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(mjonMsgVO.getUserId());//회원 아이디
String[] arrMsgGroupId = mjonMsgVO.getMsgGroupId().split(",");
int resultSts = 0;
//문자 발송요청일자 체크해주기
boolean compareReqDate = getCompareReqDateList(arrMsgGroupId, mjonMsgVO.getUserId());
if(!compareReqDate) {
modelAndView.addObject("isStatus", "dateFail");
modelAndView.addObject("msg", "발송시간이 지난 문자가 있습니다. 문자 발송예정 시간을 확인해 주세요.");
return modelAndView;
}
for(String temp : arrMsgGroupId) {
mjonResvMsgVO.setMsgGroupId(temp);//취소 문자 그룹 아이디
int count = mjonMsgService.deleteKakaoAtDelaySendCancelData(mjonResvMsgVO);
resultSts = resultSts + count;
}
if(resultSts > 0) {
modelAndView.addObject("isStatus", "success");
modelAndView.addObject("msg", "발송취소가 정상적으로 처리되었습니다.");
}else {
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "발송취소에 오류가 발생하였습니다.");
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ deleteKakaoATDelaySendCancelDataAjax Controller Error !!!! "+e);
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "오류가 발생하였습니다.");
return modelAndView;
}
return modelAndView;
}
/**
* 스팸 및 스미싱 30분 지연알림톡 즉시 전송 처리
* @param mjonMsgVO
* @param model
* @return "/uss/ion/msg/updateKakaoATDelaySendRealTimeDataAjax.do"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/updateKakaoATDelaySendRealTimeDataAjax.do"})
public ModelAndView updateKakaoATDelaySendRealTimeDataAjax(MjonMsgVO mjonMsgVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
String isStatus = "";
String msg = "";
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("isStatus", "loginFail");
modelAndView.addObject("msg", "로그인이 필요합니다.");
return modelAndView;
}
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(mjonMsgVO.getUserId());//회원 아이디
String[] arrMsgGroupId = mjonMsgVO.getMsgGroupId().split(",");
int resultSts = 0;
//문자 발송요청일자 체크해주기
boolean compareReqDate = getCompareReqDateList(arrMsgGroupId, mjonMsgVO.getUserId());
if(!compareReqDate) {
modelAndView.addObject("isStatus", "dateFail");
modelAndView.addObject("msg", "발송시간이 지난 문자가 있습니다. 문자 발송예정 시간을 확인해 주세요.");
return modelAndView;
}
for(String temp : arrMsgGroupId) {
mjonResvMsgVO.setMsgGroupId(temp);//취소 문자 그룹 아이디
//문자 발송 지연 데이터 즉시 발송처리
int count = mjonMsgService.updateKakaoAtDelaySendRealTimeData(mjonResvMsgVO);
resultSts = resultSts + count;
}
if(resultSts > 0) {
modelAndView.addObject("isStatus", "success");
modelAndView.addObject("msg", "즉시 발송 처리가 완료되었습니다.");
}else {
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "즉시 발송 처리에 오류가 발생하였습니다.");
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ updateKakaoATDelaySendRealTimeDataAjax Controller Error !!!! "+e);
modelAndView.addObject("isStatus", "fail");
modelAndView.addObject("msg", "오류가 발생하였습니다.");
return modelAndView;
}
return modelAndView;
}
/**
* 전송사 발송 통계
* @param
* @param
* @return "/uss/ion/msg/MsgSendStatistics.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/MsgSendStatistics.do"})
public String MsgSendStatistics(@ModelAttribute("searchVO") MjonMsgStatVO searchVO, HttpServletRequest request, ModelMap model) throws Exception{
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
if (null == searchVO.getSearchStartDate() || searchVO.getSearchStartDate().equals("")) {
searchVO.setSearchDateType("day");
searchVO.setSearchStartDate(toDay);
searchVO.setSearchEndDate(toDay);
}
List<MjonMsgStatVO> statList = mjonMsgService.selectAgentSmsCountStatList(searchVO);
model.addAttribute("statList", statList);
paginationInfo.setTotalRecordCount(statList.size() > 0 ? ((MjonMsgStatVO)statList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
model.addAttribute("searchVO", searchVO);
return "/uss/ion/msg/MsgSendStatistics";
}
// 전송사 발송 통계
@RequestMapping(value = "/uss/ion/msg/insertAgentSmsCountStatApiAjax.do")
public ModelAndView AgentSmsCountStatApiAjax(
@ModelAttribute("mjonMsgStatVO") MjonMsgStatVO mjonMsgStatVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
StatsVO memPayStatInfo = new StatsVO();
try {
mjonMsgService.insertAgentSmsCountStat(mjonMsgStatVO);
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("memPayStatInfo", memPayStatInfo);
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
return modelAndView;
}
public boolean getCompareReqDateList(String[] arrMsgGroupId, String userId) throws Exception {
boolean compareStatus = true;
try {
MjonResvMsgVO mjonResvMsgVO = new MjonResvMsgVO();
mjonResvMsgVO.setUserId(userId);//회원 아이디
int resultSts = 0;
//문자 그룹 정보 체크하기
List<String> groupIdList = new ArrayList<String>();
for(String msgGId : arrMsgGroupId) {
groupIdList.add(msgGId);
}
mjonResvMsgVO.setMsgGroupIdList(groupIdList);
List<MjonResvMsgVO> resultMsgReqDateList = mjonMsgService.selectMsgGroupDataReqDateList(mjonResvMsgVO);
String compareDate = "";
for(int i=0; i < resultMsgReqDateList.size(); i++) {
System.out.println(resultMsgReqDateList.get(i).getStrReqDate());
String toDate = resultMsgReqDateList.get(i).getStrReqDate();
compareDate = MJUtil.getCompareDateToSeconds(toDate);
if(compareDate.equals("after")) {//발송 예정 일자가 현재시간 이전이면 false를 리턴함.
compareStatus = false;
return compareStatus;
}
}
} catch (Exception e) {
System.out.println("+++++++++++++++++++++++++++++++++++ getCompareReqDateList Controller Error !!!! "+e);
return compareStatus;
}
return compareStatus;
}
/**
* 관리자 이메일 발송 처리
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/email/insertAdminToMemberSendEmailDataAjax.do"})
public ModelAndView insertAdminToMemberSendEmailDataAjax(SendLogVO sendLogVO, EmailVO mailSender) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId.equals("")) {
modelAndView.addObject("message", "로그인이 필요합니다.");
modelAndView.addObject("result", "LoginFail");
return modelAndView;
}
try {
// 이메일 발송 내용
String contents = "";
contents += "<!DOCTYPE html>";
contents += "<html lang=\"ko\">";
contents += "<head>";
contents += "<meta charset=\"UTF-8\">";
contents += "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">";
contents += "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">";
contents += "<title>대량문자 발송 사이트 문자온 안내 메일 입니다.</title>";
contents += "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">";
contents += "<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>";
contents += "<link href=\"https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap\" rel=\"stylesheet\">";
contents += "</head>";
contents += "";
contents += "<body>";
contents += "<div class=\"wrap\" style=\"width: 100%; height: 100%; background-color: #e3e8f0; padding: 70px 0;\">";
contents += "<div class=\"box\" style=\"max-width: 700px; width: 98%; background-color: #fff; box-shadow: 0 0 5px rgba(0,0,0,0.2); border-radius: 20px; overflow: hidden; margin: 0 auto;\">";
contents += "<div class=\"area_top\" style=\"background-color: #2e5ac8; width: 100%; height: 80px; padding: 0 40px; box-sizing: border-box;\">";
contents += "<p style=\"display:inline-block; color: #fff; font-size: 24px; margin: 0; font-family: 'Noto Sans KR', sans-serif; line-height: 80px;\">";
contents += "<span style=\"font-weight: 600;\">문자온 안내</span> 메일입니다.</p> <a href=\"http://www.munjaon.co.kr\" target='_blank' style='text-decoration:none'><img src=\"http://www.munjaon.co.kr/publish/images/emailForm/top_logo.png\" alt=\"\" style=\"width: 94px; height: 53px; float: right; margin-top: 12px; vertical-align:top;\"></a>";
contents += "</div>";
contents += "<div class=\"area_content\" style=\"padding: 6%;\">";
contents += "<p style=\"font-size: 18px; letter-spacing: -0.5px; line-height: 1.5; color: #222; margin: 0; font-weight: 400; font-family: 'Noto Sans KR', sans-serif;\">";
contents += "안녕하세요. 대량문자 발송 사이트 문자온입니다.<br></p>";
contents += "<p class=\"area_num\" style=\"background-color: #f3f4f5; width: 100%; font-family: 'Noto Sans KR', sans-serif; font-size: 21px; font-weight: 600; box-sizing: border-box; border-radius: 1px; letter-spacing: -0.5px; padding: 8px 30px; margin: 20px 0;\">%emailContents%</p>";
contents += "<p style=\"padding-top: 40px; font-size: 18px; font-family: 'Noto Sans KR', sans-serif; letter-spacing: -0.5px; line-height: 1.5; color: #222; margin: 0;\">문자온 서비스를 이용해 주셔서 감사합니다.</p>";
contents += "<div class=\"info_mail\" style=\"width: 100%; border-top: 1px solid #d5d5d5; margin-top: 20px;\">";
contents += "<p style=\"font-size: 15px; font-weight: 400; color: #999; line-height: 1.3; letter-spacing: -0.5px; font-family: 'Noto Sans KR', sans-serif;\">본 메일은 <span style=\"font-weight: 500;\">발신전용</span>이며, 문의에 대한 회신은 처리되지 않습니다. 문자온 관련하여 궁금하신 점이나 불편한 사항은 <span style=\"font-weight: 500;\">고객센터</span>를 통해 문의하여 주시기 바랍니다.</p>";
contents += "<p style=\"margin-top: 20px; font-size: 15px; font-weight: 400; color: #999; line-height: 1.3; letter-spacing: -0.5px; font-family: 'Noto Sans KR', sans-serif;\">주소 : (12248) 경기도 남양주시 다산순환로 20, A동 735호(다산동, 현대프리미어캠퍼스) <br> 사업자 번호 : 653-87-00858 | 대표 : 유인식 | 통신판매등록번호 : 제 2021-다산-0422 <br> 문의전화 : 010-8432-9333 | E-mail : help@iten.co.kr</p>";
contents += "<p style=\"margin-top: 20px; font-size: 15px; font-weight: 400; color: #999; line-height: 1.3; letter-spacing: -0.5px; font-family: 'Noto Sans KR', sans-serif;\">Copyright 2020 ⓒ MUNJAON co. Ltd, All rights reserved.</p>";
contents += "</div>";
contents += "</div>";
contents += "</div>";
contents += "</div>";
contents += "</body>";
contents += "";
contents += "</html>";
String repContents = contents;
String emailCont = mailSender.getContents().replace("\r\n", "<br/>");//줄바꿈 변환해주기
repContents = repContents.replace("%emailContents%", emailCont);
/*SimpleDateFormat format = new SimpleDateFormat("yyyy년 MM월 dd일 HH시 mm분");
Date nowdate = new Date();
String date = format.format(nowdate);
repContents = repContents.replace("%date%", date);*/
// 이메일로 보내기
SendMail sMail = new SendMail();
// 사용자 이메일 주소
mailSender.setSend_from(mailSender.getSend_from());
// 발송자 이메일 주소
mailSender.setSend_to(mailSender.getSend_to());
// 메일 제목
mailSender.setTitle(mailSender.getTitle());
// 메일 내용
mailSender.setContents(repContents);
// 메일 발송하기
sMail.sendMail2(mailSender);
// 발송 이력 저장 SendType 1:문자로 발송 2:이메일로 발송
sendLogVO.setSendType("2");
sendLogVO.setFrstSendInfo(mailSender.getSend_from());//이메일 발신자 정보
sendLogVO.setReceive(mailSender.getSend_to()); //수신자 정보
sendLogVO.setContents(repContents);
mjonMsgDataService.insertSysMsgLog(sendLogVO);
modelAndView.addObject("result", "success");
modelAndView.addObject("message", "정상적으로 이메일이 발송되었습니다.");
} catch (Exception e) {
e.printStackTrace();
modelAndView.addObject("result", "fail");
modelAndView.addObject("message", "이메일 발송 중에 오류가 발생하였습니다.\n(F5)새로고침 후 다시 진행 부탁드립니다.");
}
return modelAndView;
}
/**
* 욕설 및 금지어 리스트
* @param MjonMsgResultCodeVO
* @param model
* @return "/uss/ion/msg/MsgResultCodeList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/selectSwearWordList.do"})
public String selectSwearWordList(@ModelAttribute("searchVO") MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model) throws Exception{
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonSwearWordVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonSwearWordVO.getPageUnit());
paginationInfo.setPageSize(mjonSwearWordVO.getPageSize());
mjonSwearWordVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonSwearWordVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonSwearWordVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
List<MjonSwearWordVO> resultList = mjonMsgService.selectSwearWordListPageing(mjonSwearWordVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonSwearWordVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/swear/SwearWordList"; //문자결과 리스트
}
/**
* 욕설 및 금지어 등록 화면
* @param MjonSwearWordVO
* @param model
* @return ""
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/addSwearWord.do"})
public String addSwearWord(@ModelAttribute("searchVO") MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model) throws Exception{
return "/uss/ion/swear/SwearWordRegist";
}
/**
* 욕설 및 금지어 등록 처리
* @param MjonSwearWordVO
* @param model
* @return "/uss/ion/swear/selectSwearWordList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/insertSwearWord.do"})
public String insertSwearWord(MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model,
RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
mjonSwearWordVO.setFrstRegisterId(lastUpdusrId);
mjonSwearWordVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.insertSwearWord(mjonSwearWordVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "등록이 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "등록이 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/swear/selectSwearWordList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 욕설 및 금지어 수정 화면
* @param MjonSwearWordVO
* @param model
* @return "/uss/ion/swear/selectSwearWordModify.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/selectSwearWordModify.do"})
public String selectSwearWordModify(MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model,
RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(loginVO == null || lastUpdusrId.equals("")) {
redirectAttributes.addFlashAttribute("message", "로그인이 필요합니다.");
return "redirect:/uat/uia/EgovLoginUsr.do";
}
MjonSwearWordVO resultVO = mjonMsgService.selectSwearWordModify(mjonSwearWordVO);
model.addAttribute("resultVO", resultVO);
return "/uss/ion/swear/SwearWordModify";
}
/**
* 욕설 및 금지어 수정 처리
* @param MjonSwearWordVO
* @param model
* @return "/uss/ion/swear/selectSwearWordList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/updateSwearWord.do"})
public String updateSwearWord(MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model,
RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(loginVO == null || lastUpdusrId.equals("")) {
redirectAttributes.addFlashAttribute("message", "로그인이 필요합니다.");
return "redirect:/uat/uia/EgovLoginUsr.do";
}
mjonSwearWordVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.updateSwearWord(mjonSwearWordVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "수정이 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "수정이 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/swear/selectSwearWordList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 욕설 및 금지어 삭제 처리
* @param MjonSwearWordVO
* @param model
* @return "/uss/ion/swear/selectSwearWordList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/swear/deleteSwearWord.do"})
public String deleteSwearWord(MjonSwearWordVO mjonSwearWordVO,
HttpServletRequest request,
ModelMap model,
RedirectAttributes redirectAttributes) throws Exception{
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(loginVO == null || lastUpdusrId.equals("")) {
redirectAttributes.addFlashAttribute("message", "로그인이 필요합니다.");
return "redirect:/uat/uia/EgovLoginUsr.do";
}
mjonSwearWordVO.setLastUpdusrId(lastUpdusrId);
int resultCnt = mjonMsgService.deleteSwearWord(mjonSwearWordVO);
if(resultCnt == 0) {
redirectAttributes.addFlashAttribute("message", "수정이 실패되었습니다.");
}else {
redirectAttributes.addFlashAttribute("message", "수정이 완료되었습니다.");
}
RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("uss/ion/swear/selectSwearWordList.do");
return redirectUrlMaker.getRedirectUrl();
}
/**
* 신규회원 문자전송 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/NewUserSendMsgList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/NewUserSendMsgList.do"})
public String newUserSendMsgList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("reqDate");
searchVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
resultList = mjonMsgService.selectNewUserMjonMsgGroupList(searchVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/NewUserSendMsgList";
}
/**
* 일별 문자발송 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/msgDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/msgDayChart.do"})
public String selectMsgDayChart(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgVO.getPageSize());
mjonMsgVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(mjonMsgVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgVO.setSearchSortCnd("regDate");
mjonMsgVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = mjonMsgService.selectMsgDayChart(mjonMsgVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/MsgDayChart";
}
/**
* 일별 문자발송 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/msgDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/msgDayChart_230125.do"})
public String selectMsgDayChart_230125(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgVO.getPageSize());
mjonMsgVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(mjonMsgVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgVO.setSearchSortCnd("regDate");
mjonMsgVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = mjonMsgService.selectMsgDayChart_230125(mjonMsgVO);
try {
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
if (resultList.size()>0) {
model.addAttribute("sttstDate", resultList.get(0).getRegistPnttm());
}
}catch(Exception ex) {
ex.printStackTrace();
}
return "/uss/ion/msg/MsgDayChart_230125";
}
/**
* 월별 문자발송 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/msgDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/msgMonthChart.do"})
public String selectMsgMonthChart(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
if("".equals(mjonMsgVO.getNtceBgnde()) || mjonMsgVO.getNtceBgnde() == null){ //최초조회시 현재년도 조회
LocalDate now = LocalDate.now();
int year = now.getYear();
mjonMsgVO.setNtceBgnde(Integer.toString(year));
}
List<MjonMsgVO> resultList = mjonMsgService.selectMsgMonthChart(mjonMsgVO);
model.addAttribute("resultList", resultList);
return "/uss/ion/msg/MsgMonthChart";
}
/**
* 월별 문자발송 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/msgDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/msgMonthChart_230125.do"})
public String selectMsgMonthChart_230125(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
if("".equals(mjonMsgVO.getNtceBgnde()) || mjonMsgVO.getNtceBgnde() == null){ //최초조회시 현재년도 조회
LocalDate now = LocalDate.now();
int year = now.getYear();
mjonMsgVO.setNtceBgnde(Integer.toString(year));
}
List<MjonMsgVO> resultList = mjonMsgService.selectMsgMonthChart_230125(mjonMsgVO);
model.addAttribute("resultList", resultList);
try {
if (resultList.size()>0) {
model.addAttribute("sttstDate", resultList.get(0).getRegistPnttm());
}
}catch(Exception ex) {
ex.printStackTrace();
}
return "/uss/ion/msg/MsgMonthChart_230125";
}
/**
* 일별 회원가입 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/memDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/memDayChart.do"})
public String selectMemDayChart(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgVO.getPageSize());
mjonMsgVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(mjonMsgVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgVO.setSearchSortCnd("regDate");
mjonMsgVO.setSearchSortOrd("desc");
}
List<MjonMsgVO> resultList = mjonMsgService.selectMemDayChart(mjonMsgVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/MemDayChart";
}
/**
* 월별 회원가입 건수 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/memDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/memMonthChart.do"})
public String selectMemMonthChart(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
if("".equals(mjonMsgVO.getNtceBgnde()) || mjonMsgVO.getNtceBgnde() == null){ //최초조회시 현재년도 조회
LocalDate now = LocalDate.now();
int year = now.getYear();
mjonMsgVO.setNtceBgnde(Integer.toString(year));
}
mjonMsgVO.setFirstIndex(0);
mjonMsgVO.setRecordCountPerPage(100);
List<MjonMsgVO> resultList = mjonMsgService.selectMemMonthChart(mjonMsgVO);
model.addAttribute("resultList", resultList);
return "/uss/ion/msg/MemMonthChart";
}
/**
* 일별 일별회원전환률 통계
* @param searchVO
* @param model
* @return "/uss/ion/msg/memDayChart"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/memLoginDayChart.do"})
public String selectMemLoginDayChart(@ModelAttribute("searchVO") MjonMsgVO mjonMsgVO,
HttpServletRequest request,
ModelMap model) throws Exception{
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(mjonMsgVO.getPageIndex());
paginationInfo.setRecordCountPerPage(mjonMsgVO.getPageUnit());
paginationInfo.setPageSize(mjonMsgVO.getPageSize());
mjonMsgVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mjonMsgVO.setLastIndex(paginationInfo.getLastRecordIndex());
mjonMsgVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(mjonMsgVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mjonMsgVO.setSearchSortCnd("regDate");
mjonMsgVO.setSearchSortOrd("desc");
}
//오늘
Date today = new Date();
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd");
String toDay = date.format(today);
//한달 전
Calendar mon = Calendar.getInstance();
//mon.add(Calendar.MONTH , -1);
mon.add(Calendar.WEEK_OF_MONTH , -2);
String beforeMonthDay = new java.text.SimpleDateFormat("yyyy-MM-dd").format(mon.getTime());
if (null == mjonMsgVO.getNtceBgnde() || mjonMsgVO.getNtceBgnde().equals("")) {
mjonMsgVO.setNtceBgnde(beforeMonthDay);
mjonMsgVO.setNtceEndde(toDay);
}
List<MjonMsgVO> resultList = mjonMsgService.selectMemLoginDayChart(mjonMsgVO);
MjonMsgVO resultInfo = mjonMsgService.selectMemLoginDayChartCount(mjonMsgVO);
model.addAttribute("resultList", resultList);
paginationInfo.setTotalRecordCount(resultInfo.getTotCnt() > 0 ? resultInfo.getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/MemLoginDayChart";
}
/**
* 관리자 / 시스템에서 발송한 문자전송 리스트
* @param searchVO
* @param model
* @return "/uss/ion/msg/admSystemSendMsgList.do"
* @throws Exception
*/
@RequestMapping(value= {"/uss/ion/msg/admSystemSendMsgList.do"})
public String admSystemSendMsgList(@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
ModelMap model) throws Exception{
//value 값 가져오기
// String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("reqDate");
searchVO.setSearchSortOrd("desc");
}
// 기간검색 설정
String toDay = MJUtil.getTodayDate(); //오늘
String beforeMonthDay = MJUtil.getBefore1MonthDate(); //한달 전
if (null == searchVO.getNtceBgnde() || searchVO.getNtceBgnde().equals("")) {
searchVO.setNtceBgnde(beforeMonthDay);
//searchVO.setNtceEndde(toDay);
}
List<MjonMsgVO> resultList = new ArrayList<MjonMsgVO>();
resultList = mjonMsgService.selectAdmSystemSendMsgList(searchVO);
model.addAttribute("resultList", resultList);
//문자발송 실패 결과 코드정보 리스트 불러오기
MjonMsgResultCodeVO mjonMsgResultCodeVO = new MjonMsgResultCodeVO();
List<MjonMsgResultCodeVO> resultMsgCodeList = mjonMsgService.selectMsgResultCodeAllList(mjonMsgResultCodeVO);
model.addAttribute("resultMsgCodeList", resultMsgCodeList);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjonMsgVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/admSys/AdmSystemSendMsgList";
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = "/uss/ion/msg/admSystemSendMsgModify.do")
public String admSystemSendMsgModify(
@ModelAttribute("searchVO") MjonMsgVO searchVO,
HttpServletRequest request ,
Model model) throws Exception {
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE) ;
MjonMsgVO mjonMsgVO = new MjonMsgVO();
if(null != searchVO.getUserData() && !"".equals(searchVO.getUserData())) { //수정
mjonMsgVO = mjonMsgService.selectMjonMsgVO(searchVO);
//문자 상세보기 이미지 아이디 받아오기
String atchFileId1 ="";
String atchFileId2 ="";
String atchFileId3 ="";
String path1 = mjonMsgVO.getFilePath1();
String path2 = mjonMsgVO.getFilePath2();
String path3 = mjonMsgVO.getFilePath3();
FileVO fileVO1 = new FileVO();
FileVO fileVO2 = new FileVO();
FileVO fileVO3 = new FileVO();
if(StringUtil.isNotEmpty(path1)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO1 = getFilePathToAtchFileId(path1);
model.addAttribute("fileVO1", fileVO1);
}
if(StringUtil.isNotEmpty(path2)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO2 = getFilePathToAtchFileId(path2);
model.addAttribute("fileVO2", fileVO2);
}
if(StringUtil.isNotEmpty(path3)) {
//파일경로 및 이름을 이용하여 atchFileId, fileExtsn 번호 받아오기
fileVO3 = getFilePathToAtchFileId(path3);
model.addAttribute("fileVO3", fileVO3);
}
}
if(request.getHeader("REFERER").contains("ReceiveNumberList") ) { //수신번호 조회에서 넘김
mjonMsgVO.setBeforeUrl("ReceiveNumberList");
}
if(pattern.equals("/uss/ion/msg/CampaignMsgModify.do")) { //사용자 발신
searchVO.setSearchCampaignYn("Y");
}
model.addAttribute("mjonMsgVO", mjonMsgVO);
return "/uss/ion/msg/admSys/AdmSystemSendMsgModify";
}
//파일 이름을 이용하여 첨부파일 아이디(atchFileId), 첨부파일 순번(fileExtsn)을 찾는 함수
public FileVO getFilePathToAtchFileId(String filePath) throws Exception{
//마지막 / 의 인덱스 값 +1을 기준으로 문자열을 짤라줌
String strFilePath = filePath.substring(filePath.lastIndexOf("/")+1);
FileVO returnFileVO = new FileVO();
//파일 이름과 확장자를 분리해줌
String[] arrFileNm = strFilePath.split("\\.");
String fileNm = arrFileNm[0];
String fileExtsn = arrFileNm[1];
FileVO fileVO = new FileVO();
fileVO.setStreFileNm(fileNm);
fileVO.setFileExtsn(fileExtsn);
returnFileVO = mjonReservMsgService.selectFileNmToAtchFileIdInfo(fileVO);
return returnFileVO;
}
public String setSendNumberMakeParamUrl(MjPhoneMemberVO mjPhoneMemberVO) {
return "?delFlag="+mjPhoneMemberVO.getDelFlag()
+"&pageIndex="+mjPhoneMemberVO.getPageIndex()
+"&pageType="+mjPhoneMemberVO.getPageType()
+"&searchKeyword="+mjPhoneMemberVO.getSearchKeyword()
+"&searchCondition="+mjPhoneMemberVO.getSearchCondition()
+"&searchCondition2="+mjPhoneMemberVO.getSearchCondition2()
+"&searchCondition3="+mjPhoneMemberVO.getSearchCondition3()
+"&searchSortCnd="+mjPhoneMemberVO.getSearchSortCnd()
+"&searchSortOrd="+mjPhoneMemberVO.getSearchSortOrd()
;
}
private String setBlockNumberMakeParamUrl(MjPhoneMemberVO mjPhoneMemberVO) {
return "?delFlag="+mjPhoneMemberVO.getDelFlag()
+"&pageIndex="+mjPhoneMemberVO.getPageIndex()
+"&pageType="+mjPhoneMemberVO.getPageType()
+"&searchKeyword="+mjPhoneMemberVO.getSearchKeyword()
+"&searchCondition="+mjPhoneMemberVO.getSearchCondition()
+"&searchCondition4="+mjPhoneMemberVO.getSearchCondition4()
+"&searchSortCnd="+mjPhoneMemberVO.getSearchSortCnd()
+"&searchSortOrd="+mjPhoneMemberVO.getSearchSortOrd()
;
}
// 번호도용 문자차단 서비스로 인한 발송실패 문자알림 여부
@RequestMapping(value = "/uss/ion/msg/updateMsgGroupDataCallBackAjax.do")
public ModelAndView saveMainTagAjax(
@ModelAttribute("searchVO") MjonMsgVO searchVO) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
try{
// All
mjonMsgService.updateMsgGroupDataCallBackAll(searchVO);
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
return modelAndView;
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/insertAdminToMemberSendMsgDataAgentTestAjax.do"})
public ModelAndView insertAdminToMemberSendMsgDataAgentTestAjax(MjonMsgVO mjonMsgVO
, HttpServletRequest request) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
//로그인 정보 획득
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
String resultSts = "0";
String resultBlockSts = "0";
if(userId.equals("")) {
modelAndView.addObject("message", "로그인이 필요합니다.");
modelAndView.addObject("result", "LoginFail");
return modelAndView;
}
try {
//문자종류 관리자가 발송하는 것은 msgKind : S 로 셋팅
mjonMsgVO.setMsgKind("S");
//회원 발신번호 받아오기
String callTo = "01030266269";
//
mjonMsgVO.setCallFrom("01030266269");
//mjonMsgVO.setCallTo(vaMsgLogVO.getCallTo()); //수신자 번호
//mjonMsgVO.setUserId(userId); //회원아이디
//JSPark 2023.01.13 : 시스템 발송 문자로 처리 => 전송사별 발송통계시 필요, 발송한 관리자 확인필요시 관리자 로그시간과 발송시간 확인요망
mjonMsgVO.setUserId("system"); // 문자전송 ID
mjonMsgVO.setReserveYn("N"); //즉시전송
if(mjonMsgVO.getFileCnt() == null) {//첨부이미지 갯수가 없는 경우
mjonMsgVO.setFileCnt("0");
}
//수신번호가 배열로 되어있어서 배열에 담아준다.
String[] phone = new String[1];
for(int j=0; j< 1; j++) {
phone[j] = callTo;
}
mjonMsgVO.setCallToList(phone);
// 문자타입 구분
if (mjonMsgVO.getMsgType().equals("4")) {
mjonMsgVO.setMsgDiv("S"); // 단문
}
else if (mjonMsgVO.getMsgType().equals("6")) {
mjonMsgVO.setMsgDiv("L"); // 장문
}
// 문자타입별 대표전송사 정보
MjonMsgVO mjonMsgVO2 = new MjonMsgVO();
mjonMsgVO2 = mjonMsgService.selectRepMsgAgetnInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(request.getParameter("agent")); //전송사 선택
if (mjonMsgVO.getAgentCode().equals("03")) { //아이엠오 전송사 문자 타입 설정해 주기
// 단순 장문 문자는 neoType : 2, 그림 포함 : 4
if (mjonMsgVO.getFileCnt().equals("0")) { // 단순 장문 문자
mjonMsgVO.setNeoType("2");
}
else { // 그림포함 문자인경우
mjonMsgVO.setNeoType("4");
}
}
// 전송금액
mjonMsgVO.setTotPrice(mjonMsgVO2.getAgentPrice().toString()); //총금액
mjonMsgVO.setEachPrice(mjonMsgVO2.getAgentPrice().toString()); //한건 금액
//현재 고객의 보유 캐시가 문자 발송이 가능한 금액인지 체크
String userPoint = "0.0";
mjonMsgVO.setBefPoint(userPoint); //현재 보유 포인트 정보 저장
mjonMsgVO.setBefCash("0.0"); //관리자가 발송하는 것이라서 0원으로 입력
//문자 발송 처리
mjonMsgVO.setSmsTxt("test");
MjonMsgReturnVO returnVO = mjonMsgDataService.insertAdmToMberMsgDataInfo(mjonMsgVO);
mjonMsgVO.setAgentCode(returnVO.getAgentCode());
resultSts = returnVO.getSendMsgCnt();
resultBlockSts = returnVO.getSendMsgBlockCnt();
if (!resultSts.equals("")) {
modelAndView.addObject("message", "문자 발송에 성공 하였습니다.");
modelAndView.addObject("result", "success");
modelAndView.addObject("resultSts", resultSts);
modelAndView.addObject("resultBlockSts", resultBlockSts);
}
else {
modelAndView.addObject("message", "문자 발송에 실패 하였습니다.");
modelAndView.addObject("result", "fail");
}
} catch (Exception e) {
throw new Exception("관리자가 사용자에게 문자 발송 오류 ::: " + e);
}
return modelAndView;
}
@RequestMapping(value = {"/uss/ion/msg/weekendCsWorkMain.do"})
public String weekendCsWorkMain() throws Exception {
return "/uss/ion/msg/weekendCsWorkMain";
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/weekendCsWork.do"})
public String weekendCsWork(@ModelAttribute("searchVO") MjPhoneMemberVO searchVO,
HttpServletRequest request,
ModelMap model,
MberCmpHstVO mberCmpHstVO) throws Exception {
String certType = request.getParameter("certType");
model.addAttribute("certType", certType);
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(1);
paginationInfo.setRecordCountPerPage(100);
paginationInfo.setPageSize(100);
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(searchVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
searchVO.setSearchSortCnd("frstRegistPnttm");
searchVO.setSearchSortOrd("desc");
}
searchVO.setSearchSortAuthYN("Y");
searchVO.setPhmType("01"); //발신조회
List<MjPhoneMemberVO> resultList = mjonMsgService.selectSendNumberList(searchVO);
List<MjPhoneMemberVO> resultList2 = new ArrayList<MjPhoneMemberVO>();
resultList.stream()
.filter(t->t.getAuthYnTxt().equals("심사중"))
.collect(Collectors.toList())
.forEach(li->{resultList2.add(li);});
model.addAttribute("resultList", resultList2);
paginationInfo.setTotalRecordCount(resultList.size() > 0 ? ((MjPhoneMemberVO)resultList.get(0)).getTotCnt() : 0);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/weekendCsWork";
}
/**
* 문자전송 등록하기 위한 전 처리(공통코드 처리)
* @param searchVO
* @param model
* @return "/uss/ion/msg/SendMsgModify"
* @throws Exception
*/
@RequestMapping(value = {"/uss/ion/msg/weekendCsWork2.do"})
public String weekendCsWork2(@ModelAttribute("searchVO") MberCmpHstVO mberCmpHstVO,
HttpServletRequest request ,
ModelMap model) throws Exception {
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
String hstSttus = request.getParameter("hstSttus");
model.addAttribute("hstSttus", hstSttus);
//기업유형
ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
voComCode.setCodeId("ITN033");
model.addAttribute("bizTypeList", cmmUseService.selectCmmCodeDetail(voComCode));
// 유형 코드조회
voComCode.setCodeId("ITN048");
model.addAttribute("hstTypeList", cmmUseService.selectCmmCodeDetail(voComCode));
// 처리상태 코드조회
voComCode.setCodeId("ITN049");
model.addAttribute("hstSttusList", cmmUseService.selectCmmCodeDetail(voComCode));
if(mberCmpHstVO.getPageUnit() != 10) {
mberCmpHstVO.setPageUnit(mberCmpHstVO.getPageUnit());
}
/** paging */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(1);
paginationInfo.setRecordCountPerPage(100);
paginationInfo.setPageSize(100);
mberCmpHstVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
mberCmpHstVO.setLastIndex(paginationInfo.getLastRecordIndex());
mberCmpHstVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(mberCmpHstVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
mberCmpHstVO.setSearchSortCnd("frstRegistPnttm");
mberCmpHstVO.setSearchSortOrd("desc");
}
List<MberCmpHstVO> mberCmpHstList = egovMberCmpHstService.selectMberCmpHstListByType(mberCmpHstVO);
List<MberCmpHstVO> resultList = new ArrayList<MberCmpHstVO>();
mberCmpHstList.stream()
.filter(t -> t.getHstSttus().equals("01"))
.collect(Collectors.toList())
.forEach(li ->
{
resultList.add(li);
});
int totCnt = 0;
if(mberCmpHstList.size() > 0) {
totCnt = mberCmpHstList.get(0).getTotCnt();
}
model.addAttribute("mberCmpHstList", resultList);
paginationInfo.setTotalRecordCount(totCnt);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/weekendCsWork2";
}
@RequestMapping(value = {"/uss/ion/msg/pdfView.do"})
public String pdfView(FileVO fileVO
, ModelMap model
, HttpServletRequest request) throws Exception {
// 파라미터
String docuDiv = request.getParameter("docuDiv");
String hstManagerNm = request.getParameter("hstManagerNm");
String hstMbtlNum = request.getParameter("hstMbtlNum");
String cmphstId = request.getParameter("cmphstId");
String atchFileId = request.getParameter("atchFileId");
String workAtchFileId = request.getParameter("workAtchFileId");
// 조회
MberCmpHstVO mberCmpHstVO = new MberCmpHstVO();
mberCmpHstVO.setCmphstId(cmphstId);
mberCmpHstVO = egovMberCmpHstService.selectMberCmpHstDetail(mberCmpHstVO);
String hstSttus = mberCmpHstVO.getHstSttus();
String hstType = mberCmpHstVO.getHstType();
String mberNm = mberCmpHstVO.getMberNm();
String bizType = mberCmpHstVO.getBizType();
String bizNo = mberCmpHstVO.getBizNo();
String ceoNm = mberCmpHstVO.getCeoNm();
String mberId = mberCmpHstVO.getMberId();
String managerNm = mberCmpHstVO.getManagerNm();
String mbtlNum = mberCmpHstVO.getMbtlNum();
if (docuDiv.equals("2")) {
fileVO.setAtchFileId(workAtchFileId);
}
FileVO fvo = fileService.selectFileInf(fileVO);
String path = "";
String fileType = "";
String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray));
if(fvo != null) {
if("pdf".equals(fvo.getFileExtsn().toLowerCase())) {
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
fileType = "pdf";
} else if(imgExtList.contains(fvo.getFileExtsn().toLowerCase())) {
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
fileType = "img";
} else {
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
fileType = "etc";
}
}
//기업유형
ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
voComCode.setCodeId("ITN033");
model.addAttribute("bizTypeList", cmmUseService.selectCmmCodeDetail(voComCode));
// 유형 코드조회
voComCode.setCodeId("ITN048");
model.addAttribute("hstTypeList", cmmUseService.selectCmmCodeDetail(voComCode));
model.addAttribute("pdfPath", path);
model.addAttribute("fileType", fileType);
model.addAttribute("docuDiv", docuDiv);
model.addAttribute("atchFileId", atchFileId);
model.addAttribute("workAtchFileId", workAtchFileId);
model.addAttribute("mberNm", mberNm);
model.addAttribute("bizType", bizType);
model.addAttribute("bizNo", bizNo);
model.addAttribute("ceoNm", ceoNm);
model.addAttribute("hstManagerNm", hstManagerNm);
model.addAttribute("hstMbtlNum", hstMbtlNum);
model.addAttribute("hstSttus", hstSttus);
model.addAttribute("cmphstId", cmphstId);
model.addAttribute("hstType", hstType);
model.addAttribute("mberId", mberId);
model.addAttribute("managerNm", managerNm);
model.addAttribute("mbtlNum", mbtlNum);
model.addAttribute("atchFileSttus", mberCmpHstVO.getAtchFileSttus());
model.addAttribute("workAtchFileSttus", mberCmpHstVO.getWorkAtchFileSttus());
return "/uss/ion/msg/pdfView";
}
@RequestMapping(value = {"/uss/ion/msg/pdfViewPhone.do"})
public String pdfViewPhone(FileVO fileVO
, ModelMap model
, HttpServletRequest request) throws Exception {
FileVO fvo = fileService.selectFileInf(fileVO);
String path = "";
String fileType = "";
String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray));
if(fvo != null) {
if("pdf".equals(fvo.getFileExtsn().toLowerCase())) {
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
fileType = "pdf";
} else if(imgExtList.contains(fvo.getFileExtsn().toLowerCase())) {
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
fileType = "img";
} else {
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
fileType = "etc";
}
}
// 첨부파일 목록
List<FileVO> fileList = fileService.selectFileInfs(fileVO);
model.addAttribute("fileList", fileList);
// 파라미터
String phmId = request.getParameter("phmId");
String managerNm = request.getParameter("managerNm");
String dept = request.getParameter("dept");
String authYnTxt = request.getParameter("authYnTxt");
String phmAuthTypeTxt = request.getParameter("phmAuthTypeTxt");
String ownerName = request.getParameter("ownerName");
// 조회
MjPhoneMemberVO mjPhoneMemberVO = new MjPhoneMemberVO();
mjPhoneMemberVO = mjonMsgService.selectSendPhoneNumberByPhmId(phmId);
String phoneNumber = mjPhoneMemberVO.getPhoneNumber();
String userId = mjPhoneMemberVO.getUserId();
String userName = mjPhoneMemberVO.getUserName();
String nameType = mjPhoneMemberVO.getNameType();
String phmType = mjPhoneMemberVO.getPhmType();
String authYn = mjPhoneMemberVO.getAuthYn();
String rejectReason = mjPhoneMemberVO.getRejectReason();
// 필수서류
String requiredDocuments = "";
if (dept.equals("c")) {
// 기업
if (nameType.equals("1")) {
// 당사
requiredDocuments = "통신서비스이용증명원";
}
else if (nameType.equals("2")) {
// 대표
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
// 인증완료
}
else {
// 서류
requiredDocuments = "통신서비스이용증명원";
}
}
else if (nameType.equals("3")) {
// 직원
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
requiredDocuments = "재직증명서류";
}
else {
// 서류
requiredDocuments = "통신서비스이용증명원, 재직증명서류";
}
}
else if (nameType.equals("4")) {
// 타사
requiredDocuments = "거래관계확인서(계약서 등), 발신번호 사업자등록증, 재직증명서류(직원번호인 경우)<br />대리인 신분증 사본, 위임장, 통신서비스이용증명원";
}
else if (nameType.equals("5")) {
// 본인
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
// 인증완료
}
else {
// 서류
requiredDocuments = "통신서비스이용증명원";
}
}
else {
// 타인
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
}
else {
// 서류
}
}
}
else {
// 개인
if (nameType.equals("5")) {
// 본인
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
// 인증완료
}
else {
// 서류
requiredDocuments = "통신서비스이용증명원";
}
}
else {
// 타인
if (phmAuthTypeTxt.equals("휴대폰 인증")) {
// 휴대폰
requiredDocuments = "위임장, 대리인 신분증 사본";
}
else {
// 서류
requiredDocuments = "타인(일반전화) : 통신서비스이용증명원, 위임장, 대리인 신분증 사본<br />회사번호일경우 : 통신서비스이용증명원, 사업자등록증, 재직증명서류";
}
}
}
model.addAttribute("pdfPath", path);
model.addAttribute("fileType", fileType);
model.addAttribute("atchFileId", fileVO.getAtchFileId());
model.addAttribute("fileSn", fileVO.getFileSn());
model.addAttribute("phmId", phmId);
model.addAttribute("phoneNumber", phoneNumber);
model.addAttribute("userId", userId);
model.addAttribute("userName", userName);
model.addAttribute("managerNm", managerNm);
model.addAttribute("dept", dept);
model.addAttribute("nameType", nameType);
model.addAttribute("phmType", phmType);
model.addAttribute("authYn", authYn);
model.addAttribute("authYnTxt", authYnTxt);
model.addAttribute("phmAuthTypeTxt", phmAuthTypeTxt);
model.addAttribute("ownerName", ownerName);
model.addAttribute("requiredDocuments", requiredDocuments);
model.addAttribute("rejectReason", rejectReason);
return "/uss/ion/msg/pdfViewPhone";
}
}