-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
58 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
src/main/java/in/koreatech/koin/domain/graduation/dto/ExcelStudentData.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/in/koreatech/koin/domain/graduation/model/GradeExcelData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package in.koreatech.koin.domain.graduation.model; | ||
|
||
import org.apache.poi.ss.usermodel.Cell; | ||
import org.apache.poi.ss.usermodel.Row; | ||
|
||
public record GradeExcelData( | ||
String year, | ||
String semester, | ||
String code, | ||
String classTitle, | ||
String lectureClass, | ||
String professor, | ||
String courseType, | ||
String credit, | ||
String grade, | ||
String retakeStatus | ||
) { | ||
public static GradeExcelData fromRow(Row row) { | ||
return new GradeExcelData( | ||
getCellValueAsString(row.getCell(1)), | ||
getCellValueAsString(row.getCell(2)), | ||
getCellValueAsString(row.getCell(4)), | ||
getCellValueAsString(row.getCell(5)), | ||
getCellValueAsString(row.getCell(6)), | ||
getCellValueAsString(row.getCell(7)), | ||
getCellValueAsString(row.getCell(8)), | ||
getCellValueAsString(row.getCell(9)), | ||
getCellValueAsString(row.getCell(10)), | ||
getCellValueAsString(row.getCell(11)) | ||
); | ||
} | ||
|
||
private static String getCellValueAsString(Cell cell) { | ||
if (cell == null) { | ||
return ""; | ||
} | ||
return switch (cell.getCellType()) { | ||
case STRING -> cell.getStringCellValue(); | ||
case NUMERIC -> String.valueOf((int)cell.getNumericCellValue()); | ||
default -> ""; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters