diff --git a/README.md b/README.md index 6a8787e..d4a57ad 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Aggregate란, 여러 도메인을 하나로 합치는 과정을 의미합니다. 아래 페이지는 신입모집 어드민 페이지입니다. +image 하나의 API 요청에 모든 데이터를 담을 수 있도록 구성해봅시다. @@ -57,4 +58,4 @@ Aggregate란, 여러 도메인을 하나로 합치는 과정을 의미합니다. 제출지 : ymecca730135@gmail.com -### 마감시간 : 2024:05:11/21:30 \ No newline at end of file +### 마감시간 : 2024:05:11/21:30 diff --git a/src/main/java/com/econovation/third_project/controller/AdminQueryController.java b/src/main/java/com/econovation/third_project/controller/AdminQueryController.java index 4c15adb..498d7a8 100644 --- a/src/main/java/com/econovation/third_project/controller/AdminQueryController.java +++ b/src/main/java/com/econovation/third_project/controller/AdminQueryController.java @@ -2,6 +2,8 @@ import com.econovation.third_project.database.Database; import com.econovation.third_project.database.Registration; +import com.econovation.third_project.dto.response.AdminPageResponse; +import com.econovation.third_project.service.GetAdminPage; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -13,6 +15,7 @@ @RequiredArgsConstructor public class AdminQueryController { private final Database database; + private final GetAdminPage getAdminPage; // 예시 코드 @PostMapping("/registration") @@ -25,4 +28,9 @@ public ResponseEntity getRegistration(String userId) { return ResponseEntity.ok().body(database.getRegistration(userId)); } + @GetMapping("/admin") + public ResponseEntity getAdminPage(){ + return ResponseEntity.ok().body(); + } + } diff --git a/src/main/java/com/econovation/third_project/database/Database.java b/src/main/java/com/econovation/third_project/database/Database.java index 33b8710..9c9ef22 100644 --- a/src/main/java/com/econovation/third_project/database/Database.java +++ b/src/main/java/com/econovation/third_project/database/Database.java @@ -25,4 +25,20 @@ public void register(Registration registrationRequest) { public Registration getRegistration(String userId) { return registration.get(userId); } + + public Map getAllRegistration(){ + return this.registration; + } + + public Map getAllPersonalInformation(){ + return this.personalInformation; + } + + public Map getAllPath(){ + return this.path; + } + + public Map getAllDesiredTime(){ + return this.desiredTime; + } } \ No newline at end of file diff --git a/src/main/java/com/econovation/third_project/dto/response/AdminPageResponse.java b/src/main/java/com/econovation/third_project/dto/response/AdminPageResponse.java new file mode 100644 index 0000000..60731e8 --- /dev/null +++ b/src/main/java/com/econovation/third_project/dto/response/AdminPageResponse.java @@ -0,0 +1,8 @@ +package com.econovation.third_project.dto.response; + +public class AdminPageResponse { + private HopeField hopeField; + private Priority priority; + + +} diff --git a/src/main/java/com/econovation/third_project/dto/response/HopeField.java b/src/main/java/com/econovation/third_project/dto/response/HopeField.java new file mode 100644 index 0000000..17266d5 --- /dev/null +++ b/src/main/java/com/econovation/third_project/dto/response/HopeField.java @@ -0,0 +1,5 @@ +package com.econovation.third_project.dto.response; + +public class HopeField { + +} diff --git a/src/main/java/com/econovation/third_project/dto/response/Priority.java b/src/main/java/com/econovation/third_project/dto/response/Priority.java new file mode 100644 index 0000000..488de35 --- /dev/null +++ b/src/main/java/com/econovation/third_project/dto/response/Priority.java @@ -0,0 +1,5 @@ +package com.econovation.third_project.dto.response; + +public class Priority { + +} diff --git a/src/main/java/com/econovation/third_project/service/ApplicantMapper.java b/src/main/java/com/econovation/third_project/service/ApplicantMapper.java new file mode 100644 index 0000000..5445be6 --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/ApplicantMapper.java @@ -0,0 +1,14 @@ +package com.econovation.third_project.service; + + +import java.util.Map; + +public class ApplicantMapper { + Map applicantNum; + Map applicantPriority; + + public ApplicantMapper(Map applicantNum, Map applicantPriority) { + this.applicantNum = applicantNum; + this.applicantPriority = applicantPriority; + } +} diff --git a/src/main/java/com/econovation/third_project/service/DesiredTimeMapper.java b/src/main/java/com/econovation/third_project/service/DesiredTimeMapper.java new file mode 100644 index 0000000..1c1447d --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/DesiredTimeMapper.java @@ -0,0 +1,7 @@ +package com.econovation.third_project.service; + +import java.util.Map; + +public class DesiredTimeMapper { + +} diff --git a/src/main/java/com/econovation/third_project/service/GetAdminPage.java b/src/main/java/com/econovation/third_project/service/GetAdminPage.java new file mode 100644 index 0000000..055bc04 --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/GetAdminPage.java @@ -0,0 +1,13 @@ +package com.econovation.third_project.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class GetAdminPage { + private final GetApplicant getApplicant; + private final GetDesiredTime getDesiredTime; + private final GetMajor getMajor; + private final GetPath getPath; +} diff --git a/src/main/java/com/econovation/third_project/service/GetApplicant.java b/src/main/java/com/econovation/third_project/service/GetApplicant.java new file mode 100644 index 0000000..b14f48c --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/GetApplicant.java @@ -0,0 +1,77 @@ +package com.econovation.third_project.service; + +import com.econovation.third_project.database.Database; +import com.econovation.third_project.database.Registration; +import java.util.HashMap; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class GetApplicant { + private final Database db; + + public ApplicantMapper getAllApplicant(){ + Map allRegistration = db.getAllRegistration(); + + // PG 개발자, PM 기획자, DE 디자이너 + // key = hopeField, value = 몇 명인지 + Map allApplicantNum = new HashMap<>(); + + allApplicantNum.put("PG", 0); + allApplicantNum.put("PM", 0); + allApplicantNum.put("DE", 0); + + // value = Registration + for (String key : allRegistration.keySet()){ + Registration registration = allRegistration.get(key); + allApplicantNum.put(registration.getHopeField(), allApplicantNum.get(registration.getHopeField()) + 1); + } + + // WEB, APP, AI, GAME + // key = firstPriority, secondPriority + Map allApplicantPriority = new HashMap<>(); + + allApplicantPriority.put("WEB", new int[2]); + allApplicantPriority.put("APP", new int[2]); + allApplicantPriority.put("AI", new int[2]); + allApplicantPriority.put("GAME", new int[2]); + + // value = Registration + for (String key : allRegistration.keySet()){ + Registration registration = allRegistration.get(key); + int[] firstPriority = allApplicantPriority.get(registration.getFirstPriority()); + int[] secondPriority = allApplicantPriority.get(registration.getSecondPriority()); + + firstPriority[0] += 1; + secondPriority[1] += 1; + + } + + return new ApplicantMapper(allApplicantNum, allApplicantPriority); + } + +// public Map getAllApplicantPriority(){ +// Map allRegistration = db.getAllRegistration(); +// // WEB, APP, AI, GAME +// Map allApplicantPriority = new HashMap<>(); +// +// allApplicantPriority.put("WEB", new int[2]); +// allApplicantPriority.put("APP", new int[2]); +// allApplicantPriority.put("AI", new int[2]); +// allApplicantPriority.put("GAME", new int[2]); +// +// // value = Registration +// for (String key : allRegistration.keySet()){ +// Registration registration = allRegistration.get(key); +// int[] firstPriority = allApplicantPriority.get(registration.getFirstPriority()); +// int[] secondPriority = allApplicantPriority.get(registration.getSecondPriority()); +// +// firstPriority[0] += 1; +// secondPriority[1] += 1; +// +// } +// return allApplicantPriority; +// } +} diff --git a/src/main/java/com/econovation/third_project/service/GetDesiredTime.java b/src/main/java/com/econovation/third_project/service/GetDesiredTime.java new file mode 100644 index 0000000..585458b --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/GetDesiredTime.java @@ -0,0 +1,29 @@ +package com.econovation.third_project.service; + +import com.econovation.third_project.database.Database; +import com.econovation.third_project.database.DesiredTime; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class GetDesiredTime { + + private final Database db; + + public DesiredTimeMapper getAllDesiredTime() { + Map allDesiredTime = db.getAllDesiredTime(); + for (String key : allDesiredTime.keySet()){ + DesiredTime desiredTime = allDesiredTime.get(key); + for (int[] times: desiredTime.getDesiredTime()){ + int startTime = times[0]; + int endTime = times[1]; + + + } + + } + } + +} diff --git a/src/main/java/com/econovation/third_project/service/GetMajor.java b/src/main/java/com/econovation/third_project/service/GetMajor.java new file mode 100644 index 0000000..1989de3 --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/GetMajor.java @@ -0,0 +1,47 @@ +package com.econovation.third_project.service; + +import com.econovation.third_project.database.Database; +import com.econovation.third_project.database.PersonalInformation; +import com.econovation.third_project.database.Registration; +import java.util.HashMap; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class GetMajor { + private final Database db; + + public Map getAllMajor(){ + Map allPersonalInformation = db.getAllPersonalInformation(); + // PG 개발자, PM 기획자, DE 디자이너 + // key = hopeField, value = 몇 명인지 + Map allMajor = new HashMap<>(); + + + for (String key : allPersonalInformation.keySet()){ + PersonalInformation personalInformation = allPersonalInformation.get(key); + + String major = personalInformation.getMajor(); + String doubleMajor = personalInformation.getDoubleMajor(); + String minor = personalInformation.getMinor(); + + // 리팩토링 예정 + if(!allMajor.containsKey(major)){ + allMajor.put(major, 0); + } + if(!allMajor.containsKey(doubleMajor)){ + allMajor.put(doubleMajor, 0); + } + if(!allMajor.containsKey(minor)){ + allMajor.put(minor, 0); + } + + allMajor.put(major, allMajor.get(major) + 1); + allMajor.put(doubleMajor, allMajor.get(doubleMajor) + 1); + allMajor.put(minor, allMajor.get(minor) + 1); + } + return allMajor; + } +} diff --git a/src/main/java/com/econovation/third_project/service/GetPath.java b/src/main/java/com/econovation/third_project/service/GetPath.java new file mode 100644 index 0000000..397fe50 --- /dev/null +++ b/src/main/java/com/econovation/third_project/service/GetPath.java @@ -0,0 +1,32 @@ +package com.econovation.third_project.service; + +import com.econovation.third_project.database.Database; +import com.econovation.third_project.database.Path; +import java.util.HashMap; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class GetPath { + private final Database db; + + public Map getAllApplicantNum(){ + Map allPath = db.getAllPath(); + // 홍보 포스터, 학과 공지사항, 지인 소개, 인스타그램, 에브리타임 + // key = supportPath, value = 몇 명인지 + Map allSupportPath = new HashMap<>(); + allSupportPath.put("홍보 포스터", 0); + allSupportPath.put("학과 공지사항", 0); + allSupportPath.put("지인 소개", 0); + allSupportPath.put("지인 인스타그램", 0); + allSupportPath.put("에브리타임", 0); + + for (String key : allPath.keySet()){ + Path path = allPath.get(key); + allSupportPath.put(path.getSupportPath(), allSupportPath.get(path.getSupportPath()) + 1); + } + return allSupportPath; + } +}