dateUtils.js or java 작업
This commit is contained in:
parent
fb44ab739d
commit
01cd8f78a6
@ -121,15 +121,19 @@ public final class DateUtils {
|
||||
}
|
||||
|
||||
// 현재 날짜에서 특정 일수 전 날짜를 기본 포맷으로 반환
|
||||
public static String getDateDaysAgo(int days) {
|
||||
return getDateDaysAgo(days, SLUSH_FORMATTER);
|
||||
public static String getDateMonthsAgo(int months) {
|
||||
return getDateMonthsAgo(months, SLUSH_FORMATTER);
|
||||
}
|
||||
|
||||
// 현재 날짜에서 특정 일수 전 날짜를 지정된 포맷으로 반환
|
||||
public static String getDateDaysAgo(int days, DateTimeFormatter formatter) {
|
||||
public static String getDateMonthsAgo(int months, DateTimeFormatter formatter) {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate daysAgo = today.minusDays(days);
|
||||
return daysAgo.format(formatter);
|
||||
// System.out.println("months : "+ months);
|
||||
// System.out.println("today.minusMonths(months) : "+ today.minusMonths(months).format(formatter));
|
||||
LocalDate monthsAgo = today.minusMonths(months).plusDays(1);
|
||||
// System.out.println("monthsAgo : " + monthsAgo);
|
||||
// System.out.println("monthsAgo.format(formatter) : " + monthsAgo.format(formatter));
|
||||
return monthsAgo.format(formatter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ public class MjonMsgCustomWebController {
|
||||
// 내 보관함 - 기본 날짜 검색 셋팅
|
||||
// 오늘 날짜에서 365일 날짜 가져와서
|
||||
// 검색날짜에 입력
|
||||
model.addAttribute("myStartDate", DateUtils.getDateDaysAgo(365));
|
||||
model.addAttribute("myStartDate", DateUtils.getDateMonthsAgo(12));
|
||||
model.addAttribute("myEndDate", DateUtils.getCurrentDate());
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ public class MjonMsgCustomWebController {
|
||||
// 총 기간이 365일이 넘으면 현재일부터 365일 전 날짜를 넣어서 검색
|
||||
if(!DateUtils.dateChkAndValueChk(mjonMsgCustomVO.getSearchStartDate(),mjonMsgCustomVO.getSearchEndDate(), 12 )) {
|
||||
|
||||
mjonMsgCustomVO.setSearchStartDate(DateUtils.getDateDaysAgo(365));
|
||||
mjonMsgCustomVO.setSearchStartDate(DateUtils.getDateMonthsAgo(12));
|
||||
mjonMsgCustomVO.setSearchEndDate(DateUtils.getCurrentDate());
|
||||
|
||||
};
|
||||
|
||||
@ -35,6 +35,7 @@ import itn.com.cmm.EgovMessageSource;
|
||||
import itn.com.cmm.LoginVO;
|
||||
import itn.com.cmm.service.EgovFileMngService;
|
||||
import itn.com.cmm.service.EgovFileMngUtil;
|
||||
import itn.com.cmm.util.DateUtils;
|
||||
import itn.com.utl.fcc.service.EgovStringUtil;
|
||||
import itn.let.kakao.user.sent.service.KakaoSentService;
|
||||
import itn.let.mjo.addr.service.AddrGroupService;
|
||||
@ -235,21 +236,23 @@ private static final Logger logger = LoggerFactory.getLogger(MjonMsgSentControll
|
||||
|
||||
if(startDate == null && endDate == null ) {
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Date now = new Date();
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
|
||||
|
||||
//종료일은 오늘날짜
|
||||
cal.setTime(now);
|
||||
endDate = format.format(cal.getTime());
|
||||
|
||||
//시작일은 전날로 셋팅
|
||||
cal.add(Calendar.DATE, -1);
|
||||
startDate = format.format(cal.getTime());
|
||||
|
||||
mjonMsgSentVO.setStartDate(startDate);
|
||||
mjonMsgSentVO.setEndDate(endDate);
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// Date now = new Date();
|
||||
//
|
||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
|
||||
//
|
||||
// //종료일은 오늘날짜
|
||||
// cal.setTime(now);
|
||||
// endDate = format.format(cal.getTime());
|
||||
//
|
||||
// //시작일은 전날로 셋팅
|
||||
// cal.add(Calendar.DATE, -1);
|
||||
// startDate = format.format(cal.getTime());
|
||||
|
||||
mjonMsgSentVO.setStartDate(DateUtils.getDateMonthsAgo(3));
|
||||
mjonMsgSentVO.setEndDate(DateUtils.getCurrentDate());
|
||||
|
||||
}
|
||||
|
||||
@ -455,6 +458,16 @@ private static final Logger logger = LoggerFactory.getLogger(MjonMsgSentControll
|
||||
mjonMsgSentVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
mjonMsgSentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
|
||||
|
||||
if(!DateUtils.dateChkAndValueChk(mjonMsgSentVO.getStartDate(),mjonMsgSentVO.getEndDate(), 3 )) {
|
||||
mjonMsgSentVO.setStartDate(DateUtils.getDateMonthsAgo(3));
|
||||
mjonMsgSentVO.setEndDate(DateUtils.getCurrentDate());
|
||||
};
|
||||
|
||||
model.addAttribute("startDate", mjonMsgSentVO.getStartDate());
|
||||
model.addAttribute("endDate", mjonMsgSentVO.getEndDate());
|
||||
|
||||
//전체 발송 리스트 불러오기
|
||||
List<MjonMsgSentVO> resultAllSentList = mjonMsgSentService.selectAllMsgSentList(mjonMsgSentVO);
|
||||
model.addAttribute("resultAllSentList", resultAllSentList);
|
||||
|
||||
@ -2030,8 +2030,10 @@ public class MjonPayController {
|
||||
|
||||
{
|
||||
// 초기 날짜 셋팅
|
||||
model.addAttribute("startDate", DateUtils.getDateDaysAgo(365));
|
||||
model.addAttribute("startDate", DateUtils.getDateMonthsAgo(13));
|
||||
model.addAttribute("endDate", DateUtils.getCurrentDate());
|
||||
// model.addAttribute("startDate", DateUtils.getDateDaysAgo(365));
|
||||
// model.addAttribute("endDate", DateUtils.getCurrentDate());
|
||||
}
|
||||
|
||||
|
||||
@ -2121,7 +2123,7 @@ public class MjonPayController {
|
||||
// mjonPayVO.setEndDate(mjonPayVO.getEndDate() == null ? DateUtil.getCurrentDate() : mjonPayVO.getEndDate());
|
||||
|
||||
if(!DateUtils.dateChkAndValueChk(mjonPayVO.getStartDate(),mjonPayVO.getEndDate(), 12 )) {
|
||||
mjonPayVO.setStartDate(DateUtils.getDateDaysAgo(365));
|
||||
mjonPayVO.setStartDate(DateUtils.getDateMonthsAgo(12));
|
||||
mjonPayVO.setEndDate(DateUtils.getCurrentDate());
|
||||
};
|
||||
|
||||
@ -2738,7 +2740,7 @@ public class MjonPayController {
|
||||
}
|
||||
{
|
||||
// 초기 날짜 셋팅
|
||||
model.addAttribute("startDate", DateUtils.getDateDaysAgo(365));
|
||||
model.addAttribute("startDate", DateUtils.getDateMonthsAgo(12));
|
||||
model.addAttribute("endDate", DateUtils.getCurrentDate());
|
||||
}
|
||||
|
||||
@ -2793,7 +2795,7 @@ public class MjonPayController {
|
||||
// 총 기간이 365일이 넘으면 현재일부터 365일 전 날짜를 넣어서 검색
|
||||
if(!DateUtils.dateChkAndValueChk(mjonMsgVO.getStartDate(),mjonMsgVO.getEndDate(), 12 )) {
|
||||
|
||||
mjonMsgVO.setStartDate(DateUtils.getDateDaysAgo(365));
|
||||
mjonMsgVO.setStartDate(DateUtils.getDateMonthsAgo(12));
|
||||
mjonMsgVO.setEndDate(DateUtils.getCurrentDate());
|
||||
|
||||
};
|
||||
|
||||
@ -442,6 +442,7 @@ public class EgovUserManageController {
|
||||
userSearchVO.setCandidateYn("Y");
|
||||
|
||||
List<?> resultList = mberManageService.selectMberLoginAddList(userSearchVO);
|
||||
System.out.println("?????????????????????????????");
|
||||
model.addAttribute("resultList", resultList);
|
||||
paginationInfo.setTotalRecordCount( resultList.size()> 0 ? ((Long)((EgovMap)resultList.get(0)).get("totCnt")).intValue() : 0);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
@ -998,7 +999,7 @@ public class EgovUserManageController {
|
||||
|
||||
//회원정보 불러오기
|
||||
mberManageVO = mberManageService.selectMber(reqMberManageVO.getMberId());
|
||||
|
||||
System.out.println(" mberManageVOmberManageVO");
|
||||
//스팸 필터링 예외처리 여부 값 - (온: Y, 오프 : N) 온 일때 스미싱의심 예외 되도록 적용
|
||||
String exceptSpamYn = mberManageVO.getExceptSpamYn();
|
||||
model.addAttribute("exceptSpamYn", exceptSpamYn);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,15 @@
|
||||
<script src="/publish/js/popupLayer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var startDate = '${startDate}';
|
||||
var endDate = '${endDate}';
|
||||
|
||||
// DatePicker 값 수정
|
||||
var startDatePicker = $('#startDate').pickadate('picker');
|
||||
startDatePicker.set('select', startDate, { format: 'yyyy/mm/dd' });
|
||||
startDatePicker = $('#endDate').pickadate('picker');
|
||||
startDatePicker.set('select', endDate, { format: 'yyyy/mm/dd' });
|
||||
|
||||
|
||||
/* 목록 정렬 항목 아이콘 표시 */
|
||||
var searchSortCnd = $("[name='searchSortCnd']").val();
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<script src="/publish/js/popupLayer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
/* 목록 정렬 항목 아이콘 표시 */
|
||||
var searchSortCnd = $("[name='searchSortCnd']").val();
|
||||
var searchSortOrd = $("[name='searchSortOrd']").val();
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<script src="/publish/js/popupLayer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
/* 목록 정렬 항목 아이콘 표시 */
|
||||
var searchSortCnd = $("[name='searchSortCnd']").val();
|
||||
var searchSortOrd = $("[name='searchSortOrd']").val();
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<script src="/publish/js/popupLayer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
/* 목록 정렬 항목 아이콘 표시 */
|
||||
var searchSortCnd = $("[name='searchSortCnd']").val();
|
||||
var searchSortOrd = $("[name='searchSortOrd']").val();
|
||||
|
||||
@ -11,8 +11,6 @@ var lastfulstday = ""; //전월 시작일
|
||||
var lastfuledday = ""; //전월 마지막일
|
||||
var thisfulstlday = ""; //당월 시작일
|
||||
var thisfuledtlday = ""; //당원 마지막일
|
||||
var threefulstday = ""; //3개월전 시작일
|
||||
var threefuledday = ""; //3개월전 마지막일
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
@ -38,8 +36,6 @@ $(document).ready(function(){
|
||||
thisfulstlday += "/01" ;
|
||||
|
||||
//3개월 이전 날짜 구해오기
|
||||
threefulstday = prevMonth(3);
|
||||
threefuledday = today();
|
||||
|
||||
/* 목록 정렬 항목 아이콘 표시 */
|
||||
/* var searchSortCnd = $("[name='searchSortCnd']").val();
|
||||
@ -101,35 +97,9 @@ $(document).ready(function(){
|
||||
|
||||
});
|
||||
|
||||
//오늘날짜 구하기
|
||||
function today() {
|
||||
var d = new Date();
|
||||
return getDateStr(d);
|
||||
}
|
||||
|
||||
//이전 날짜 구하기
|
||||
function prevDay(days) {
|
||||
var d = new Date();
|
||||
var dayOfMonth = d.getDate();
|
||||
d.setDate(dayOfMonth - days);
|
||||
return getDateStr(d);
|
||||
}
|
||||
|
||||
//이전 월 구하기
|
||||
function prevMonth(month) {
|
||||
var d = new Date();
|
||||
var monthOfYear = d.getMonth();
|
||||
d.setMonth(monthOfYear - month);
|
||||
return getDateStr(d);
|
||||
}
|
||||
|
||||
//날짜 받아오기
|
||||
function getDateStr(myDate){
|
||||
var year = myDate.getFullYear();
|
||||
var month = ("0"+(myDate.getMonth()+1)).slice(-2);
|
||||
var day = ("0"+myDate.getDate()).slice(-2);
|
||||
return ( year + '/' + month + '/' + day );
|
||||
}
|
||||
|
||||
//캘린더에 날짜 입력해 주기
|
||||
function setCalVal(val,targetObj){
|
||||
@ -278,9 +248,11 @@ function fnTabLoad(tabType, tabNum){
|
||||
}
|
||||
|
||||
function fnSearch(pageNo){
|
||||
|
||||
if(!fn_G_cmndataValueChk("startDate", "endDate", 3)){
|
||||
return;
|
||||
};
|
||||
console.log('fnSearch')
|
||||
var form = document.searchForm;
|
||||
|
||||
form.pageIndex.value = pageNo ;
|
||||
|
||||
|
||||
@ -931,7 +903,7 @@ function subContent(p_content_no){
|
||||
<button type="button" onclick="setCalVal(lastfulstday,'startDate');setCalVal( lastfuledday,'endDate'); return false;" class="btnType btnType19">전월</button>
|
||||
<button type="button" onclick="setCalVal(thisfulstlday,'startDate');setCalVal( thisfuledtlday,'endDate'); return false;" class="btnType btnType19">당월</button>
|
||||
<!-- <button type="button">3개월</button> -->
|
||||
<button type="button" onclick="setCalVal(threefulstday,'startDate');setCalVal( threefuledday,'endDate'); return false;" class="btnType btnType19">3개월</button>
|
||||
<button type="button" onclick="fn_G_getPrevMonth('startDate', 3);fn_G_getCurrDate('endDate'); return false;" class="btnType btnType19">3개월</button>
|
||||
<button type="button" class="btnType6" onClick="javascript:fnSearch(1); return false;">조회</button>
|
||||
</div>
|
||||
<div class="btn_right">
|
||||
|
||||
@ -48,8 +48,6 @@ function fn_G_cmndataValueChk(startId, endId, chkMonth) {
|
||||
maxStartDate.setMonth(maxStartDate.getMonth() - chkMonth);
|
||||
|
||||
// 시작일자가 종료일자 기준 chkMonth 개월 전보다 이전인지 확인
|
||||
console.log('start :: ',start);
|
||||
console.log('maxStartDate :: ',maxStartDate);
|
||||
if (start <= maxStartDate) {
|
||||
alert("총 검색 기간은 " + chkMonth + "개월을 넘을 수 없습니다.");
|
||||
return false;
|
||||
@ -78,3 +76,39 @@ function fn_G_getCurrYearDateRange(startId, endId) {
|
||||
$('#'+startId).val(startOfYear);
|
||||
$('#'+endId).val(endOfYear);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 몇개월 전 date 구하기
|
||||
* @param {String} a 값 입력할 search input ID
|
||||
* @param {String} b 값 구고하고 싶은 month번째 전월
|
||||
* @returns {String} ex) b = 3; a value 해당년도/해당달-3/해당일+1
|
||||
*/
|
||||
function fn_G_getPrevMonth(searchId, month) {
|
||||
var d = new Date();
|
||||
d.setDate(d.getDate() +1);
|
||||
var monthOfYear = d.getMonth();
|
||||
d.setMonth(monthOfYear - month);
|
||||
console.log('getDateStr(d) : ', getDateStr(d));
|
||||
$('#'+searchId).val(getDateStr(d));
|
||||
}
|
||||
|
||||
/**
|
||||
* 해당 년월일 가져오기
|
||||
* @param {String} a 값 입력할 search input ID
|
||||
* @returns {String} ID value 해당년도/해당달/해당일
|
||||
*/
|
||||
function fn_G_getCurrDate(searchId) {
|
||||
var d = new Date();
|
||||
$('#'+searchId).val(getDateStr(d));
|
||||
}
|
||||
|
||||
|
||||
// 날짜를 원하는 포멧으로 수정후 리턴 Str
|
||||
function getDateStr(myDate){
|
||||
var year = myDate.getFullYear();
|
||||
var month = ("0"+(myDate.getMonth()+1)).slice(-2);
|
||||
var day = ("0"+myDate.getDate()).slice(-2);
|
||||
return ( year + '/' + month + '/' + day );
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user