From d243758e9bf02d4f325cfdd60582a7e6ac53ea8a Mon Sep 17 00:00:00 2001 From: taem1n1 Date: Fri, 15 Apr 2022 15:11:19 +0900 Subject: [PATCH 01/25] =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/massage/controller/admin/AdminMassageController.java | 2 +- .../controller/councillor/CouncillorMassageController.java | 2 +- .../controller/developer/DeveloperMassageController.java | 2 +- .../massage/controller/member/MemberMassageController.java | 2 +- .../Dotori/domain/massage/service/MassageServiceTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java index 23a0bb89..f079f687 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java @@ -50,6 +50,6 @@ public SingleResult getMassageStudentsAdmin() { @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) public SingleResult> getMassageStatusAndCountAdmin() { - return responseService.getSingleResult(massageService.getMassageStatusAndCount()); + return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java index 14084a49..7af3796d 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java @@ -85,7 +85,7 @@ public SingleResult> getMassageStudentsCouncillor() { @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) public SingleResult> getMassageStatusAndCountCouncillor() { - return responseService.getSingleResult(massageService.getMassageStatusAndCount()); + return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java index ae48a05d..f9192cf4 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java @@ -85,6 +85,6 @@ public SingleResult> getMassageStudentsDeveloper() { @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) public SingleResult> getMassageStatusAndCountDeveloper() { - return responseService.getSingleResult(massageService.getMassageStatusAndCount()); + return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java index 0fdf706f..d57ee193 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java @@ -85,7 +85,7 @@ public SingleResult> getMassageStudentsMember() { @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) public SingleResult> getMassageStatusAndCountMember() { - return responseService.getSingleResult(massageService.getMassageStatusAndCount()); + return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/test/java/com/server/Dotori/domain/massage/service/MassageServiceTest.java b/src/test/java/com/server/Dotori/domain/massage/service/MassageServiceTest.java index 25bdf5f8..3e869eea 100644 --- a/src/test/java/com/server/Dotori/domain/massage/service/MassageServiceTest.java +++ b/src/test/java/com/server/Dotori/domain/massage/service/MassageServiceTest.java @@ -117,7 +117,7 @@ public void findAllMassageTest() { @DisplayName("안마의자를 신청한 학생의 상태와 안마의자 신청 카운트 조회가 잘 되나요?") public void findMassageStatusAndCountTest() { massageService.requestMassage(DayOfWeek.THURSDAY, 20, 40); - Map find = massageService.getMassageStatusAndCount(); + Map find = massageService.getMassageInfo(); assertEquals(String.valueOf(Massage.APPLIED), find.get("status")); assertEquals("1", find.get("count")); From 798c8967cacdc572f65caecbeb0a1aafbb5fd721 Mon Sep 17 00:00:00 2001 From: taem1n1 Date: Fri, 15 Apr 2022 15:44:11 +0900 Subject: [PATCH 02/25] =?UTF-8?q?=ED=99=95=EC=9E=A5=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../massage/controller/admin/AdminMassageController.java | 8 ++++---- .../councillor/CouncillorMassageController.java | 8 ++++---- .../controller/developer/DeveloperMassageController.java | 8 ++++---- .../controller/member/MemberMassageController.java | 8 ++++---- .../Dotori/domain/massage/service/MassageService.java | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java index f079f687..f1e4d52e 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/admin/AdminMassageController.java @@ -39,17 +39,17 @@ public SingleResult getMassageStudentsAdmin() { } /** - * 안마의자를 신청한 학생수와 자신의 신청 상태 조회 - * @return Map + * 안마의자를 신청한 학생수와 자신의 신청 상태와 안마의자 신청 금지 만료일 조회 + * @return Map */ @GetMapping ("/massage/info") @ResponseStatus( HttpStatus.OK ) - @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회") + @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) - public SingleResult> getMassageStatusAndCountAdmin() { + public SingleResult> getMassageInfoAdmin() { return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java index 7af3796d..2cb0a03b 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/councillor/CouncillorMassageController.java @@ -74,17 +74,17 @@ public SingleResult> getMassageStudentsCouncillor() { } /** - * 안마의자를 신청한 학생수와 자신의 신청 상태 조회 - * @return Map + * 안마의자를 신청한 학생수와 자신의 신청 상태와 안마의자 신청 금지 만료일 조회 + * @return Map */ @GetMapping ("/massage/info") @ResponseStatus( HttpStatus.OK ) - @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회") + @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) - public SingleResult> getMassageStatusAndCountCouncillor() { + public SingleResult> getMassageInfoCouncillor() { return responseService.getSingleResult(massageService.getMassageInfo()); } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java index f9192cf4..b5ebd643 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/developer/DeveloperMassageController.java @@ -74,17 +74,17 @@ public SingleResult> getMassageStudentsDeveloper() { } /** - * 안마의자를 신청한 학생수와 자신의 신청 상태 조회 - * @return Map + * 안마의자를 신청한 학생수와 자신의 신청 상태와 안마의자 신청 금지 만료일 조회 + * @return Map */ @GetMapping ("/massage/info") @ResponseStatus( HttpStatus.OK ) - @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회") + @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) - public SingleResult> getMassageStatusAndCountDeveloper() { + public SingleResult> getMassageInfoDeveloper() { return responseService.getSingleResult(massageService.getMassageInfo()); } } diff --git a/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java b/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java index d57ee193..31f65a3d 100644 --- a/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java +++ b/src/main/java/com/server/Dotori/domain/massage/controller/member/MemberMassageController.java @@ -74,17 +74,17 @@ public SingleResult> getMassageStudentsMember() { } /** - * 안마의자를 신청한 학생수와 자신의 신청 상태 조회 - * @return Map + * 안마의자를 신청한 학생수와 자신의 신청 상태와 안마의자 신청 금지 만료일 조회 + * @return Map */ @GetMapping ("/massage/info") @ResponseStatus( HttpStatus.OK ) - @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회") + @ApiOperation(value = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일", notes = "안마의자를 신청한 학생 카운트, 안마의자 신청 상태 조회, 안마의자 신청 금지 만료일") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") }) - public SingleResult> getMassageStatusAndCountMember() { + public SingleResult> getMassageInfoMember() { return responseService.getSingleResult(massageService.getMassageInfo()); } diff --git a/src/main/java/com/server/Dotori/domain/massage/service/MassageService.java b/src/main/java/com/server/Dotori/domain/massage/service/MassageService.java index 41ddcb02..ca9a7039 100644 --- a/src/main/java/com/server/Dotori/domain/massage/service/MassageService.java +++ b/src/main/java/com/server/Dotori/domain/massage/service/MassageService.java @@ -11,5 +11,5 @@ public interface MassageService { void cancelMassage(DayOfWeek dayOfWeek, int hour, int min); void updateMassageStatus(); List getMassageStudents(); - Map getMassageStatusAndCount(); + Map getMassageInfo(); } From 4ac86b6061b1471b7b33443d225ebcf573833c9a Mon Sep 17 00:00:00 2001 From: taem1n1 Date: Fri, 15 Apr 2022 15:44:45 +0900 Subject: [PATCH 03/25] =?UTF-8?q?=EC=8B=9C=EA=B0=84=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=20=EC=BA=A1=EC=8A=90=ED=99=94=20=EB=B0=8F=20=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20=EC=95=88?= =?UTF-8?q?=EB=A7=88=EC=9D=98=EC=9E=90=20=EC=83=81=ED=83=9C=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=EC=8B=9C=20=EB=A7=8C=EB=A3=8C=EA=B8=B0=EA=B0=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/Impl/MassageServiceImpl.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java index e5fa8109..7673724d 100644 --- a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java @@ -16,6 +16,7 @@ import java.time.DayOfWeek; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,6 +33,12 @@ public class MassageServiceImpl implements MassageService { private final CurrentMemberUtil currentMemberUtil; private final MemberRepository memberRepository; + private void timeValidate(DayOfWeek dayOfWeek, int hour, int min) { + if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_DATE); + if (!(hour >= 20 && hour < 21)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); + if (!(min >= 20)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); + } + /** * 안마의자를 신청하는 로직 * 5명이 신청가능, 안마의자 신청 상태가 'CAN'일때만 신청가능, 금토일은 신청 불가능 @@ -50,12 +57,10 @@ public class MassageServiceImpl implements MassageService { @Override @Transactional public void requestMassage(DayOfWeek dayOfWeek, int hour, int min) { - if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_DATE); - if (!(hour >= 20 && hour < 21)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); - if (!(min >= 20)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); + timeValidate(dayOfWeek, hour, min); long count = massageRepository.count(); - try{ + try { if (count < 5) { Member currentMember = currentMemberUtil.getCurrentMember(); @@ -67,10 +72,10 @@ public void requestMassage(DayOfWeek dayOfWeek, int hour, int min) { currentMember.updateMassage(APPLIED); currentMember.updateMassageExpiredDate(LocalDateTime.now().plusMonths(1)); - log.info("Current MassageRequest Student Count is {}", count+1); + log.info("Current MassageRequest Student Count is {}", count + 1); } else throw new DotoriException(MASSAGE_ALREADY); } else throw new DotoriException(MASSAGE_OVER); - } catch (DataIntegrityViolationException e){ + } catch (DataIntegrityViolationException e) { throw new DotoriException(MASSAGE_ALREADY); } } @@ -93,9 +98,7 @@ public void requestMassage(DayOfWeek dayOfWeek, int hour, int min) { @Override @Transactional public void cancelMassage(DayOfWeek dayOfWeek, int hour, int min) { - if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_DATE); - if (!(hour >= 20 && hour < 21)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); - if (!(min >= 20)) throw new DotoriException(MASSAGE_CANT_REQUEST_THIS_TIME); + timeValidate(dayOfWeek, hour, min); long count = massageRepository.count(); Member currentMember = currentMemberUtil.getCurrentMember(); @@ -127,16 +130,17 @@ public void updateMassageStatus() { } /** - * 안마의자 신청을 한 학생수와 현재 자신의 안마의자 신청 상태를 조회하는 로직 - * @return Map + * 안마의자 신청을 한 학생수와 현재 자신의 안마의자 신청 상태와 안마의자 신청 금지 만료일을 조회하는 로직 + * @return Map * @author 김태민 */ @Override @Transactional(readOnly = true) - public Map getMassageStatusAndCount() { + public Map getMassageInfo() { Map map = new HashMap<>(); map.put("status",currentMemberUtil.getCurrentMember().getMassage().toString()); map.put("count", String.valueOf(massageRepository.count())); + map.put("expiredTime", currentMemberUtil.getCurrentMember().getMassageExpiredDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); return map; } From 0be260ce34e38f85fbc084a67941119655f37a27 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 11:42:45 +0900 Subject: [PATCH 04/25] =?UTF-8?q?[UPDATE]=20=EC=9E=90=EC=8A=B5=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EB=AA=A9=EB=A1=9D=20=EC=84=B1=EB=B3=84=EB=8F=84=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=ED=95=98=EC=97=AC=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/self_study/dto/SelfStudyStudentsDto.java | 10 ++++------ .../self_study/repository/SelfStudyRepositoryImpl.java | 4 +++- .../self_study/service/Impl/SelfStudyServiceImpl.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/self_study/dto/SelfStudyStudentsDto.java b/src/main/java/com/server/Dotori/domain/self_study/dto/SelfStudyStudentsDto.java index 97b1643e..876833c7 100644 --- a/src/main/java/com/server/Dotori/domain/self_study/dto/SelfStudyStudentsDto.java +++ b/src/main/java/com/server/Dotori/domain/self_study/dto/SelfStudyStudentsDto.java @@ -1,19 +1,17 @@ package com.server.Dotori.domain.self_study.dto; +import com.server.Dotori.domain.member.enumType.Gender; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data +@AllArgsConstructor @NoArgsConstructor public class SelfStudyStudentsDto { private Long id; private String stuNum; private String memberName; - - public SelfStudyStudentsDto(Long id, String stuNum, String memberName) { - this.id = id; - this.stuNum = stuNum; - this.memberName = memberName; - } + private Gender gender; } diff --git a/src/main/java/com/server/Dotori/domain/self_study/repository/SelfStudyRepositoryImpl.java b/src/main/java/com/server/Dotori/domain/self_study/repository/SelfStudyRepositoryImpl.java index 1deb1673..73d70233 100644 --- a/src/main/java/com/server/Dotori/domain/self_study/repository/SelfStudyRepositoryImpl.java +++ b/src/main/java/com/server/Dotori/domain/self_study/repository/SelfStudyRepositoryImpl.java @@ -22,7 +22,9 @@ public List findByCreateDate() { .select(Projections.fields(SelfStudyStudentsDto.class, selfStudy.member.id, selfStudy.member.stuNum, - selfStudy.member.memberName) + selfStudy.member.memberName, + selfStudy.member.gender + ) ) .where( selfStudy.member.selfStudy.eq(SelfStudy.APPLIED) diff --git a/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java b/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java index 01be00e5..fc2d70f6 100644 --- a/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java @@ -49,8 +49,8 @@ public class SelfStudyServiceImpl implements SelfStudyService { @Override @Transactional public void requestSelfStudy(DayOfWeek dayOfWeek, int hour) { - if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(SELF_STUDY_CANT_REQUEST_DATE); - if (!(hour >= 20 && hour < 21)) throw new DotoriException(SELF_STUDY_CANT_REQUEST_TIME); // 20시(8시)부터 21시(9시 (8시 59분)) 사이가 아니라면 자습신청 불가능 +// if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(SELF_STUDY_CANT_REQUEST_DATE); +// if (!(hour >= 20 && hour < 21)) throw new DotoriException(SELF_STUDY_CANT_REQUEST_TIME); // 20시(8시)부터 21시(9시 (8시 59분)) 사이가 아니라면 자습신청 불가능 Member currentMember = currentMemberUtil.getCurrentMember(); long count = selfStudyRepository.count(); From 21e4aae1a4b5101ef0693f8d26202ffa76b6aa77 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 11:49:26 +0900 Subject: [PATCH 05/25] =?UTF-8?q?[UPDATE]=20=ED=95=99=EC=83=9D=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=AA=A9=EB=A1=9D=20=EC=84=B1=EB=B3=84=EB=8F=84=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=ED=95=98=EC=97=AC=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/server/Dotori/domain/stu_info/dto/StudentInfoDto.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/server/Dotori/domain/stu_info/dto/StudentInfoDto.java b/src/main/java/com/server/Dotori/domain/stu_info/dto/StudentInfoDto.java index b07a2bd3..12da76fe 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/dto/StudentInfoDto.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/dto/StudentInfoDto.java @@ -1,5 +1,6 @@ package com.server.Dotori.domain.stu_info.dto; +import com.server.Dotori.domain.member.enumType.Gender; import com.server.Dotori.domain.member.enumType.Role; import com.server.Dotori.domain.member.enumType.SelfStudy; import lombok.AccessLevel; @@ -18,4 +19,5 @@ public class StudentInfoDto { private String memberName; private List roles; private SelfStudy selfStudy; + private Gender gender; } From 996a8b71b340561fe7850e53139610a9a03e4481 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:11:45 +0900 Subject: [PATCH 06/25] =?UTF-8?q?[ADD]=20=ED=95=99=EC=83=9D=20=EC=84=B1?= =?UTF-8?q?=EB=B3=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/AdminStuInfoController.java | 19 +++++++++++++++++++ .../CouncillorStuInfoController.java | 19 +++++++++++++++++++ .../developer/DeveloperStuInfoController.java | 19 +++++++++++++++++++ .../domain/stu_info/dto/GenderUpdateDto.java | 13 +++++++++++++ .../service/Impl/StuInfoServiceImpl.java | 14 ++++++++++---- .../stu_info/service/StuInfoService.java | 7 +++---- 6 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/server/Dotori/domain/stu_info/dto/GenderUpdateDto.java diff --git a/src/main/java/com/server/Dotori/domain/stu_info/controller/admin/AdminStuInfoController.java b/src/main/java/com/server/Dotori/domain/stu_info/controller/admin/AdminStuInfoController.java index 5fde450e..a760fdb0 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/controller/admin/AdminStuInfoController.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/controller/admin/AdminStuInfoController.java @@ -1,5 +1,6 @@ package com.server.Dotori.domain.stu_info.controller.admin; +import com.server.Dotori.domain.stu_info.dto.GenderUpdateDto; import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; @@ -111,6 +112,24 @@ public CommonResult updateMemberNameAdmin(@Valid @RequestBody MemberNameUpdateDt return responseService.getSuccessResult(); } + /** + * 학생 정보 변경 - 성별 변경 + * @param genderUpdateDto (receiverId, gender) + * @return CommonResult - SuccessResult + * @author 배태현 + */ + @PutMapping("/info/gender") + @ResponseStatus( HttpStatus.OK ) + @ApiOperation(value = "성별 변경", notes = "성별 변경") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") + }) + public CommonResult updateGenderAdmin(@Valid @RequestBody GenderUpdateDto genderUpdateDto) { + stuInfoService.updateGender(genderUpdateDto); + return responseService.getSuccessResult(); + } + /** * 이름으로 학생들을 검색하는 컨트롤러 * @param memberName diff --git a/src/main/java/com/server/Dotori/domain/stu_info/controller/councillor/CouncillorStuInfoController.java b/src/main/java/com/server/Dotori/domain/stu_info/controller/councillor/CouncillorStuInfoController.java index 67b642b1..9f2d78c2 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/controller/councillor/CouncillorStuInfoController.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/controller/councillor/CouncillorStuInfoController.java @@ -1,5 +1,6 @@ package com.server.Dotori.domain.stu_info.controller.councillor; +import com.server.Dotori.domain.stu_info.dto.GenderUpdateDto; import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; @@ -111,6 +112,24 @@ public CommonResult updateMemberNameCouncillor(@Valid @RequestBody MemberNameUpd return responseService.getSuccessResult(); } + /** + * 학생 정보 변경 - 성별 변경 + * @param genderUpdateDto (receiverId, gender) + * @return CommonResult - SuccessResult + * @author 배태현 + */ + @PutMapping("/info/gender") + @ResponseStatus( HttpStatus.OK ) + @ApiOperation(value = "성별 변경", notes = "성별 변경") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") + }) + public CommonResult updateGenderCouncillor(@Valid @RequestBody GenderUpdateDto genderUpdateDto) { + stuInfoService.updateGender(genderUpdateDto); + return responseService.getSuccessResult(); + } + /** * 이름으로 학생들을 검색하는 컨트롤러 * @param memberName diff --git a/src/main/java/com/server/Dotori/domain/stu_info/controller/developer/DeveloperStuInfoController.java b/src/main/java/com/server/Dotori/domain/stu_info/controller/developer/DeveloperStuInfoController.java index 3ad16d05..b3c9bfd3 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/controller/developer/DeveloperStuInfoController.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/controller/developer/DeveloperStuInfoController.java @@ -1,5 +1,6 @@ package com.server.Dotori.domain.stu_info.controller.developer; +import com.server.Dotori.domain.stu_info.dto.GenderUpdateDto; import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; @@ -111,6 +112,24 @@ public CommonResult updateMemberNameDeveloper(@Valid @RequestBody MemberNameUpda return responseService.getSuccessResult(); } + /** + * 학생 정보 변경 - 성별 변경 + * @param genderUpdateDto (receiverId, gender) + * @return CommonResult - SuccessResult + * @author 배태현 + */ + @PutMapping("/info/gender") + @ResponseStatus( HttpStatus.OK ) + @ApiOperation(value = "성별 변경", notes = "성별 변경") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "RefreshToken", value = "로그인 성공 후 refresh_token", required = false, dataType = "String", paramType = "header") + }) + public CommonResult updateGenderDeveloper(@Valid @RequestBody GenderUpdateDto genderUpdateDto) { + stuInfoService.updateGender(genderUpdateDto); + return responseService.getSuccessResult(); + } + /** * 이름으로 학생들을 검색하는 컨트롤러 * @param memberName diff --git a/src/main/java/com/server/Dotori/domain/stu_info/dto/GenderUpdateDto.java b/src/main/java/com/server/Dotori/domain/stu_info/dto/GenderUpdateDto.java new file mode 100644 index 00000000..5cda1b76 --- /dev/null +++ b/src/main/java/com/server/Dotori/domain/stu_info/dto/GenderUpdateDto.java @@ -0,0 +1,13 @@ +package com.server.Dotori.domain.stu_info.dto; + +import com.server.Dotori.domain.member.enumType.Gender; +import lombok.*; + +@Getter @Builder +@AllArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor +public class GenderUpdateDto { + + private Long receiverId; + + private Gender gender; +} diff --git a/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java b/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java index eac58709..03928c66 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java @@ -1,10 +1,7 @@ package com.server.Dotori.domain.stu_info.service.Impl; import com.server.Dotori.domain.member.Member; -import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; -import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StudentInfoDto; +import com.server.Dotori.domain.stu_info.dto.*; import com.server.Dotori.domain.member.repository.member.MemberRepository; import com.server.Dotori.domain.stu_info.service.StuInfoService; import com.server.Dotori.global.exception.DotoriException; @@ -121,6 +118,15 @@ public void updateMemberName(MemberNameUpdateDto memberNameUpdateDto) { } + @Override + @Transactional + public void updateGender(GenderUpdateDto genderUpdateDto) { + Member member = memberRepository.findById(genderUpdateDto.getReceiverId()) + .orElseThrow(() -> new DotoriException(MEMBER_NOT_FOUND)); + + member.updateMemberGender(genderUpdateDto.getGender()); + } + /** * 이름으로 학생정보를 조회하는 로직 (사감쌤, 기자위, 개발자 사용가능) * @param memberName memberName diff --git a/src/main/java/com/server/Dotori/domain/stu_info/service/StuInfoService.java b/src/main/java/com/server/Dotori/domain/stu_info/service/StuInfoService.java index f58b8a60..77cd3deb 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/service/StuInfoService.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/service/StuInfoService.java @@ -1,9 +1,6 @@ package com.server.Dotori.domain.stu_info.service; -import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; -import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StudentInfoDto; +import com.server.Dotori.domain.stu_info.dto.*; import java.util.List; @@ -19,5 +16,7 @@ public interface StuInfoService { void updateMemberName(MemberNameUpdateDto memberNameUpdateDto); + void updateGender(GenderUpdateDto genderUpdateDto); + List getStuInfoByMemberName(String memberName); } From 1451fc4c5d20cb88979095112963125c23c46983 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:12:07 +0900 Subject: [PATCH 07/25] =?UTF-8?q?[UPDATE]=20=EC=9E=90=EC=8A=B5=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EB=AA=A9=EB=A1=9D=20=EC=84=B1=EB=B3=84=EB=8F=84=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=ED=95=98=EC=97=AC=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/repository/member/MemberRepositoryImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/member/repository/member/MemberRepositoryImpl.java b/src/main/java/com/server/Dotori/domain/member/repository/member/MemberRepositoryImpl.java index 20c7c568..0b12cb21 100644 --- a/src/main/java/com/server/Dotori/domain/member/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/com/server/Dotori/domain/member/repository/member/MemberRepositoryImpl.java @@ -36,7 +36,9 @@ public List findBySelfStudyAPLLIED() { .select(Projections.fields(SelfStudyStudentsDto.class, member.id, member.stuNum, - member.memberName) + member.memberName, + member.gender + ) ).where( member.selfStudy.eq(SelfStudy.APPLIED) ) @@ -56,7 +58,10 @@ public List findBySelfStudyCategory(Long id) { .select(Projections.fields(SelfStudyStudentsDto.class, member.id, member.stuNum, - member.memberName)) + member.memberName, + member.gender + ) + ) .where( member.selfStudy.eq(SelfStudy.APPLIED) .and(member.stuNum.like(id+"%")) From eaaf3efe24a328a1d5ccbfb8e4465a778ef15a8e Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:12:43 +0900 Subject: [PATCH 08/25] =?UTF-8?q?[UPDATE]=20=EC=9E=90=EC=8A=B5=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EB=AA=A9=EB=A1=9D=20=EC=84=B1=EB=B3=84=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelfStudyServiceTest.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/test/java/com/server/Dotori/domain/self_study/service/SelfStudyServiceTest.java b/src/test/java/com/server/Dotori/domain/self_study/service/SelfStudyServiceTest.java index daffca41..2a49b758 100644 --- a/src/test/java/com/server/Dotori/domain/self_study/service/SelfStudyServiceTest.java +++ b/src/test/java/com/server/Dotori/domain/self_study/service/SelfStudyServiceTest.java @@ -2,11 +2,10 @@ import com.server.Dotori.domain.member.Member; import com.server.Dotori.domain.member.dto.MemberDto; -import com.server.Dotori.domain.member.enumType.Gender; -import com.server.Dotori.domain.self_study.dto.SelfStudyStudentsDto; import com.server.Dotori.domain.member.enumType.Role; import com.server.Dotori.domain.member.enumType.SelfStudy; import com.server.Dotori.domain.member.repository.member.MemberRepository; +import com.server.Dotori.domain.self_study.dto.SelfStudyStudentsDto; import com.server.Dotori.domain.self_study.repository.SelfStudyRepository; import com.server.Dotori.global.exception.DotoriException; import com.server.Dotori.global.util.CurrentMemberUtil; @@ -27,6 +26,7 @@ import java.util.List; import java.util.Map; +import static com.server.Dotori.domain.member.enumType.Gender.MAN; import static com.server.Dotori.domain.member.enumType.Music.CAN; import static com.server.Dotori.domain.member.enumType.SelfStudy.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -55,7 +55,7 @@ void currentUser() { .stuNum("2409") .password("0809") .email("s20032@gsm.hs.kr") - .gender(Gender.MAN) + .gender(MAN) .build(); memberRepository.save( memberDto.toEntity( @@ -135,9 +135,11 @@ public void getSelfStudyStudents() { //then assertEquals(1, selfStudyStudents.size()); + assertEquals(MAN, selfStudyStudents.get(0).getGender()); } @Test + @DisplayName("자습을 신청한 순서대로 자습신청한 학생들 목록이 잘 조회 되나요 ?") public void getSelfStudyByCreateDate() { //given //when selfStudyService.requestSelfStudy(DayOfWeek.MONDAY, 20); @@ -145,6 +147,7 @@ public void getSelfStudyByCreateDate() { //then assertEquals(1, students.size()); + assertEquals(MAN, students.get(0).getGender()); } @Test @@ -156,6 +159,7 @@ public void getSelfStudyStudentsCategoryTest() { //then assertEquals(1, selfStudyStudentsByCategory.size()); + assertEquals(MAN, selfStudyStudentsByCategory.get(0).getGender()); } @Test @@ -172,7 +176,7 @@ public void updateSelfStudyStatus() { .music(CAN) .selfStudy(APPLIED) .point(0L) - .gender(Gender.MAN) + .gender(MAN) .build() ); @@ -186,7 +190,7 @@ public void updateSelfStudyStatus() { .music(CAN) .selfStudy(CANT) .point(0L) - .gender(Gender.MAN) + .gender(MAN) .build() ); @@ -200,7 +204,7 @@ public void updateSelfStudyStatus() { .music(CAN) .selfStudy(SelfStudy.CAN) .point(0L) - .gender(Gender.MAN) + .gender(MAN) .build() ); @@ -263,16 +267,11 @@ public void banCancelSelfStudyTest() { } @Test - @DisplayName("") + @DisplayName("자습신청 금지 때 회원을 찾을 수 없음 예외가 잘 터지나요 ?") public void banAndBanCancelSelfStudyExceptionTest() { assertThrows( DotoriException.class, () -> selfStudyService.banSelfStudy(0L) ); - - assertThrows( - DotoriException.class, - () -> selfStudyService.banSelfStudy(0L) - ); } } \ No newline at end of file From 87218ec563e84c0948dbea80a8f82d9f038c8c72 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:13:31 +0900 Subject: [PATCH 09/25] =?UTF-8?q?[ADD]=20=ED=95=99=EC=83=9D=20=EC=84=B1?= =?UTF-8?q?=EB=B3=84=EC=9D=B4=20=EC=9E=98=20=EB=B3=80=EA=B2=BD=EB=90=98?= =?UTF-8?q?=EB=8A=94=EC=A7=80=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stu_info/service/StuInfoServiceTest.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/server/Dotori/domain/stu_info/service/StuInfoServiceTest.java b/src/test/java/com/server/Dotori/domain/stu_info/service/StuInfoServiceTest.java index 3d301818..a5ac58dd 100644 --- a/src/test/java/com/server/Dotori/domain/stu_info/service/StuInfoServiceTest.java +++ b/src/test/java/com/server/Dotori/domain/stu_info/service/StuInfoServiceTest.java @@ -1,13 +1,9 @@ package com.server.Dotori.domain.stu_info.service; -import com.server.Dotori.domain.member.dto.*; -import com.server.Dotori.domain.member.enumType.Gender; -import com.server.Dotori.domain.stu_info.dto.MemberNameUpdateDto; -import com.server.Dotori.domain.stu_info.dto.RoleUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StuNumUpdateDto; -import com.server.Dotori.domain.stu_info.dto.StudentInfoDto; +import com.server.Dotori.domain.member.dto.MemberDto; import com.server.Dotori.domain.member.enumType.Role; import com.server.Dotori.domain.member.repository.member.MemberRepository; +import com.server.Dotori.domain.stu_info.dto.*; import com.server.Dotori.global.util.CurrentMemberUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -25,6 +21,8 @@ import java.util.Collections; import java.util.List; +import static com.server.Dotori.domain.member.enumType.Gender.MAN; +import static com.server.Dotori.domain.member.enumType.Gender.WOMAN; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -47,7 +45,7 @@ void currentUser() { .stuNum("2409") .password("0809") .email("s20032@gsm.hs.kr") - .gender(Gender.MAN) + .gender(MAN) .build(); memberRepository.save( memberDto.toEntity( @@ -136,6 +134,21 @@ public void updateMemberNameTest() { assertNotNull(memberRepository.findByEmail("s20032@gsm.hs.kr")); } + @Test + @DisplayName("학생의 성별이 잘 변경되나요 ?") + public void updateGenderTest() { + //given //when + stuInfoService.updateGender( + GenderUpdateDto.builder() + .receiverId(currentMemberUtil.getCurrentMember().getId()) + .gender(WOMAN) + .build() + ); + + //then + assertEquals(WOMAN, memberRepository.findByEmail("s20032@gsm.hs.kr").get().getGender()); + } + @Test @DisplayName("이름으로 학생정보가 잘 검색되나요?") public void searchMemberByMemberNameTest() { From d234daf85ca760ba3b27d77d6e0bffe1893aabe3 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:22:06 +0900 Subject: [PATCH 10/25] =?UTF-8?q?[UPDATE]=20=EC=9E=90=EC=8A=B5=20feature?= =?UTF-8?q?=20=EC=84=B1=EB=B3=84=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../self_study/service/Impl/SelfStudyServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java b/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java index fc2d70f6..9d4c4ead 100644 --- a/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/self_study/service/Impl/SelfStudyServiceImpl.java @@ -49,8 +49,8 @@ public class SelfStudyServiceImpl implements SelfStudyService { @Override @Transactional public void requestSelfStudy(DayOfWeek dayOfWeek, int hour) { -// if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(SELF_STUDY_CANT_REQUEST_DATE); -// if (!(hour >= 20 && hour < 21)) throw new DotoriException(SELF_STUDY_CANT_REQUEST_TIME); // 20시(8시)부터 21시(9시 (8시 59분)) 사이가 아니라면 자습신청 불가능 + if (dayOfWeek == DayOfWeek.FRIDAY || dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) throw new DotoriException(SELF_STUDY_CANT_REQUEST_DATE); + if (!(hour >= 20 && hour < 21)) throw new DotoriException(SELF_STUDY_CANT_REQUEST_TIME); // 20시(8시)부터 21시(9시 (8시 59분)) 사이가 아니라면 자습신청 불가능 Member currentMember = currentMemberUtil.getCurrentMember(); long count = selfStudyRepository.count(); @@ -105,7 +105,7 @@ public void cancelSelfStudy(DayOfWeek dayOfWeek, int hour) { /** * 자습신청한 학생을 전체 조회하는 서비스로직 (로그인된 유저 사용가능) - * @return List - SelfStudyStudentDto (id, stuNum, username) + * @return List - SelfStudyStudentDto (id, stuNum, username, gender) * @exception DotoriException (SELF_STUDY_NOT_FOUND) 자습신청한 학생이 없을 때 * @author 배태현 */ @@ -120,7 +120,7 @@ public List getSelfStudyStudents() { /** * 자습신청 한 학생들 자습신청 한 순서대로 전체조회하는 서비스 로직 (로그인된 유저 사용가능) - * @return List - SelfStudyStudentDto (id, stuNum, username) + * @return List - SelfStudyStudentDto (id, stuNum, username, gender) * @exception DotoriException (SELF_STUDY_NOT_FOUND) 자습신청한 학생이 없을 때 * @author 배태현 */ @@ -136,7 +136,7 @@ public List getSelfStudyStudentsByCreateDate() { /** * 자습신청한 학생을 학년반별로 조회하는 서비스로직 (로그인된 유저 사용가능) * @param id classId - * @return List - SelfStudyStudentDto (id, stuNum, username) + * @return List - SelfStudyStudentDto (id, stuNum, username, gender) * @exception DotoriException (MEMBER_NOT_FOUND_BY_CLASS) 해당 반에 해당하는 학생이 없을 때 * @author 배태현 */ From 83a1ffdf3aab0f60d0774d31c30fde118e871648 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sat, 16 Apr 2022 12:31:33 +0900 Subject: [PATCH 11/25] =?UTF-8?q?[UPDATE]=20=ED=95=99=EC=83=9D=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20feature=20=EC=84=B1=EB=B3=84=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stu_info/service/Impl/StuInfoServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java b/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java index 03928c66..2a0768fc 100644 --- a/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/stu_info/service/Impl/StuInfoServiceImpl.java @@ -31,7 +31,7 @@ public class StuInfoServiceImpl implements StuInfoService { * 학년반별로 조회한 학생들 List를 List Dto로 변경후 반환하는 서비스로직 (사감쌤, 개발자, 자치위원 사용가능) * @param id classId * @exception DotoriException (MEMBER_NOT_FOUND_BY_CLASS) 해당 반에 해당하는 학생들이 없을 때 - * @return List - StudentInfoDto (id, stuNum, username, roles) + * @return List - StudentInfoDto (id, stuNum, username, roles, gender) * @author 배태현 */ @Override @@ -45,7 +45,7 @@ public List getStudentInfo(Long id) { /** * 전체 조회한 학생들 List를 List Dto로 변경후 반환하는 서비스로직 (사감쌤, 개발자, 자치위원 사용가능) - * @return List - StudentInfoDto (id, stuNum, username, roles) + * @return List - StudentInfoDto (id, stuNum, username, roles, gender) * @author 배태현 */ @Override @@ -118,6 +118,12 @@ public void updateMemberName(MemberNameUpdateDto memberNameUpdateDto) { } + /** + * 학생의 성별을 변경시키는 서비스 로직 (사감쌤, 개발자, 자치위원 사용가능) + * @param genderUpdateDto (receiverId, gender) + * @exception DotoriException (MEMBER_NOT_FOUND) 해당 Id에 해당하는 유저를 찾을 수 없을 때 + * @author 배태현 + */ @Override @Transactional public void updateGender(GenderUpdateDto genderUpdateDto) { From 09eda049df4ea25cf1a9f924f30089e228d0679d Mon Sep 17 00:00:00 2001 From: taem1n1 Date: Sat, 16 Apr 2022 15:12:31 +0900 Subject: [PATCH 12/25] =?UTF-8?q?=EC=95=88=EB=A7=88=EC=9D=98=EC=9E=90?= =?UTF-8?q?=EB=A5=BC=20=EC=8B=A0=EC=B2=AD=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=80=20=ED=95=99=EC=83=9D=EB=93=A4=EB=8F=84=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dotori/domain/massage/service/Impl/MassageServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java index 7673724d..05c604fc 100644 --- a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java @@ -140,6 +140,9 @@ public Map getMassageInfo() { Map map = new HashMap<>(); map.put("status",currentMemberUtil.getCurrentMember().getMassage().toString()); map.put("count", String.valueOf(massageRepository.count())); + if (currentMemberUtil.getCurrentMember().getMassageExpiredDate() == null) { + return map; + } map.put("expiredTime", currentMemberUtil.getCurrentMember().getMassageExpiredDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); return map; } From 8ddc9c4ad1807a1a9399def9fcbfcd986cedc9e0 Mon Sep 17 00:00:00 2001 From: taem1n1 Date: Sat, 16 Apr 2022 15:19:20 +0900 Subject: [PATCH 13/25] =?UTF-8?q?=EC=BD=94=EB=93=9C=EB=A5=BC=20=EC=A2=80?= =?UTF-8?q?=20=EC=98=88=EC=81=98=EA=B2=8C=20=EB=A7=8C=EB=93=A4=EC=97=88?= =?UTF-8?q?=EC=96=B4=EC=9A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/massage/service/Impl/MassageServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java index 05c604fc..79d02cb4 100644 --- a/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/massage/service/Impl/MassageServiceImpl.java @@ -140,10 +140,9 @@ public Map getMassageInfo() { Map map = new HashMap<>(); map.put("status",currentMemberUtil.getCurrentMember().getMassage().toString()); map.put("count", String.valueOf(massageRepository.count())); - if (currentMemberUtil.getCurrentMember().getMassageExpiredDate() == null) { - return map; + if (!(currentMemberUtil.getCurrentMember().getMassageExpiredDate() == null)) { + map.put("expiredTime", currentMemberUtil.getCurrentMember().getMassageExpiredDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); } - map.put("expiredTime", currentMemberUtil.getCurrentMember().getMassageExpiredDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); return map; } From c891a7499c6356e91f9fa8572da5c59619979657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 16:23:34 +0900 Subject: [PATCH 14/25] =?UTF-8?q?Update=20SignController=20signin=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20gender=20=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/SignController.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/member/controller/SignController.java b/src/main/java/com/server/Dotori/domain/member/controller/SignController.java index 11c856f8..1d7510b5 100644 --- a/src/main/java/com/server/Dotori/domain/member/controller/SignController.java +++ b/src/main/java/com/server/Dotori/domain/member/controller/SignController.java @@ -1,9 +1,6 @@ package com.server.Dotori.domain.member.controller; -import com.server.Dotori.domain.member.dto.EmailDto; -import com.server.Dotori.domain.member.dto.MemberDto; -import com.server.Dotori.domain.member.dto.SignInDto; -import com.server.Dotori.domain.member.dto.SignUpEmailCheckDto; +import com.server.Dotori.domain.member.dto.*; import com.server.Dotori.domain.member.service.MemberService; import com.server.Dotori.global.response.ResponseService; import com.server.Dotori.global.response.result.CommonResult; @@ -16,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; -import java.util.Map; @RequiredArgsConstructor @RestController @@ -73,8 +69,8 @@ public CommonResult checkEmailSignup(@Valid @RequestBody SignUpEmailCheckDto mem */ @PostMapping("/signin") @ApiOperation(value="로그인") - public SingleResult> signin(@Valid @RequestBody SignInDto memberLoginDto){ - Map data = memberService.signIn(memberLoginDto); + public SingleResult signin(@Valid @RequestBody SignInDto memberLoginDto){ + SignInResponseDto data = memberService.signIn(memberLoginDto); return responseService.getSingleResult(data); } } From 1c604a2a3f1d0aa4ca408993a8bdf6f9131d9a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 16:23:51 +0900 Subject: [PATCH 15/25] =?UTF-8?q?Update=20MemberService=20signin=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20gender=20=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/Dotori/domain/member/service/MemberService.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/member/service/MemberService.java b/src/main/java/com/server/Dotori/domain/member/service/MemberService.java index 6b9371da..02d85f6c 100644 --- a/src/main/java/com/server/Dotori/domain/member/service/MemberService.java +++ b/src/main/java/com/server/Dotori/domain/member/service/MemberService.java @@ -2,13 +2,11 @@ import com.server.Dotori.domain.member.dto.*; -import java.util.Map; - public interface MemberService { Long signup(MemberDto memberDto); String sendEmailSignup(EmailDto emailDto); void checkEmailSignup(SignUpEmailCheckDto memberEmailKeyDto); - Map signIn(SignInDto memberLoginDto); + SignInResponseDto signIn(SignInDto memberLoginDto); String changePassword(ChangePasswordDto changePasswordDto); String sendEmailChangePassword(EmailDto emailDto); void checkEmailChangePassword(ChangePasswordEmailCheckDto verifiedAuthKeyAndChangePasswordDto); From 0a7ddc96d71a12f570e5bc1757d1fb96761b9cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 16:24:03 +0900 Subject: [PATCH 16/25] =?UTF-8?q?Update=20MemberServiceImpl=20signin=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20gender=20=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/impl/MemberServiceImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java index b91d0cc8..8eb2ccc3 100644 --- a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java @@ -3,7 +3,6 @@ import com.server.Dotori.domain.member.EmailCertificate; import com.server.Dotori.domain.member.Member; import com.server.Dotori.domain.member.dto.*; -import com.server.Dotori.domain.member.enumType.Gender; import com.server.Dotori.domain.member.repository.email.EmailCertificateRepository; import com.server.Dotori.domain.member.repository.member.MemberRepository; import com.server.Dotori.domain.member.service.MemberService; @@ -99,16 +98,16 @@ public void checkEmailSignup(SignUpEmailCheckDto signUpEmailCheckDto) { */ @Transactional @Override - public Map signIn(SignInDto signInDto) { + public SignInResponseDto signIn(SignInDto signInDto) { String email = signInDto.getEmail(); Member findMember = memberRepository.findByEmail(email) .orElseThrow(() -> new DotoriException(MEMBER_NOT_FOUND)); if(!passwordEncoder.matches(signInDto.getPassword(),findMember.getPassword())) throw new DotoriException(MEMBER_PASSWORD_NOT_MATCHING); - Map token = createToken(findMember); + SignInResponseDto signInResponseDto = new SignInResponseDto(createToken(findMember),findMember.getGender()); - return token; + return signInResponseDto; } /** From 6580948cdb10dc257a2f59bda5ae970a13e3add8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 16:24:27 +0900 Subject: [PATCH 17/25] =?UTF-8?q?Update=20SignInResponseDto=20signin=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20gender=20=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/dto/SignInResponseDto.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/server/Dotori/domain/member/dto/SignInResponseDto.java diff --git a/src/main/java/com/server/Dotori/domain/member/dto/SignInResponseDto.java b/src/main/java/com/server/Dotori/domain/member/dto/SignInResponseDto.java new file mode 100644 index 00000000..ec25020c --- /dev/null +++ b/src/main/java/com/server/Dotori/domain/member/dto/SignInResponseDto.java @@ -0,0 +1,15 @@ +package com.server.Dotori.domain.member.dto; + +import com.server.Dotori.domain.member.enumType.Gender; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Map; + +@Getter +@AllArgsConstructor +public class SignInResponseDto { + + private Map token; + private Gender gender; +} From 567733d56e08de6a47c6dad92ff0de4288a143c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 16:24:46 +0900 Subject: [PATCH 18/25] =?UTF-8?q?Update=20MemberServiceTest=20signin=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20gender=20=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberServiceTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/server/Dotori/domain/member/service/MemberServiceTest.java b/src/test/java/com/server/Dotori/domain/member/service/MemberServiceTest.java index f68c1dce..6366be4f 100644 --- a/src/test/java/com/server/Dotori/domain/member/service/MemberServiceTest.java +++ b/src/test/java/com/server/Dotori/domain/member/service/MemberServiceTest.java @@ -1,9 +1,6 @@ package com.server.Dotori.domain.member.service; -import com.server.Dotori.domain.member.dto.ChangePasswordDto; -import com.server.Dotori.domain.member.dto.MemberDto; -import com.server.Dotori.domain.member.dto.SignInDto; -import com.server.Dotori.domain.member.dto.WithdrawlDto; +import com.server.Dotori.domain.member.dto.*; import com.server.Dotori.domain.member.enumType.Gender; import com.server.Dotori.domain.member.enumType.Role; import com.server.Dotori.domain.member.repository.member.MemberRepository; @@ -21,7 +18,6 @@ import javax.transaction.Transactional; import java.util.List; -import java.util.Map; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; @@ -98,11 +94,11 @@ void signin(){ .build(); // when - Map result = memberService.signIn(memberLoginDto); + SignInResponseDto result = memberService.signIn(memberLoginDto); // then assertNotNull(result); - assertThat(result.get("email")).isEqualTo(memberRepository.findByEmail(memberLoginDto.getEmail()).orElseThrow().getEmail()); + assertThat(result.getGender()).isEqualTo(Gender.MAN); } @Test From 219ac1bf26cd69dadd20fc2a2a7c84d69161c553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sat, 16 Apr 2022 17:05:24 +0900 Subject: [PATCH 19/25] =?UTF-8?q?Update=20MemberServiceImpl=20logout=20@Tr?= =?UTF-8?q?ansactional=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EB=8B=AC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dotori/domain/member/service/impl/MemberServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java index 8eb2ccc3..48048d06 100644 --- a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java @@ -173,6 +173,7 @@ public void checkEmailChangePassword(ChangePasswordEmailCheckDto changePasswordE * 로그아웃 하는 서비스 로직 * @author 노경준 */ + @Transactional @Override public void logout() { currentMemberUtil.getCurrentMember().updateRefreshToken(null); From 3a73c2806debb3c3ae3df82da93ae0108af0065d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sun, 17 Apr 2022 00:43:30 +0900 Subject: [PATCH 20/25] =?UTF-8?q?Update=20Board=20content=205000=20?= =?UTF-8?q?=EC=9E=90=20=EA=B9=8C=EC=A7=80=20=EC=88=98=EC=9A=A9=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/server/Dotori/domain/board/Board.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/board/Board.java b/src/main/java/com/server/Dotori/domain/board/Board.java index d41d505b..d2db03e7 100644 --- a/src/main/java/com/server/Dotori/domain/board/Board.java +++ b/src/main/java/com/server/Dotori/domain/board/Board.java @@ -26,7 +26,7 @@ public class Board extends BaseTimeEntity { @Column(name = "board_title", nullable = false) private String title; - @Column(name = "board_content", length = 800, nullable = false) + @Column(name = "board_content", length = 5000, nullable = false) private String content; @Column(name = "board_image_url") From c3f9e82b4170381b50be5aecccc0a10da65329ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sun, 17 Apr 2022 00:43:37 +0900 Subject: [PATCH 21/25] =?UTF-8?q?Update=20BoardDto=20content=205000=20?= =?UTF-8?q?=EC=9E=90=20=EA=B9=8C=EC=A7=80=20=EC=88=98=EC=9A=A9=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/server/Dotori/domain/board/dto/BoardDto.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/board/dto/BoardDto.java b/src/main/java/com/server/Dotori/domain/board/dto/BoardDto.java index d6dc4d28..00c481f8 100644 --- a/src/main/java/com/server/Dotori/domain/board/dto/BoardDto.java +++ b/src/main/java/com/server/Dotori/domain/board/dto/BoardDto.java @@ -17,7 +17,7 @@ public class BoardDto { private String title; @NotBlank - @Size(min = 1, max = 800) + @Size(min = 1, max = 5000) private String content; public Board saveToEntity(Member member, String url) { From f4e738185992bb3facef8a2e91fcf832aecf2f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sun, 17 Apr 2022 00:47:10 +0900 Subject: [PATCH 22/25] =?UTF-8?q?Update=20MemberServiceImpl=20gender?= =?UTF-8?q?=EB=A5=BC=20email=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dotori/domain/member/service/impl/MemberServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java index 48048d06..53aea691 100644 --- a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java @@ -202,7 +202,7 @@ public void withdrawal(WithdrawlDto withdrawlDto) { @Transactional @Override public void setGender(SetGenderDto setGenderDto) { - Member member = memberRepository.findById(setGenderDto.getMemberId()).get(); + Member member = memberRepository.findByEmail(setGenderDto.getEmail()).get(); member.updateMemberGender(setGenderDto.getGender()); } From 51cfd0b6c2c2f54afadbc28234e9c18ae9e28ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sun, 17 Apr 2022 00:47:19 +0900 Subject: [PATCH 23/25] =?UTF-8?q?Update=20SetGenderDto=20gender=EB=A5=BC?= =?UTF-8?q?=20email=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/server/Dotori/domain/member/dto/SetGenderDto.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/member/dto/SetGenderDto.java b/src/main/java/com/server/Dotori/domain/member/dto/SetGenderDto.java index 42819342..b6a2f474 100644 --- a/src/main/java/com/server/Dotori/domain/member/dto/SetGenderDto.java +++ b/src/main/java/com/server/Dotori/domain/member/dto/SetGenderDto.java @@ -5,6 +5,6 @@ @Getter public class SetGenderDto { - private Long memberId; + private String email; private Gender gender; } From 6f07bd3989ee3891cf3b997964ff92d6b6766deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=85=B8=EA=B2=BD=EC=A4=80?= Date: Sun, 17 Apr 2022 00:51:24 +0900 Subject: [PATCH 24/25] =?UTF-8?q?Update=20MemberServiceImpl=20exception=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dotori/domain/member/service/impl/MemberServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java index 53aea691..a9600984 100644 --- a/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/member/service/impl/MemberServiceImpl.java @@ -202,7 +202,8 @@ public void withdrawal(WithdrawlDto withdrawlDto) { @Transactional @Override public void setGender(SetGenderDto setGenderDto) { - Member member = memberRepository.findByEmail(setGenderDto.getEmail()).get(); + Member member = memberRepository.findByEmail(setGenderDto.getEmail()) + .orElseThrow(() -> new DotoriException(MEMBER_NOT_FOUND)); member.updateMemberGender(setGenderDto.getGender()); } From cc5da00c3786d234510ffeac35f1b32babe5bb85 Mon Sep 17 00:00:00 2001 From: qoxogus Date: Sun, 17 Apr 2022 05:48:33 +0900 Subject: [PATCH 25/25] =?UTF-8?q?[FIX]=20=EC=A1=B0=ED=9A=8C=ED=95=9C=20?= =?UTF-8?q?=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD=EC=9D=B4=20=EB=B9=84?= =?UTF-8?q?=EC=96=B4=EC=9E=88=EC=9D=84=20=EB=95=8C=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main_page/service/Impl/BoardAlarmServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/server/Dotori/domain/main_page/service/Impl/BoardAlarmServiceImpl.java b/src/main/java/com/server/Dotori/domain/main_page/service/Impl/BoardAlarmServiceImpl.java index e13326af..89f23e23 100644 --- a/src/main/java/com/server/Dotori/domain/main_page/service/Impl/BoardAlarmServiceImpl.java +++ b/src/main/java/com/server/Dotori/domain/main_page/service/Impl/BoardAlarmServiceImpl.java @@ -1,12 +1,15 @@ package com.server.Dotori.domain.main_page.service.Impl; import com.server.Dotori.domain.board.Board; -import com.server.Dotori.domain.main_page.dto.BoardAlarmDto; import com.server.Dotori.domain.board.repository.BoardRepository; +import com.server.Dotori.domain.main_page.dto.BoardAlarmDto; import com.server.Dotori.domain.main_page.service.BoardAlarmService; +import com.server.Dotori.global.exception.DotoriException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import static com.server.Dotori.global.exception.ErrorCode.BOARD_EMPTY; + @Service @RequiredArgsConstructor public class BoardAlarmServiceImpl implements BoardAlarmService { @@ -22,6 +25,8 @@ public class BoardAlarmServiceImpl implements BoardAlarmService { public BoardAlarmDto getBoardAlarmInfo() { Board lastWriteBoard = boardRepository.findTop1ByOrderByCreatedDateDesc(); + if (lastWriteBoard == null) throw new DotoriException(BOARD_EMPTY); + return BoardAlarmDto.builder() .id(lastWriteBoard.getId()) .title(lastWriteBoard.getTitle())