-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/sheets #66
Merged
+441
โ10
Merged
Feat/sheets #66
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0461ce9
feat : ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐ
ywj9811 f348661
fix : nullalbe ํ๋๋ก ์์
ywj9811 180e04d
feat : excel์
๋ก๋ ์ถ๊ฐ
ywj9811 4a3087e
feat : ํ๋ถ๋ชจ ์๊ฒ๋ ๊ฒฝ๋ก ์ถ๊ฐ
ywj9811 be0006b
fix : ์๋ฆผํก ์ ์ก ์ญ์
ywj9811 caf7c56
fix : ์ ์๋ ๋ฒํธ ์ถ๊ฐ
ywj9811 b184c5b
fix : ์ ์๋ ๊ธฐ๋ณธ ์ํ ๋ณ๊ฒฝ
ywj9811 7f74b82
fix : ์ ์๋ ๊ณ์ฝ ์๋ฃ์ ํ๋์ํ ๋ณ๊ฒฝ
ywj9811 ae0211d
refactor : Excel ํ์ผ๋ก์ง ๋ฆฌํฉํ ๋ง
ywj9811 c694706
feat : ๊ธฐ์กด ๋ฐ์ดํฐ ์ด์ ์ ํ๋กํ ์
๋ก๋
ywj9811 bc56550
feat : ๊ธฐ์กด ๋ฐ์ดํฐ ์ด์ ์ ํ๋กํ ์
๋ก๋
ywj9811 cd7c10e
Merge branch 'develop' into feat/sheets
ywj9811 762aa04
fix : ์ค๋ณต ๋ฐ์ดํฐ ์์
ywj9811 ef9e6d8
refactor : ์ปฌ๋ผ ์ธ๋ฑ์ค enum๋ณ๊ฒฝ
ywj9811 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
50 changes: 50 additions & 0 deletions
50
src/main/java/com/yedu/backend/global/excel/application/dto/TeacherInfoRequest.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,50 @@ | ||
package com.yedu.backend.global.excel.application.dto; | ||
|
||
import com.yedu.backend.domain.teacher.domain.entity.constant.TeacherGender; | ||
|
||
import java.util.List; | ||
|
||
public record TeacherInfoRequest( | ||
String name, | ||
String nickName, | ||
String email, | ||
String phoneNumber, | ||
String birth, | ||
TeacherGender gender, | ||
String university, | ||
String major, | ||
String highSchool, | ||
String highSchoolType, | ||
String introduce, | ||
String teachingStyle1, | ||
String teachingStyleInfo1, | ||
String teachingStyle2, | ||
String teachingStyleInfo2, | ||
boolean englishPossible, | ||
boolean mathPossible, | ||
String recommenedStudent, | ||
String comment, | ||
List<List<String>> available, | ||
List<String> region, | ||
String source, | ||
boolean marketingAgree, | ||
English english, | ||
Math math | ||
) { | ||
public record English( | ||
String appealPoint, | ||
String teachingExperience, | ||
String foreignExperience, | ||
int teachingHistory, | ||
String teachingStyle, | ||
String managementStyle | ||
) {} | ||
|
||
public record Math( | ||
String appealPoint, | ||
String teachingExperience, | ||
int teachingHistory, | ||
String teachingStyle, | ||
String managementStyle | ||
) {} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/com/yedu/backend/global/excel/application/mapper/ExcelMapper.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,99 @@ | ||
package com.yedu.backend.global.excel.application.mapper; | ||
|
||
import com.yedu.backend.domain.teacher.domain.entity.constant.TeacherGender; | ||
import com.yedu.backend.global.excel.application.dto.TeacherInfoRequest; | ||
import org.apache.poi.ss.usermodel.Cell; | ||
import org.apache.poi.ss.usermodel.CellType; | ||
import org.apache.poi.ss.usermodel.Row; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static com.yedu.backend.global.excel.constant.TeacherExcelColumn.*; | ||
|
||
public class ExcelMapper { | ||
|
||
public static TeacherInfoRequest mapToInfoRequest(Row row) { | ||
String email = getStringValue(row.getCell(EMAIL.getIndex())); | ||
String name = getStringValue(row.getCell(NAME.getIndex())); | ||
String nickName = getStringValue(row.getCell(NICKNAME.getIndex())); | ||
String phoneNumber = getStringValue(row.getCell(PHONE_NUMBER.getIndex())); | ||
double birthNum = getNumericValue(row.getCell(BIRTH.getIndex())); | ||
String birth = birthNum == 0 ? null : String.valueOf(birthNum); | ||
String gender = getStringValue(row.getCell(GENDER.getIndex())); | ||
String university = getStringValue(row.getCell(UNIVERSITY.getIndex())); | ||
String major = getStringValue(row.getCell(MAJOR.getIndex())); | ||
String highSchool = getStringValue(row.getCell(HIGH_SCHOOL.getIndex())); | ||
String highSchoolType = getStringValue(row.getCell(HIGH_SCHOOL_TYPE.getIndex())); | ||
String introduce = getStringValue(row.getCell(INTRODUCE.getIndex())); | ||
String teachingStyle1 = getStringValue(row.getCell(TEACHING_STYLE_1.getIndex())); | ||
String teachingStyleInfo1 = getStringValue(row.getCell(TEACHING_STYLE_INFO_1.getIndex())); | ||
String teachingStyle2 = getStringValue(row.getCell(TEACHING_STYLE_2.getIndex())); | ||
String teachingStyleInfo2 = getStringValue(row.getCell(TEACHING_STYLE_INFO_2.getIndex())); | ||
boolean englishPossible = getBooleanValueByString(row.getCell(ENGLISH_POSSIBLE.getIndex())); | ||
boolean mathPossible = getBooleanValueByString(row.getCell(MATH_POSSIBLE.getIndex())); | ||
String recommendStudent = getStringValue(row.getCell(RECOMMEND_STUDENT.getIndex())); | ||
String comment = getStringValue(row.getCell(COMMENT.getIndex())); | ||
List<List<String>> available = new ArrayList<>(); | ||
List<String> region = Arrays.stream((getStringValue(row.getCell(REGION.getIndex()))) | ||
.split(",")).toList(); | ||
String source = getStringValue(row.getCell(SOURCE.getIndex())); | ||
boolean marketingAgree = true; | ||
|
||
return new TeacherInfoRequest( | ||
name, nickName, email, phoneNumber, birth, TeacherGender.valueOf(gender), university, | ||
major, highSchool, highSchoolType, introduce, teachingStyle1, teachingStyleInfo1, teachingStyle2, teachingStyleInfo2, | ||
englishPossible, mathPossible, recommendStudent, comment, available, region, source, marketingAgree, getEnglish(row), getMath(row) | ||
); | ||
} | ||
|
||
private static TeacherInfoRequest.Math getMath(Row row) { | ||
int mathTeachingHistory = (int) getNumericValue(row.getCell(MATH_TEACHING_HISTORY.getIndex())); | ||
String mathAppealPoint = getStringValue(row.getCell(MATH_APPEAL_POINT.getIndex())); | ||
String mathTeachingExperience = getStringValue(row.getCell(MATH_TEACHING_EXPERIENCE.getIndex())); | ||
String mathTeachingStyle = getStringValue(row.getCell(MATH_TEACHING_STYLE.getIndex())); | ||
String mathManageStyle = getStringValue(row.getCell(MATH_MANAGE_STYLE.getIndex())); | ||
return new TeacherInfoRequest.Math( | ||
mathAppealPoint, | ||
mathTeachingExperience, | ||
mathTeachingHistory, | ||
mathTeachingStyle, | ||
mathManageStyle | ||
); | ||
} | ||
|
||
private static TeacherInfoRequest.English getEnglish(Row row) { | ||
int englishTeachingHistory = (int) getNumericValue(row.getCell(ENGLISH_TEACHING_HISTORY.getIndex())); | ||
String englishAppealPoint = getStringValue(row.getCell(ENGLISH_APPEAL_POINT.getIndex())); | ||
String englishTeachingExperience = getStringValue(row.getCell(ENGLISH_TEACHING_EXPERIENCE.getIndex())); | ||
String englishForeignExperience = getStringValue(row.getCell(ENGLISH_FOREIGN_EXPERIENCE.getIndex())); | ||
String englishTeachingStyle = getStringValue(row.getCell(ENGLISH_TEACHING_STYLE.getIndex())); | ||
String englishManagementStyle = getStringValue(row.getCell(ENGLISH_MANAGEMENT_STYLE.getIndex())); | ||
// ์์ด ๊ณผ์ธ ์ ๋ณด | ||
return new TeacherInfoRequest.English( | ||
englishAppealPoint, | ||
englishTeachingExperience, | ||
englishForeignExperience, | ||
englishTeachingHistory, | ||
englishTeachingStyle, | ||
englishManagementStyle | ||
); | ||
} | ||
|
||
private static String getStringValue(Cell cell) { | ||
return (cell != null && cell.getCellType() != CellType.BLANK && cell.getCellType() != CellType._NONE) ? cell.getStringCellValue() : null; | ||
} | ||
|
||
private static double getNumericValue(Cell cell) { | ||
return (cell != null && cell.getCellType() != CellType.BLANK && cell.getCellType() != CellType._NONE) ? cell.getNumericCellValue() : 0; | ||
} | ||
|
||
private static boolean getBooleanValueByString(Cell cell) { | ||
if (cell != null && cell.getCellType() != CellType.BLANK && cell.getCellType() != CellType._NONE) { | ||
String value = cell.getStringCellValue(); | ||
return "๋ค".equals(value); | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
Add validation annotations for fields.
Consider adding validation annotations to ensure data integrity:
email
phoneNumber
birth
๐ Committable suggestion