Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ajax 사용 예시
- 셀렉트박스 커스텀
- prisma
- 검색
- route
- angular animation
- angular button
- 앵귤러 애니메이션
- 옵저버블
- flex-1
- 스크롤 이벤트 감지
- Router
- 아이오닉 스크롤 이벤트
- Ionic modal
- 호버
- 스크롤 이벤트
- Angular Router
- egov spring ajax 사용 예시
- 모달
- mysql if
- modal
- formgroup
- ApexChart
- angular route
- TAILWIND
- summary
- 앵귤러 모달
- scroll
- Oracle LISTAGG 사용 예시
- angular modal
Archives
- Today
- Total
깜놀하는 해므찌로
Java 엑셀 라이브러리를 활용하여 날짜 값 통으로 출력하기 예시 본문
반응형
SMALL
/* 엑셀 다운로드 */
@SuppressWarnings("unchecked")
@RequestMapping(folderPath + "excelDown.do")
public ModelAndView excelDown(@ModelAttribute("searchVO") CmmnDefaultVO searchVO, ModelMap model) throws Exception{
ModelAndView mav = new ModelAndView(excelView);
/* 제목 URL 셋팅 */
String tit = "통계자료";
String url = "totalStatistics.xlsx";
String time = ""; // 기간
/* default 날짜 값 설정 */
String year = searchVO.getExcelYear();
String nowDay = DateUtils.getNowDate("dd");
String month = searchVO.getExcelMonth();
/* 날짜 포멧 */
if(!"ALL".equals(searchVO.getExcelMonth()) && Integer.parseInt(month) < 10){
month = "0" + month;
searchVO.setExcelMonth(month);
}
/* 날짜 설정 */
if("ALL".equals(searchVO.getExcelMonth())){
time = year + "년";
}else{
time = year + "년" + month + "월" + "01일 ~" + year + "년" + month + "월" + nowDay + "일";
}
/* 조회 할 날짜 값 셋팅 */
searchVO.setSchEtc01(searchVO.getExcelYear()+"."+month);
/* 월 : 전체 검색 시 날짜 값 셋팅 */
if("ALL".equals(searchVO.getExcelMonth())){
searchVO.setSchEtc01(searchVO.getExcelYear());
}
/* 엑셀 통계 조회 */
List<St01VO> eatLst = (List<St01VO>) cmmnService.selectList(searchVO, PROGRAM_ID + ".excelEatLogSelectList");
List<St01VO> overTimeLst = (List<St01VO>) cmmnService.selectList(searchVO, PROGRAM_ID + ".excelOverTimeSelectList");
St01VO eatLog = (St01VO) cmmnService.selectContents(searchVO, PROGRAM_ID + ".statisticsEatLogExcelDown" );
St01VO overTime = (St01VO) cmmnService.selectContents(searchVO, PROGRAM_ID + ".statisticsOverTimeExcelDown" );
/* 값 담아주기 key : value */
mav.addObject("target", tit);
mav.addObject("source", url);
mav.addObject("time", time);
mav.addObject("eatLst", eatLst);
mav.addObject("overTimeLst", overTimeLst);
mav.addObject("overTime", overTime);
mav.addObject("eatLog", eatLog);
return mav;
}
1. String time 변수 선언
2. 계산된 날짜 값 + 포멧 형태에 맞추어 출력
반응형
LIST
'IT' 카테고리의 다른 글
Java 배열 선언 후 길이 설정하기 예시 (0) | 2022.08.19 |
---|---|
Java 자바 캘린더 달력형 -> 데이트형 형변환 예시 / 데이트형 -> 문자열 형변환 예시 (0) | 2022.08.18 |
Oracle DECODE 오라클 삼항연산자 예시 (0) | 2022.08.16 |
JavaScript 동적이게 추가된 HTML 요소 JS 먹이기 예시 (0) | 2022.08.15 |
CSS 글씨 ... 처리 / CSS 긴 글 ...처리 예시 (0) | 2022.08.13 |