Skip to content

Commit b1906b3

Browse files
committed
Set charset encoding (UTF-8)
1 parent 011424b commit b1906b3

File tree

6 files changed

+129
-791
lines changed

6 files changed

+129
-791
lines changed

Utils/src/main/java/root/utils/CsvUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class CsvUtils {
1717

1818
/**
19-
* 객체리스트를 csv string 형태로 변환한다.
19+
* 객체리스트를 csv string 형태로 변환한다.
2020
*
2121
* @param list
2222
* @param clazz
@@ -43,7 +43,7 @@ public static String toCsvString(List<?> list, Class<?> clazz) {
4343
}
4444

4545
/**
46-
* 문자열리스트를 comma(,) 문자로 이어 csv형태의 헤더를 반환한다.
46+
* 문자열리스트를 comma(,) 문자로 이어 csv형태의 헤더를 반환한다.
4747
*
4848
* @param fieldNames
4949
* @return
@@ -59,7 +59,7 @@ public static String createCsvHeader(List<String> fieldNames) {
5959
}
6060

6161
/**
62-
* 매개변수로 전달된 Class의 필드와, 부모 클래스의 필드를 comma(,)로 이어 csv형태의 헤더를 반환한다.
62+
* 매개변수로 전달된 Class의 필드와, 부모 클래스의 필드를 comma(,)로 이어 csv형태의 헤더를 반환한다.
6363
*
6464
* @param clazz
6565
* @return
@@ -78,7 +78,7 @@ public static String createCsvHeader(Class<?> clazz) {
7878

7979
return sb.toString();
8080
}
81-
81+
8282
/**
8383
*
8484
* @param object
@@ -203,7 +203,7 @@ public static List<Map<String, String>> parseCsvString(List<String> headers, Str
203203
}
204204

205205
/**
206-
* csv 형태의 문자열을 파싱하여 순서대로 Map객체에 담아 반환한다.
206+
* csv 형태의 문자열을 파싱하여 순서대로 Map객체에 담아 반환한다.
207207
*
208208
* @param csvLine
209209
* @return
@@ -241,7 +241,7 @@ public static Map<Integer, String> parseCsvLine(String csvLine) {
241241
}
242242

243243
/**
244-
* 문자열을 쌍따옴표로 감싼 후 반환한다. 단, 문자열 내에 쌍따옴표가 있다면 html escape된 문자로 변환한다.
244+
* 문자열을 쌍따옴표로 감싼 후 반환한다. 단, 문자열 내에 쌍따옴표가 있다면 html escape된 문자로 변환한다.
245245
*
246246
* @param string
247247
* @return
@@ -251,7 +251,7 @@ private static String wrapInDoubleQuotation(String string) {
251251
}
252252

253253
/**
254-
* 매개변수로 전달된 클래스의 Field와, 부모클래스의 Field까지 Reflection하여 반환한다.
254+
* 매개변수로 전달된 클래스의 Field와, 부모클래스의 Field까지 Reflection하여 반환한다.
255255
*
256256
* @param clazz
257257
* @return

Utils/src/main/java/root/utils/DBManageExcel.java

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

Utils/src/main/java/root/utils/DateUtils.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DateUtils {
3939
}
4040

4141
/**
42-
* 오늘 날짜 및 시간을 지정한 format에 따라 반환한다.
42+
* 오늘 날짜 및 시간을 지정한 format에 따라 반환한다.
4343
*
4444
* @param format
4545
* @return
@@ -50,7 +50,7 @@ public static String getToday(String format) {
5050
}
5151

5252
/**
53-
* 매개변수로 주어진 년도, 달의 총 일수를 반환한다.
53+
* 매개변수로 주어진 년도, 달의 총 일수를 반환한다.
5454
*
5555
* @param year
5656
* @param month
@@ -62,7 +62,7 @@ public static int getMonthlyDayCount(int year, int month) {
6262
}
6363

6464
/**
65-
* 월, 일의 값을 두 자리로 변환하여 반환한다.
65+
* 월, 일의 값을 두 자리로 변환하여 반환한다.
6666
*
6767
* @param value
6868
* @return
@@ -72,7 +72,7 @@ public static String getTwoDigitDate(int value) {
7272
}
7373

7474
/**
75-
* 주어진 일자의 요일을 반환한다.
75+
* 주어진 일자의 요일을 반환한다.
7676
*
7777
* @param year
7878
* @param month
@@ -88,7 +88,7 @@ public static String getDayOfWeek(int year, int month, int day, TextStyle style,
8888
}
8989

9090
/**
91-
* 주어진 일자가 주말인지 확인한다.
91+
* 주어진 일자가 주말인지 확인한다.
9292
*
9393
* @param year
9494
* @param month
@@ -102,10 +102,10 @@ public static boolean isWeekEnd(int year, int month, int day) {
102102
}
103103

104104
/**
105-
* 기준일자에서 년, 월, 일을 더한 날짜를 반환한다. 빼기도 가능하다.
105+
* 기준일자에서 년, 월, 일을 더한 날짜를 반환한다. 빼기도 가능하다.
106106
*
107-
* @param curDate 기준일자
108-
* @param returnFormat 반환받을 날짜포맷
107+
* @param curDate 기준일자
108+
* @param returnFormat 반환받을 날짜포맷
109109
* @param year
110110
* @param month
111111
* @param day
@@ -122,9 +122,9 @@ public static String addDate(Date curDate, String returnFormat, int year, int mo
122122
}
123123

124124
/**
125-
* 기준일자에서 년, 월, 일을 더한 날짜를 반환한다. 빼기도 가능하다.
125+
* 기준일자에서 년, 월, 일을 더한 날짜를 반환한다. 빼기도 가능하다.
126126
*
127-
* @param dateStringYMD yyyy-MM-dd 형태의 날짜 문자열
127+
* @param dateStringYMD yyyy-MM-dd 형태의 날짜 문자열
128128
* @param year
129129
* @param month
130130
* @param day
@@ -145,8 +145,8 @@ public static String addDate(String dateStringYMD, int year, int month, int day)
145145
}
146146

147147
/**
148-
* 두 날짜간 차이를 반환한다. (첫번째날짜 - 두번째날짜) 이 때, 각 날짜의 포맷은 첫번째 인자로 전달한 dateFormat과
149-
* 동일해야한다.
148+
* 두 날짜간 차이를 반환한다. (첫번째날짜 - 두번째날짜) 이 때, 각 날짜의 포맷은 첫번째 인자로 전달한 dateFormat과
149+
* 동일해야한다.
150150
*
151151
* @param dateFormat
152152
* @param date1
@@ -167,7 +167,7 @@ public static long getDateDiffTime(String dateFormat, String date1, String date2
167167
}
168168

169169
/**
170-
* 날짜 표현 포맷을 변환한다.
170+
* 날짜 표현 포맷을 변환한다.
171171
*
172172
* @param fromFormat
173173
* @param toFormat
@@ -189,7 +189,7 @@ public static String convertDateFormat(String fromFormat, String toFormat, Strin
189189
}
190190

191191
/**
192-
* 날짜 표현 포맷을 변환한다.
192+
* 날짜 표현 포맷을 변환한다.
193193
*
194194
* @param toFormat
195195
* @param localDate
@@ -200,7 +200,7 @@ public static String convertDateFormat(String toFormat, LocalDate localDate) {
200200
}
201201

202202
/**
203-
* Date 객체를 포맷팅한다.
203+
* Date 객체를 포맷팅한다.
204204
*
205205
* @param date
206206
* @param toFormat
@@ -211,11 +211,11 @@ public static String format(Date date, String toFormat) {
211211
}
212212

213213
/**
214-
* 날짜간 대소관계를 비교한다.
214+
* 날짜간 대소관계를 비교한다.
215215
*
216-
* @param format 날짜 포맷
217-
* @param base 기준 날짜
218-
* @param compare 비교 날짜
216+
* @param format 날짜 포맷
217+
* @param base 기준 날짜
218+
* @param compare 비교 날짜
219219
* @return
220220
*/
221221
public static int compareTo(String format, String base, String compare) {
@@ -233,9 +233,9 @@ public static int compareTo(String format, String base, String compare) {
233233
}
234234

235235
/**
236-
* DateFormat에 대한 정규표현식을 모를 때, 사전 저장된 DateTimeFormatter 목록을 순회하여 날짜문자열을 파싱한다.
236+
* DateFormat에 대한 정규표현식을 모를 때, 사전 저장된 DateTimeFormatter 목록을 순회하여 날짜문자열을 파싱한다.
237237
*
238-
* @param dateString 날짜 문자열
238+
* @param dateString 날짜 문자열
239239
* @return
240240
*/
241241
public static LocalDate parse(String dateString) {

0 commit comments

Comments
 (0)