문자전송 > 주소록 불러오기 건수 테스트

This commit is contained in:
hylee 2024-08-28 14:07:17 +09:00
parent c72fd172ed
commit 83beeb1b7e
8 changed files with 1895 additions and 1657 deletions

View File

@ -412,5 +412,39 @@ public class AddrVO extends ComDefaultVO{
} }
private int page = 1; // 기본 설정
private int size = 10; // 기본 설정
private int offset; // 기본 설정
public int getPage() {
return page;
}
public void setPage(int page) {
if(page > 0) {
this.page = page;
}
}
public int getSize() {
return size;
}
public void setSize(int size) {
if(size > 0) {
this.size = size;
}
}
// OFFSET 계산 메서드 추가
public int getOffset() {
return (page - 1) * size;
}
public void setOffset(int offset) {
this.offset = offset;
}
} }

View File

@ -174,5 +174,7 @@ public interface MjonMsgDataService {
public String selectMsgUserLastIdgen(MjonMsgVO mjonMsgVO) throws Exception; public String selectMsgUserLastIdgen(MjonMsgVO mjonMsgVO) throws Exception;
public List<AddrVO> selectMsgAddrListAjax_advc(AddrVO addrVO) throws Exception; public List<AddrVO> selectMsgAddrListAjax_advc(AddrVO addrVO) throws Exception;
public int countByMsgAddrListAjax_advc(AddrVO addrVO) throws Exception;
} }

View File

@ -355,5 +355,10 @@ public class MjonMsgDataDAO extends EgovAbstractDAO {
public List<AddrVO> selectMsgAddrListAjax_advc(AddrVO addrVO) { public List<AddrVO> selectMsgAddrListAjax_advc(AddrVO addrVO) {
return (List<AddrVO>) list("mjonMsgDAO.selectMsgAddrListAjax_advc", addrVO); return (List<AddrVO>) list("mjonMsgDAO.selectMsgAddrListAjax_advc", addrVO);
} }
public int countByMsgAddrListAjax_advc(AddrVO addrVO) {
return (int) select("mjonMsgDAO.countByMsgAddrListAjax_advc", addrVO);
}
} }

View File

@ -3057,5 +3057,11 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
return mjonMsgDataDAO.selectMsgAddrListAjax_advc(addrVO); return mjonMsgDataDAO.selectMsgAddrListAjax_advc(addrVO);
} }
@Override
public int countByMsgAddrListAjax_advc(AddrVO addrVO) throws Exception {
return mjonMsgDataDAO.countByMsgAddrListAjax_advc(addrVO);
}
} }

View File

@ -40,6 +40,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
@ -1759,8 +1761,7 @@ public class MjonMsgDataController {
long startTime = System.currentTimeMillis(); // 시작 시간 측정 long startTime = System.currentTimeMillis(); // 시작 시간 측정
// List<AddrVO> resultAddrList = mjonMsgDataService.selectMsgAddrListAjax(addrVO); List<AddrVO> resultAddrList = mjonMsgDataService.selectMsgAddrListAjax(addrVO);
List<AddrVO> resultAddrList = mjonMsgDataService.selectMsgAddrListAjax_advc(addrVO);
long endTime = System.currentTimeMillis(); // 종료 시간 측정 long endTime = System.currentTimeMillis(); // 종료 시간 측정
@ -1775,6 +1776,56 @@ public class MjonMsgDataController {
return modelAndView; return modelAndView;
} }
/**
* 주소록 그룹 선택시 우측 주소록 리스트 화면 불러오기
*
* @param AddrGroupVO
* @param AddrVO
* @param sessionVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value= {"/web/mjon/msgdata/selectMsgAddrListAjax_advc.do"})
public ResponseEntity<?> selectMsgAddrListAjax_advc(@ModelAttribute("searchVO") AddrVO addrVO) {
Map<String, Object> response = new HashMap<>();
try {
// 로그인 권한 정보 확인
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated() ? (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser() : null;
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if (userId.isEmpty()) {
response.put("result", "loginFail");
response.put("message", "로그인 후 이용이 가능합니다.");
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response);
}
addrVO.setMberId(userId);
// OFFSET 계산
int offset = (addrVO.getPage()) * addrVO.getSize();
addrVO.setOffset(offset);
// 데이터 조회
List<AddrVO> resultAddrList = mjonMsgDataService.selectMsgAddrListAjax_advc(addrVO);
int totalCount = mjonMsgDataService.countByMsgAddrListAjax_advc(addrVO); // 필터에 맞는 레코드 가져오기
// 페이지네이션 계산
int lastPage = (int) Math.ceil((double) totalCount / addrVO.getSize());
// 응답 데이터 구성
response.put("data", resultAddrList);
response.put("last_page", lastPage); // 클라이언트가 사용할 있도록 last_page 포함
response.put("total_count", totalCount); // 필요 , 레코드 포함
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
return ResponseEntity.ok(response); // resultAddrList만 반환
}
/** /**
* 최근 전송내역 리스트 화면 불러오기 * 최근 전송내역 리스트 화면 불러오기
* *

View File

@ -3710,6 +3710,7 @@
<!-- 등록 주소록 그룹 선택시 리스트 불러오기 --> <!-- 등록 주소록 그룹 선택시 리스트 불러오기 -->
<select id="mjonMsgDAO.selectMsgAddrListAjax_advc" parameterClass="addrVO" resultClass="addrVO"> <select id="mjonMsgDAO.selectMsgAddrListAjax_advc" parameterClass="addrVO" resultClass="addrVO">
/* mjonMsgDAO.selectMsgAddrListAjax_advc */
SELECT A.ADDR_ID AS addrId, SELECT A.ADDR_ID AS addrId,
A.ADDR_GRP_ID AS addrGrpId, A.ADDR_GRP_ID AS addrGrpId,
@ -3763,6 +3764,54 @@
</isEqual> </isEqual>
</isNotEmpty> </isNotEmpty>
ORDER BY A.ADDR_NM ASC, A.LAST_UPDT_PNTTM DESC ORDER BY A.ADDR_NM ASC, A.LAST_UPDT_PNTTM DESC
LIMIT #size# OFFSET #offset#
</select>
<!-- 등록 주소록 그룹 선택시 리스트 불러오기 -->
<select id="mjonMsgDAO.countByMsgAddrListAjax_advc" parameterClass="addrVO" resultClass="int">
SELECT
COUNT(A.ADDR_ID)
FROM MJ_ADDR A
LEFT OUTER JOIN
MJ_ADDR_GRP B
ON
A.ADDR_GRP_ID = B.ADDR_GRP_ID
WHERE A.MBER_ID = #mberId#
AND (A.RECV_STATUS = 'Y' OR A.RECV_STATUS = 'S' OR A.RECV_STATUS IS NULL)
AND A.DELETE_YN = 'N'
<isNotEmpty property="type">
<isEqual property="type" compareValue="none">
AND A.ADDR_GRP_ID = '0'
AND A.BOOKMARK = 'N'
</isEqual>
<isEqual property="type" compareValue="book">
AND A.BOOKMARK = 'Y'
</isEqual>
<isEqual property="type" compareValue="grp">
AND A.ADDR_GRP_ID = #searchAddrGrpId#
</isEqual>
</isNotEmpty>
<isNotEmpty property="searchCondition">
<isEqual property="searchCondition" compareValue="0">
AND
(
A.ADDR_NM LIKE CONCAT('%', #searchKeyword#, '%')
OR A.ADDR_PHONE_NO LIKE CONCAT('%', #searchKeyword#, '%')
OR B.ADDR_GRP_NM LIKE CONCAT('%', #searchKeyword#, '%')
)
</isEqual>
<isEqual property="searchCondition" compareValue="1">
AND B.ADDR_GRP_NM LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="2">
AND A.ADDR_NM LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
<isEqual property="searchCondition" compareValue="3">
AND A.ADDR_PHONE_NO LIKE CONCAT('%', #searchKeyword#, '%')
</isEqual>
</isNotEmpty>
</select> </select>

File diff suppressed because it is too large Load Diff

View File

@ -87,50 +87,58 @@ $(document).ready(function(){
}); });
// Tabulator 초기화
//주소록 불러오기 팝업 내용
//Tabulator AJAX Data Loading
tableAddr = new Tabulator(".callAddr_box", { tableAddr = new Tabulator(".callAddr_box", {
height:"255px", height: "255px",
layout:"fitColumns", layout: "fitColumns",
headerHozAlign:"center", headerHozAlign: "center",
validationMode:"highlight", validationMode: "highlight",
placeholder:"주소록 그룹을 선택해 주세요.", //fit columns to width of table (optional) placeholder: "주소록 그룹을 선택해 주세요.",
resizableColumns:false, resizableColumns: false,
columns:[ //Define Table Columns progressiveLoad:"scroll",
{formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){ // progressiveLoadScrollMargin:300, //trigger next ajax load when scroll bar is 300px or less from the bottom of the table.
cell.getRow().toggleSelect(); ajaxURL: "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do", // 데이터 URL 설정
} ajaxConfig: {
}, method: "GET",
{title:"그룹명", hozAlign:"center", field:"addrGroupNm", editor:"input", width:100, validator:["required","minLength:2", "maxLength:40"]}, },
{title:"이름", hozAlign:"center", field:"addrName", editor:"input", width:100, validator:["maxLength:12"]}, ajaxParams: { // Initial AJAX parameters
{title:"휴대폰번호", hozAlign:"center", field:"addrPhone", editor:"input", width:100, validator:["required","minLength:10", "maxLength:11"]}, size: 350000, // Set initial page size
{title:"[*1*]", hozAlign:"center", field:"addrRep1", editor:"input", width:84, validator:["maxLength:40"]}, type: "", // Default value, can be updated later
{title:"[*2*]", hozAlign:"center", field:"addrRep2", editor:"input", width:84, validator:["maxLength:40"]}, searchAddrGrpId: "", // Default value, can be updated later
{title:"[*3*]", hozAlign:"center", field:"addrRep3", editor:"input", width:84, validator:["maxLength:40"]}, searchKeyword: "", // Default value, can be updated later
{title:"[*4*]", hozAlign:"center", field:"addrRep4", editor:"input", width:84, validator:["maxLength:40"]}, searchCondition: "" // Default value, can be updated later
},
], columns: [
validationFailed:function(cell, value, parameters){ // 유효성 체크 함수 - 아직 잘 모르겠음 {formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerSort: false, cellClick: function(e, cell) {
var valid = cell.isValid(); cell.getRow().toggleSelect();
var fieldNm = cell.getField(); }
if(!valid){ },
if(fieldNm == "addrName"){ {formatter: "rownum", align: "center", title: "No", hozAlign: "center", headerHozAlign: "center", width: 60},
alert("받는사람 이름은 최대 12글자까지만 입력 가능합니다."); {title: "그룹명", hozAlign: "center", field: "addrGroupNm", editor: "input", width: 100, validator: ["required", "minLength:2", "maxLength:40"]},
}else if(fieldNm == "addrPhone"){ {title: "이름", hozAlign: "center", field: "addrName", editor: "input", width: 100, validator: ["maxLength:12"]},
alert("휴대폰번호는 하이픈(-)을 제외한 숫자만 정확히 입력해 주세요."); {title: "휴대폰번호", hozAlign: "center", field: "addrPhone", editor: "input", width: 100, validator: ["required", "minLength:10", "maxLength:11"]},
}else if(fieldNm == "addrGroupNm"){ {title: "[*1*]", hozAlign: "center", field: "addrRep1", editor: "input", width: 84, validator: ["maxLength:40"]},
alert("그룹명을 정확히 입력해 주세요. 2 ~ 40글자 이내로 입력 가능합니다."); {title: "[*2*]", hozAlign: "center", field: "addrRep2", editor: "input", width: 84, validator: ["maxLength:40"]},
}else{ {title: "[*3*]", hozAlign: "center", field: "addrRep3", editor: "input", width: 84, validator: ["maxLength:40"]},
alert("치환문자를 정확히 입력해 주세요. 100글자 이내로 입력 가능합니다."); {title: "[*4*]", hozAlign: "center", field: "addrRep4", editor: "input", width: 84, validator: ["maxLength:40"]},
} ],
validationFailed: function(cell, value, parameters) {
//해당 셀 데이터 삭제 var valid = cell.isValid();
cell.setValue(""); var fieldNm = cell.getField();
} if (!valid) {
return value % parameters.addrPhone; if (fieldNm == "addrName") {
alert("받는사람 이름은 최대 12글자까지만 입력 가능합니다.");
} else if (fieldNm == "addrPhone") {
alert("휴대폰번호는 하이픈(-)을 제외한 숫자만 정확히 입력해 주세요.");
} else if (fieldNm == "addrGroupNm") {
alert("그룹명을 정확히 입력해 주세요. 2 ~ 40글자 이내로 입력 가능합니다.");
} else {
alert("치환문자를 정확히 입력해 주세요. 100글자 이내로 입력 가능합니다.");
}
cell.setValue("");
}
return value % parameters.addrPhone;
}, },
}); });
@ -2850,43 +2858,39 @@ function fnAddrGrpSearch(){
} }
//주소록 불러오기 팝업의 그룹 선택시 우측에 주소록 불러오기 //주소록 불러오기 팝업의 그룹 선택시 우측에 주소록 불러오기
function fnSelectAddrList(type,addrGrpId,item){ function fnSelectAddrList(type, addrGrpId, item) {
// 폴더 이미지 초기화 및 설정
// 주소록 그룹 열림, 닫힘 폴더이미지 초기화
$(".adr_pop_list div p").each(function (index, item) { $(".adr_pop_list div p").each(function (index, item) {
$(item).find("img").attr("src", "/publish/images/content/close_folder2.png"); $(item).find("img").attr("src", "/publish/images/content/close_folder2.png");
$(item).find("img").attr("alt", "폴더 닫힘"); $(item).find("img").attr("alt", "폴더 닫힘");
}); });
var form = document.searchAddrGrpForm; // var form = document.searchAddrGrpForm;
form.type.value = type; // form.type.value = type;
form.searchAddrGrpId.value = addrGrpId; // form.searchAddrGrpId.value = addrGrpId;
form.searchKeyword.value = ""; // form.searchKeyword.value = "";
form.searchCondition.value = form.searchAddrCondition.value; // form.searchCondition.value = form.searchAddrCondition.value;
//왼쪽 그룹리스트의 그룸명을 선택시 검색어를 초기화해준다. // 왼쪽 그룹리스트의 그룹명을 선택 시 검색어를 초기화해준다.
form.searchAddrKeyword.value=""; // form.searchAddrKeyword.value = "";
/*
$(item).toggleClass("open");
if ($(item).hasClass("open") === true) {
$(item).find("img").attr("src", "/publish/images/content/open_folder2.png");
$(item).find("img").attr("alt", "폴더 열림");
}
else {
$(item).find("img").attr("src", "/publish/images/content/close_folder2.png");
$(item).find("img").attr("alt", "폴더 닫힘");
}
*/
$(item).find("img").attr("src", "/publish/images/content/open_folder2.png"); $(item).find("img").attr("src", "/publish/images/content/open_folder2.png");
$(item).find("img").attr("alt", "폴더 열림"); $(item).find("img").attr("alt", "폴더 열림");
loadAddrList(); // Tabulator의 ajaxParams 설정
tableAddr.setData("/web/mjon/msgdata/selectMsgAddrListAjax_advc.do", {
searchAddrGrpId: addrGrpId,
type: type,
// searchKeyword: form.searchAddrKeyword.value,
// searchCondition: form.searchCondition.value,
size: 350000, // 페이지당 로드할 데이터 수
});
} }
function fnAddrSearch(){ function fnAddrSearch(){
var form = document.searchAddrGrpForm; var form = document.searchAddrGrpForm;
@ -2900,11 +2904,11 @@ function fnAddrSearch(){
function loadAddrList(){ function loadAddrList(){
/* /*
serialize 를 사용할때는 processData, contentType 옵션 제가할것 serialize 를 사용할때는 processDa ta, contentType 옵션 제가할것
*/ */
var data = $("#searchAddrGrpForm").serialize(); var data = $("#searchAddrGrpForm").serialize();
var url = "/web/mjon/msgdata/selectMsgAddrListAjax.do"; var url = "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do";
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -2920,12 +2924,11 @@ function loadAddrList(){
if(returnData.result == "success"){ if(returnData.result == "success"){
var addrList = returnData.resultAddrList; var addrList = returnData.resultAddrList;
var tableData = [];
if(addrList.length == 0){ if(addrList.length == 0){
alert("주소록 정보가 없습니다."); alert("주소록 정보가 없습니다.");
tableAddr.setData(tableData); // tableAddr.setData([]);
return false; return false;
} }
@ -2956,7 +2959,8 @@ function loadAddrList(){
//우측 주소록 리스트 Tabulator에 입력해주기 //우측 주소록 리스트 Tabulator에 입력해주기
// tableAddr.setData(tableData); // tableAddr.setData(tableData);
tableAddr.setData(addrList); // tableAddr.setData(addrList);
tableAddr.updateOrAddData(addrList); // 무한 스크롤을 위해 데이터를 업데이트
}else{ }else{
@ -2969,8 +2973,10 @@ function loadAddrList(){
alert("주소록 불러오기에 실패하였습니다. !!"); alert("주소록 불러오기에 실패하였습니다. !!");
} }
}, },
error: function (e) { error: function (jqXHR, textStatus, errorThrown) {
alert("주소록 불러오기에 실패하였습니다."); console.log("ERROR : ", e); alert("주소록 불러오기에 실패하였습니다.");
console.log("ERROR : ", jqXHR.status, textStatus, errorThrown); // 상태 코드, 상태 텍스트, 에러 메시지 출력
console.log("Response Text: ", jqXHR.responseText); // 서버 응답 텍스트 출력
}, },
beforeSend : function(xmlHttpRequest) { beforeSend : function(xmlHttpRequest) {
//로딩창 show //로딩창 show