@@ -16,7 +16,7 @@ public DBManageExcel(String sheetName) {
1616 }
1717
1818 /**
19- * 월별 DB모니터링 관리대장 엑셀파일 템플릿을 생성한다.
19+ * 월별 DB모니터링 관리대장 엑셀파일 템플릿을 생성한다.
2020 *
2121 * @param year
2222 * @param month
@@ -26,66 +26,70 @@ public static void createMonthlyReportInExcel(int year, int month) {
2626 OutputStream fos ;
2727 try {
2828 String filePath = "./report/" ;
29- String fileName = "DB관리대장_종합_" + year + "." + DateUtils .getTwoDigitDate (month );
29+ String fileName = "DB관리대장_종합_" + year + "." + DateUtils .getTwoDigitDate (month );
3030 String extension = ".xlsx" ;
3131 fos = new FileOutputStream (filePath + fileName + extension );
32-
32+
3333 ExcelSheet excel = new ExcelSheet ("MonthlyReport" );
34-
35- // CellStyle 생성
36- // 1. 회색 배경, 검은색 실선 테두리, 중앙정렬
34+
35+ // CellStyle 생성
36+ // 1. 회색 배경, 검은색 실선 테두리, 중앙정렬
3737 XSSFCellStyle grayCS = excel .createCellStyle (IndexedColors .GREY_25_PERCENT , false ); /// "#d0cece"
38- // 2. 회색 배경, 검은색 실선 테두리, 왼쪽정렬
38+ // 2. 회색 배경, 검은색 실선 테두리, 왼쪽정렬
3939 XSSFCellStyle grayCSLeft = excel .createCellStyle (IndexedColors .GREY_25_PERCENT , false );
4040 grayCSLeft .setAlignment (HorizontalAlignment .LEFT );
41- // 3. 흰색 배경, 검은색 실선 테두리, 중앙정렬
41+ // 3. 흰색 배경, 검은색 실선 테두리, 중앙정렬
4242 XSSFCellStyle whiteCS = excel .createCellStyle (IndexedColors .WHITE , false );
43- // 4. 흰색 배경, 검은색 실선 테두리, 왼쪽정렬
43+ // 4. 흰색 배경, 검은색 실선 테두리, 왼쪽정렬
4444 XSSFCellStyle whiteCSLeft = excel .createCellStyle (IndexedColors .WHITE , false );
4545 whiteCSLeft .setAlignment (HorizontalAlignment .LEFT );
46-
46+
4747 // Write Header Region
48- // 1. [DB Check List] 텍스트
48+ // 1. [DB Check List] 텍스트
4949 excel .merge (0 , 0 , 1 , 1 , grayCS , "DB Check List" );
50- // 2. [yyyy년 MM월] 텍스트
51- excel .merge (2 , 0 , 2 , 1 , grayCS , "2021년 10월" );
50+ // 2. [yyyy년 MM월] 텍스트
51+ excel .merge (2 , 0 , 2 , 1 , grayCS , "2021년 10월" );
5252 excel .setColWidth (2 , 8000 );
53- // 3. [Check List, 날짜 Header]
53+ // 3. [Check List, 날짜 Header]
5454 excel .merge (0 , 2 , 2 , 3 , grayCS , "Check List" );
5555
5656 int dayOfMonth = DateUtils .getMonthlyDayCount (year , month );
57-
57+
5858 int dayTextColIndex = 3 ;
5959 int dayTextRowIndex = 2 ;
60- for (int i = 1 ; i <= dayOfMonth ; i ++) {
60+ for (int i = 1 ; i <= dayOfMonth ; i ++) {
6161 String dayOfWeek = DateUtils .getDayOfWeek (year , month , i , TextStyle .SHORT , Locale .KOREAN );
62- excel .setCell (dayTextColIndex +i -1 , dayTextRowIndex , grayCS , DateUtils .getTwoDigitDate (i ));
63- excel .setCell (dayTextColIndex +i -1 , dayTextRowIndex +1 , DateUtils .isWeekEnd (year , month , i ) ? grayCS : whiteCS , dayOfWeek );
62+ excel .setCell (dayTextColIndex + i - 1 , dayTextRowIndex , grayCS , DateUtils .getTwoDigitDate (i ));
63+ excel .setCell (dayTextColIndex + i - 1 , dayTextRowIndex + 1 ,
64+ DateUtils .isWeekEnd (year , month , i ) ? grayCS : whiteCS , dayOfWeek );
6465 }
65-
66- // 4. DB별 Header
67- String [] dbNames = new String [] {"DBERP1" , "DBERP2" , "DBPOS1" , "DBPOS2" , "GPOS1" , "GPOS2" , "OGG" };
68- String [] checkList1 = new String [] {"Oracle Listener(오라클 접속)" , "Alert, Trace Log" , "Archive Volume(used(%)" , "Backup Check(archivelog)" , "OGG Running Status" , "OS Disk Usage" };
69- String [] checkList2 = new String [] {"Oracle Listener(오라클 접속)" , "Alert, Trace Log" , "OS Disk Usage" };
70- String [] checkList3 = new String [] {"Oracle Listener(오라클 접속)" , "Oradata01" , "Oradata02" , "Oradata03" , "Oradata04" , "Oradata05" , "Oradata06" , "Alert, Trace Log" , "OGG Running Status" };
71- String [][] checkListType = new String [][] {checkList1 , checkList2 , checkList1 , checkList2 , checkList1 , checkList2 , checkList3 };
66+
67+ // 4. DB별 Header
68+ String [] dbNames = new String [] { "DBERP1" , "DBERP2" , "DBPOS1" , "DBPOS2" , "GPOS1" , "GPOS2" , "OGG" };
69+ String [] checkList1 = new String [] { "Oracle Listener(오라클 접속)" , "Alert, Trace Log" ,
70+ "Archive Volume(used(%)" , "Backup Check(archivelog)" , "OGG Running Status" , "OS Disk Usage" };
71+ String [] checkList2 = new String [] { "Oracle Listener(오라클 접속)" , "Alert, Trace Log" , "OS Disk Usage" };
72+ String [] checkList3 = new String [] { "Oracle Listener(오라클 접속)" , "Oradata01" , "Oradata02" , "Oradata03" ,
73+ "Oradata04" , "Oradata05" , "Oradata06" , "Alert, Trace Log" , "OGG Running Status" };
74+ String [][] checkListType = new String [][] { checkList1 , checkList2 , checkList1 , checkList2 , checkList1 ,
75+ checkList2 , checkList3 };
7276
7377 int curIndex = 4 ;
74- for (int i = 0 ; i < dbNames .length ; i ++) {
78+ for (int i = 0 ; i < dbNames .length ; i ++) {
7579 excel .merge (1 , curIndex , 2 , curIndex , grayCSLeft , dbNames [i ]);
76- for (int j = 3 ; j < 3 + DateUtils .getMonthlyDayCount (year , month ); j ++) {
80+ for (int j = 3 ; j < 3 + DateUtils .getMonthlyDayCount (year , month ); j ++) {
7781 excel .setCell (j , curIndex , grayCS , null );
7882 }
7983 curIndex ++;
80- for (int j = 0 ; j < checkListType [i ].length ; j ++) {
84+ for (int j = 0 ; j < checkListType [i ].length ; j ++) {
8185 excel .merge (1 , curIndex , 2 , curIndex , whiteCSLeft , " - " + checkListType [i ][j ]);
82- for (int k = 3 ; k < 3 + DateUtils .getMonthlyDayCount (year , month ); k ++) {
86+ for (int k = 3 ; k < 3 + DateUtils .getMonthlyDayCount (year , month ); k ++) {
8387 excel .setCell (k , curIndex , whiteCS , null );
8488 }
8589 curIndex ++;
8690 }
8791 }
88-
92+
8993 excel .write (fos );
9094 } catch (Exception e ) {
9195 e .printStackTrace ();
0 commit comments