From 1eef366c59b1cb7af59cf53c0a0ec6dc5d8a9f1e Mon Sep 17 00:00:00 2001 From: rosewiper Date: Fri, 8 Dec 2023 12:09:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=A0=EA=B1=B0=EB=AC=B8=EC=9E=90=2020?= =?UTF-8?q?=EA=B1=B4=20=EC=8B=A0=EA=B7=9C=20=EA=B8=B0=EB=8A=A5=201?= =?UTF-8?q?=EC=B0=A8=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EB=B0=9C=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=20-=20=ED=99=94=EB=A9=B4=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EB=B0=9C=20=20-=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1=20=EA=B8=B0=EB=8A=A5=EC=9D=80=20=EB=AF=B8=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/MjonCandidateService.java | 59 +- .../msgcampain/service/MjonCandidateTWVO.java | 125 + .../service/impl/MjonCandidateDAO.java | 142 +- .../impl/MjonCandidateServiceImpl.java | 172 + .../web/MjonMsgCampainTWDataController.java | 1368 +++++ .../let/msg/MjonMsgCampainData_SQL_mysql.xml | 151 +- .../msgcampain/tw/MsgTWDataCallToListView.jsp | 80 + .../web/msgcampain/tw/MsgTWDataSMLView.jsp | 4594 +++++++++++++++++ .../jsp/web/msgcampain/tw/MsgTWDataView.jsp | 2271 ++++++++ src/main/webapp/js/MJUtill.js | 17 + src/main/webapp/publish/js/publish.js | 104 +- 11 files changed, 9031 insertions(+), 52 deletions(-) create mode 100644 src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateTWVO.java create mode 100644 src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainTWDataController.java create mode 100644 src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataCallToListView.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataSMLView.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataView.jsp diff --git a/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateService.java b/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateService.java index 47a12258..13439017 100644 --- a/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateService.java +++ b/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateService.java @@ -1,19 +1,52 @@ package itn.let.mjo.msgcampain.service; +import java.util.List; + public interface MjonCandidateService { // 선거문자 후보자 정보 불러오기 - public MjonCandidateVO selectCandidateDataInfo(String userId) throws Exception; - - // 선거문자 후보자 등록 처리 - public int insertCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; - - // 선거문자 후보자 정보 수정 - public int updateCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; - - // 선거문자 후보자 삭제 처리 - public int deleteCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; - - // 선거문자 후보자 등록/수정시 회원정보 테이블 세금계산서 정보 수정해주기 - public int updateTaxBillMemberInfo(MjonCandidateVO mjonCandidateVO) throws Exception; + public MjonCandidateVO selectCandidateDataInfo(String userId) throws Exception; + + // 선거문자 후보자 등록 처리 + public int insertCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; + + // 선거문자 후보자 정보 수정 + public int updateCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; + + // 선거문자 후보자 삭제 처리 + public int deleteCandidateDataInfo(MjonCandidateVO mjonCandidateVO) throws Exception; + + // 선거문자 후보자 등록/수정시 회원정보 테이블 세금계산서 정보 수정해주기 + public int updateTaxBillMemberInfo(MjonCandidateVO mjonCandidateVO) throws Exception; + + //선거문자 20건 발송 전체 수신목록 입력 + public int insertCandidateTWCallToData(List mjonCandidateTWVO) throws Exception; + + //선거문자 20건 기존 등록 수신목록 모두 취소 시키기 + public int updateCandidateTWCallToDataCancel(String mberId) throws Exception; + + //선거문자 20건 회원 Call_seq 최대값 불러오기 + public int selectCandidateTWMaxCallSeq(String mberId) throws Exception; + + //선거문자 20건 수신목록 20개 불러오기 페이징 처리 + public List selectCampainTWCalltoList(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 수신목록 초기화 기능 - 등록된 수신목록 send_flag를 C로 변경 처리함. + public int updateMsgTWCallToListResetByMberId(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 수신목록 선택 삭제기능 + public int updateMsgTWCallToListChkDel(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 수신목록 건수 표시 정보 조회(전체건수, 발송완료 건수, 미방송 건수) + public MjonCandidateTWVO selectMsgTWCallToTotCount(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 받는사람 정보 단건추가 진행 - 번호추가 기능에서 사용 + public int insertCandidateTWCallToDataOnlyAdd(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 중복연락처 조회 + public int selectCandidateTWCallToDupleCnt(MjonCandidateTWVO mjonCandidateTWVO) throws Exception; + + //선거문자 20건 마지막 번호 불러오기 + public int selectMsgCallToSeqNum(String mberId) throws Exception; + } diff --git a/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateTWVO.java b/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateTWVO.java new file mode 100644 index 00000000..c85c243b --- /dev/null +++ b/src/main/java/itn/let/mjo/msgcampain/service/MjonCandidateTWVO.java @@ -0,0 +1,125 @@ +package itn.let.mjo.msgcampain.service; + +import java.util.List; + +import itn.let.uss.umt.service.UserDefaultVO; + +public class MjonCandidateTWVO extends UserDefaultVO{ + + /** + * + */ + private static final long serialVersionUID = 1492279559142297416L; + + private int campainTmpId; + private List campainTmpIdList; + private String mberId; + private int callSeq; + private String callTo; + private List callToList; + private String[] callToArr; + private String sendFlag; + + private String frstRegisterId; + private String frstRegistPnttm; + private String lastUpdtPnttm; + private String lastUpdusrId; + + private int sendComplete; + private int sendReady; + private int totCallToCnt; + + public int getCampainTmpId() { + return campainTmpId; + } + public void setCampainTmpId(int campainTmpId) { + this.campainTmpId = campainTmpId; + } + + public List getCampainTmpIdList() { + return campainTmpIdList; + } + public void setCampainTmpIdList(List campainTmpIdList) { + this.campainTmpIdList = campainTmpIdList; + } + public String getMberId() { + return mberId; + } + public void setMberId(String mberId) { + this.mberId = mberId; + } + public int getCallSeq() { + return callSeq; + } + public void setCallSeq(int callSeq) { + this.callSeq = callSeq; + } + public String getCallTo() { + return callTo; + } + public void setCallTo(String callTo) { + this.callTo = callTo; + } + public List getCallToList() { + return callToList; + } + public void setCallToList(List callToList) { + this.callToList = callToList; + } + public String[] getCallToArr() { + return callToArr; + } + public void setCallToArr(String[] callToArr) { + this.callToArr = callToArr; + } + public String getSendFlag() { + return sendFlag; + } + public void setSendFlag(String sendFlag) { + this.sendFlag = sendFlag; + } + public String getFrstRegisterId() { + return frstRegisterId; + } + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + public String getFrstRegistPnttm() { + return frstRegistPnttm; + } + public void setFrstRegistPnttm(String frstRegistPnttm) { + this.frstRegistPnttm = frstRegistPnttm; + } + public String getLastUpdtPnttm() { + return lastUpdtPnttm; + } + public void setLastUpdtPnttm(String lastUpdtPnttm) { + this.lastUpdtPnttm = lastUpdtPnttm; + } + public String getLastUpdusrId() { + return lastUpdusrId; + } + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + public int getSendComplete() { + return sendComplete; + } + public void setSendComplete(int sendComplete) { + this.sendComplete = sendComplete; + } + public int getSendReady() { + return sendReady; + } + public void setSendReady(int sendReady) { + this.sendReady = sendReady; + } + public int getTotCallToCnt() { + return totCallToCnt; + } + public void setTotCallToCnt(int totCallToCnt) { + this.totCallToCnt = totCallToCnt; + } + + +} diff --git a/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateDAO.java b/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateDAO.java index 6d9879f1..837618a9 100644 --- a/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateDAO.java +++ b/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateDAO.java @@ -1,15 +1,19 @@ package itn.let.mjo.msgcampain.service.impl; +import java.util.ArrayList; +import java.util.List; + import org.springframework.stereotype.Repository; import egovframework.rte.psl.dataaccess.EgovAbstractDAO; +import itn.let.mjo.msgcampain.service.MjonCandidateTWVO; import itn.let.mjo.msgcampain.service.MjonCandidateVO; @Repository("mjonCandidateDAO") public class MjonCandidateDAO extends EgovAbstractDAO { public MjonCandidateVO selectCandidateDataInfo(String userId) throws Exception{ - + return (MjonCandidateVO) select("mjonCandidateDAO.selectCandidateDataInfo", userId); } @@ -33,4 +37,140 @@ public class MjonCandidateDAO extends EgovAbstractDAO { return update("mjonCandidateDAO.updateTaxBillMemberInfo", mjonCandidateVO); } + + //선거문자 20건 발송 전체 수신목록 입력 + public int insertCandidateTWCallToData(List mjonCandidateTWVO) throws Exception{ + return update("mjonCandidateDAO.insertCandidateTWCallToData", mjonCandidateTWVO); + } + + public int updateCandidateTWCallToDataCancel(String mberId) throws Exception{ + + return update("mjonCandidateDAO.updateCandidateTWCallToDataCancel", mberId); + + } + + //선거문자 20건 회원 Call_seq 최대값 불러오기 + public int selectCandidateTWMaxCallSeq(String mberId) throws Exception{ + return (int) select("mjonCandidateDAO.selectCandidateTWMaxCallSeq",mberId); + } + + //선거문자 20건 수신목록 20개 불러오기 페이징 처리 + @SuppressWarnings("unchecked") + public List selectCampainTWCalltoList(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + return (List) list("mjonCandidateDAO.selectCampainTWCalltoList", mjonCandidateTWVO); + + } + + //선거문자 20건 수신목록 초기화 기능 - 등록된 수신목록 send_flag를 C로 변경 처리함. + public int updateMsgTWCallToListResetByMberId(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + int resultCnt = 0; + + try { + + resultCnt = update("mjonCandidateDAO.updateMsgTWCallToListResetByMberId", mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListResetByMberId DAO Error!!! " + e); + } + + return resultCnt; + } + + //선거문자 20건 수신목록 선택 삭제기능 + public int updateMsgTWCallToListChkDel(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + List campainTmpIdList = new ArrayList(); + List cmpTmpIdList = new ArrayList(); + + for(String id : mjonCandidateTWVO.getCallToArr()) { + + campainTmpIdList.add(Integer.parseInt(id)); + + } + + mjonCandidateTWVO.setCampainTmpIdList(campainTmpIdList); + + resultCnt = update("mjonCandidateDAO.updateMsgTWCallToListChkDel", mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListChkDel DAO Error!!! " + e); + } + + return resultCnt; + + } + + + //선거문자 20건 수신목록 건수 표시 정보 조회(전체건수, 발송완료 건수, 미방송 건수) + public MjonCandidateTWVO selectMsgTWCallToTotCount(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + MjonCandidateTWVO result = new MjonCandidateTWVO(); + + try { + + result = (MjonCandidateTWVO) select("mjonCandidateDAO.selectMsgTWCallToTotCount", mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("selectMsgTWCallToTotCount DAO Error!!! " + e); + } + + return result; + + } + + //선거문자 20건 받는사람 정보 단건추가 진행 - 번호추가 기능에서 사용 + public int insertCandidateTWCallToDataOnlyAdd(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = update("mjonCandidateDAO.insertCandidateTWCallToDataOnlyAdd", mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("insertCandidateTWCallToDataOnlyAdd DAO Error!!! " + e); + } + + return resultCnt; + + } + + //선거문자 20건 중복연락처 조회 + public int selectCandidateTWCallToDupleCnt(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = (int) select("mjonCandidateDAO.selectCandidateTWCallToDupleCnt", mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("selectCandidateTWCallToDupleCnt DAO Error!!! " + e); + } + + return resultCnt; + + } + + //선거문자 20건 callSeq 번호 불러오기 + public int selectMsgCallToSeqNum(String mberId) throws Exception{ + + int resultNum = 0; + + try { + + resultNum = (int) select("mjonCandidateDAO.selectMsgCallToSeqNum", mberId); + + } catch (Exception e) { + System.out.println("selectMsgCallToSeqNum Service DAO Error!!! " + e); + } + + return resultNum; + + } } diff --git a/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateServiceImpl.java b/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateServiceImpl.java index 037608d9..12ca1050 100644 --- a/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateServiceImpl.java +++ b/src/main/java/itn/let/mjo/msgcampain/service/impl/MjonCandidateServiceImpl.java @@ -1,11 +1,15 @@ package itn.let.mjo.msgcampain.service.impl; +import java.util.ArrayList; +import java.util.List; + import javax.annotation.Resource; import org.springframework.stereotype.Service; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import itn.let.mjo.msgcampain.service.MjonCandidateService; +import itn.let.mjo.msgcampain.service.MjonCandidateTWVO; import itn.let.mjo.msgcampain.service.MjonCandidateVO; @Service("mjonCandidateService") @@ -38,4 +42,172 @@ public class MjonCandidateServiceImpl extends EgovAbstractServiceImpl implement public int updateTaxBillMemberInfo(MjonCandidateVO mjonCandidateVO) throws Exception{ return mjonCandidateDAO.updateTaxBillMemberInfo(mjonCandidateVO); } + + //선거문자 20건 발송 전체 수신목록 입력 + public int insertCandidateTWCallToData(List mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + //기존에 저장된 회원의 미전송된 모든 데이터의 SEND_FLAG를 취소 처리함(값을 C 로변경) + String mberId = mjonCandidateTWVO.get(0).getMberId(); + mjonCandidateDAO.updateCandidateTWCallToDataCancel(mberId); + + resultCnt = mjonCandidateDAO.insertCandidateTWCallToData(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("insertCandidateTWCallToData Service Imple Error!!! " + e); + } + + return resultCnt; + } + + //선거문자 20건 기존 등록 수신목록 모두 취소 시키기 + public int updateCandidateTWCallToDataCancel(String mberId) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.updateCandidateTWCallToDataCancel(mberId); + + } catch (Exception e) { + System.out.println("updateCandidateTWCallToDataCancel Service Imple Error!!! " + e); + } + + return resultCnt; + + } + + //선거문자 20건 회원 Call_seq 최대값 불러오기 + public int selectCandidateTWMaxCallSeq(String mberId) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.selectCandidateTWMaxCallSeq(mberId); + + } catch (Exception e) { + System.out.println("selectCandidateTWMaxCallSeq Service Imple Error!!! " + e); + } + + return resultCnt; + } + + //선거문자 20건 수신목록 20개 불러오기 페이징 처리 + public List selectCampainTWCalltoList(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + List resultList = new ArrayList<>(); + + try { + + resultList = mjonCandidateDAO.selectCampainTWCalltoList(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("selectCampainTWCalltoList Service Imple Error!!! " + e); + } + + return resultList; + } + + //선거문자 20건 수신목록 초기화 기능 - 등록된 수신목록 send_flag를 C로 변경 처리함. + public int updateMsgTWCallToListResetByMberId(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.updateMsgTWCallToListResetByMberId(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListResetByMberId Service Imple Error!!! " + e); + } + + return resultCnt; + } + + + //선거문자 20건 수신목록 선택 삭제기능 + public int updateMsgTWCallToListChkDel(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.updateMsgTWCallToListChkDel(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListChkDel Service Imple Error!!! " + e); + } + + return resultCnt; + + } + + //선거문자 20건 수신목록 건수 표시 정보 조회(전체건수, 발송완료 건수, 미방송 건수) + public MjonCandidateTWVO selectMsgTWCallToTotCount(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + MjonCandidateTWVO result = new MjonCandidateTWVO(); + + try { + + result = mjonCandidateDAO.selectMsgTWCallToTotCount(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("selectMsgTWCallToTotCount Service Imple Error!!! " + e); + } + + return result; + } + + //선거문자 20건 받는사람 정보 단건추가 진행 - 번호추가 기능에서 사용 + public int insertCandidateTWCallToDataOnlyAdd(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.insertCandidateTWCallToDataOnlyAdd(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("insertCandidateTWCallToDataOnlyAdd Service Imple Error!!! " + e); + } + + return resultCnt; + } + + //선거문자 20건 중복연락처 조회 + public int selectCandidateTWCallToDupleCnt(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = mjonCandidateDAO.selectCandidateTWCallToDupleCnt(mjonCandidateTWVO); + + } catch (Exception e) { + System.out.println("selectCandidateTWCallToDupleCnt Service Imple Error!!! " + e); + } + + return resultCnt; + + } + + //선거문자 20건 callSeq 번호 불러오기 + public int selectMsgCallToSeqNum(String mberId) throws Exception{ + + int resultNum = 0; + + try { + + resultNum = mjonCandidateDAO.selectMsgCallToSeqNum(mberId); + + } catch (Exception e) { + System.out.println("selectCandidateTWCallToDupleCnt Service Imple Error!!! " + e); + } + + return resultNum; + + } } diff --git a/src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainTWDataController.java b/src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainTWDataController.java new file mode 100644 index 00000000..803ff163 --- /dev/null +++ b/src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainTWDataController.java @@ -0,0 +1,1368 @@ +package itn.let.mjo.msgcampain.web; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import egovframework.rte.fdl.idgnr.EgovIdGnrService; +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; +import egovframework.rte.psl.dataaccess.util.EgovMap; +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import itn.com.cmm.ComDefaultCodeVO; +import itn.com.cmm.EgovMessageSource; +import itn.com.cmm.JsonResult; +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.util.MJUtil; +import itn.com.cmm.util.RedirectUrlMaker; +import itn.com.cmm.util.StringUtil; +import itn.com.utl.fcc.service.EgovStringUtil; +import itn.let.lett.service.HashConfVO; +import itn.let.lett.service.LetterService; +import itn.let.lett.service.LetterVO; +import itn.let.mjo.addr.service.AddrGroupService; +import itn.let.mjo.addr.service.AddrService; +import itn.let.mjo.addr.service.AddrVO; +import itn.let.mjo.event.service.MjonEventService; +import itn.let.mjo.event.service.MjonEventVO; +import itn.let.mjo.msg.service.MjonMsgService; +import itn.let.mjo.msgcampain.service.MjonCandidateService; +import itn.let.mjo.msgcampain.service.MjonCandidateTWVO; +import itn.let.mjo.msgcampain.service.MjonCandidateVO; +import itn.let.mjo.msgdata.service.MjonMsgDataService; +import itn.let.mjo.msgdata.service.MjonMsgDataVO; +import itn.let.mjo.msgdata.service.PhoneVO; +import itn.let.mjo.pay.service.MjonPayService; +import itn.let.mjo.spammsg.service.MjonSpamMsgService; +import itn.let.mjo.symbol.service.MjonSymbolService; +import itn.let.mjo.symbol.service.MjonSymbolVO; +import itn.let.sym.ccm.cde.service.CateCode; +import itn.let.sym.ccm.cde.service.EgovCcmCmmnDetailCodeManageService; +import itn.let.sym.grd.service.MberGrdService; +import itn.let.sym.site.service.EgovSiteManagerService; +import itn.let.sym.site.service.JoinSettingVO; +import itn.let.uss.umt.service.EgovMberManageService; +import itn.let.uss.umt.service.EgovUserManageService; +import itn.let.uss.umt.service.MberManageVO; +import itn.let.utl.fcc.service.EgovCryptoUtil; + +@Controller +public class MjonMsgCampainTWDataController { + + @Resource(name = "mjonMsgService") + private MjonMsgService mjonMsgService; + + @Resource(name = "mjonPayService") + private MjonPayService mjonPayService; + + @Resource(name = "MjonMsgDataService") + private MjonMsgDataService mjonMsgDataService; + + @Resource(name = "LetterService") + private LetterService letterService; + + @Resource(name = "mjonSymbolService") + private MjonSymbolService mjonSymbolService; + + /** mberManageService */ + @Resource(name = "mberManageService") + private EgovMberManageService mberManageService; + + @Resource (name = "AddrService") + private AddrService addrService; + + @Resource (name = "AddrGroupService") + private AddrGroupService addrGroupService; + + @Resource(name = "mjonCandidateService") + private MjonCandidateService mjonCandidateService; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + /* 암복호화 */ + @Resource(name = "egovCryptoUtil") + EgovCryptoUtil egovCryptoUtil; + + @Resource(name = "egovMjonMsgGroupIdGnrService") + private EgovIdGnrService idgenMjonMsgGroupId; + + @Resource(name = "egovMjonCashIdGnrService") + private EgovIdGnrService idgenMjonCashId; + + @Resource(name = "CmmnDetailCodeManageService") + private EgovCcmCmmnDetailCodeManageService cmmnDetailCodeManageService; + + /** 첨부파일 저장경로 */ + @Value("#{globalSettings['Globals.file.saveDir']}") + private String fileSaveDir; + + /** userManageService */ + @Resource(name = "userManageService") + private EgovUserManageService userManageService; + + @Resource(name = "MjonEventService") + private MjonEventService mjonEventService; + + @Resource(name = "mjonSpamMsgService") + private MjonSpamMsgService mjonSpamMsgService; + + /** 사이트 설정 */ + @Resource(name = "egovSiteManagerService") + EgovSiteManagerService egovSiteManagerService; + + /** 등급제 관리 서비스 */ + @Resource(name = "mberGrdService") + MberGrdService mberGrdService; + + /** + * 선거 문자 20건씩 발송 화면 + * @param searchVO + * @param model + * @return "/web/mjon/msgcampain/selectMsgTWDataView.do" + * @throws Exception + */ + @RequestMapping(value= {"/web/mjon/msgcampain/selectMsgTWDataView.do"}) + public String selectMsgTWDataView(@ModelAttribute("searchVO") MjonMsgDataVO searchVO + , CateCode cateCode + , HttpServletRequest request + , ModelMap model) throws Exception{ + + String categoryType = cateCode.getCateType(); + + if(categoryType == null) { + + categoryType = "N"; + + } + + // 문자 카테고리 리스트 불러오기 + List cateConfList = letterService.selectCateConfWithList(categoryType); + model.addAttribute("cateCodeList", cateConfList); + + // 문자 해쉬태그 리스트 불러오기 + String msgType = "M"; + List hashTagList = letterService.selectHashTagWithList(msgType); + model.addAttribute("hashTagList", hashTagList); + + // 문자 리스트 불러오기 + LetterVO letterVO = new LetterVO(); + if(letterVO.getPageUnit() != 10) { + letterVO.setPageUnit(letterVO.getPageUnit()); + } + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + model.addAttribute("loginVO", loginVO); + + for(int i=0 ; i < cateConfList.size(); i++) { + if("선거".equals(cateConfList.get(i).getCateNm())) { + letterVO.setCategoryCode(cateConfList.get(i).getCateCode()); + } + } + + //주소록에서 선택시 넘어오는 파라미터 + if("Y".equals(searchVO.getMoveAddrFlag())) { + model.addAttribute("addrVO", searchVO); + } + + //주소록에서 선택시 넘어오는 파라미터 + if("Y".equals(searchVO.getMoveAddrAllFlag())) { + AddrVO addrVO = new AddrVO(); + + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + if(userId != "") { + addrVO.setMberId(userId); + } + addrVO.setRecordCountPerPage(100000); + addrVO.setFirstIndex(0); + addrVO.setSearchAddrGrpId(request.getParameter("searchAddrGrpId")); + addrVO.setSearchCondition(request.getParameter("searchCondition")); + addrVO.setSearchKeyword(request.getParameter("searchKeyword")); + addrVO.setStartKeyword(request.getParameter("startKeyword")); + List addrList = addrService.selectAddrList(addrVO); + + List addrIdList = new ArrayList(); + for(AddrVO item : addrList) { + addrIdList.add(item.getAddrId()); + } + + searchVO.setAddrIdList(addrIdList); + searchVO.setMoveAddrFlag("Y"); + + model.addAttribute("addrVO", searchVO); + } + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(letterVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(letterVO.getPageUnit()); + paginationInfo.setPageSize(letterVO.getPageSize()); + + letterVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + letterVO.setLastIndex(paginationInfo.getLastRecordIndex()); + letterVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + + List resultPhoList = mjonMsgDataService.selectPhotoLetterList(letterVO); + + model.addAttribute("resultPhoList", resultPhoList); + paginationInfo.setTotalRecordCount( resultPhoList.size()> 0 ? ((Long)((EgovMap)resultPhoList.get(0)).get("totCnt")).intValue() : 0); + model.addAttribute("paginationInfo", paginationInfo); + + //발송결과 문자 재전송에서 넘어오는 경우 파마리터 전달 + List temp = searchVO.getMsgSeqList(); + + if(temp != null) { + + model.addAttribute("reSendMsgVO", searchVO); + + } + model.addAttribute("letterVO", letterVO); + + // 문자 재전송 New + model.addAttribute("msgResendAllFlag", searchVO.getMsgResendAllFlag()); + model.addAttribute("msgResendAllGroupId", searchVO.getMsgResendAllGroupId()); + model.addAttribute("msgResendAllAdvertiseYn", searchVO.getMsgResendAllAdvertiseYn()); + model.addAttribute("msgResendAllReplaceYn", searchVO.getMsgResendAllReplaceYn()); + + return "web/msgcampain/tw/MsgTWDataView"; + } + + /** + * 선거 문자 20건씩 발송 단문/장문/그림문자 전송 화면 + * @param searchVO + * @param model + * @return "/web/mjon/msgcampain/selectMsgTWDataSMLViewAjax.do" + * @throws Exception + */ + @RequestMapping(value= {"/web/mjon/msgcampain/selectMsgTWDataSMLViewAjax.do"}) + public String selectMsgTWDataSMLView(@ModelAttribute("searchVO") MjonMsgDataVO searchVO, CateCode cateCode, ModelMap model) throws Exception{ + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + String author = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getAuthority()); + + String categoryType = cateCode.getCateType(); + + if(categoryType == null) { + + categoryType = "N"; + + } + + //문자 전송 개인 단가 불러오기 + + //0.이벤트 진행중이 회원 정보 불러오기. + //이벤트 회원 정보 테이블에서 대상자의 정보를 불러온다. + MjonEventVO mjonEventVO = new MjonEventVO(); + mjonEventVO.setMberId(userId); + MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO); + + + long eventDiffDate = 0; + float eventRemainCash = 0; + boolean compareEndDate = false; + + if(eventMberInfo != null) { + + String eventEndDate = eventMberInfo.getEventEndDate(); + + /** + * MJUtil.getCompareDate() + * 현재 날짜와 파라미터 전달 날짜를 비교 + * 전달날짜를 지난경우 False를 리턴함. + * 현재날짜 이전 혹은 같은 날짜면 True를 리턴함. + * + * */ + + if(eventEndDate != null) { + compareEndDate = MJUtil.getCompareDate(eventEndDate); + eventRemainCash = (float) eventMberInfo.getEventRemainCash(); + + //이벤트 종료 일자가 지난 경우, 이벤트 상태가 종료아 아니면 종료 처리 시킴 + //이벤트 남은 캐시가 단문 발송금액 7.5원 보다 낮으면 이벤트 종료 시킴 + if(!compareEndDate || eventRemainCash < 7.5) { + + if(!eventMberInfo.getEventStatus().equals("E")) { + + //이벤트 상태값을 종료로 변경한다. + mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId()); + mjonEventVO.setEventStatus("E"); + mjonEventVO.setEventMemo("이벤트 발송 최소 금액(7.5) 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴"); + mjonEventVO.setEventRemainCash(eventRemainCash); + mjonEventService.updateEventEndStatus(mjonEventVO); + eventMberInfo.setEventStatus("E"); + + } + + }else {//이벤트 진행중이면 남은 날짜 계산해서 전달. + + /** + * MJUtil.getDiffDateDay() + * 현재 날짜와 파라미터 날짜 사이의 날짜 수를 계산해줌. + * + * */ + eventDiffDate = MJUtil.getDiffDateDay(eventEndDate); + + } + } + + } + + //남은 날짜값을 절대값으로 변경(음수로 나오기 때문) + model.addAttribute("eventDiffDate", Math.abs(eventDiffDate)); + model.addAttribute("compareEndDate", compareEndDate); + model.addAttribute("eventRemainCash", eventRemainCash); + model.addAttribute("eventMberInfo", eventMberInfo); + + //1.시스템 기본 단가 정보 불러오기 + JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo(); + + // 등급제 단가 추출 => 시스템 단가에 적용 + sysJoinSetVO = mberGrdService.selectMberGrdDefaultInfo(sysJoinSetVO, userId); + + //2.사용자 개인 단가 정보 불러오기 + MberManageVO mberManageVO = new MberManageVO(); + + if(!userId.equals("") && !author.equals("ROLE_ADMIN")) { + + mberManageVO = mjonMsgDataService.selectMberManageInfo(userId); + searchVO.setUserId(userId); + + } + + model.addAttribute("exceptSpamYn", mberManageVO.getExceptSpamYn()); + + //3.사용자 개인단가 정보가 0이 아니면 개인단가 사용, 없으면 시스템 기본 단가 사용 + Float shortPrice = mberManageVO.getShortPrice(); + Float longPrice = mberManageVO.getLongPrice(); + Float picturePrice = mberManageVO.getPicturePrice(); + Float picture2Price = mberManageVO.getPicture2Price(); + Float picture3Price = mberManageVO.getPicture3Price(); + BigDecimal userMoney = new BigDecimal(mberManageVO.getUserMoney()).setScale(2, RoundingMode.HALF_EVEN); + + //일반 단가정보 저장 변수 셋팅 - 이벤트 캐시 부족시 일반단가로 계산하기 위해서임.20230328, 우영두추가 + Float norShortPrice = mberManageVO.getShortPrice(); + Float norLongPrice = mberManageVO.getLongPrice(); + Float norPicturePrice = mberManageVO.getPicturePrice(); + Float norPicture2Price = mberManageVO.getPicture2Price(); + Float norPicture3Price = mberManageVO.getPicture3Price(); + + //기존 소수점 2째자리에서 반올림하였으나, 정책 변경으로 소수점 버림 처리함 20220623 + /*int shortPrice = (int) mberManageVO.getShortPrice(); + int longPrice = (int) mberManageVO.getLongPrice(); + int picturePrice = (int) mberManageVO.getPicturePrice(); + int picture2Price = (int) mberManageVO.getPicture2Price(); + int picture3Price = (int) mberManageVO.getPicture3Price(); + int userMoney = (int) mberManageVO.getUserMoney();*/ + + String userPoint = mberManageVO.getUserPoint(); + + //이벤트 진행 회원의 발송 단가 처리해주기 + if(eventMberInfo != null && eventMberInfo.getEventStatus().equals("Y") && compareEndDate) { + + shortPrice = Float.parseFloat(eventMberInfo.getEventShortPrice()); + longPrice = Float.parseFloat(eventMberInfo.getEventLongPrice()); + picturePrice = Float.parseFloat(eventMberInfo.getEventPicturePrice()); + picture2Price = Float.parseFloat(eventMberInfo.getEventPicture2Price()); + picture3Price = Float.parseFloat(eventMberInfo.getEventPicture3Price()); + + //이벤트 캐시 부족시 일반단가로 계산하기 위해서임.20230328, 우영두추가 + if(shortPrice < 1 || longPrice < 1 || picturePrice < 1) {//이벤트 단가 적용시 일반단가도 필요하여 셋팅 해줌. + + norShortPrice = (float) sysJoinSetVO.getShortPrice(); + norLongPrice = (float) sysJoinSetVO.getLongPrice(); + norPicturePrice = (float) sysJoinSetVO.getPicturePrice(); + norPicture2Price = (float) sysJoinSetVO.getPicture2Price(); + norPicture3Price = (float) sysJoinSetVO.getPicture3Price(); + + } + + }else if(shortPrice < 1 || longPrice < 1 || picturePrice < 1) { + + shortPrice = (float) sysJoinSetVO.getShortPrice(); + longPrice = (float) sysJoinSetVO.getLongPrice(); + picturePrice = (float) sysJoinSetVO.getPicturePrice(); + picture2Price = (float) sysJoinSetVO.getPicture2Price(); + picture3Price = (float) sysJoinSetVO.getPicture3Price(); + + } + + model.addAttribute("shortPrice", shortPrice); + model.addAttribute("longPrice", longPrice); + model.addAttribute("picturePrice", picturePrice); + model.addAttribute("picture2Price", picture2Price); + model.addAttribute("picture3Price", picture3Price); + model.addAttribute("userMoney", userMoney); + model.addAttribute("userPoint", userPoint); + + //이벤트 캐시 부족시 일반단가로 계산하기 위해서임.20230328, 우영두추가 + if(norShortPrice < 1 || norLongPrice < 1 || norPicturePrice < 1) {//협의 단가가 없는 경우 일반단가에 시스템 단가로 셋팅해줌 + + norShortPrice = (float) sysJoinSetVO.getShortPrice(); + norLongPrice = (float) sysJoinSetVO.getLongPrice(); + norPicturePrice = (float) sysJoinSetVO.getPicturePrice(); + norPicture2Price = (float) sysJoinSetVO.getPicture2Price(); + norPicture3Price = (float) sysJoinSetVO.getPicture3Price(); + + } + + model.addAttribute("norShortPrice", norShortPrice); + model.addAttribute("norLongPrice", norLongPrice); + model.addAttribute("norPicturePrice", norPicturePrice); + model.addAttribute("norPicture2Price", norPicture2Price); + model.addAttribute("norPicture3Price", norPicture3Price); + + //선거 후보자 정보 불러오기 + MjonCandidateVO mjonCandidateVO = new MjonCandidateVO(); + + if(userId != ""){ + + mjonCandidateVO = mjonCandidateService.selectCandidateDataInfo(userId); + + //String cryptText = egovCryptoUtil.encrypt(plainText); + + if(mjonCandidateVO != null) { + + // 주민번호 복호화 하기 + String regidentNo1 = egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo1()); + String regidentNo2 = egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo2()); + + mjonCandidateVO.setRegidentNo1(regidentNo1); + mjonCandidateVO.setRegidentNo2(regidentNo2); + + } + + } + + model.addAttribute("mjonCandidateVO", mjonCandidateVO); + + // 이메일 코드조회 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("ITN031"); + model.addAttribute("emailCode", cmmUseService.selectCmmCodeDetail(voComCode)); + + if(!userId.equals("")) {//로그인 했을때만 발신번호 리스트 불러오기 + + //아이디 발신번호 리스트 불러오기. + List resultSendPhonList = mjonMsgDataService.selectSendPhonNumList(userId); + List resultPhonList = new ArrayList(); + MJUtil mjUtil = new MJUtil(); + + for(String phone : resultSendPhonList) { + + resultPhonList.add(mjUtil.addDash(phone)); + + } + model.addAttribute("resultPhonList", resultPhonList); + + } + + // 문자 카테고리 리스트 불러오기 + List cateConfList = letterService.selectCateConfWithList(categoryType); + model.addAttribute("cateCodeList", cateConfList); + + //그림 문자 리스트 불러오기 + LetterVO letterVO = new LetterVO(); + if(letterVO.getPageUnit() != 10) { + letterVO.setPageUnit(letterVO.getPageUnit()); + } + + MjonSymbolVO symbolVO = new MjonSymbolVO(); + // 특수문자 리스트 불러오기 + List symbolList = mjonSymbolService.selectMjonSymbolList(symbolVO); + model.addAttribute("symbolList", symbolList); + + //최근 전송 내역 + Calendar cal = Calendar.getInstance(); + Date now = new Date(); + + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + + cal.setTime(now); + cal.add(Calendar.DATE, -3); + + String chkDate = format.format(cal.getTime()); + + searchVO.setMyMsgStDt(chkDate); //검색 시작일 저장 - 현재날짜로 부터 3일 이전 날짜로 시작 + List resultLatestMsgList = mjonMsgDataService.selectLatestMsgList(searchVO); + model.addAttribute("resultLatestMsgList", resultLatestMsgList); + + //자주보내는 번호 + List resultBookMarkMsgList = mjonMsgDataService.selectBookMarkMsgList(searchVO); + model.addAttribute("resultBookMarkMsgList", resultBookMarkMsgList); + + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(letterVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(letterVO.getPageUnit()); + paginationInfo.setPageSize(letterVO.getPageSize()); + + letterVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + letterVO.setLastIndex(paginationInfo.getLastRecordIndex()); + letterVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + List resultPhoList = mjonMsgDataService.selectPhotoLetterList(letterVO); + + model.addAttribute("resultPhoList", resultPhoList); + paginationInfo.setTotalRecordCount( resultPhoList.size()> 0 ? ((Long)((EgovMap)resultPhoList.get(0)).get("totCnt")).intValue() : 0); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("mberManageVO", mberManageVO); + + //기존 작업하던 수신목록 정보가 있는지 확인 + int callSeq = mjonCandidateService.selectMsgCallToSeqNum(userId); + model.addAttribute("callSeq", callSeq); + + return "web/msgcampain/tw/MsgTWDataSMLView"; + } + + //선거문자 20건 받는사람 목록 불러오기 + @RequestMapping(value="/web/mjon/msgcampain/selectMsgTWCallToListAjax.do") + public String selectMsgTWCallToListAjax(MjonCandidateTWVO mjonCandidateTWVO, ModelMap model, RedirectAttributes redirectAttributes) throws Exception{ + + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + + if(userId.equals("")) { + + redirectAttributes.addFlashAttribute("message", "로그인이 필요합니다."); + RedirectUrlMaker redirectUrlMaker = new RedirectUrlMaker("/web/user/login/login.do"); + return redirectUrlMaker.getRedirectUrl(); + + } + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(mjonCandidateTWVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(mjonCandidateTWVO.getPageUnit()); + paginationInfo.setPageSize(5); + + mjonCandidateTWVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + mjonCandidateTWVO.setLastIndex(paginationInfo.getLastRecordIndex()); + mjonCandidateTWVO.setRecordCountPerPage(20); + + mjonCandidateTWVO.setMberId(userId); + List resultCallToList = mjonCandidateService.selectCampainTWCalltoList(mjonCandidateTWVO); + + model.addAttribute("resultCallToList", resultCallToList); + paginationInfo.setTotalRecordCount( resultCallToList.size()> 0 ? ((Long)((EgovMap)resultCallToList.get(0)).get("totCnt")).intValue() : 0); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("mjonCandidateTWVO", mjonCandidateTWVO); + + //전체 남은 리스트 수 및 전송완료 등 건수 정보 조회 + MjonCandidateTWVO resultTotCallToInfo = mjonCandidateService.selectMsgTWCallToTotCount(mjonCandidateTWVO); + + model.addAttribute("resultTotCallToInfo", resultTotCallToInfo); + + return "web/msgcampain/tw/MsgTWDataCallToListView"; + } + + + @RequestMapping(value="/web/mjon/msgcampain/insertMyAddrTWCallToAjax.do") + public ModelAndView insertMyAddrTWCallToAjax(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + + if(userId.equals("")) { + + modelAndView.addObject("result", "loginFail"); + modelAndView.addObject("message", "로그인이 필요합니다."); + return modelAndView; + + } + try { + + List callToList = new ArrayList(); + int totRowDataCnt = 0; + + for(String callTo : mjonCandidateTWVO.getCallToArr()) { + + System.out.println("++++++++++++++ callTo ::: "+callTo); + callToList.add(callTo); + totRowDataCnt++; + + } + + //수신자 목록 중복 체크 및 디비화 처리 + List dupCallToList = MJUtil.getDuplicateList(callToList); + + String dupCallCnt = Integer.toString(totRowDataCnt - dupCallToList.size()); + + //입력되어있는 데이터의 마지막 순번(call_seq)을 조회해 온다. + int maxCallSeq = mjonCandidateService.selectCandidateTWMaxCallSeq(userId); + maxCallSeq += 1;//마지막 순번에 1을 더해서 다음 순번을 지정해준다. + + List mjonCandidateTwVO = new ArrayList(); + + for(String callTo : dupCallToList) { + + MjonCandidateTWVO tmpCandidateTwVO = new MjonCandidateTWVO(); + + tmpCandidateTwVO.setMberId(userId); + tmpCandidateTwVO.setCallTo(callTo); + tmpCandidateTwVO.setFrstRegisterId(userId); + tmpCandidateTwVO.setLastUpdusrId(userId); + tmpCandidateTwVO.setCallSeq(maxCallSeq); + + mjonCandidateTwVO.add(tmpCandidateTwVO); + + } + + int resultCnt = mjonCandidateService.insertCandidateTWCallToData(mjonCandidateTwVO); + + if(resultCnt > 0) { + + modelAndView.addObject("result", "success"); + modelAndView.addObject("dupCallCnt", dupCallCnt); + modelAndView.addObject("maxCallSeq", maxCallSeq); + + }else { + + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "주소록을 불러오는 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + + } + + + } catch (Exception e) { + System.out.println("insertMyAddrTWCallToAjax Controller Error!!! " + e); + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "주소록을 불러오는 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + return modelAndView; + } + + return modelAndView; + } + + /* + * 받는사람 목록 데이터 전체 초기화 처리 + * 데이터베이스에 저장된 해당 회원의 발신목록 정보를 모두 초기화 처리 + * */ + @RequestMapping(value="/web/mjon/msgcampain/updateMsgTWCallToListResetAjax.do") + public ModelAndView updateMsgTWCallToListResetAjax(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + + if(userId.equals("")) { + + modelAndView.addObject("result", "loginFail"); + modelAndView.addObject("message", "로그인이 필요합니다."); + return modelAndView; + + } + + try { + + mjonCandidateTWVO.setMberId(userId); + + //수신목록 테이블에 있는 회원의 데이터를 모두 취소 처리해준다. + int resultCnt = mjonCandidateService.updateCandidateTWCallToDataCancel(userId); + + if(resultCnt > 0) { + + modelAndView.addObject("result", "success"); + + }else { + + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "받는사람 초기화 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + + } + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListResetAjax Controller Error!!! " + e); + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "받는사람 초기화 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + return modelAndView; + } + + return modelAndView; + } + + /* + * 받는사람 목록 선택 삭제 데이터 취소 처리 + * + * */ + @RequestMapping(value="/web/mjon/msgcampain/updateMsgTWCallToListChkDelAjax.do") + public ModelAndView updateMsgTWCallToListChkDelAjax(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + + if(userId.equals("")) { + + modelAndView.addObject("result", "loginFail"); + modelAndView.addObject("message", "로그인이 필요합니다."); + return modelAndView; + + } + + try { + + mjonCandidateTWVO.setMberId(userId); + + int resultCnt = mjonCandidateService.updateMsgTWCallToListChkDel(mjonCandidateTWVO); + + if(resultCnt > 0) { + + modelAndView.addObject("result", "success"); + + }else { + + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "받는사람 삭제 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + + } + + } catch (Exception e) { + System.out.println("updateMsgTWCallToListResetAjax Controller Error!!! " + e); + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "받는사람 초기화 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + return modelAndView; + } + + return modelAndView; + } + + @RequestMapping(value="/web/mjon/msgcampain/insertMsgTWCallToOneNumberAddAjax.do") + public ModelAndView insertMsgTWCallToOneNumberAdd(MjonCandidateTWVO mjonCandidateTWVO) throws Exception{ + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + + if(userId.equals("")) { + + modelAndView.addObject("result", "loginFail"); + modelAndView.addObject("message", "로그인이 필요합니다."); + return modelAndView; + + } + + try { + + + System.out.println("================ callSeq ::: "+mjonCandidateTWVO.getCallSeq()); + String callToNum = ""; + for(String callTo : mjonCandidateTWVO.getCallToArr()) { + + System.out.println("++++++++++++++++ callToArr ::: "+callTo); + callToNum = callTo; + + } + + int callSeq = mjonCandidateTWVO.getCallSeq(); + + //처음 등록되는 연락처 번호이면 기존 회원 CallSeq 마지막 번호 다음으로 신규 추가 + if(callSeq == 0) { + + int maxCallSeq = mjonCandidateService.selectCandidateTWMaxCallSeq(userId); + maxCallSeq += 1;//마지막 순번에 1을 더해서 다음 순번을 지정해준다. + + mjonCandidateTWVO.setCallSeq(maxCallSeq); + + } + + //연락처 추가 관련 입력정보 셋팅해주기 + mjonCandidateTWVO.setMberId(userId); + mjonCandidateTWVO.setCallTo(callToNum.replaceAll("-", "")); + mjonCandidateTWVO.setFrstRegisterId(userId); + mjonCandidateTWVO.setLastUpdusrId(userId); + + //중복 연락처 체크 해주기 + int dupCallNum = mjonCandidateService.selectCandidateTWCallToDupleCnt(mjonCandidateTWVO); + + if(dupCallNum > 0) { + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "이미 등록된 연락처 입니다. 연락처를 다시 확인해 주세요."); + return modelAndView; + } + + int resultCnt = mjonCandidateService.insertCandidateTWCallToDataOnlyAdd(mjonCandidateTWVO); + + if(resultCnt > 0) { + modelAndView.addObject("result", "success"); + modelAndView.addObject("callSeq", mjonCandidateTWVO.getCallSeq()); + }else { + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "연락처 추가 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + } + + + } catch (Exception e) { + System.out.println("insertMsgTWCallToOneNumberAdd Controller Error!!! " + e); + modelAndView.addObject("result", "fail"); + modelAndView.addObject("message", "연락처 추가 중 오류가 발생하였습니다. 잠시 후 다시 시도해 주세요."); + return modelAndView; + } + + return modelAndView; + + } + + /** + * 선거문자 20건씩 문자 발송 - 엑셀파일 불러오기 + * @param body + * @param uploadFile + * @param search + * @param result + * @param model + * @param request + * @return + * @throws Exception + */ + @RequestMapping(value = "/web/mjon/msgcampain/insertExelFileTWCallToAjax.do") + @ResponseBody + public Object insertExelFileTWCallToAjax(final MultipartHttpServletRequest multiRequest) throws Exception { + + JsonResult jr = new JsonResult(); + jr.setSuccess(false); + jr.setMessage("엑셀 파일만 업로드할 수 있습니다."); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + String author = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getAuthority()); + + if(userId.equals("") || author.equals("")) { + + jr.setMessage("엑셀파일 업로드는 로그인이 필요합니다."); + return jr; + + } + + try { + + //final Map files = multiRequest.getFileMap(); + List files = (List) multiRequest.getFiles("file0"); + + // 파일명에 .이 있을경우 오류 => Ex) 테스트6.20.xlsx + int fileNameSplitCnt = 0; + List> json = new ArrayList>(); + + //전체 엑셀 데이터 갯수 체크 변수 + int totRowDataCnt = 0; + + //수신자 목록을 디비화 하기 위한 변수 셋팅 + List mjonCandidateTwVO = new ArrayList(); + List callToList = new ArrayList(); + + if(!files.isEmpty()) { + fileNameSplitCnt = files.get(0).getOriginalFilename().split("[.]").length; + + if (files.get(0).getSize() > 0 + && (files.get(0).getContentType().indexOf("spreadsheetml") > -1) + || files.get(0).getContentType().indexOf("ms-excel") > -1 + || files.get(0).getOriginalFilename().split("[.]")[fileNameSplitCnt-1].indexOf("xlsx") > -1 + || files.get(0).getOriginalFilename().split("[.]")[fileNameSplitCnt-1].indexOf("xls") > -1) { + + // 엑셀 파일 용량 3MB이상 시 10만건 이상으로 서버가 다운되는 증상 발생 + long fileSize = multiRequest.getFile("file0").getSize(); + + if(fileSize > 3374653) { + jr.setMessage("엑셀 파일은 3MB를 넘을수 없습니다."); + return jr; + } + + String Ext = files.get(0).getOriginalFilename().split("[.]")[1]; + String errMessage = ""; + String cellValue = ""; + + String phoneRegExp = "^(050[234567]{1}|01[016789]{1})-?[0-9]{3,4}-?[0-9]{4}$"; + + int errPhoneCnt = 0; + String errPhoneLine = ""; + String errEtcLine = ""; + + //엑셀 확장자에 따른 처리 로직 분리 + if(Ext.equals("xls")) { + + HSSFWorkbook workbook = new HSSFWorkbook(files.get(0).getInputStream()); + HSSFSheet sheet = workbook.getSheetAt(0); + + if(sheet.getLastRowNum() > 20000) { // + errMessage = "20000건 이상의 업로드는 데이터 부하로 업로드 할수 없습니다."; + jr.setSuccess(false); + jr.setMessage(errMessage); + return jr; + } + + //List> json = new ArrayList>(); + PhoneVO pVO = new PhoneVO(); + for(int i=2; i< sheet.getLastRowNum() + 2; i++){ //먼저 밸리데이션 체크(1줄은 생략) + HSSFRow row = sheet.getRow(i); //열읽기 + if(null == row) { + continue; + } + + //전체 엑셀의 Row 갯수 카운트 해주기 + totRowDataCnt++; + + //HashMap jm = new HashMap<>(); + // 행의 두번째 열(이름부터 받아오기) + HSSFCell cell = null; + boolean errSts = true; + for(int j = 0 ; j < 1; j++){ //행읽기 + cellValue = ""; + cell = row.getCell(j); //핸드폰 + if(null == cell || "".equals(cell.toString().trim())) { //셀에 값이 없으면 + //System.out.println("Cell 데이터가 없습니다."); + if(j == 0) { + if (sheet.getLastRowNum() == i) { + continue; + } + + //errPhoneCnt++; + //errSts = false; + break; + } + + } + if(null != cell){ + switch(cell.getCellType()){ //숫자타임을 문자로 변환 + case Cell.CELL_TYPE_NUMERIC: + cell.setCellType(Cell.CELL_TYPE_STRING); + } + cellValue = StringUtil.getString(cell.getStringCellValue().trim()) ; + } + + if(j == 0) { + //전화번호 + if(cellValue.matches(phoneRegExp) && errSts) { + //수신자목록을 디비화 하기 위하여 리스트에 저장해줌 + callToList.add(cellValue); + }else { + errPhoneCnt++; + errPhoneLine += (i+1) + "행 "; + errSts = false; + break; + } + } + + } + + } + + int resultErrCnt = errPhoneCnt; + + if(resultErrCnt > 0) { + if (errPhoneCnt <= 10) { + if (StringUtils.isNotEmpty(errPhoneLine.trim())) { + errPhoneLine = "[" + errPhoneLine.trim() + "]"; + } + } + else { + errPhoneLine = ""; + } + jr.setMessage("유효하지 않은 형식의 전화번호 "+ errPhoneCnt +"건" + errPhoneLine.trim() + " 있습니다.\n해당 건을 제외하고 수신목록에 추가됩니다."); + }else { + jr.setMessage(""); + } + + }else { //확장자가 xlsx + + OPCPackage opcPackage = OPCPackage.open(files.get(0).getInputStream()); + XSSFWorkbook workbook = new XSSFWorkbook(opcPackage); + XSSFSheet sheet = workbook.getSheetAt(0); // 첫번째 시트 불러오기 + opcPackage.close(); + + for(int r=2; r 20000) { // + if(totRowDataCnt > 20000) { // + errMessage = "20000건 이상의 업로드는 데이터 부하로 업로드 할수 없습니다."; + jr.setSuccess(false); + jr.setMessage(errMessage); + return jr; + } + + //List> json = new ArrayList>(); + PhoneVO pVO = new PhoneVO(); + for(int i=2; i< sheet.getLastRowNum() + 2; i++){ //먼저 밸리데이션 체크(1줄은 생략) + XSSFRow row = sheet.getRow(i); //열읽기 + if(null == row) { + continue; + } + + //HashMap jm = new HashMap<>(); + // 행의 두번째 열(이름부터 받아오기) + XSSFCell cell = null; + boolean errSts = true; + + for(int j = 0 ; j < 1; j++){ //행읽기 + cellValue = ""; + cell = row.getCell(j); //이름/핸드폰/변환1/변환2/변환3/변환4/변환5 + if(null == cell || "".equals(cell.toString().trim())) { //셀에 값이 없으면 + //System.out.println("Cell 데이터가 없습니다."); + if(j == 0) { + if (sheet.getLastRowNum() == i) { + continue; + } + + //errPhoneCnt++; + //errSts = false; + break; + + } + } + if(null != cell){ + switch(cell.getCellType()){ //숫자타임을 문자로 변환 + case Cell.CELL_TYPE_NUMERIC: + cell.setCellType(Cell.CELL_TYPE_STRING); + } + cellValue = StringUtil.getString(cell.getStringCellValue().trim()) ; + } + + if(j == 0) { + //전화번호 + if(cellValue.matches(phoneRegExp) && errSts) { + //수신자목록을 디비화 하기 위하여 리스트에 저장해줌 + callToList.add(cellValue); + + }else { + errPhoneCnt++; + errPhoneLine += (i+1) + "행 "; + errSts = false; + break; + } + } + + } + + } + + int resultErrCnt = errPhoneCnt; + + if(resultErrCnt > 0) { + if (errPhoneCnt <= 10) { + if (StringUtils.isNotEmpty(errPhoneLine.trim())) { + errPhoneLine = "[" + errPhoneLine.trim() + "]"; + } + } + else { + errPhoneLine = ""; + } + jr.setMessage("유효하지 않은 형식의 전화번호 "+ errPhoneCnt +"건" + errPhoneLine.trim() + " 있습니다.\n해당 건을 제외하고 수신목록에 추가됩니다."); + }else { + jr.setMessage(""); + } + } //xlsx 처리 끝 + + } + + //수신자 목록 중복 체크 및 디비화 처리 + List dupCallToList = MJUtil.getDuplicateList(callToList); + + String dupCallCnt = Integer.toString(totRowDataCnt - dupCallToList.size()); + + //입력되어있는 데이터의 마지막 순번(call_seq)을 조회해 온다. + int maxCallSeq = mjonCandidateService.selectCandidateTWMaxCallSeq(userId); + maxCallSeq += 1;//마지막 순번에 1을 더해서 다음 순번을 지정해준다. + HashMap callHm = new HashMap<>(); + for(String callTo : dupCallToList) { + + MjonCandidateTWVO tmpCandidateTwVO = new MjonCandidateTWVO(); + + tmpCandidateTwVO.setMberId(userId); + tmpCandidateTwVO.setCallTo(callTo.replaceAll("-", "")); + tmpCandidateTwVO.setFrstRegisterId(userId); + tmpCandidateTwVO.setLastUpdusrId(userId); + tmpCandidateTwVO.setCallSeq(maxCallSeq); + + mjonCandidateTwVO.add(tmpCandidateTwVO); + + } + + int resultCnt = mjonCandidateService.insertCandidateTWCallToData(mjonCandidateTwVO); + + if(resultCnt > 0) { + + callHm.put("callSeq", Integer.toString(maxCallSeq)); + json.add(callHm); + + jr.setData(json); + jr.setSuccess(true); + + }else { + + jr.setSuccess(false); + jr.setMessage("엑셀 데이터 처리에 오류가 발생하였습니다. 잠시후 다시 시도해 주세요."); + + } + + } + + return jr; + + } catch (Exception e) { + // TODO: handle exception + System.out.println("+++++++++++++++++ insertExelFileTWCallToAjax Controller Error !!! "+e); + jr.setSuccess(false); + jr.setMessage("엑셀 데이터에 오류가 있습니다. 엑셀 데이터를 확인해 주세요."); + return jr; + } + + } + + + /** + * 선거문자 20건씩 문자 발송 - TXT파일 불러오기 + * @param body + * @param uploadFile + * @param search + * @param result + * @param model + * @param request + * @return + * @throws Exception + */ + @RequestMapping(value = "/web/mjon/msgcampain/insertTxtFileTWCallToAjax.do") + @ResponseBody + public Object insertTxtFileTWCallToAjax(final MultipartHttpServletRequest multiRequest) throws Exception { + + JsonResult jr = new JsonResult(); + jr.setSuccess(false); + jr.setMessage("TXT 파일만 업로드할 수 있습니다."); + + //로그인 권한정보 불러오기 + LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; + String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); + String author = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getAuthority()); + + if(userId.equals("") || author.equals("")) { + + jr.setMessage("TXT 파일 업로드는 로그인이 필요합니다."); + return jr; + + } + + try { + + List files = (List) multiRequest.getFiles("file0"); + List mjonCandidateTwVO = new ArrayList(); + List callToList = new ArrayList(); + List> json = new ArrayList>(); + //전체 엑셀 데이터 갯수 체크 변수 + int totRowDataCnt = 0; + + if(!files.isEmpty()) { + + if (files.get(0).getSize() > 0 + || files.get(0).getOriginalFilename().split("[.]")[1].indexOf("txt") > -1) { + + // txt 파일 용량 3MB이상 시 10만건 이상으로 서버가 다운되는 증상 발생 + long fileSize = multiRequest.getFile("file0").getSize(); + + if(fileSize > 3374653) { + jr.setMessage("txt 파일은 3MB를 넘을수 없습니다."); + return jr; + } + + BufferedReader reader = new BufferedReader(new InputStreamReader(multiRequest.getFile("file0").getInputStream())); + + String line = null; + String[] splitedStr = null; + String[] tempStr = null; + int errPhoneCnt = 0; + + //String phoneRegExp = "^01(?:0|1|[6-9])[.-]?(\\d{3}|\\d{4})[.-]?(\\d{4})$"; + String phoneRegExp = "^(050[234567]{1}|01[016789]{1})-?[0-9]{3,4}-?[0-9]{4}$"; + + //파일 읽어서 탭으로 구분해주기 + while ((line = reader.readLine()) != null) { + + HashMap jm = new HashMap<>(); + splitedStr = null; + tempStr = null; + + //txt 파일의 데이터가 탭 혹은 콤마로 구분되어 있는지 구분처리 + tempStr = line.split("\t"); + if(tempStr.length > 0) { + + splitedStr = tempStr; + + }else { + + splitedStr = line.split(","); + + } + + for (int i = 0; i < splitedStr.length; i++) { + + splitedStr[i] = splitedStr[i].trim(); + + if(i == 0) { + + if(splitedStr[i].matches(phoneRegExp)) { + //휴대폰 번호 + //jm.put("phone", splitedStr[i]); + callToList.add(splitedStr[i]); + totRowDataCnt++; + + }else { + errPhoneCnt++; + } + + } + + } + + /*if(jm.get("phone") != null) { + + json.add(jm); + + }*/ + + } // end while + //jr.setData(json); + //jr.setSuccess(true); + if(errPhoneCnt > 0) { + + jr.setMessage("올바르지 않은 휴대폰 번호가 "+ errPhoneCnt +" 건 있습니다."); + + }else { + + jr.setMessage(""); + + } + } + + + //수신자 목록 중복 체크 및 디비화 처리 + List dupCallToList = MJUtil.getDuplicateList(callToList); + + String dupCallCnt = Integer.toString(totRowDataCnt - dupCallToList.size()); + + //입력되어있는 데이터의 마지막 순번(call_seq)을 조회해 온다. + int maxCallSeq = mjonCandidateService.selectCandidateTWMaxCallSeq(userId); + maxCallSeq += 1;//마지막 순번에 1을 더해서 다음 순번을 지정해준다. + HashMap callHm = new HashMap<>(); + for(String callTo : dupCallToList) { + + MjonCandidateTWVO tmpCandidateTwVO = new MjonCandidateTWVO(); + + tmpCandidateTwVO.setMberId(userId); + tmpCandidateTwVO.setCallTo(callTo.replaceAll("-", "")); + tmpCandidateTwVO.setFrstRegisterId(userId); + tmpCandidateTwVO.setLastUpdusrId(userId); + tmpCandidateTwVO.setCallSeq(maxCallSeq); + + mjonCandidateTwVO.add(tmpCandidateTwVO); + + } + + int resultCnt = mjonCandidateService.insertCandidateTWCallToData(mjonCandidateTwVO); + + if(resultCnt > 0) { + + callHm.put("callSeq", Integer.toString(maxCallSeq)); + json.add(callHm); + + jr.setData(json); + jr.setSuccess(true); + + }else { + + jr.setSuccess(false); + jr.setMessage("엑셀 데이터 처리에 오류가 발생하였습니다. 잠시후 다시 시도해 주세요."); + + } + + + } + + return jr; + + } catch (Exception e) { + // TODO: handle exception + System.out.println("+++++++++++++++++ insertTxtFileTWCallToAjax Controller Error !!! "+e); + jr.setSuccess(false); + jr.setMessage("TXT 데이터에 오류가 있습니다. TXT 데이터를 확인해 주세요."); + return jr; + } + + } + +} diff --git a/src/main/resources/egovframework/sqlmap/let/msg/MjonMsgCampainData_SQL_mysql.xml b/src/main/resources/egovframework/sqlmap/let/msg/MjonMsgCampainData_SQL_mysql.xml index 293022e3..8be33ded 100644 --- a/src/main/resources/egovframework/sqlmap/let/msg/MjonMsgCampainData_SQL_mysql.xml +++ b/src/main/resources/egovframework/sqlmap/let/msg/MjonMsgCampainData_SQL_mysql.xml @@ -6,7 +6,7 @@ - + + + SELECT IFNULL(MAX(CALL_SEQ), 0) + FROM MJ_CAMPAIN_TMP_CALLTO + WHERE MBER_ID = #mberId# + + + + + + + + UPDATE MJ_CAMPAIN_TMP_CALLTO SET + SEND_FLAG = 'C', + LAST_UPDUSR_ID = #mberId#, + LAST_UPDT_PNTTM = NOW() + WHERE MBER_ID = #mberId# + AND CALL_SEQ = #callSeq# + + + + + + UPDATE MJ_CAMPAIN_TMP_CALLTO SET + SEND_FLAG = 'C', + LAST_UPDUSR_ID = #mberId#, + LAST_UPDT_PNTTM = NOW() + WHERE MBER_ID = #mberId# + + #campainTmpIdList[]# + + + + + + + + + INSERT + INTO MJ_CAMPAIN_TMP_CALLTO + ( + MBER_ID, + CALL_TO, + SEND_FLAG, + CALL_SEQ, + FRST_REGISTER_ID, + FRST_REGIST_PNTTM, + LAST_UPDUSR_ID, + LAST_UPDT_PNTTM + ) + VALUES + ( + #mberId#, + #callTo#, + 'N', + #callSeq#, + #frstRegisterId#, + NOW(), + #lastUpdusrId#, + NOW() + ) + + + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataCallToListView.jsp b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataCallToListView.jsp new file mode 100644 index 00000000..4b2b86e9 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataCallToListView.jsp @@ -0,0 +1,80 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> + + +
+
    +
  • +
  • + 번호 + +
  • +
  • +
  • + 번호 + +
  • +
+ +
+
+
    + +
+
+ +
+ +
+

마우스를 누르고 있으면 받는사람을 연속적으로 20명까지 선택할 수 있습니다.

+
+
+
+ <%--
+ +
+
+ + + +
+
+

0건 / 중복 0

+ +
--%> +
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataSMLView.jsp b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataSMLView.jsp new file mode 100644 index 00000000..d77a784b --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataSMLView.jsp @@ -0,0 +1,4594 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + + + + +<% pageContext.setAttribute("newLineChar", "\r\n"); %> + + +
+
+
+
Loading
+
+
+ +
+ + + + + +
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ + + +
+ +
+ + +
+ +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + "/> + "/> + "/> + "/> + "/> + "/> + + + + + + + + + + + + + + + + + + + + + "/> + "/> + "/> + "/> + "/> + + + + + + +
+

선거 20건씩 문자전송

+
+ + + + + + + + + + + + + + + +
+
+ <%--
+

- 90byte 초과 시, 장문으로 전환됩니다. 장문 문자는 최대 2,000byte까지 작성할 수 있습니다.

+

- 그림문자 1건에 포토 최대 3장 첨부가능 [권장 사이즈 : 640 x 960픽셀 / 최대용량 : 10MB이내]

+

- 광고성 메시지는 반드시 유의사항 확인 후 발송해 주시기 바랍니다. [선거문자 관련규정 안내]

+
--%> +
+
+ <%--
+
나의 요금제
+
+
    +
  • 단문
  • +
  • 장문
  • +
  • 그림(2장 : 원 / 3장 : 원)
  • +
+
+
--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + --%> + +
일반 문자보내기 분류 번호 내용 등을 입력하는 표
발신번호 + + + +
제목 +
    +
  • + + + + +
  • +
  • + + +
  • +
+
내용 +
+
+ +
    + + + +
    +
    +

    + 0 / + 90byte +

    + 단문 +
    +
    +
    +
    +
    + +
    + + +
    +
    + + + + + +
    +
    + +
    +
    + + + ${symbolList.symbol} + + +
    +
    + + +
    +
    + + + ${symbolList.symbol} + + +
    +
    + + +
    +
    + + + ${symbolList.symbol} + + +
    +
    + + +
    +
    + + + ${symbolList.symbol} + + +
    +
    + + +
    +
    + + + ${symbolList.symbol} + + +
    +
    + + +
    +
    +
    + + +
    + + +
    + + +
    +
    +
    +

    * 현재 [단문] 0건 발송 가능합니다.

    +
    받는사람 +
    +
    + + + + * 중복번호는 한번만 발송됩니다. +
    +
    + <%-- 받는 사람 리스트 박스 시작 --%> +
    +
    +
      +
    • +
    • + 번호 + +
    • +
    • +
    • 번호 + +
    • +
    + +
    +
    + <%-- 받는 사람 리스트 박스 종료 --%> +
    + + +
    + +
    +

    휴대폰 번호 입력 시 해당 휴대폰 번호에 대한 형식이 어긋나거나 휴대폰 번호에 오류가 있는지 등을 검사하는 기능

    + (예시) 010-1234-0001(O) / 010-123-0001(X) +
    +
    +
    +
    전체 받는사람
    +
    +

    0

    +
    +
    전송완료
    +
    +

    0

    +
    +
    잔여 받는사람
    +
    +

    0

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    발송금액 :

    +
    + 단문 : 20/장문 : 150/그림문자 : 30건 +
    +
    +

    0(부가세 포함)

    +
    + +

    * 이벤트회원의 발송금액은 이벤트단가를 적용하여 계산된 금액이므로 실제 발송금액과 다를 수 있습니다.

    +
    +
    + +
    + + + <%-- --%> + + + + +
    + +
    +
    +
    + + + + + +
    +
    추천인 ID + + + + +
    + + + +
    +
    +
    +
    +
    +
    +
    +

    미리보기

    +
    + 단문 +
    + 글자크기 + + +
    +
    +
    + 포토 +
      +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    +
    + 글자크기 + + +
    +
    + +
    +
    +
    +

    내용을 입력해주세요.222222

    +
    adfasfdasdf
    +
    +
    + +
    +
    +

    ※ 단말기 설정에 따라 다르게 보일 수 있습니다

    +
    +
    +
    +
    +
    +
      +
    • +
    • +
    +
    +
    + + +
    +
    +
    +
    + 날짜 : +
    + +
    + +
    + + + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + + + + + + + + +
    diff --git a/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataView.jsp b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataView.jsp new file mode 100644 index 00000000..ce00eb9e --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/web/msgcampain/tw/MsgTWDataView.jsp @@ -0,0 +1,2271 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ page import="itn.com.cmm.LoginVO" %> + + + + +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    + +
      +
    • +
    • + + +
    • +
    + + +
    + + + + +
    + +
    + +
      +
    • +
    • +
    • +
    • +
    + + +
    + + + + + + + + + +
    + + +
    + +
    +
    +
    + + + +
    + <%-- 맞춤제작 요청 JSPark => 2023.02.21 추가 --%> + <%-- + + + --%> + +
    +
    +
    +
    + All + BEST + + + +
    +
    + <%-- 전체 + + # + --%> +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + +
    + <%-- 맞춤제작 요청 JSPark => 2023.02.21 추가 --%> + <%-- + + + --%> + +
    +
    +
    +
    + All + BEST + + + +
    +
    + + <%-- 전체 + + # + --%> +
    +
    +
    +
    +
    + +
    +
    + + +
    + + +
    + +
    + + + + + +
    +
    +
    + · 기간 +
    + + ~ + +
    + +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + + +
    diff --git a/src/main/webapp/js/MJUtill.js b/src/main/webapp/js/MJUtill.js index 6dcd5348..febec3d4 100644 --- a/src/main/webapp/js/MJUtill.js +++ b/src/main/webapp/js/MJUtill.js @@ -882,3 +882,20 @@ function setCursorInsertText(pTxtArea, pAddTxt) { txtArea.selectionEnd = selectPos; // 커서 끝지점을 추가 삽입된 텍스트 이후로 지정 txtArea.focus(); } + +//선거문자 20건 수신자 목록 추가된 건수 및 발송 금액 변경해주기 +function fnChkCallToChange(){ + + var callToCnt = 0; + $("input[name=chkCallTo]").each(function(){ + + var chkSts = $(this).is(':checked'); + if(chkSts){ + callToCnt++; + } + }); + + updateTotCnt(callToCnt); //전체 데이터 갯수 구하기 + totalPriceSum(callToCnt); + +} diff --git a/src/main/webapp/publish/js/publish.js b/src/main/webapp/publish/js/publish.js index 618d79e6..479c0efe 100644 --- a/src/main/webapp/publish/js/publish.js +++ b/src/main/webapp/publish/js/publish.js @@ -1,37 +1,67 @@ - -// 마우스 길게 누르는 function -var onlongclick = function ($target, time, callback) { - $($target).on("mousedown", function () { - const timer = setTimeout(callback, time); - $($target).on("mouseup", function () { - clearTimeout(timer); - }); - }); -} - - -var publishCommon = { - count: 0, - longMousePressCheck: function (checkTarget, checkTime) { - // checkTarget → 체크박스([name='']) / checkTime → 몇초 간격으로 체크 될지 - var checkLength = checkTarget.length; // 체크박스 몇개인지 - var cnt = 0; // 몇개 체크됐는지 - var checkEvent = setInterval(function () { - if (this.count == 0) {} - else if (cnt >= checkLength) { - clearInterval(checkEvent); // 자동체크 끝. - } - $(checkTarget[cnt]).prop('checked', true); // 체크박스 체크. - cnt++; - }, checkTime); - }, - clickCheck: function (checkTarget) { - // 한번 클릭 했을 때 체크, checkTarget → 체크박스([name='']) - if (checkTarget.length < this.count) { - // 체크 다하면 더이상 작동 x. - return false; - } - $(checkTarget[this.count]).prop('checked', true); // 체크박스 체크 - this.count++; - } -} + +// 마우스 길게 누르는 function +var onlongclick = function ($target, time, callback) { + $($target).on("mousedown", function () { + const timer = setTimeout(callback, time); + $($target).on("mouseup", function () { + clearTimeout(timer); + }); + }); +} + + +var publishCommon = { + count: 0, + longMousePressCheck: function (checkTarget, checkTime) { + // checkTarget → 체크박스([name='']) / checkTime → 몇초 간격으로 체크 될지 + var checkLength = checkTarget.length; // 체크박스 몇개인지 + var cnt = 0; // 몇개 체크됐는지 + var checkEvent = setInterval(function () { + if (this.count == 0) {} + else if (cnt >= checkLength) { + clearInterval(checkEvent); // 자동체크 끝. + } + $(checkTarget[cnt]).prop('checked', true); // 체크박스 체크. + cnt++; + console.log("+++++ publishCommon ::: " + cnt); + }, checkTime); + }, + clickCheck: function (checkTarget) { + // 한번 클릭 했을 때 체크, checkTarget → 체크박스([name='']) + /*if (checkTarget.length < this.count) { + // 체크 다하면 더이상 작동 x. + return false; + } + $(checkTarget[this.count]).prop('checked', true); // 체크박스 체크 + this.count++;*/ + + $("input:checkbox[name='chkCallTo']").each(function(){ + + var chkSts = $(this).is(":checked"); + + if(!chkSts){ + $(this).prop("checked","true"); + return false; + } + + }); + + console.log("+++++ publishCommonClick ::: " + this.count); + }, + clickCheckPrice : function(){ + + var callToCnt = 0; + $("input[name=chkCallTo]").each(function(){ + + var chkSts = $(this).is(':checked'); + if(chkSts){ + callToCnt++; + } + }); + + updateTotCnt(callToCnt); //전체 데이터 갯수 구하기 + totalPriceSum(callToCnt); + + } + +}