From 58acf280703af234373c10f4ab814eccd7c6d9d7 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 19:34:07 +0900 Subject: [PATCH 001/127] =?UTF-8?q?feat:=20#63=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=82=AC=EC=9D=B4=EB=93=9C?= =?UTF-8?q?=EB=B0=94=20Fragment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/fragment/mypageSidebar.html | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/resources/templates/main/fragment/mypageSidebar.html diff --git a/src/main/resources/templates/main/fragment/mypageSidebar.html b/src/main/resources/templates/main/fragment/mypageSidebar.html new file mode 100644 index 0000000..9ccffce --- /dev/null +++ b/src/main/resources/templates/main/fragment/mypageSidebar.html @@ -0,0 +1,57 @@ + + + + + + From 5f3559d058dc85ed755d105a41567fb8498b44e9 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 19:53:55 +0900 Subject: [PATCH 002/127] =?UTF-8?q?feat:=20#62=20`mypageLayout`=20-=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/layout/mypageLayout.html | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/main/resources/templates/main/layout/mypageLayout.html diff --git a/src/main/resources/templates/main/layout/mypageLayout.html b/src/main/resources/templates/main/layout/mypageLayout.html new file mode 100644 index 0000000..4081993 --- /dev/null +++ b/src/main/resources/templates/main/layout/mypageLayout.html @@ -0,0 +1,25 @@ + + + + + + + +
+ +
+
+ +
+ +
+
+ +
+
+ + + + + + From 747ac7a2449fafadc076cfb8e955228e09b620c9 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 19:54:26 +0900 Subject: [PATCH 003/127] =?UTF-8?q?feat:=20#61=20`mypageInfo.html`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EB=B7=B0=20=ED=94=84=EB=A0=88=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageInfo.html | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/resources/templates/main/page/mypageInfo.html diff --git a/src/main/resources/templates/main/page/mypageInfo.html b/src/main/resources/templates/main/page/mypageInfo.html new file mode 100644 index 0000000..0cc0e9c --- /dev/null +++ b/src/main/resources/templates/main/page/mypageInfo.html @@ -0,0 +1,57 @@ + + + + + +
+

회원 기본 정보

+ + + + + + + + + + + + + + + + + + + + + + + +
아이디woody1234
비밀번호 + 현재 비밀번호 + + 변경할 비밀번호 + + 변경할 비밀번호 다시 입력 +
+ + +
이메일woody@mail.com
휴대폰 번호010-1234-5678
기본 배송지 +
+
+ +
+
+ +
+
+
+
+
+ From 8207fe4401353433d3b1f22a5c5ab7a7c649ca14 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 19:54:54 +0900 Subject: [PATCH 004/127] =?UTF-8?q?feat:=20#61=20`MyPageController`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A7=B5=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyPageController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/controller/MyPageController.java diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java new file mode 100644 index 0000000..1b6d231 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -0,0 +1,13 @@ +package com.t3t.frontserver.member.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class MyPageController { + + @GetMapping("/mypage/info") + public String myPageInfoView(){ + return "main/page/mypageInfo"; + } +} From b6891f564db8f21d1bb2cb8d516c4043ff523ea8 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 19:55:15 +0900 Subject: [PATCH 005/127] =?UTF-8?q?modify:=20#61=20`topbar.html`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A7=81=ED=81=AC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/topbar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/topbar.html b/src/main/resources/templates/main/fragment/topbar.html index 8bed08a..be88bd4 100644 --- a/src/main/resources/templates/main/fragment/topbar.html +++ b/src/main/resources/templates/main/fragment/topbar.html @@ -16,7 +16,7 @@ - + From e6aa5451b112c5128fb2e09e9310851e16703910 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 20:24:44 +0900 Subject: [PATCH 006/127] =?UTF-8?q?modify:=20#60=20`SecurityConfig`=20-=20?= =?UTF-8?q?mypage=20=EC=A3=BC=EC=86=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/t3t/frontserver/config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/t3t/frontserver/config/SecurityConfig.java b/src/main/java/com/t3t/frontserver/config/SecurityConfig.java index 7ed04c9..2e0b321 100644 --- a/src/main/java/com/t3t/frontserver/config/SecurityConfig.java +++ b/src/main/java/com/t3t/frontserver/config/SecurityConfig.java @@ -54,7 +54,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .httpBasic().disable() .authorizeRequests((auth) -> auth .antMatchers("/admin/**").hasRole("ADMIN") - .antMatchers("/myPage/**").authenticated() + .antMatchers("/mypage/**").authenticated() .antMatchers("/logout").authenticated() .antMatchers("/**").permitAll()) .addFilterAt(new GlobalTokenFilter(), SessionManagementFilter.class) From c889dfab1e5a8c70ef94270134f45f4dd0cec1af Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 21:18:20 +0900 Subject: [PATCH 007/127] =?UTF-8?q?feat:=20#60=20`MemberApiClient`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=8B=9D=EB=B3=84=EC=9E=90=EB=A1=9C=20?= =?UTF-8?q?=ED=8A=B9=EC=A0=95=20=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/client/MemberApiClient.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java index 64a6785..e552731 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java @@ -1,23 +1,39 @@ package com.t3t.frontserver.member.client; +import com.t3t.frontserver.member.model.dto.MemberDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; +import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; /** * 회원 가입 요청 API 호출을 위한 Feign Client + * * @author woody35545(구건모) */ @FeignClient(name = "MemberApiClient", url = "${t3t.feignClient.url}") public interface MemberApiClient { /** * 회원 가입 요청 API 호출 + * * @param memberRegistrationRequest 회원 가입 요청 정보 * @author woody35545(구건모) */ @PostMapping(value = "/bookstore/members") - ResponseEntity registerMember(@RequestBody MemberRegistrationRequest memberRegistrationRequest); + ResponseEntity> registerMember(@RequestBody MemberRegistrationRequest memberRegistrationRequest); + + /** + * 회원 식별자로 특정 회원 정보를 조회하는 API + * + * @param memberId 조회하려는 회원의 식별자 + * @author woody35545(구건모) + */ + @GetMapping(value = "/t3t/bookstore/members/{memberId}") + ResponseEntity> getMemberById(@PathVariable("memberId") long memberId); + } From c71a13795d973652d20254207a8752f20ebd4313 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 21:19:00 +0900 Subject: [PATCH 008/127] =?UTF-8?q?feat:=20#60=20`MemberService`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=8B=9D=EB=B3=84=EC=9E=90=EB=A1=9C=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberService.java | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberService.java b/src/main/java/com/t3t/frontserver/member/service/MemberService.java index 3c4f9b4..f70c995 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberService.java @@ -1,12 +1,19 @@ package com.t3t.frontserver.member.service; import com.t3t.frontserver.member.client.MemberApiClient; +import com.t3t.frontserver.member.exception.MemberApiClientException; +import com.t3t.frontserver.member.model.dto.MemberDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; +import com.t3t.frontserver.model.response.BaseResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import java.util.Optional; + + @Slf4j @Service @RequiredArgsConstructor @@ -15,10 +22,38 @@ public class MemberService { /** * 회원 가입 요청 + * * @param memberRegistrationRequest 회원 가입 요청 정보 * @author woody35545(구건모) */ - public MemberRegistrationResponse registerMember(MemberRegistrationRequest memberRegistrationRequest){ - return memberApiClient.registerMember(memberRegistrationRequest).getBody(); + public MemberRegistrationResponse registerMember(MemberRegistrationRequest memberRegistrationRequest) { + ResponseEntity> responseEntity = memberApiClient.registerMember(memberRegistrationRequest); + + if (!responseEntity.getStatusCode().is2xxSuccessful()) { + throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); + } + + return Optional.ofNullable(responseEntity.getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); + } + + + /** + * 회원 식별자로 특정 회원 정보를 조회 + * + * @param memberId 조회하려는 회원의 식별자 + * @author woody35545(구건모) + */ + public MemberDto getMemberById(long memberId) { + ResponseEntity> responseEntity = memberApiClient.getMemberById(memberId); + + if (!responseEntity.getStatusCode().is2xxSuccessful()) { + throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); + } + + return Optional.ofNullable(responseEntity.getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); } } From 74c6d8eca6907532ac10306ef987f2f551e1e208 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sat, 4 May 2024 21:19:20 +0900 Subject: [PATCH 009/127] =?UTF-8?q?feat:=20#60=20`MemberApiClientException?= =?UTF-8?q?`=20-=20=ED=9A=8C=EC=9B=90=20API=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=EC=8B=9C=20=EB=B0=9C=EC=83=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=98=88=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/MemberApiClientException.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/exception/MemberApiClientException.java diff --git a/src/main/java/com/t3t/frontserver/member/exception/MemberApiClientException.java b/src/main/java/com/t3t/frontserver/member/exception/MemberApiClientException.java new file mode 100644 index 0000000..9a28a1a --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/exception/MemberApiClientException.java @@ -0,0 +1,15 @@ +package com.t3t.frontserver.member.exception; + +/** + * 회원 API 호출 실패시 발생하는 예외 + * @author woody35545(구건모) + */ +public class MemberApiClientException extends RuntimeException{ + private static final String DEFAULT_MESSAGE = "회원 API 호출에 실패하였습니다."; + public MemberApiClientException(){ + super(DEFAULT_MESSAGE); + } + public MemberApiClientException(String message) { + super(message); + } +} From f0ccac3e6949785422ee66780dbb62f906a4d249 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:18:45 +0900 Subject: [PATCH 010/127] =?UTF-8?q?feat:=20#60=20`MemberInfoResponse`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=EA=B3=BC=20=EA=B4=80=EB=A0=A8=EB=90=9C=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=A2=85=ED=95=A9=EC=A0=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=8B=B4=EA=B8=B0=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=ED=81=B4=EB=9E=98=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/response/MemberInfoResponse.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/model/response/MemberInfoResponse.java diff --git a/src/main/java/com/t3t/frontserver/member/model/response/MemberInfoResponse.java b/src/main/java/com/t3t/frontserver/member/model/response/MemberInfoResponse.java new file mode 100644 index 0000000..b4ad83d --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/model/response/MemberInfoResponse.java @@ -0,0 +1,36 @@ +package com.t3t.frontserver.member.model.response; + +import com.t3t.frontserver.member.model.constant.MemberRole; +import com.t3t.frontserver.member.model.constant.MemberStatus; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 회원과 관련된 정보를 종합적으로 담기 위한 응답 클래스 + * + * @author woody35545(구건모) + */ + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberInfoResponse { + private String accountId; + private Long memberId; + private String name; + private String phone; + private String email; + private LocalDate birthDate; + private LocalDateTime latestLogin; + private Long point; + private Integer gradeId; + private String gradeName; + private MemberStatus status; + private MemberRole role; +} From 6a1142baa1e0e8257dddaccb82ba9f55e5b9a708 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:19:24 +0900 Subject: [PATCH 011/127] =?UTF-8?q?modify:=20#60=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20API=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=20=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/t3t/frontserver/member/client/MemberApiClient.java | 3 ++- .../com/t3t/frontserver/member/service/MemberService.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java index e552731..88875b3 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java @@ -2,6 +2,7 @@ import com.t3t.frontserver.member.model.dto.MemberDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; +import com.t3t.frontserver.member.model.response.MemberInfoResponse; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; @@ -34,6 +35,6 @@ public interface MemberApiClient { * @author woody35545(구건모) */ @GetMapping(value = "/t3t/bookstore/members/{memberId}") - ResponseEntity> getMemberById(@PathVariable("memberId") long memberId); + ResponseEntity> getMemberById(@PathVariable("memberId") long memberId); } diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberService.java b/src/main/java/com/t3t/frontserver/member/service/MemberService.java index f70c995..6c89a84 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberService.java @@ -2,8 +2,8 @@ import com.t3t.frontserver.member.client.MemberApiClient; import com.t3t.frontserver.member.exception.MemberApiClientException; -import com.t3t.frontserver.member.model.dto.MemberDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; +import com.t3t.frontserver.member.model.response.MemberInfoResponse; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; import com.t3t.frontserver.model.response.BaseResponse; import lombok.RequiredArgsConstructor; @@ -45,8 +45,8 @@ public MemberRegistrationResponse registerMember(MemberRegistrationRequest membe * @param memberId 조회하려는 회원의 식별자 * @author woody35545(구건모) */ - public MemberDto getMemberById(long memberId) { - ResponseEntity> responseEntity = memberApiClient.getMemberById(memberId); + public MemberInfoResponse getMemberInfoResponseById(long memberId) { + ResponseEntity> responseEntity = memberApiClient.getMemberById(memberId); if (!responseEntity.getStatusCode().is2xxSuccessful()) { throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); From 38eb8a60b4abed62f991786f08b82d00543062b1 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:30:52 +0900 Subject: [PATCH 012/127] =?UTF-8?q?feat:=20#60=20`MemberAddressDto`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=EC=97=90=20=EB=8C=80=ED=95=9C=20DTO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/model/dto/MemberAddressDto.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java diff --git a/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java b/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java new file mode 100644 index 0000000..30de702 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java @@ -0,0 +1,25 @@ +package com.t3t.frontserver.member.model.dto; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 회원 주소 정보에 대한 DTO + * + * @author woody35545(구건모) + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class MemberAddressDto { + private Long id; + private Long memberId; + private Integer addressNumber; + private String roadNameAddress; + private String addressNickname; + private String addressDetail; +} \ No newline at end of file From 8345a340caaedd45d0db781ea2501bdb37a53d20 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:31:12 +0900 Subject: [PATCH 013/127] =?UTF-8?q?feat:=20#60=20`MemberApiClient`=20-=20?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EC=8B=9D=EB=B3=84=EC=9E=90=EB=A1=9C=20?= =?UTF-8?q?=ED=8A=B9=EC=A0=95=20=ED=9A=8C=EC=9B=90=EC=9D=B4=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=ED=95=9C=20=EB=AA=A8=EB=93=A0=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=A0=95=EB=B3=B4=EB=93=A4=EC=9D=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=ED=95=98=EB=8A=94=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontserver/member/client/MemberApiClient.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java index 88875b3..35db22a 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java @@ -1,5 +1,6 @@ package com.t3t.frontserver.member.client; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; import com.t3t.frontserver.member.model.dto.MemberDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberInfoResponse; @@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * 회원 가입 요청 API 호출을 위한 Feign Client * @@ -37,4 +40,14 @@ public interface MemberApiClient { @GetMapping(value = "/t3t/bookstore/members/{memberId}") ResponseEntity> getMemberById(@PathVariable("memberId") long memberId); + /** + * 회원 식별자로 특정 회원이 등록한 모든 회원 주소 정보들을 조회하는 API + * + * @param memberId 조회하려는 회원의 식별자 + * @return 회원 주소 목록 + * @author woody35545(구건모) + */ + @GetMapping("/members/{memberId}/addresses") + ResponseEntity>> getMemberAddressListByMemberId(@PathVariable("memberId") long memberId); + } From 7c014954bad5660edb9fe0f599ce5bca5d89919a Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:32:02 +0900 Subject: [PATCH 014/127] =?UTF-8?q?feat:=20#60=20`MemberService`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=8B=9D=EB=B3=84=EC=9E=90=EB=A1=9C=20?= =?UTF-8?q?=ED=8A=B9=EC=A0=95=20=ED=9A=8C=EC=9B=90=EC=9D=B4=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=ED=95=9C=20=EB=AA=A8=EB=93=A0=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=A0=95=EB=B3=B4=EB=93=A4=EC=9D=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberService.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberService.java b/src/main/java/com/t3t/frontserver/member/service/MemberService.java index 6c89a84..10f66cf 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberService.java @@ -2,6 +2,7 @@ import com.t3t.frontserver.member.client.MemberApiClient; import com.t3t.frontserver.member.exception.MemberApiClientException; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberInfoResponse; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; @@ -11,6 +12,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Optional; @@ -56,4 +58,22 @@ public MemberInfoResponse getMemberInfoResponseById(long memberId) { .map(BaseResponse::getData) .orElseThrow(MemberApiClientException::new); } + + /** + * 회원 식별자로 특정 회원이 등록한 모든 회원 주소 정보들을 조회 + * @param memberId 조회하려는 회원의 식별자 + * @return 회원 주소 목록 + * @author woody35545(구건모) + */ + public List getMemberAddressDtoListByMemberId(long memberId) { + ResponseEntity>> responseEntity = memberApiClient.getMemberAddressListByMemberId(memberId); + + if (!responseEntity.getStatusCode().is2xxSuccessful()) { + throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); + } + + return Optional.ofNullable(responseEntity.getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); + } } From cefb945befafac7db3beb7114c50a6ba61ac55b2 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:58:41 +0900 Subject: [PATCH 015/127] =?UTF-8?q?feat:=20#60=20`MyPageInfoViewDto`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=B7=B0=EC=97=90=20=ED=95=84=EC=9A=94=ED=95=9C=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=A0=95=EC=9D=98=ED=95=9C=20DTO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/model/dto/MyPageInfoViewDto.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java diff --git a/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java new file mode 100644 index 0000000..fc796d0 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java @@ -0,0 +1,31 @@ +package com.t3t.frontserver.member.model.dto; + +import lombok.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 회원 정보 페이지 뷰에 필요한 정보를 정의한 DTO + * + * @author woody35545(구건모) + */ +@ToString +@Getter +@Builder +public class MyPageInfoViewDto { + private String accountId; + private Long memberId; + private String name; + private String phone; + private String email; + private LocalDate birthDate; + private LocalDateTime latestLogin; + private Long point; + private Integer gradeId; + private String gradeName; + private String status; + private String role; + private List addressList; +} From a68ccade0e4dac73f04d0e8b63e8a879befc4a5e Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 14:59:36 +0900 Subject: [PATCH 016/127] =?UTF-8?q?modify:=20#60=20`MemberApiClient`=20-?= =?UTF-8?q?=20uri=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EB=B6=80=EB=B6=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/t3t/frontserver/member/client/MemberApiClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java index 35db22a..b13cf1f 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java @@ -28,7 +28,7 @@ public interface MemberApiClient { * @param memberRegistrationRequest 회원 가입 요청 정보 * @author woody35545(구건모) */ - @PostMapping(value = "/bookstore/members") + @PostMapping(value = "/t3t/bookstore/members") ResponseEntity> registerMember(@RequestBody MemberRegistrationRequest memberRegistrationRequest); /** @@ -47,7 +47,7 @@ public interface MemberApiClient { * @return 회원 주소 목록 * @author woody35545(구건모) */ - @GetMapping("/members/{memberId}/addresses") + @GetMapping("/t3t/bookstore/members/{memberId}/addresses") ResponseEntity>> getMemberAddressListByMemberId(@PathVariable("memberId") long memberId); } From ea56d70e80cbd39a43820321eda55da4fb39335c Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 15:00:48 +0900 Subject: [PATCH 017/127] =?UTF-8?q?feat:=20#60=20`MyPageController`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=20=EB=B0=94=EC=9D=B8=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyPageController.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java index 1b6d231..664c6ac 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -1,13 +1,57 @@ package com.t3t.frontserver.member.controller; +import com.t3t.frontserver.auth.util.SecurityContextUtils; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.dto.MyPageInfoViewDto; +import com.t3t.frontserver.member.model.response.MemberInfoResponse; +import com.t3t.frontserver.member.service.MemberService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import java.util.List; +import java.util.stream.Collectors; + @Controller +@RequiredArgsConstructor public class MyPageController { + private final MemberService memberService; + @GetMapping("/mypage/info") - public String myPageInfoView(){ + public String myPageInfoView(Model model) { + + if (!SecurityContextUtils.isLoggedIn()) { + return "redirect:/login"; + } + + Long memberId = SecurityContextUtils.getMemberId(); + + MemberInfoResponse memberInfoResponse = memberService.getMemberInfoResponseById(memberId); + List memberAddressDtoList = memberService.getMemberAddressDtoListByMemberId(memberId); + + MyPageInfoViewDto myPageInfoViewDto = + MyPageInfoViewDto.builder() + .accountId(memberInfoResponse.getAccountId()) + .email(memberInfoResponse.getEmail()) + .name(memberInfoResponse.getName()) + .phone(memberInfoResponse.getPhone()) + .birthDate(memberInfoResponse.getBirthDate()) + .latestLogin(memberInfoResponse.getLatestLogin()) + .point(memberInfoResponse.getPoint()) + .gradeId(memberInfoResponse.getGradeId()) + .gradeName(memberInfoResponse.getGradeName()) + .status(memberInfoResponse.getStatus().name()) + .role(memberInfoResponse.getRole().name()) + .addressList(memberAddressDtoList.stream() + .map(addressDto -> addressDto.getRoadNameAddress() + " " + addressDto.getAddressDetail() + + " (" + addressDto.getAddressNickname() + ")") + .collect(Collectors.toList())) + .build(); + + model.addAttribute("myPageInfoViewDto", myPageInfoViewDto); + return "main/page/mypageInfo"; } } From 1754089e4062a541d102ba28a21ac8d5674953de Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 15:02:16 +0900 Subject: [PATCH 018/127] =?UTF-8?q?feat:=20#60=20`mypageInfo.html`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageInfo.html | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageInfo.html b/src/main/resources/templates/main/page/mypageInfo.html index 0cc0e9c..34ee0b3 100644 --- a/src/main/resources/templates/main/page/mypageInfo.html +++ b/src/main/resources/templates/main/page/mypageInfo.html @@ -11,7 +11,7 @@

회원 기본 정보

아이디 - woody1234 + 비밀번호 @@ -23,29 +23,43 @@

회원 기본 정보

변경할 비밀번호 다시 입력
- + 이메일 - woody@mail.com + 휴대폰 번호 - 010-1234-5678 + 기본 배송지
- + + + +
- + + +
From d12bbaa17d634e1787c2126e23131b634d792aa7 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:09:08 +0900 Subject: [PATCH 019/127] =?UTF-8?q?chore:=20`application.yml`=20-=20feign?= =?UTF-8?q?=20okhttp=20=EA=B4=80=EB=A0=A8=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6f5c4e6..016efe3 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,6 +15,10 @@ spring: restart: enabled: true +feign: + okhttp: + enabled: true + eureka: instance: prefer-ip-address: true From f65d962f667e8755a4e0a6be73a34418a7d5a7f1 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:10:29 +0900 Subject: [PATCH 020/127] =?UTF-8?q?feat:=20`FeignClientUtils`=20-=20FeignC?= =?UTF-8?q?lientException=20=EC=9D=B4=20=EB=B0=9C=EC=83=9D=ED=95=9C=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EC=9D=91=EB=8B=B5=20=EB=B3=B8=EB=B6=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=A9=94=EC=8B=9C=EC=A7=80=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EC=B6=9C=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=9C=A0=ED=8B=B8=EB=A6=AC=ED=8B=B0=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontserver/util/FeignClientUtils.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/util/FeignClientUtils.java diff --git a/src/main/java/com/t3t/frontserver/util/FeignClientUtils.java b/src/main/java/com/t3t/frontserver/util/FeignClientUtils.java new file mode 100644 index 0000000..92658ff --- /dev/null +++ b/src/main/java/com/t3t/frontserver/util/FeignClientUtils.java @@ -0,0 +1,31 @@ +package com.t3t.frontserver.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.FeignException; + +import java.util.Map; + +/** + * FeignClientException 이 발생한 경우 응답 본분에서 메시지를 추출하기 위한 유틸리티 클래스 + * 메시지가 없는 경우 빈 문자열을 반환한다. + * + * @author woody35545(구건모) + * @see FeignException + */ +public class FeignClientUtils { + private static ObjectMapper objectMapper = new ObjectMapper(); + + public static String getMessageFromFeignException(FeignException e) { + try { + String contentUTF8 = e.contentUTF8(); + if (contentUTF8 != null && !contentUTF8.isEmpty()) { + Map contentMap = objectMapper.readValue(contentUTF8, Map.class); + return contentMap.getOrDefault("message", ""); + } + } catch (JsonProcessingException ex) { + ex.printStackTrace(); + } + return ""; + } +} From be5da5438d57817e2413a02191e7ad5e7e1f0e30 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:13:19 +0900 Subject: [PATCH 021/127] =?UTF-8?q?feat:=20#68=20`MemberApiClient`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/client/MemberApiClient.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java index b13cf1f..7169a4f 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberApiClient.java @@ -1,17 +1,14 @@ package com.t3t.frontserver.member.client; import com.t3t.frontserver.member.model.dto.MemberAddressDto; -import com.t3t.frontserver.member.model.dto.MemberDto; +import com.t3t.frontserver.member.model.request.MemberPasswordModifyRequest; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberInfoResponse; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -50,4 +47,13 @@ public interface MemberApiClient { @GetMapping("/t3t/bookstore/members/{memberId}/addresses") ResponseEntity>> getMemberAddressListByMemberId(@PathVariable("memberId") long memberId); + /** + * 회원 비밀번호 변경 API + * + * @param memberId 회원 식별자 + * @param request 비밀번호 변경 요청 정보 + * @author woody35545(구건모) + */ + @PatchMapping("/t3t/bookstore/members/{memberId}") + ResponseEntity> modifyMemberPassword(@PathVariable("memberId") long memberId, @RequestBody MemberPasswordModifyRequest request); } From ba6adf53140b72b2cbb4198cb58b4d024f4799f6 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:13:48 +0900 Subject: [PATCH 022/127] =?UTF-8?q?feat:=20#68=20`MemberPasswordModifyRequ?= =?UTF-8?q?est`=20-=20=ED=9A=8C=EC=9B=90=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=88=98=EC=A0=95=20=EC=9A=94=EC=B2=AD=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/MemberPasswordModifyRequest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/model/request/MemberPasswordModifyRequest.java diff --git a/src/main/java/com/t3t/frontserver/member/model/request/MemberPasswordModifyRequest.java b/src/main/java/com/t3t/frontserver/member/model/request/MemberPasswordModifyRequest.java new file mode 100644 index 0000000..4bbd436 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/model/request/MemberPasswordModifyRequest.java @@ -0,0 +1,21 @@ +package com.t3t.frontserver.member.model.request; + +import lombok.*; + +import javax.validation.constraints.NotBlank; + +/** + * 회원 비밀번호 수정 요청 객체 + * + * @author woody35545(구건모) + */ +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class MemberPasswordModifyRequest { + @NotBlank(message = "현재 비밀번호가 누락되었습니다.") + private String currentPassword; + @NotBlank(message = "새로운 비밀번호가 누락되었습니다.") + private String newPassword; +} \ No newline at end of file From 159d28accb9c2cae5cf61d221afb632a3514e677 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:14:57 +0900 Subject: [PATCH 023/127] =?UTF-8?q?feat:=20#68=20`MemberAdaptor`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/adaptor/MemberAdaptor.java | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/adaptor/MemberAdaptor.java diff --git a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAdaptor.java b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAdaptor.java new file mode 100644 index 0000000..dccb76d --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAdaptor.java @@ -0,0 +1,90 @@ +package com.t3t.frontserver.member.adaptor; + +import com.t3t.frontserver.member.client.MemberApiClient; +import com.t3t.frontserver.member.exception.MemberApiClientException; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberPasswordModifyRequest; +import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; +import com.t3t.frontserver.member.model.response.MemberInfoResponse; +import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.util.FeignClientUtils; +import feign.FeignException; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +@Component +@RequiredArgsConstructor +public class MemberAdaptor { + private final MemberApiClient memberApiClient; + + /** + * 회원 가입 요청 + * + * @param memberRegistrationRequest 회원 가입 요청 정보 + * @author woody35545(구건모) + */ + public MemberRegistrationResponse registerMember(MemberRegistrationRequest memberRegistrationRequest) { + try { + return Optional.ofNullable(memberApiClient.registerMember(memberRegistrationRequest).getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); + } catch (FeignException e) { + throw new MemberApiClientException("회원 가입에 실패하였습니다. " + FeignClientUtils.getMessageFromFeignException(e)); + } + } + + + /** + * 회원 식별자로 특정 회원 정보를 조회 + * + * @param memberId 조회하려는 회원의 식별자 + * @author woody35545(구건모) + */ + public MemberInfoResponse getMemberInfoResponseById(long memberId) { + try { + return Optional.ofNullable(memberApiClient.getMemberById(memberId).getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); + } catch (FeignException e) { + throw new MemberApiClientException("회원 정보 조회에 실패하였습니다. " + FeignClientUtils.getMessageFromFeignException(e)); + } + } + + /** + * 회원 식별자로 특정 회원이 등록한 모든 회원 주소 정보들을 조회 + * + * @param memberId 조회하려는 회원의 식별자 + * @return 회원 주소 목록 + * @author woody35545(구건모) + */ + public List getMemberAddressDtoListByMemberId(long memberId) { + try { + return Optional.ofNullable(memberApiClient.getMemberAddressListByMemberId(memberId).getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberApiClientException::new); + } catch (FeignException e) { + throw new MemberApiClientException("회원 주소 목록 조회에 실패하였습니다. " + FeignClientUtils.getMessageFromFeignException(e)); + } + } + + /** + * 회원 비밀번호 변경 + * + * @param memberId 회원 식별자 + * @param request 비밀번호 변경 요청 정보 + * @autor woody35545(구건모) + */ + public void modifyPassword(long memberId, MemberPasswordModifyRequest request) { + try { + memberApiClient.modifyMemberPassword(memberId, request); + } catch (FeignException e) { + throw new MemberApiClientException("비밀번호 변경에 실패하였습니다. " + FeignClientUtils.getMessageFromFeignException(e)); + } + } + +} From b0cb28d2f2df82a6833d14e26db0f7cdc5b9e834 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:16:09 +0900 Subject: [PATCH 024/127] =?UTF-8?q?feat:=20#68=20`MemberService`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberService.java | 50 +++++++------------ 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberService.java b/src/main/java/com/t3t/frontserver/member/service/MemberService.java index 10f66cf..25ef1f8 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberService.java @@ -1,26 +1,24 @@ package com.t3t.frontserver.member.service; -import com.t3t.frontserver.member.client.MemberApiClient; -import com.t3t.frontserver.member.exception.MemberApiClientException; +import com.t3t.frontserver.member.adaptor.MemberAdaptor; import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberPasswordModifyRequest; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.model.response.MemberInfoResponse; import com.t3t.frontserver.member.model.response.MemberRegistrationResponse; -import com.t3t.frontserver.model.response.BaseResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.util.List; -import java.util.Optional; @Slf4j @Service @RequiredArgsConstructor public class MemberService { - private final MemberApiClient memberApiClient; + + private final MemberAdaptor memberAdaptor; /** * 회원 가입 요청 @@ -29,15 +27,7 @@ public class MemberService { * @author woody35545(구건모) */ public MemberRegistrationResponse registerMember(MemberRegistrationRequest memberRegistrationRequest) { - ResponseEntity> responseEntity = memberApiClient.registerMember(memberRegistrationRequest); - - if (!responseEntity.getStatusCode().is2xxSuccessful()) { - throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); - } - - return Optional.ofNullable(responseEntity.getBody()) - .map(BaseResponse::getData) - .orElseThrow(MemberApiClientException::new); + return memberAdaptor.registerMember(memberRegistrationRequest); } @@ -48,32 +38,28 @@ public MemberRegistrationResponse registerMember(MemberRegistrationRequest membe * @author woody35545(구건모) */ public MemberInfoResponse getMemberInfoResponseById(long memberId) { - ResponseEntity> responseEntity = memberApiClient.getMemberById(memberId); - - if (!responseEntity.getStatusCode().is2xxSuccessful()) { - throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); - } - - return Optional.ofNullable(responseEntity.getBody()) - .map(BaseResponse::getData) - .orElseThrow(MemberApiClientException::new); + return memberAdaptor.getMemberInfoResponseById(memberId); } /** * 회원 식별자로 특정 회원이 등록한 모든 회원 주소 정보들을 조회 + * * @param memberId 조회하려는 회원의 식별자 * @return 회원 주소 목록 * @author woody35545(구건모) */ public List getMemberAddressDtoListByMemberId(long memberId) { - ResponseEntity>> responseEntity = memberApiClient.getMemberAddressListByMemberId(memberId); - - if (!responseEntity.getStatusCode().is2xxSuccessful()) { - throw new MemberApiClientException("status code => " + responseEntity.getStatusCodeValue()); - } + return memberAdaptor.getMemberAddressDtoListByMemberId(memberId); + } - return Optional.ofNullable(responseEntity.getBody()) - .map(BaseResponse::getData) - .orElseThrow(MemberApiClientException::new); + /** + * 회원 비밀번호 변경 + * + * @param memberId 회원 식별자 + * @param request 비밀번호 변경 요청 정보 + * @author woody35545(구건모) + */ + public void modifyPassword(long memberId, MemberPasswordModifyRequest request) { + memberAdaptor.modifyPassword(memberId, request); } } From a669cb0af6089ea6381a18c7be278a523a414217 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:16:39 +0900 Subject: [PATCH 025/127] =?UTF-8?q?feat:=20`MessageController`=20-=20?= =?UTF-8?q?=EC=95=8C=EB=A6=BC=20=EB=A9=94=EC=8B=9C=EC=A7=80=EB=A5=BC=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20=EB=B7=B0=20=EB=A7=B5?= =?UTF-8?q?=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/controller/MessageController.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/message/controller/MessageController.java diff --git a/src/main/java/com/t3t/frontserver/message/controller/MessageController.java b/src/main/java/com/t3t/frontserver/message/controller/MessageController.java new file mode 100644 index 0000000..31d9502 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/message/controller/MessageController.java @@ -0,0 +1,18 @@ +package com.t3t.frontserver.message.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Controller +public class MessageController { + + @GetMapping("/message") + public String messageView(@RequestParam("message") String message, Model model) { + + model.addAttribute("message", message); + + return "main/page/message"; + } +} From 55bb538386d72f9c039b8612b0a5a0a6106cf1e9 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:33:25 +0900 Subject: [PATCH 026/127] =?UTF-8?q?modify:=20`GlobalExceptionHandler`=20-?= =?UTF-8?q?=20=EC=98=88=EC=99=B8=20=EB=B0=9C=EC=83=9D=EC=8B=9C=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=EB=B7=B0=EB=A1=9C=20=EB=A6=AC=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EB=A0=89=ED=8A=B8=20=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/exception/GlobalExceptionHandler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java index a11988a..2d536f4 100644 --- a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java @@ -1,14 +1,20 @@ package com.t3t.frontserver.common.exception; +import com.t3t.frontserver.member.client.MemberApiClient; +import com.t3t.frontserver.member.exception.MemberApiClientException; +import feign.FeignException; +import lombok.extern.slf4j.Slf4j; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +@Slf4j @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) - public String handleException(Model model, Exception e){ - model.addAttribute("message", e.getMessage()); - return "main/page/message"; + public String handleException(RedirectAttributes redirectAttributes, Exception e){ + redirectAttributes.addAttribute("message", e.getMessage()); + return "redirect:/message"; } } From ba550c2ae1449414bc002c866c96a205a1d28c33 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:34:20 +0900 Subject: [PATCH 027/127] =?UTF-8?q?chore:=20`feign=20okhttp`=20dependency?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index dc845b0..57a5d78 100644 --- a/pom.xml +++ b/pom.xml @@ -110,6 +110,10 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity5 + + io.github.openfeign + feign-okhttp + From 301da91277da83f1deba37868d4e3f9f996a6a03 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:35:20 +0900 Subject: [PATCH 028/127] =?UTF-8?q?feat:=20#68=20`MemberController`=20-=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=ED=95=98=EB=8A=94=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EB=A7=B5=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MemberController.java | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MemberController.java b/src/main/java/com/t3t/frontserver/member/controller/MemberController.java index 0384751..6bc96cf 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MemberController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MemberController.java @@ -1,14 +1,22 @@ package com.t3t.frontserver.member.controller; +import com.t3t.frontserver.auth.util.SecurityContextUtils; +import com.t3t.frontserver.member.model.request.MemberPasswordModifyRequest; import com.t3t.frontserver.member.model.request.MemberRegistrationRequest; import com.t3t.frontserver.member.service.MemberService; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.validation.Valid; +@Slf4j @Controller @RequiredArgsConstructor public class MemberController { @@ -16,6 +24,7 @@ public class MemberController { /** * 회원 가입 페이지 뷰 반환 + * * @return 회원 가입 뷰 * @author woody35545(구건모) */ @@ -27,13 +36,45 @@ public String registerView(Model model) { /** * 회원 가입 요청 처리 + * * @return 성공 또는 실패 뷰 * @author woody35545(구건모) */ @PostMapping("/member/register") - public String register(Model model, @Valid @ModelAttribute MemberRegistrationRequest memberRegistrationRequest) { + public String register(RedirectAttributes redirectAttributes, @Valid @ModelAttribute MemberRegistrationRequest memberRegistrationRequest) { memberService.registerMember(memberRegistrationRequest); - model.addAttribute("message", "회원가입이 완료되었습니다."); - return "main/page/message"; + redirectAttributes.addAttribute("message", "회원가입이 완료되었습니다."); + return "redirect:/message"; + } + + /** + * 비밀번호 변경 처리 + * + * @author woody35545(구건모) + */ + @PostMapping("/member/password") + public String modifyPassword(RedirectAttributes redirectAttributes, + @RequestParam("currentPassword") String currentPassword, + @RequestParam("newPassword") String newPassword, + @RequestParam("confirmNewPassword") String confirmNewPassword) { + + if (!SecurityContextUtils.isLoggedIn()) { + redirectAttributes.addAttribute("message", "로그인이 필요합니다."); + return "redirect:/message"; + } + + if (!newPassword.equals(confirmNewPassword)) { + redirectAttributes.addAttribute("message", "변경할 비밀번호가 일치하지 않습니다."); + return "redirect:/message"; + } + + MemberPasswordModifyRequest request = MemberPasswordModifyRequest.builder() + .currentPassword(currentPassword) + .newPassword(newPassword) + .build(); + + memberService.modifyPassword(SecurityContextUtils.getMemberId(), request); + redirectAttributes.addAttribute("message", "비밀번호가 변경되었습니다."); + return "redirect:/message"; } } From 10562b5ce392345c04f092b6f25ca543fda68900 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Sun, 5 May 2024 21:36:08 +0900 Subject: [PATCH 029/127] =?UTF-8?q?feat:=20#68=20`mypageInfo.html`=20-=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EB=B0=8F=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageInfo.html | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageInfo.html b/src/main/resources/templates/main/page/mypageInfo.html index 34ee0b3..81f78a9 100644 --- a/src/main/resources/templates/main/page/mypageInfo.html +++ b/src/main/resources/templates/main/page/mypageInfo.html @@ -11,19 +11,28 @@

회원 기본 정보

아이디 - + 비밀번호 - 현재 비밀번호 - - 변경할 비밀번호 - - 변경할 비밀번호 다시 입력 -
+
+ 현재 비밀번호 + + 변경할 비밀번호 + + 변경할 비밀번호 다시 입력 +
+ - + + + +
@@ -67,5 +76,31 @@

회원 기본 정보

+ From 44ed567368f1c33381bbe80426432509ba04869c Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 00:05:39 +0900 Subject: [PATCH 030/127] =?UTF-8?q?feat=20:=20#39=20=EB=A9=80=ED=8B=B0?= =?UTF-8?q?=ED=8C=8C=ED=8A=B8=20=ED=8F=BC=20=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=A0=84=EC=86=A1=ED=95=98=EB=8A=94=20BookFormApiC?= =?UTF-8?q?lient=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/client/BookApiClient.java | 9 +----- .../book/client/BookFormApiClient.java | 30 +++++++++++++++++++ .../frontserver/config/FormConfiguration.java | 22 ++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/t3t/frontserver/book/client/BookFormApiClient.java create mode 100644 src/main/java/com/t3t/frontserver/config/FormConfiguration.java diff --git a/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java b/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java index 126bc72..e24c485 100644 --- a/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java +++ b/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java @@ -1,20 +1,13 @@ package com.t3t.frontserver.book.client; -import com.t3t.frontserver.book.model.request.BookRegisterRequest; import com.t3t.frontserver.book.model.response.BookDetailResponse; import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; @FeignClient(name = "bookAdaptor", url = "${t3t.feignClient.url}") public interface BookApiClient { @GetMapping(value = "/t3t/bookstore/books/{bookId}") ResponseEntity> getBook(@PathVariable Long bookId); - -// @PostMapping(value = "/t3t/bookstore/books") -// ResponseEntity> createBook(@RequestBody BookRegisterRequest request); } \ No newline at end of file diff --git a/src/main/java/com/t3t/frontserver/book/client/BookFormApiClient.java b/src/main/java/com/t3t/frontserver/book/client/BookFormApiClient.java new file mode 100644 index 0000000..f96945f --- /dev/null +++ b/src/main/java/com/t3t/frontserver/book/client/BookFormApiClient.java @@ -0,0 +1,30 @@ +package com.t3t.frontserver.book.client; + +import com.t3t.frontserver.book.model.request.BookRegisterRequest; +import com.t3t.frontserver.config.FormConfiguration; +import com.t3t.frontserver.model.response.BaseResponse; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * Feign을 사용하여 멀티파트 폼 데이터를 전송하는 BookFormApiClient 인터페이스 + * 이 인터페이스는 Feign을 사용하여 원격 서버에 HTTP 요청을 보내고, BookRegisterRequest 객체를 멀티파트 폼 데이터로 전송함 + * @author Yujin-nKim(김유진) + */ +@FeignClient(name = "test", url = "${t3t.feignClient.url}", configuration = FormConfiguration.class) +public interface BookFormApiClient { + + /** + * 새 책을 생성하는 POST 요청 + * 요청 바디에는 BookRegisterRequest 객체가 멀티파트 폼 데이터로 전송됨 + * + * @param request 책을 등록하기 위한 요청 객체 + * @return 책 생성 요청에 대한 응답 + * @author Yujin-nKim(김유진) + */ + @PostMapping(value = "/t3t/bookstore/books", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + ResponseEntity> createBook(@ModelAttribute BookRegisterRequest request); +} \ No newline at end of file diff --git a/src/main/java/com/t3t/frontserver/config/FormConfiguration.java b/src/main/java/com/t3t/frontserver/config/FormConfiguration.java new file mode 100644 index 0000000..08547c6 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/config/FormConfiguration.java @@ -0,0 +1,22 @@ +package com.t3t.frontserver.config; + +import feign.codec.Encoder; +import feign.form.spring.SpringFormEncoder; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.cloud.openfeign.support.SpringEncoder; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; + +public class FormConfiguration { + + /** + * 멀티파트 폼 인코더 빈을 생성하고 구성함 + * 이 인코더는 Feign 클라이언트를 사용하여 요청을 할 때 멀티파트 폼 데이터를 인코딩하는 역할을 담당 + * @return 구성된 멀티파트 폼 인코더 + * @author Yujin-nKim(김유진) + */ + @Bean + public Encoder multipartFormEncoder() { + return new SpringFormEncoder(new SpringEncoder(() -> new HttpMessageConverters(new RestTemplate().getMessageConverters()))); + } +} \ No newline at end of file From 971ed6b76601d768c3e6ad854c91fb7c5dfddcf5 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 00:07:58 +0900 Subject: [PATCH 031/127] =?UTF-8?q?feat=20:=20#39=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=9A=94=EC=B2=AD=20Controller=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/AdminBookController.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java b/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java index 775cc5a..204378e 100644 --- a/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java +++ b/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java @@ -1,14 +1,17 @@ package com.t3t.frontserver.book.controller; import com.t3t.frontserver.book.client.BookApiClient; +import com.t3t.frontserver.book.client.BookFormApiClient; import com.t3t.frontserver.book.model.request.BookRegisterRequest; import com.t3t.frontserver.model.response.BaseResponse; +import feign.FeignException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Slf4j @RequiredArgsConstructor @@ -17,6 +20,7 @@ public class AdminBookController { private final BookApiClient bookApiClient; + private final BookFormApiClient bookFormApiClient; /** * 도서 등록 페이지를 요청 @@ -37,9 +41,23 @@ public String getRegisterBookAdminPage(Model model) { * @author Yujin-nKim(김유진) */ @PostMapping - public String createBook(@ModelAttribute("bookRegisterRequest") BookRegisterRequest request) { - log.info(request.toString()); -// ResponseEntity> response = bookApiClient.createBook(request); - return "admin/page/registerBook"; + public String createBook(@ModelAttribute(value = "bookRegisterRequest") BookRegisterRequest request, RedirectAttributes redirectAttributes) { + + log.info("도서 등록 요청 = {}", request.toString()); + + try { + ResponseEntity> response = bookFormApiClient.createBook(request); + + Long bookId = response.getBody().getData(); + String message = response.getBody().getMessage(); + redirectAttributes.addFlashAttribute("successMessage", message + "\n저장된 도서 Id : " + bookId); + return "redirect:/admin/books/new"; + + } catch (FeignException e) { + log.error(e.getMessage()); + redirectAttributes.addFlashAttribute("bookRegisterRequest", request); + redirectAttributes.addFlashAttribute("errorMessage", "도서 등록에 실패했습니다."); + return "redirect:/admin/books/new"; + } } } From 33f2d8ddfa71a7d7b69b0345516f5cdc4f423a52 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 00:08:48 +0900 Subject: [PATCH 032/127] =?UTF-8?q?fix=20:=20#39=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=9A=94=EC=B2=AD=20request=20dto=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../t3t/frontserver/book/model/dto/ParticipantMapDto.java | 3 +-- .../frontserver/book/model/request/BookRegisterRequest.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/book/model/dto/ParticipantMapDto.java b/src/main/java/com/t3t/frontserver/book/model/dto/ParticipantMapDto.java index 076d22c..c51aa96 100644 --- a/src/main/java/com/t3t/frontserver/book/model/dto/ParticipantMapDto.java +++ b/src/main/java/com/t3t/frontserver/book/model/dto/ParticipantMapDto.java @@ -10,10 +10,9 @@ * @author Yujin-nKim(김유진) */ @Data -@ToString @NoArgsConstructor @AllArgsConstructor public class ParticipantMapDto { - private Integer participantId; // 도서 참여자 id + private Long participantId; // 도서 참여자 id private Integer participantRoleId; // 도서 참여자 역할 id } diff --git a/src/main/java/com/t3t/frontserver/book/model/request/BookRegisterRequest.java b/src/main/java/com/t3t/frontserver/book/model/request/BookRegisterRequest.java index f750d31..671c023 100644 --- a/src/main/java/com/t3t/frontserver/book/model/request/BookRegisterRequest.java +++ b/src/main/java/com/t3t/frontserver/book/model/request/BookRegisterRequest.java @@ -7,6 +7,7 @@ import javax.validation.constraints.*; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.List; /** @@ -14,7 +15,6 @@ * @author Yujin-nKim(김유진) */ @Data -@ToString public class BookRegisterRequest { @NotBlank(message = "도서 제목을 입력해주세요.") private String bookTitle; // 도서 제목 @@ -48,7 +48,7 @@ public class BookRegisterRequest { private String bookDesc; // 도서 설명 @NotNull(message = "출판사 ID를 입력해주세요.") - private Integer publisherId; // 출판사 id + private Long publisherId; // 출판사 id @NotEmpty(message = "도서 참여자를 선택해주세요.") private List participantMapList; // 도서 참여자 - 참여자 역할 선택 리스트 @@ -62,5 +62,5 @@ public class BookRegisterRequest { private List categoryList; // 카테고리 id 리스트 @NotEmpty(message = "태그를 선택해주세요.") - private List tagList; // 태그 id 리스트 + private List tagList; // 태그 id 리스트 } From 9f480c76d6afb02f5a932529aada8ec2412e9b6a Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 00:10:20 +0900 Subject: [PATCH 033/127] =?UTF-8?q?feat=20:=20#39=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=9A=94=EC=B2=AD=20=EC=84=B1=EA=B3=B5=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20alert?= =?UTF-8?q?=EC=B0=BD=20=EB=9D=84=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/assets/admin/js/adminBook.js | 4 ---- .../templates/admin/page/registerBook.html | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/resources/static/assets/admin/js/adminBook.js b/src/main/resources/static/assets/admin/js/adminBook.js index 512d0b3..f91f561 100644 --- a/src/main/resources/static/assets/admin/js/adminBook.js +++ b/src/main/resources/static/assets/admin/js/adminBook.js @@ -104,10 +104,6 @@ document.addEventListener("DOMContentLoaded", function() { this.appendChild(tagInput); }, this); - // TODO : API 연동 후에 제거 - alert("성공") - event.preventDefault(); - return; }); /** diff --git a/src/main/resources/templates/admin/page/registerBook.html b/src/main/resources/templates/admin/page/registerBook.html index 203bed1..5b62087 100644 --- a/src/main/resources/templates/admin/page/registerBook.html +++ b/src/main/resources/templates/admin/page/registerBook.html @@ -11,6 +11,19 @@
+ +
도서 등록하기
@@ -20,7 +33,7 @@
도서 등록하기
- +
From d7a3dd0ec47745e84a3dc47d2f8b5ecd92ae5c71 Mon Sep 17 00:00:00 2001 From: parkjonggyeong18 Date: Mon, 6 May 2024 10:56:42 +0900 Subject: [PATCH 034/127] =?UTF-8?q?feat:=20#30=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EA=B2=80=EC=83=89=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elastic/adaptor/ElasticAdaptor.java | 13 ++- .../elastic/controller/ElasticController.java | 18 ++-- .../model/response/ElasticResponse.java | 1 + .../templates/main/fragment/searchbar.html | 16 +++- .../templates/main/page/elasticSearch.html | 86 +++++++++---------- 5 files changed, 81 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java b/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java index 5b63236..9211b0c 100644 --- a/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java +++ b/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java @@ -12,12 +12,23 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; +import java.math.BigDecimal; + @FeignClient(name = "ElasticAdaptor", url = "${t3t.feignClient.url}") public interface ElasticAdaptor { - @GetMapping("/t3t/bookstore/search") + /**\ + * + * @param query + * @param searchType + * @param pageNo + * @param sortBy + * @return + */ + @GetMapping("/search") ResponseEntity>> getSearchPage(@RequestParam String query, @RequestParam String searchType, @RequestParam int pageNo, + @RequestParam(value = "categoryId",required = false) BigDecimal categoryId, @RequestParam(value = "sortBy", defaultValue = "_score", required = false) String sortBy); } diff --git a/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java b/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java index f4db05a..7c737c7 100644 --- a/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java +++ b/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java @@ -15,6 +15,8 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; + import static com.t3t.frontserver.util.ServiceUtils.handleResponse; @Controller @@ -25,11 +27,12 @@ public class ElasticController { @GetMapping("/search") public String searchBooks(@RequestParam(value = "query") String query, @RequestParam("searchType") String searchType, + @RequestParam(value = "categoryId",required = false) BigDecimal categoryId, @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, @RequestParam(value = "sortBy", defaultValue = "_score", required = false) String sortBy, Model model) { - PageResponse bookList = getSearchPageAdaptor(query, searchType, pageNo, sortBy); + PageResponse bookList = getSearchPageAdaptor(query, searchType, pageNo, categoryId, sortBy); if (bookList != null) { int blockLimit = 3; @@ -41,21 +44,24 @@ public String searchBooks(@RequestParam(value = "query") String query, model.addAttribute("startPage", startPage); model.addAttribute("endPage", endPage); model.addAttribute("bookList", bookList.getContent()); - model.addAttribute("query",query); //페이징을 위한 검색어 - model.addAttribute("searchType",searchType);//페이징을 위한 검색유형 - model.addAttribute("sortBy",sortBy); //정렬 방식을 위한 객체 + model.addAttribute("query", query); //페이징을 위한 검색어 + model.addAttribute("searchType", searchType);//페이징을 위한 검색유형 + model.addAttribute("sortBy", sortBy); //정렬 방식을 위한 객체 + if (categoryId != null) { + model.addAttribute("categoryId", categoryId); + } } - return "main/page/elasticSearch"; } private PageResponse getSearchPageAdaptor(String query, String searchType, int pageNo, + BigDecimal categoryId, String sortBy) { ResponseEntity>> elasticResponse - = elasticAdaptor.getSearchPage(query, searchType, pageNo, sortBy); + = elasticAdaptor.getSearchPage(query, searchType, pageNo, categoryId, sortBy); return handleResponse(elasticResponse); } diff --git a/src/main/java/com/t3t/frontserver/elastic/model/response/ElasticResponse.java b/src/main/java/com/t3t/frontserver/elastic/model/response/ElasticResponse.java index 7315d8d..6f6aec8 100644 --- a/src/main/java/com/t3t/frontserver/elastic/model/response/ElasticResponse.java +++ b/src/main/java/com/t3t/frontserver/elastic/model/response/ElasticResponse.java @@ -23,6 +23,7 @@ public class ElasticResponse { private String coverImageUrl;//썸네일 private String authorName;//참여자 private String authorRole;//참여자 역할 + private BigDecimal categoryId; private float score; //유사도 점수 private long count; //검색한 책의 수 } diff --git a/src/main/resources/templates/main/fragment/searchbar.html b/src/main/resources/templates/main/fragment/searchbar.html index 5e8e0f0..5ab042b 100644 --- a/src/main/resources/templates/main/fragment/searchbar.html +++ b/src/main/resources/templates/main/fragment/searchbar.html @@ -40,9 +40,8 @@
찾고 싶으신 도서가 있으신가요?
+ - - @@ -51,8 +50,20 @@
찾고 싶으신 도서가 있으신가요?
document.addEventListener('DOMContentLoaded', function() { updateSearchTypeDisplay(); updateSearchQueryDisplay(); + updateCategoryIdFromURL(); // 이 함수를 호출하여 categoryId를 설정 }); + function updateCategoryIdFromURL() { + const path = window.location.pathname; + const categoryPattern = /\/category\/(\d+)/; // '/category/' 다음에 오는 숫자를 찾는 정규 표현식 + const match = path.match(categoryPattern); + + if (match && match[1]) { + document.getElementById('categoryIdInput').value = match[1]; + } else { + document.getElementById('categoryIdInput').parentNode.removeChild(document.getElementById('categoryIdInput')); + } + } function setSearchType(type) { var typeNames = { 'all': '통합검색', @@ -63,7 +74,6 @@
찾고 싶으신 도서가 있으신가요?
document.getElementById('searchTypeInput').value = type; document.getElementById('dropdownMenuButton').textContent = typeNames[type]; } - function updateSearchTypeDisplay() { var searchParams = new URLSearchParams(window.location.search); var currentType = searchParams.get('searchType') || 'all'; diff --git a/src/main/resources/templates/main/page/elasticSearch.html b/src/main/resources/templates/main/page/elasticSearch.html index 5f9d704..b63f73d 100644 --- a/src/main/resources/templates/main/page/elasticSearch.html +++ b/src/main/resources/templates/main/page/elasticSearch.html @@ -32,51 +32,51 @@

-
-

검색 결과가 없습니다..

-
- -
-
-
- -
- ... - ... -
-
-
- -

도서 제목 :

-
-
- +
+

검색 결과가 없습니다..

+
+ +
+
+
+ +
+ ... + ... +
+
+
+ +

도서 제목 :

+
+
+ $45 - % OFF - $40.00 - - - $40.00 - -
-

출판 일시 :

-

출판사 :

-

평균 평점 :

-

좋아요 수 :

+ % OFF + $40.00 + + + $40.00 +
+

출판 일시 :

+

출판사 :

+

평균 평점 :

+

좋아요 수 :

-
+
+
@@ -84,7 +84,7 @@

검색 결과가 없습니다..

  • @@ -92,14 +92,14 @@

    검색 결과가 없습니다..

  • + th:href="@{|/search?query=${query}&searchType=${searchType}&sortBy=${sortBy}&pageNo=${page - 1}${(categoryId != null) ? ('&categoryId=' + categoryId) : ''}|}" + th:text="${page}">
  • + th:href="@{|/search?query=${query}&searchType=${searchType}&sortBy=${sortBy}&pageNo=${pageNo}${(categoryId != null) ? ('&categoryId=' + categoryId) : ''}|}" + aria-label="Next">
  • From 25b31989ed7125fc80bbb3d611f070b4d9911785 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 14:57:29 +0900 Subject: [PATCH 035/127] =?UTF-8?q?feat:=20#60=20`mypageSidebar.html`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?,=20=EC=A3=BC=EC=86=8C=20=EA=B4=80=EB=A6=AC=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/mypageSidebar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/main/fragment/mypageSidebar.html b/src/main/resources/templates/main/fragment/mypageSidebar.html index 9ccffce..1cc7d21 100644 --- a/src/main/resources/templates/main/fragment/mypageSidebar.html +++ b/src/main/resources/templates/main/fragment/mypageSidebar.html @@ -9,10 +9,10 @@

    회원 정보

    • - 기본 정보 관리 + 기본 정보 관리
    • - 회원 주소 관리 + 회원 주소 관리
    • 회원 등급 From 8b2f7145102a964f0c125ff7d8e7a81f3b078de5 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 15:10:57 +0900 Subject: [PATCH 036/127] =?UTF-8?q?update:=20#69=20`MemberAddressDto`=20-?= =?UTF-8?q?=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC=EC=86=8C=20=EC=97=AC=EB=B6=80?= =?UTF-8?q?=20=EA=B4=80=EB=A0=A8=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/t3t/frontserver/member/model/dto/MemberAddressDto.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java b/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java index 30de702..d0b3c8b 100644 --- a/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java +++ b/src/main/java/com/t3t/frontserver/member/model/dto/MemberAddressDto.java @@ -22,4 +22,5 @@ public class MemberAddressDto { private String roadNameAddress; private String addressNickname; private String addressDetail; + private Boolean isDefaultAddress; } \ No newline at end of file From 15ba625223ef82e9ce654cc5d7e05a1bfec4385d Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 17:02:27 +0900 Subject: [PATCH 037/127] =?UTF-8?q?feat=20:=20#70=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20view=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/admin/fragment/sidebar.html | 2 +- .../templates/admin/page/bookList.html | 111 ++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/templates/admin/page/bookList.html diff --git a/src/main/resources/templates/admin/fragment/sidebar.html b/src/main/resources/templates/admin/fragment/sidebar.html index 94fda00..ca6e720 100644 --- a/src/main/resources/templates/admin/fragment/sidebar.html +++ b/src/main/resources/templates/admin/fragment/sidebar.html @@ -8,7 +8,7 @@
+ + \ No newline at end of file From 1fdf47e22d8f670bffb2883008bcb16855f4f4ab Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:16:54 +0900 Subject: [PATCH 045/127] =?UTF-8?q?feat=20:=20#72=20`MemberAddressCreation?= =?UTF-8?q?Request`=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=9A=94=EC=B2=AD=20=EA=B0=9D=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/MemberAddressCreationRequest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/model/request/MemberAddressCreationRequest.java diff --git a/src/main/java/com/t3t/frontserver/member/model/request/MemberAddressCreationRequest.java b/src/main/java/com/t3t/frontserver/member/model/request/MemberAddressCreationRequest.java new file mode 100644 index 0000000..8cba7c8 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/model/request/MemberAddressCreationRequest.java @@ -0,0 +1,31 @@ +package com.t3t.frontserver.member.model.request; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 회원 주소 생성 요청 객체 + * + * @author woody35545(구건모) + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class MemberAddressCreationRequest { + @NotNull(message = "회원 식별자가 누락되었습니다.") + private Long memberId; + @NotNull(message = "우편 주소가 누락되었습니다.") + private Integer addressNumber; + @NotBlank(message = "도로명 주소가 누락되었습니다.") + private String roadNameAddress; + @NotBlank(message = "주소 별칭이 누락되었습니다.") + private String addressNickname; + @NotBlank(message = "상세 주소가 누락되었습니다.") + private String addressDetail; +} From 0b055ac9b533acbcdc38aa9dbcafe3f3b0474a55 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:17:11 +0900 Subject: [PATCH 046/127] =?UTF-8?q?feat:=20#72=20`MemberAddressApiClient`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/client/MemberAddressApiClient.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java new file mode 100644 index 0000000..38cadf9 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java @@ -0,0 +1,21 @@ +package com.t3t.frontserver.member.client; + +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberAddressCreationRequest; +import com.t3t.frontserver.model.response.BaseResponse; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@FeignClient(name = "MemberAddressApiClient", url = "${t3t.feignClient.url}") +public interface MemberAddressApiClient { + /** + * 회원 주소 등록 API + * + * @author woody35545(구건모) + */ + @PostMapping("/t3t/bookstore/member-addresses") + ResponseEntity> createMemberAddress(@RequestBody MemberAddressCreationRequest request); + +} From 4446d7107bee284d93007be23728e77e378d6163 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:17:29 +0900 Subject: [PATCH 047/127] =?UTF-8?q?feat:=20#72=20`MemberAddressApiClientEx?= =?UTF-8?q?ception`=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20API=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EC=8B=A4=ED=8C=A8=EC=8B=9C=20=EB=B0=9C?= =?UTF-8?q?=EC=83=9D=ED=95=98=EB=8A=94=20=EC=98=88=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MemberAddressApiClientException.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/exception/MemberAddressApiClientException.java diff --git a/src/main/java/com/t3t/frontserver/member/exception/MemberAddressApiClientException.java b/src/main/java/com/t3t/frontserver/member/exception/MemberAddressApiClientException.java new file mode 100644 index 0000000..4f5b82f --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/exception/MemberAddressApiClientException.java @@ -0,0 +1,21 @@ +package com.t3t.frontserver.member.exception; + + +/** + * 회원 주소 API 호출 실패시 발생하는 예외 + * + * @author woody35545(구건모) + */ +public class MemberAddressApiClientException extends RuntimeException { + + private static final String DEFAULT_MESSAGE = "회원 주소 API 호출에 실패하였습니다."; + + public MemberAddressApiClientException() { + super(DEFAULT_MESSAGE); + } + + public MemberAddressApiClientException(String reason) { + super(DEFAULT_MESSAGE + " " + reason); + } + +} From dcea250efeaa4118d6c90aa42ddcdb0b803fe852 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:18:04 +0900 Subject: [PATCH 048/127] =?UTF-8?q?feat:=20#72=20`MemberAddressAdaptor`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/adaptor/MemberAddressAdaptor.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java diff --git a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java new file mode 100644 index 0000000..98fdaa4 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java @@ -0,0 +1,34 @@ +package com.t3t.frontserver.member.adaptor; + +import com.t3t.frontserver.member.client.MemberAddressApiClient; +import com.t3t.frontserver.member.exception.MemberAddressApiClientException; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberAddressCreationRequest; +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.util.FeignClientUtils; +import feign.FeignException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +@Component +@RequiredArgsConstructor +public class MemberAddressAdaptor { + private final MemberAddressApiClient memberAddressApiClient; + + /** + * 회원 주소 생성 + * + * @author woody35545(구건모) + */ + public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request) { + try { + return Optional.ofNullable(memberAddressApiClient.createMemberAddress(request).getBody()) + .map(BaseResponse::getData) + .orElseThrow(MemberAddressApiClientException::new); + } catch (FeignException e) { + throw new MemberAddressApiClientException(FeignClientUtils.getMessageFromFeignException(e)); + } + } +} From f3278298aaddaf67c69b3cd86cb2162f3616fbe1 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:18:21 +0900 Subject: [PATCH 049/127] =?UTF-8?q?feat:=20#72=20`MemberAddressService`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberAddressService.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java new file mode 100644 index 0000000..485ab3b --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java @@ -0,0 +1,24 @@ +package com.t3t.frontserver.member.service; + +import com.t3t.frontserver.member.adaptor.MemberAddressAdaptor; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberAddressCreationRequest; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class MemberAddressService { + private final MemberAddressAdaptor memberAddressAdaptor; + + /** + * 회원 주소 생성 + * + * @param request + */ + public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request) { + return memberAddressAdaptor.createMemberAddress(request); + } +} From 2127ce1e4b832e31472a14fda3d1ed43eaa8f92b Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:19:52 +0900 Subject: [PATCH 050/127] =?UTF-8?q?feat:=20#72=20`MemberAddressController`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9A=94=EC=B2=AD=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MemberAddressController.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java diff --git a/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java new file mode 100644 index 0000000..128591e --- /dev/null +++ b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java @@ -0,0 +1,50 @@ +package com.t3t.frontserver.member.controller; + +import com.t3t.frontserver.auth.util.SecurityContextUtils; +import com.t3t.frontserver.member.model.dto.MemberAddressDto; +import com.t3t.frontserver.member.model.request.MemberAddressCreationRequest; +import com.t3t.frontserver.member.service.MemberAddressService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Slf4j +@Controller +@RequiredArgsConstructor +public class MemberAddressController { + + private final MemberAddressService memberAddressService; + + /** + * 회원 주소 등록 요청 처리 + * + * @author woody35545(구건모) + */ + @PostMapping("/member-addresses") + public String createMemberAddress(@RequestParam("roadNameAddress") String roadNameAddress, + @RequestParam("addressDetail") String addressDetail, + @RequestParam("addressNumber") Integer addressNumber, + @RequestParam("addressNickname") String addressNickname) { + + if (!SecurityContextUtils.isLoggedIn()) { + return "redirect:/login"; + } + + MemberAddressCreationRequest request = + MemberAddressCreationRequest.builder() + .memberId(SecurityContextUtils.getMemberId()) + .roadNameAddress(roadNameAddress) + .addressDetail(addressDetail) + .addressNumber(addressNumber) + .addressNickname(addressNickname) + .build(); + + MemberAddressDto memberAddressDto = memberAddressService.createMemberAddress(request); + + log.info("memberAddressDto => {}", memberAddressDto); + + return "redirect:/mypage/address"; + } +} From 6d56f143cefd949c1d492027adc82a2b5286563f Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 22:29:29 +0900 Subject: [PATCH 051/127] =?UTF-8?q?modify:=20#60=20`mypageAddress.html`=20?= =?UTF-8?q?-=20=EC=9D=BC=EB=B6=80=20=EB=A0=8C=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/main/page/mypageAddress.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageAddress.html b/src/main/resources/templates/main/page/mypageAddress.html index 7799fcc..34962a3 100644 --- a/src/main/resources/templates/main/page/mypageAddress.html +++ b/src/main/resources/templates/main/page/mypageAddress.html @@ -75,8 +75,7 @@

주소 등록

등록된 주소

@@ -103,12 +102,12 @@

기본 주소 설정

- - - - From c5d8db6b29b16cad8634b86fd8fdd4fef2a56421 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 22:36:39 +0900 Subject: [PATCH 052/127] =?UTF-8?q?feat=20:=20#144=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EA=B4=80=EB=A6=AC=EC=9E=90=20view=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/admin/js/adminBook.js | 12 ++ .../static/assets/admin/js/modifyBook.js | 162 ++++++++++++++++++ .../templates/admin/page/editBook.html | 156 +++++++++++++++++ 3 files changed, 330 insertions(+) create mode 100644 src/main/resources/static/assets/admin/js/modifyBook.js create mode 100644 src/main/resources/templates/admin/page/editBook.html diff --git a/src/main/resources/static/assets/admin/js/adminBook.js b/src/main/resources/static/assets/admin/js/adminBook.js index f91f561..93ec268 100644 --- a/src/main/resources/static/assets/admin/js/adminBook.js +++ b/src/main/resources/static/assets/admin/js/adminBook.js @@ -14,6 +14,18 @@ var bookDescEditor = new toastui.Editor({ height: '500px', }); +var indexViewer = new toastui.Editor.factory({ + el: document.querySelector('#indexViewer'), + viewer: true, + initialValue: document.querySelector('#indexViewer').getAttribute('value') +}); + +var descViewer = new toastui.Editor.factory({ + el: document.querySelector('#descViewer'), + viewer: true, + initialValue: document.querySelector('#descViewer').getAttribute('value') +}); + /* * 문서가 로드되었을 때 실행되는 이벤트 핸들러 diff --git a/src/main/resources/static/assets/admin/js/modifyBook.js b/src/main/resources/static/assets/admin/js/modifyBook.js new file mode 100644 index 0000000..4a916f3 --- /dev/null +++ b/src/main/resources/static/assets/admin/js/modifyBook.js @@ -0,0 +1,162 @@ +document.addEventListener("DOMContentLoaded", function() { + var bookModifyForm = document.getElementsByName('BookDetailModifyForm')[0]; + + // 변경 전 값 + var beforeTitle = document.getElementById('beforeTitle').textContent; + var beforeIndex = document.querySelector('#indexViewer').getAttribute('value'); + var beforeDesc = document.querySelector('#descViewer').getAttribute('value'); + var beforeIsbn = document.getElementById('beforeIsbn').textContent; + var beforePrice = document.getElementById('beforePrice').textContent; + var beforeDiscountRate = document.getElementById('beforeDiscountRate').textContent; + var beforePackagingAvailableStatus = document.getElementById('beforePackagingAvailableStatus').getAttribute('value'); + var beforePublished = document.getElementById('beforePublished').textContent; + var beforeStock = document.getElementById('beforeStock').textContent; + + // input 값 + var titleInput = document.getElementById('bookTitle'); + var isbnInput = document.getElementById('bookIsbn'); + var priceInput = document.getElementById('bookPrice'); + var discountRateInput = document.getElementById('bookDiscountRate'); + var publishedInput = document.getElementById('bookPublished'); + var stockInput = document.getElementById('bookStock'); + + // validation message를 표시할 div 영역 + var titleValidationMessage = document.getElementById('titleValidationMessage'); + var isbnValidationMessage = document.getElementById('isbnValidationMessage'); + var priceValidationMessage = document.getElementById('priceValidationMessage'); + var discountRateValidationMessage = document.getElementById('discountRateValidationMessage'); + + // form의 submit 버튼 클릭시 입력값 유효성 검사 후 폼에 데이터 추가해서 전송 + bookModifyForm.addEventListener('submit', function(event) { + + // 폼 유효성 검사 + var isFormValid = isTitleValid() && isIsbnValid() && isPriceValid() && isDiscountRateValid(); + + // 유효성 검사 통과 시 폼을 제출 + if (!isFormValid) { + event.preventDefault(); + return; + } + + // 값이 변경되었다면 변경된 값을, 변경되지 않았다면 변경 이전의 값을 담음 + titleInput.value = titleInput.value === '' ? beforeTitle : titleInput.value; + isbnInput.value = isbnInput.value === '' ? beforeIsbn : isbnInput.value; + priceInput.value = priceInput.value === '' ? beforePrice : priceInput.value; + discountRateInput.value = discountRateInput.value === '' ? beforeDiscountRate : discountRateInput.value; + publishedInput.value = publishedInput.value === '' ? beforePublished : publishedInput.value; + stockInput.value = stockInput.value === '' ? beforeStock : stockInput.value; + + var selectedValue = getSelectedRadioValue(); // 포장 여부 + var bookIndexInput = bookIndexEditor.getMarkdown().trim() === '' ? beforeIndex : bookIndexEditor.getMarkdown(); // 도서 목차 + var bookDescInput = bookDescEditor.getMarkdown().trim() === '' ? beforeDesc : bookDescEditor.getMarkdown(); // 도서 설명 + + /** + * 주어진 부모 요소에 hidden input 요소를 추가하는 함수 + * @param {HTMLElement} parent - hidden input 요소를 추가할 부모 요소 + * @param {string} id - hidden input 요소의 id 속성 값 + * @param {string} name - hidden input 요소의 name 속성 값 + * @param {string} value - hidden input 요소의 value 속성 값 + * @author Yujin-nKim(김유진) + */ + function addHiddenInput(parent, id, name, value) { + var hiddenInput = document.createElement('input'); + hiddenInput.type = 'hidden'; + hiddenInput.id = id; + hiddenInput.name = name; + hiddenInput.value = value; + parent.appendChild(hiddenInput); + } + + // 폼 데이터 추가 + addHiddenInput(this, 'packagingAvailableStatus', 'packagingAvailableStatus', selectedValue); + addHiddenInput(this, 'bookIndex', 'bookIndex', bookIndexInput); + addHiddenInput(this, 'bookDesc', 'bookDesc', bookDescInput); + + }); + + /** + * 라디오 버튼 중 선택된 값을 반환하는 함수 + * @returns {string|null} 선택된 라디오 버튼의 값 + * @author Yujin-nKim(김유진) + */ + function getSelectedRadioValue() { + // 선택된 라디오 버튼 요소 가져오기 + var selectedRadioButton = document.querySelector('input[name="gridRadios"]:checked'); + // 선택된 값이 있다면 해당 값 반환, 없다면 기존값 반환 + return selectedRadioButton ? selectedRadioButton.value : beforePackagingAvailableStatus; + } + + /** + * 도서 제목 입력값의 유효성을 검사하고 결과를 반환 + * @returns {boolean} - 도서 제목의 유효성 여부 + * @author Yujin-nKim(김유진) + */ + function isTitleValid() { + var title = titleInput.value.trim(); + if (title !== '' && title.length > 255) { + titleValidationMessage.textContent = "도서 제목은 255자 이하여야 합니다."; + titleValidationMessage.style.color = "red"; + return false; + } else { + titleValidationMessage.textContent = ""; + return true; + } + } + + /** + * 도서 ISBN 입력값의 유효성을 검사하고 결과를 반환 + * @returns {boolean} - ISBN의 유효성 여부 + * @author Yujin-nKim(김유진) + */ + function isIsbnValid() { + var isbn = isbnInput.value.trim(); + // ISBN이 숫자로 이루어진 13자리의 숫자인지 확인 + if (isbn !== '' && !/^\d{13}$/.test(isbn)) { + isbnValidationMessage.textContent = "숫자로만 이루어진 13자리 숫자이어야 합니다."; + isbnValidationMessage.style.color = "red"; + return false; + } else { + isbnValidationMessage.textContent = ""; + return true; + } + } + + /** + * 도서 정가 입력값의 유효성을 검사하고 결과를 반환 + * @returns {boolean} - 도서 정가의 유효성 여부 + * @author Yujin-nKim(김유진) + */ + function isPriceValid() { + var price = priceInput.value.trim(); + // 입력값이 숫자로 이루어져 있는지 확인하는 정규표현식 + var regex = /^\d+$/; + if (price !== '' && !regex.test(price) || parseInt(price) < 0) { + priceValidationMessage.textContent = "올바른 도서 정가를 입력해주세요."; + priceValidationMessage.style.color = "red"; + return false; + } else { + priceValidationMessage.textContent = ""; + return true; + } + } + + /** + * 도서 할인율 입력값의 유효성을 검사하고 결과를 반환 + * @returns {boolean} - 도서 할인율의 유효성 여부 + * @author Yujin-nKim(김유진) + */ + function isDiscountRateValid() { + var discountRate = discountRateInput.value.trim(); + // 입력값이 숫자로 이루어져 있는지 확인하는 정규표현식 + var regex = /^\d+$/; + // 숫자로만 이루어져 있고 1 이상 99 이하의 값인지 확인 + if (discountRate !== '' && !regex.test(discountRate) || parseInt(discountRate) < 1 || parseInt(discountRate) > 99) { + discountRateValidationMessage.textContent = "할인율은 숫자로 이루어진 1 이상 99 이하의 정수값이어야 합니다."; + discountRateValidationMessage.style.color = "red"; + return false; + } else { + discountRateValidationMessage.textContent = ""; + return true; + } + } +}); \ No newline at end of file diff --git a/src/main/resources/templates/admin/page/editBook.html b/src/main/resources/templates/admin/page/editBook.html new file mode 100644 index 0000000..bfa6a32 --- /dev/null +++ b/src/main/resources/templates/admin/page/editBook.html @@ -0,0 +1,156 @@ + + + + + + + + + +
+ + +
도서 수정하기
+ +
+ +
+ +
+
+
+ +
+
+
+ + +
+ +
+
+
+
+
+
+ + +
+ +
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+
+ + +
+ +
+
+ +
+
+
+
+ + +
+ +
+
+ +
+
+
+
+ + +
+ 포장 가능 여부 선택 +
+ +
포장 가능
+
포장 불가능
+
수정할 값을 선택해주세요.
+
+ + +
+
+ + +
+
+
+
+ + +
+ +
+
+
수정할 값을 선택해주세요.
+ +
+
+
+ + +
+ +
+
+ +
+
+
+ +
+ +
+ +
+
+
+
+ +
+ + + + + + + +
+ \ No newline at end of file From 7f9e87a2490eb649a41411cb4ae5fea8e8496301 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 22:42:51 +0900 Subject: [PATCH 053/127] =?UTF-8?q?feat=20:=20#144=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=88=98=EC=A0=95=20api=20client=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/client/BookApiClient.java | 14 ++++++ .../request/ModifyBookDetailRequest.java | 46 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/main/java/com/t3t/frontserver/book/model/request/ModifyBookDetailRequest.java diff --git a/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java b/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java index 1a07386..d88255a 100644 --- a/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java +++ b/src/main/java/com/t3t/frontserver/book/client/BookApiClient.java @@ -1,5 +1,6 @@ package com.t3t.frontserver.book.client; +import com.t3t.frontserver.book.model.request.ModifyBookDetailRequest; import com.t3t.frontserver.book.model.response.BookDetailResponse; import com.t3t.frontserver.book.model.response.BookListResponse; import com.t3t.frontserver.model.response.BaseResponse; @@ -8,6 +9,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; + @FeignClient(name = "bookApiClient", url = "${t3t.feignClient.url}") public interface BookApiClient { @GetMapping(value = "/t3t/bookstore/books/{bookId}") @@ -22,4 +25,15 @@ public interface BookApiClient { */ @GetMapping(value = "/t3t/bookstore/books") ResponseEntity>> getAllBooks(@RequestParam int pageNo, @RequestParam int pageSize); + + /** + * 특정 도서의 상세 정보를 수정 + * @param bookId 수정할 도서의 식별자 + * @param request 수정할 도서의 상세 정보를 담은 요청 객체 + * @return 200 OK, 성공 메세지 + * @author Yujin-nKim(김유진) + */ + @PutMapping(value = "/t3t/bookstore/books/{bookId}/book-detail") + ResponseEntity> updateBookDetail(@PathVariable Long bookId, + @RequestBody @Valid ModifyBookDetailRequest request); } \ No newline at end of file diff --git a/src/main/java/com/t3t/frontserver/book/model/request/ModifyBookDetailRequest.java b/src/main/java/com/t3t/frontserver/book/model/request/ModifyBookDetailRequest.java new file mode 100644 index 0000000..d542a03 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/book/model/request/ModifyBookDetailRequest.java @@ -0,0 +1,46 @@ +package com.t3t.frontserver.book.model.request; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 도서 수정 요청을 나타내는 객체 + * @author Yujin-nKim(김유진) + */ +@Data +public class ModifyBookDetailRequest { + @NotBlank(message = "도서 제목을 입력해주세요.") + private String bookTitle; // 도서 제목 + + @NotBlank(message = "도서 ISBN을 입력해주세요.") + private String bookIsbn; // 도서 isbn + + @NotNull(message = "도서 가격을 입력해주세요.") + @DecimalMin(value = "0.0", message = "도서 가격은 0 이상이어야 합니다.") + private BigDecimal bookPrice; // 도서 정가 + + @DecimalMin(value = "0.0", message = "도서 할인율은 0 이상이어야 합니다.") + @DecimalMax(value = "99.99", message = "도서 할인율은 100 미만이여야 합니다.") + private BigDecimal bookDiscountRate; // 도서 할인율 + + @NotNull(message = "포장 가능 여부를 입력해주세요.") + private Integer packagingAvailableStatus; // 포장 가능 여부 + + @NotNull(message = "도서 출판일을 입력해주세요.") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate bookPublished; // 도서 출판일 + + @NotNull(message = "도서 재고를 입력해주세요.") + @Min(value = 0, message = "도서 재고는 0 이상이어야 합니다.") + private Integer bookStock; // 재고 + + @NotBlank + private String bookIndex; // 도서 목차 + + @NotBlank + private String bookDesc; // 도서 설명 +} From a3495616a7b57196cd0d8c4dec85e1e9df9b1ee2 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Mon, 6 May 2024 22:59:16 +0900 Subject: [PATCH 054/127] =?UTF-8?q?feat=20:=20#144=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=88=98=EC=A0=95=20Controller=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/AdminBookController.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java b/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java index 34d890a..471576c 100644 --- a/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java +++ b/src/main/java/com/t3t/frontserver/book/controller/AdminBookController.java @@ -3,6 +3,8 @@ import com.t3t.frontserver.book.client.BookApiClient; import com.t3t.frontserver.book.client.BookFormApiClient; import com.t3t.frontserver.book.model.request.BookRegisterRequest; +import com.t3t.frontserver.book.model.request.ModifyBookDetailRequest; +import com.t3t.frontserver.book.model.response.BookDetailResponse; import com.t3t.frontserver.book.model.response.BookListResponse; import com.t3t.frontserver.model.response.BaseResponse; import com.t3t.frontserver.model.response.PageResponse; @@ -50,13 +52,31 @@ public String getBookListAdminPage(Model model, model.addAttribute("nowPage", nowPage); model.addAttribute("startPage", startPage); - model.addAttribute("endPage2", endPage); + model.addAttribute("endPage", endPage); model.addAttribute("bookList", bookList.getContent()); } } return "admin/page/bookList"; } + /** + * 도서 수정 페이지를 요청 + * @param model 데이터를 뷰에 전달하기 위한 Model 객체 + * @param bookId 수정할 책의 ID + * @return 도서 수정 페이지 반환 + * @author Yujin-nKim(김유진) + */ + @GetMapping("/{bookId}/edit") + public String getEditBookAdminPage(Model model, @PathVariable Long bookId) { + + ResponseEntity> response = bookApiClient.getBook(bookId); + + model.addAttribute("bookDetail", response.getBody().getData()); + model.addAttribute("modifyBookDetailRequest", new ModifyBookDetailRequest()); + + return "admin/page/editBook"; + } + /** * 도서 등록 페이지를 요청 * @param model 데이터를 뷰에 전달하기 위한 Model 객체 @@ -95,4 +115,19 @@ public String createBook(@ModelAttribute(value = "bookRegisterRequest") BookRegi return "redirect:/admin/books/new"; } } + + @PostMapping("/{bookId}/edit") + public String updateBookDetail(@PathVariable Long bookId, @ModelAttribute(value = "modifyBookDetailRequest") ModifyBookDetailRequest request, RedirectAttributes redirectAttributes) { + + log.info("도서 상세 정보 수정 요청 = {}", request.toString()); + + try { + ResponseEntity> response = bookApiClient.updateBookDetail(bookId, request); + redirectAttributes.addFlashAttribute("bookDetailModifySuccess", response.getBody().getMessage()); + } catch (FeignException e) { + log.error(e.getMessage()); + redirectAttributes.addFlashAttribute("bookDetailModifyError", "도서 상세 정보 수정에 실패했습니다."); + } + return "redirect:/admin/books/"+bookId+"/edit"; + } } From 38604fbe03bdb784142917d20c63d7e3067da40e Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:15:52 +0900 Subject: [PATCH 055/127] =?UTF-8?q?update:=20#69=20`MyPageAddressViewDto`?= =?UTF-8?q?=20-=20=EC=83=81=EC=84=B8=20=EC=A3=BC=EC=86=8C=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../t3t/frontserver/member/model/dto/MyPageAddressViewDto.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/t3t/frontserver/member/model/dto/MyPageAddressViewDto.java b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageAddressViewDto.java index f3603e4..a9002c4 100644 --- a/src/main/java/com/t3t/frontserver/member/model/dto/MyPageAddressViewDto.java +++ b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageAddressViewDto.java @@ -27,6 +27,7 @@ public class MyPageAddressViewDto { public static class MemberAddressInfo { private Long id; // MemberAddress 식별자 private String roadNameAddress; // 도로명 주소 + private String addressDetail; // 상세 주소 private String nickName; // 주소 별칭 private Boolean isDefault; // 기본 주소 여부 } From 16d5cd0832735a9ef56cddbd913f0e9fb35f60b9 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:16:26 +0900 Subject: [PATCH 056/127] =?UTF-8?q?update:=20#69=20`MyPageController`=20-?= =?UTF-8?q?=20=EC=83=81=EC=84=B8=20=EC=A3=BC=EC=86=8C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EA=B3=BC=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/t3t/frontserver/member/controller/MyPageController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java index a476655..7c6f3fc 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -75,6 +75,7 @@ public String myPageAddressView(Model model) { .map(memberAddressDto -> MyPageAddressViewDto.MemberAddressInfo.builder() .id(memberAddressDto.getId()) .roadNameAddress(memberAddressDto.getRoadNameAddress()) + .addressDetail(memberAddressDto.getAddressDetail()) .nickName(memberAddressDto.getAddressNickname()) .isDefault(memberAddressDto.getIsDefaultAddress()) .build()) @@ -87,6 +88,7 @@ public String myPageAddressView(Model model) { .map(addressDto -> MyPageAddressViewDto.MemberAddressInfo.builder() .id(addressDto.getId()) .roadNameAddress(addressDto.getRoadNameAddress()) + .addressDetail(addressDto.getAddressDetail()) .nickName(addressDto.getAddressNickname()) .isDefault(addressDto.getIsDefaultAddress()) .build()) From 28a8b38e7ca03d0aa2ad3d38772944a037bd0af7 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:17:20 +0900 Subject: [PATCH 057/127] =?UTF-8?q?feat:=20#73=20`MemberAddressApiClient`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EB=B3=80=EA=B2=BD=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/client/MemberAddressApiClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java index 38cadf9..e57d4f4 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java @@ -5,6 +5,8 @@ import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -18,4 +20,12 @@ public interface MemberAddressApiClient { @PostMapping("/t3t/bookstore/member-addresses") ResponseEntity> createMemberAddress(@RequestBody MemberAddressCreationRequest request); + /** + * 기본 주소 설정 및 변경 API + * + * @param memberAddressId 변경할 회원 주소 식별자 + * @author woody35545(구건모) + */ + @PatchMapping("/t3t/bookstore/member-addresses/{memberAddressId}/default") + BaseResponse modifyDefaultAddress(@PathVariable("memberAddressId") long memberAddressId); } From e31c64618c73a55655883c6409eba2b7661149a2 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:17:49 +0900 Subject: [PATCH 058/127] =?UTF-8?q?feat:=20#73=20`MemberAddressAdaptor`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/adaptor/MemberAddressAdaptor.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java index 98fdaa4..e174727 100644 --- a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java +++ b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java @@ -31,4 +31,17 @@ public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request throw new MemberAddressApiClientException(FeignClientUtils.getMessageFromFeignException(e)); } } + + /** + * 회원 기본 주소 설정 및 변경 + * @param memberAddressId 변경하려는 회원 주소 식별자 + * @author woody35545(구건모) + */ + public void modifyDefaultAddress(long memberAddressId) { + try { + memberAddressApiClient.modifyDefaultAddress(memberAddressId); + } catch (FeignException e) { + throw new MemberAddressApiClientException(FeignClientUtils.getMessageFromFeignException(e)); + } + } } From 37ebdd5fbaaaf301f68e9b7c171e3b7a4eb7f3fa Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:18:06 +0900 Subject: [PATCH 059/127] =?UTF-8?q?feat:=20#73=20`MemberAddressService`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberAddressService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java index 485ab3b..9fe8e90 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java @@ -21,4 +21,14 @@ public class MemberAddressService { public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request) { return memberAddressAdaptor.createMemberAddress(request); } + + /** + * 회원 기본 주소 설정 및 변경 + * + * @param memberAddressId 변경하려는 회원 주소 식별자 + * @author woody35545(구건모) + */ + public void modifyDefaultAddress(long memberAddressId) { + memberAddressAdaptor.modifyDefaultAddress(memberAddressId); + } } From 6c1359b5fbdb7fa40f80b9d2815f0cbf114a8f7b Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:18:34 +0900 Subject: [PATCH 060/127] =?UTF-8?q?feat:=20#73=20`MemberAddressController`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EC=9A=94=EC=B2=AD=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MemberAddressController.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java index 128591e..400108b 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -47,4 +48,21 @@ public String createMemberAddress(@RequestParam("roadNameAddress") String roadNa return "redirect:/mypage/address"; } + + /** + * 회원 기본 주소 설정 및 변경 요청 처리 + */ + @PostMapping("/member-addresses/default") + public String modifyDefaultAddress(@RequestParam("memberAddressId") Long memberAddressId) { + + if (!SecurityContextUtils.isLoggedIn()) { + return "redirect:/login"; + } + + log.info("memberAddressId => {}", memberAddressId); + memberAddressService.modifyDefaultAddress(memberAddressId); + + return "redirect:/mypage/address"; + } + } From c31bbddaf05f18772527d59c750e379e348b64d8 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:18:51 +0900 Subject: [PATCH 061/127] =?UTF-8?q?feat:=20#73=20`mypageAddress.html`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EA=B8=B0=EB=B3=B8=20=EC=A3=BC=EC=86=8C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageAddress.html | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageAddress.html b/src/main/resources/templates/main/page/mypageAddress.html index 34962a3..a3ac7e6 100644 --- a/src/main/resources/templates/main/page/mypageAddress.html +++ b/src/main/resources/templates/main/page/mypageAddress.html @@ -79,10 +79,10 @@

등록된 주소

등록된 주소가 없습니다.
-
    +
    • - +
      @@ -96,36 +96,39 @@

      기본 주소 설정

      -
      +
      +
      +
      - + - - + - + - + - + +
      +
      From ce08f8c3e535f71c09cf1af6aa6851eb39e0153a Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:33:06 +0900 Subject: [PATCH 062/127] =?UTF-8?q?modify:=20`mypageInfo.html`=20-=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EB=B0=B0=EC=86=A1=EC=A7=80=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EB=B7=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageInfo.html | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageInfo.html b/src/main/resources/templates/main/page/mypageInfo.html index 8972f72..20afc3c 100644 --- a/src/main/resources/templates/main/page/mypageInfo.html +++ b/src/main/resources/templates/main/page/mypageInfo.html @@ -49,28 +49,17 @@

      회원 기본 정보

      - + 설정된 기본 주소가 없습니다. - -
      -
      - + + + 기본주소 관리 -
      +
      From 28a2ab7780492d475d65f4f594d8165a8192e263 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:33:43 +0900 Subject: [PATCH 063/127] =?UTF-8?q?modify:=20#69=20`MyPageInfoViewDto`=20-?= =?UTF-8?q?=20=EC=A3=BC=EC=86=8C=20=EA=B4=80=EB=A0=A8=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/model/dto/MyPageInfoViewDto.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java index fc796d0..1df0984 100644 --- a/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java +++ b/src/main/java/com/t3t/frontserver/member/model/dto/MyPageInfoViewDto.java @@ -27,5 +27,16 @@ public class MyPageInfoViewDto { private String gradeName; private String status; private String role; - private List addressList; + private MemberAddressInfo defaultMemberAddressInfo; + private List memberAddressList; + + @Getter + @Builder + public static class MemberAddressInfo { + private Long id; // MemberAddress 식별자 + private String roadNameAddress; // 도로명 주소 + private String addressDetail; // 상세 주소 + private String nickName; // 주소 별칭 + private Boolean isDefault; // 기본 주소 여부 + } } From f7a4813da032eb0da492867562e25e4c87c685fa Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:34:13 +0900 Subject: [PATCH 064/127] =?UTF-8?q?modify:=20#69=20`MyPageController`=20-?= =?UTF-8?q?=20=EC=A3=BC=EC=86=8C=20=EC=A1=B0=ED=9A=8C=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyPageController.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java index 7c6f3fc..64b7a08 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -45,9 +45,25 @@ public String myPageInfoView(Model model) { .gradeName(memberInfoResponse.getGradeName()) .status(memberInfoResponse.getStatus().name()) .role(memberInfoResponse.getRole().name()) - .addressList(memberAddressDtoList.stream() - .map(addressDto -> addressDto.getRoadNameAddress() + " " + addressDto.getAddressDetail() - + " (" + addressDto.getAddressNickname() + ")") + .defaultMemberAddressInfo(memberAddressDtoList.stream() + .filter(MemberAddressDto::getIsDefaultAddress) + .map(memberAddressDto -> MyPageInfoViewDto.MemberAddressInfo.builder() + .id(memberAddressDto.getId()) + .roadNameAddress(memberAddressDto.getRoadNameAddress()) + .addressDetail(memberAddressDto.getAddressDetail()) + .nickName(memberAddressDto.getAddressNickname()) + .isDefault(memberAddressDto.getIsDefaultAddress()) + .build()) + .findFirst() + .orElse(null)) + .memberAddressList(memberAddressDtoList.stream() + .map(addressDto -> MyPageInfoViewDto.MemberAddressInfo.builder() + .id(addressDto.getId()) + .roadNameAddress(addressDto.getRoadNameAddress()) + .addressDetail(addressDto.getAddressDetail()) + .nickName(addressDto.getAddressNickname()) + .isDefault(addressDto.getIsDefaultAddress()) + .build()) .collect(Collectors.toList())) .build(); From 4d76f48ed3042ae0a08b7394cf1208b0fd8d201f Mon Sep 17 00:00:00 2001 From: woody35545 Date: Mon, 6 May 2024 23:34:43 +0900 Subject: [PATCH 065/127] =?UTF-8?q?modify:=20`mypageAddress.html`=20-=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EA=B4=80=EB=A6=AC=20=EB=B7=B0=20=EA=B0=84?= =?UTF-8?q?=EA=B2=A9=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/page/mypageAddress.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageAddress.html b/src/main/resources/templates/main/page/mypageAddress.html index a3ac7e6..98296d4 100644 --- a/src/main/resources/templates/main/page/mypageAddress.html +++ b/src/main/resources/templates/main/page/mypageAddress.html @@ -68,10 +68,9 @@

      주소 등록

-
-
+ -
+

등록된 주소

등록된 주소

+

기본 주소 설정

-
- + From 3d541f88995246778dc2012665960f0f88d804d3 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:15:57 +0900 Subject: [PATCH 067/127] =?UTF-8?q?chore:=20`application.yml`=20-=20hidden?= =?UTF-8?q?=20method=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 016efe3..5314b30 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -14,7 +14,10 @@ spring: devtools: restart: enabled: true - + mvc: + hiddenmethod: + filter: + enabled: true feign: okhttp: enabled: true From 1d91a54423da2dcc7abd3c1780062d7e8657ee8d Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:16:37 +0900 Subject: [PATCH 068/127] =?UTF-8?q?feat:=20#74=20`MemberAddressApiClient`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/client/MemberAddressApiClient.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java index e57d4f4..1139a28 100644 --- a/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java +++ b/src/main/java/com/t3t/frontserver/member/client/MemberAddressApiClient.java @@ -5,10 +5,7 @@ import com.t3t.frontserver.model.response.BaseResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; @FeignClient(name = "MemberAddressApiClient", url = "${t3t.feignClient.url}") public interface MemberAddressApiClient { @@ -28,4 +25,13 @@ public interface MemberAddressApiClient { */ @PatchMapping("/t3t/bookstore/member-addresses/{memberAddressId}/default") BaseResponse modifyDefaultAddress(@PathVariable("memberAddressId") long memberAddressId); + + /** + * 회원 주소 삭제 API + * + * @param memberAddressId 삭제할 회원 주소 식별자 + * @author woody35545(구건모) + */ + @DeleteMapping("/t3t/bookstore/member-addresses/{memberAddressId}") + ResponseEntity> deleteMemberAddress(@PathVariable("memberAddressId") long memberAddressId); } From dc3d6e235980f7cf2b9449f0b7cbb23ecdddb2ad Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:16:57 +0900 Subject: [PATCH 069/127] =?UTF-8?q?feat:=20#74=20`MemberAddressAdaptor`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/adaptor/MemberAddressAdaptor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java index e174727..1c2e638 100644 --- a/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java +++ b/src/main/java/com/t3t/frontserver/member/adaptor/MemberAddressAdaptor.java @@ -34,6 +34,7 @@ public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request /** * 회원 기본 주소 설정 및 변경 + * * @param memberAddressId 변경하려는 회원 주소 식별자 * @author woody35545(구건모) */ @@ -44,4 +45,18 @@ public void modifyDefaultAddress(long memberAddressId) { throw new MemberAddressApiClientException(FeignClientUtils.getMessageFromFeignException(e)); } } + + /** + * 회원 주소 삭제 + * + * @param memberAddressId 삭제하려는 회원 주소 식별자 + * @author woody35545(구건모) + */ + public void deleteMemberAddress(long memberAddressId) { + try { + memberAddressApiClient.deleteMemberAddress(memberAddressId); + } catch (FeignException e) { + throw new MemberAddressApiClientException(FeignClientUtils.getMessageFromFeignException(e)); + } + } } From b6df30c5ee274f560029c9281ff51f38835a5cee Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:17:11 +0900 Subject: [PATCH 070/127] =?UTF-8?q?feat:=20#74=20`MemberAddressService`=20?= =?UTF-8?q?-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberAddressService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java index 9fe8e90..4f3b443 100644 --- a/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java +++ b/src/main/java/com/t3t/frontserver/member/service/MemberAddressService.java @@ -31,4 +31,14 @@ public MemberAddressDto createMemberAddress(MemberAddressCreationRequest request public void modifyDefaultAddress(long memberAddressId) { memberAddressAdaptor.modifyDefaultAddress(memberAddressId); } + + /** + * 회원 주소 삭제 + * + * @param memberAddressId 삭제하려는 회원 주소 식별자 + * @author woody35545(구건모) + */ + public void deleteMemberAddress(long memberAddressId) { + memberAddressAdaptor.deleteMemberAddress(memberAddressId); + } } From 90ff870da4dd235dee289523189830369de46c14 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:17:31 +0900 Subject: [PATCH 071/127] =?UTF-8?q?feat:=20#74=20`MemberAddressController`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=9A=94=EC=B2=AD=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MemberAddressController.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java index 400108b..a1074f7 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MemberAddressController.java @@ -7,9 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; @Slf4j @Controller @@ -52,7 +50,7 @@ public String createMemberAddress(@RequestParam("roadNameAddress") String roadNa /** * 회원 기본 주소 설정 및 변경 요청 처리 */ - @PostMapping("/member-addresses/default") + @PatchMapping("/member-addresses/default") public String modifyDefaultAddress(@RequestParam("memberAddressId") Long memberAddressId) { if (!SecurityContextUtils.isLoggedIn()) { @@ -65,4 +63,19 @@ public String modifyDefaultAddress(@RequestParam("memberAddressId") Long memberA return "redirect:/mypage/address"; } + /** + * 회원 주소 삭제 요청 처리 + */ + @DeleteMapping("/member-addresses") + public String deleteMemberAddress(@RequestParam("memberAddressId") Long memberAddressId) { + + if (!SecurityContextUtils.isLoggedIn()) { + return "redirect:/login"; + } + + log.info("memberAddressId => {}", memberAddressId); + memberAddressService.deleteMemberAddress(memberAddressId); + + return "redirect:/mypage/address"; + } } From a36005cedb77eb582620eeb83ffee1e3d1cc1950 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 00:17:57 +0900 Subject: [PATCH 072/127] =?UTF-8?q?feat:=20#74=20`mypageAddress.html`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EC=A3=BC=EC=86=8C=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageAddress.html | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageAddress.html b/src/main/resources/templates/main/page/mypageAddress.html index 98296d4..562feab 100644 --- a/src/main/resources/templates/main/page/mypageAddress.html +++ b/src/main/resources/templates/main/page/mypageAddress.html @@ -81,13 +81,20 @@

등록된 주소

  • - -
    - - -
    +
    + + + + +
    + + +
    +
+
@@ -101,6 +108,8 @@

기본 주소 설정

+ +
현재 비밀번호 변경할 비밀번호 From 22fa699f3796d77507ecb413aa135aa1829ed84a Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 01:03:58 +0900 Subject: [PATCH 079/127] =?UTF-8?q?feat:=20#75=20`mypageSidebar.html`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=ED=83=88=ED=87=B4=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=A7=81=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/mypageSidebar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/mypageSidebar.html b/src/main/resources/templates/main/fragment/mypageSidebar.html index 1cc7d21..2ad07aa 100644 --- a/src/main/resources/templates/main/fragment/mypageSidebar.html +++ b/src/main/resources/templates/main/fragment/mypageSidebar.html @@ -18,7 +18,7 @@

회원 정보

회원 등급
  • - 회원 탈퇴 + 회원 탈퇴
  • From 647f90fc41d6f9a757fd03f73f2df20dbf763054 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 01:04:21 +0900 Subject: [PATCH 080/127] =?UTF-8?q?feat:=20#75=20`mypageWithdrawal.html`?= =?UTF-8?q?=20-=20=ED=9A=8C=EC=9B=90=20=ED=83=88=ED=87=B4=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=B0=8F=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageWithdrawal.html | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/resources/templates/main/page/mypageWithdrawal.html diff --git a/src/main/resources/templates/main/page/mypageWithdrawal.html b/src/main/resources/templates/main/page/mypageWithdrawal.html new file mode 100644 index 0000000..c69a928 --- /dev/null +++ b/src/main/resources/templates/main/page/mypageWithdrawal.html @@ -0,0 +1,35 @@ + + + + +
    +

    회원 탈퇴

    + + + + + + +
    + + +
    +
    + + +
    + + +
    + +
    + From 17ac888c7421f828c0499186f9abb5b02e4e5322 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Tue, 7 May 2024 01:16:31 +0900 Subject: [PATCH 081/127] =?UTF-8?q?feat=20:=20#144=20=EB=8F=84=EC=84=9C=20?= =?UTF-8?q?=EC=B0=B8=EC=97=AC=EC=9E=90=20=EC=A0=95=EB=B3=B4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20view=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/assets/admin/js/api.js | 30 ++++++++- .../static/assets/admin/js/modifyBook.js | 64 +++++++++++++++++- .../templates/admin/page/editBook.html | 65 ++++++++++++++++++- 3 files changed, 156 insertions(+), 3 deletions(-) diff --git a/src/main/resources/static/assets/admin/js/api.js b/src/main/resources/static/assets/admin/js/api.js index 3b69170..2c5abbb 100644 --- a/src/main/resources/static/assets/admin/js/api.js +++ b/src/main/resources/static/assets/admin/js/api.js @@ -183,7 +183,7 @@ function fetchTagsAndUpdateModal() { * @param {number} publisherId - 변경할 출판사 ID * @author Yujin-nKim(김유진) */ -function sendPublisherRequest(bookId, publisherId) { +function sendPublisherUpdateRequest(bookId, publisherId) { $.ajax({ url: `http://localhost:8081/books/${bookId}/publisher`, // url: APP_KEY + '/t3t/bookstore/books/${bookId}/publisher', @@ -203,4 +203,32 @@ function sendPublisherRequest(bookId, publisherId) { alert("출판사 수정에 실패했습니다."); } }); +} + +/** + * 도서 참여자 변경 요청을 보내는 함수 + * @param {number} bookId - 도서 ID + * @param {number} participantList - 변경할 도서 참여자 맵핑 리스트 + * @author Yujin-nKim(김유진) + */ +function sendParticipantUpdateRequest(bookId, participantList) { + var jsonData = JSON.stringify(participantList); + $.ajax({ + url: `http://localhost:8081/books/${bookId}/participant`, + // url: APP_KEY + '/t3t/bookstore/books/${bookId}/participant', + type: 'PUT', + contentType: 'application/json', + data: jsonData, + success: function(response, textStatus, xhr) { + if (xhr.status === 200) { + // 성공적인 응답인 경우 + alert(response.message); + } + }, + error: function(xhr, status, error) { + // 그 외의 에러 처리 + console.error('Error:', error); + alert("도서 참여자 수정에 실패했습니다."); + } + }); } \ No newline at end of file diff --git a/src/main/resources/static/assets/admin/js/modifyBook.js b/src/main/resources/static/assets/admin/js/modifyBook.js index f48ffc5..7c7fc18 100644 --- a/src/main/resources/static/assets/admin/js/modifyBook.js +++ b/src/main/resources/static/assets/admin/js/modifyBook.js @@ -173,4 +173,66 @@ document.getElementById('modifyPublisherBtn').addEventListener('click', function var bookId = document.getElementById('bookId').value; sendPublisherRequest(bookId, publisherId); } -}); \ No newline at end of file +}); + +/** + * '도서 참여자 변경 요청' 버튼 클릭시 실행되는 이벤트 핸들러 + * @author Yujin-nKim(김유진) + */ +document.getElementById('modifyParticipantBtn').addEventListener('click', function() { + var tbody = document.querySelector("#participantButtonTable tbody"); + + if (tbody.children.length === 0) { + alert('도서 참여자 정보를 선택하세요.'); + } else { + var count = document.getElementById('participantCount').value; + var selectedParticipants = document.querySelectorAll('.selected-value-participant'); + var selectedParticipantRoles = document.querySelectorAll('.selected-value-participantRole'); + var newParticipantMapList = isParticipantMapValid(parseInt(count), selectedParticipants, selectedParticipantRoles) + + if (newParticipantMapList) { + var bookId = document.getElementById('bookId').value; + sendParticipantUpdateRequest(bookId, newParticipantMapList); + } + } +}); + +/** + * 도서 참여자와 역할 매핑 입력값의 유효성을 검사하고, 유효한 경우 맵핑 리스트 생성 + * @param {number} count 도서 참여자 수 + * @param {NodeListOf} participantList 도서 참여자 목록 + * @param {NodeListOf} participantRoleList 도서 참여자 역할 목록 + * @returns {Array|undefined} - 유효한 경우 도서 참여자 및 역할의 DTO 배열을 반환 + * @author Yujin-nKim(김유진) + */ +function isParticipantMapValid(count, participantList, participantRoleList) { + if (participantList.length !== count || participantRoleList.length !== count) { + alert('도서 참여자 정보를 선택하세요.'); + return; + } + + var pairSet = new Set(); + var participantMapList = []; + // participantList와 participantRoleList를 돌면서 각 요소를 짝지어서 확인 + for (var i = 0; i < count; i++) { + + var participantValue = participantList[i].value; + var participantRoleValue = participantRoleList[i].value; + var pair = participantValue + ':' + participantRoleValue; + + // 이미 존재하는 짝인지 확인하고 있다면 false를 반환 + if (pairSet.has(pair)) { + alert("도서 참여자에 중복된 값이 존재합니다."); + return; + } + // 셋에 짝을 추가 + pairSet.add(pair); + + var participantMapDto = { + participantId: participantValue, + participantRoleId: participantRoleValue + }; + participantMapList.push(participantMapDto); + } + return participantMapList; +} \ No newline at end of file diff --git a/src/main/resources/templates/admin/page/editBook.html b/src/main/resources/templates/admin/page/editBook.html index 5ae1d66..86bd9c7 100644 --- a/src/main/resources/templates/admin/page/editBook.html +++ b/src/main/resources/templates/admin/page/editBook.html @@ -157,7 +157,70 @@

    - + + +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    참여자 선택참여자 역할 선택
    +
    +
    + +
    + +
    +
    +
    +
    도서 참여자 수를 선택해주세요.
    +
    + +
    +
    + +
    +
    +
    +
    + + + + + + + + + +
    참여자 선택참여자 역할 선택
    +
    +
    + +
    +
    +
    + + + + +
    +
    From 0334f58b48756ff83b45a0d2348a0dfedbfc7869 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 02:22:20 +0900 Subject: [PATCH 082/127] =?UTF-8?q?feat:=20#76=20`mypageSidebar.html`=20-?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=20=EB=93=B1=EA=B8=89=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A7=81=ED=81=AC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/mypageSidebar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/mypageSidebar.html b/src/main/resources/templates/main/fragment/mypageSidebar.html index 2ad07aa..28dd766 100644 --- a/src/main/resources/templates/main/fragment/mypageSidebar.html +++ b/src/main/resources/templates/main/fragment/mypageSidebar.html @@ -15,7 +15,7 @@

    회원 정보

    회원 주소 관리
  • - 회원 등급 + 회원 등급
  • 회원 탈퇴 From 198147b4e7a088c99312d433eaad43fead759a11 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 02:23:11 +0900 Subject: [PATCH 083/127] =?UTF-8?q?feat:=20#76=20`MyPageController`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EB=93=B1=EA=B8=89=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B7=B0=20=EB=A7=B5=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyPageController.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java index 1d72495..50d6201 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -22,6 +22,7 @@ public class MyPageController { /** * 마이페이지 - 회원 기본 정보 관리 뷰 + * * @author woody35545(구건모) */ @GetMapping("/mypage/info") @@ -124,10 +125,32 @@ public String myPageAddressView(Model model) { /** * 마이페이지 - 회원 탈퇴 페이지 뷰 + * * @author woody35545(구건모) */ @GetMapping("/mypage/withdrawal") public String withdrawalView() { return "main/page/mypageWithdrawal"; } + + /** + * 마이페이지 - 회원 등급 페이지 뷰 + * + * @author woody35545(구건모) + */ + + @GetMapping("/mypage/grade") + public String gradeView(Model model) { + if (!SecurityContextUtils.isLoggedIn()) { + return "redirect:/login"; + } + + long memberId = SecurityContextUtils.getMemberId(); + MemberInfoResponse memberInfoResponse = memberService.getMemberInfoResponseById(memberId); + + model.addAttribute("gradeId", memberInfoResponse.getGradeId()); + + return "main/page/mypageGrade"; + } + } From ad38a20df8efcd6e163906ef20d8b4bc25a04bd0 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 02:23:28 +0900 Subject: [PATCH 084/127] =?UTF-8?q?feat:=20#76=20`mypageGrade.html`=20-=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=ED=98=84=EC=9E=AC=20=EB=93=B1=EA=B8=89=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageGrade.html | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/main/resources/templates/main/page/mypageGrade.html diff --git a/src/main/resources/templates/main/page/mypageGrade.html b/src/main/resources/templates/main/page/mypageGrade.html new file mode 100644 index 0000000..3e4e567 --- /dev/null +++ b/src/main/resources/templates/main/page/mypageGrade.html @@ -0,0 +1,156 @@ + + + + + + +
    +

    회원 등급

    + +
    +

    현재 등급

    +
    +
    +
    +
    +
    등급: Normal
    +

    혜택: 순수 금액의 1% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    등급: Royal
    +

    혜택: 순수 금액의 2% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    등급: Gold
    +

    혜택: 순수 금액의 3% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    등급: Platinum
    +

    혜택: 순수 금액의 4% 포인트 적립

    +
    +
    +
    +
    +
    + + +
    +

    다음 등급까지 남은 조건

    +
    +
    +
      + +
    • + 회원 등급은 3개월 이내 순수 주문금액을 기준으로 산정됩니다. +
    • +
    • + * 순수금액 = 주문금액 - (쿠폰 + 배송비 + 취소금액 + 포장비) +
    • +
    • + 다음 등급까지 남은 금액 + 100,000원 남음 +
    • +
    +
    +
    +
    + + + +
    +

    등급별 혜택

    +
    +
    +
    +
    +
    Normal 등급
    +

    순수 금액의 1% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    Royal 등급
    +

    순수 금액의 2% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    Gold 등급
    +

    순수 금액의 3% 포인트 적립

    +
    +
    +
    +
    +
    +
    +
    Platinum 등급
    +

    순수 금액의 4% 포인트 적립

    +
    +
    +
    +
    +
    + +
    +
    + From 647ad5f7a1596fad66668783048f3a661ee6f8d5 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 02:24:44 +0900 Subject: [PATCH 085/127] =?UTF-8?q?modify:=20`mypageInfo.html`=20-=20?= =?UTF-8?q?=EC=9D=BC=EB=B6=80=20=EC=9A=94=EC=86=8C=20=EB=B0=B0=EC=B9=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/page/mypageInfo.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/main/page/mypageInfo.html b/src/main/resources/templates/main/page/mypageInfo.html index de5b03c..f92817a 100644 --- a/src/main/resources/templates/main/page/mypageInfo.html +++ b/src/main/resources/templates/main/page/mypageInfo.html @@ -19,11 +19,11 @@

    회원 기본 정보

    현재 비밀번호 - + 변경할 비밀번호 - + 변경할 비밀번호 다시 입력 -
    @@ -49,7 +49,7 @@

    회원 기본 정보

    기본 배송지
    -
    +
    설정된 기본 주소가 없습니다. Date: Tue, 7 May 2024 04:31:55 +0900 Subject: [PATCH 086/127] =?UTF-8?q?modify:=20`mypageAddress.html`=20-=20?= =?UTF-8?q?=EB=B3=84=EC=B9=AD=20=ED=8E=B8=EC=A7=91=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/page/mypageAddress.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/page/mypageAddress.html b/src/main/resources/templates/main/page/mypageAddress.html index 562feab..62f4fc5 100644 --- a/src/main/resources/templates/main/page/mypageAddress.html +++ b/src/main/resources/templates/main/page/mypageAddress.html @@ -88,7 +88,7 @@

    등록된 주소

    th:text="${address.getRoadNameAddress() + ', ' + address.getAddressDetail() + ' (' + address.getNickName() + ')'}">
    - +
    From 6c3c36f45299c5f645615fde0056f3fb1ad08ce2 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 04:33:35 +0900 Subject: [PATCH 087/127] =?UTF-8?q?feat:=20#78=20`mypageOrder.html`=20-=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A3=BC?= =?UTF-8?q?=EB=AC=B8=20=EC=A1=B0=ED=9A=8C=20=EB=B7=B0=20=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/main/page/mypageOrder.html | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/resources/templates/main/page/mypageOrder.html diff --git a/src/main/resources/templates/main/page/mypageOrder.html b/src/main/resources/templates/main/page/mypageOrder.html new file mode 100644 index 0000000..8619567 --- /dev/null +++ b/src/main/resources/templates/main/page/mypageOrder.html @@ -0,0 +1,73 @@ + + + + +
    +

    주문 목록

    +
    +
    +
    주문번호: 111-1250912120
    +
    + +
    +
    +
    + 상품 이미지 +
    +
    +
    +
    배송 중 (배송 예정일: 2024-05-01)
    +

    상품명: 상품 A

    +

    상품 가격: 10,000원

    +
    + + + +
    +
    +
    +
    +
    +
    + +
    +
    +
    주문번호: 111-1250912120
    +
    + + +
    +
    +
    + 상품 이미지 +
    +
    +
    +
    배송 중 (배송 예정일: 2024-05-01)
    +

    상품명: 상품 A

    +

    상품 가격: 10,000원

    +
    + + + +
    +
    +
    +
    +
    +
    +
    + + +
    + From 235a264c5ec0286786f4a7c15595914bd21c32ae Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 04:34:07 +0900 Subject: [PATCH 088/127] =?UTF-8?q?feat:=20#78=20`MyPageController`=20-=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A3=BC?= =?UTF-8?q?=EB=AC=B8=20=EC=A1=B0=ED=9A=8C=20=EB=B7=B0=20=EB=A7=B5=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontserver/member/controller/MyPageController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java index 50d6201..7aca139 100644 --- a/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java +++ b/src/main/java/com/t3t/frontserver/member/controller/MyPageController.java @@ -153,4 +153,13 @@ public String gradeView(Model model) { return "main/page/mypageGrade"; } + /** + * 마이페이지 - 회원 주문 페이지 뷰 + * @author woody35545(구건모) + */ + @GetMapping("/mypage/order") + public String orderView() { + return "main/page/mypageOrder"; + } + } From 610d262ee89fb7ed0e0da1e07e811f8c09cc351b Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 04:34:35 +0900 Subject: [PATCH 089/127] =?UTF-8?q?feat:=20#78=20`mypageSidebar.html`=20-?= =?UTF-8?q?=20=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A3=BC?= =?UTF-8?q?=EB=AC=B8=20=EC=A1=B0=ED=9A=8C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=A7=81=ED=81=AC=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/mypageSidebar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/mypageSidebar.html b/src/main/resources/templates/main/fragment/mypageSidebar.html index 28dd766..ea33368 100644 --- a/src/main/resources/templates/main/fragment/mypageSidebar.html +++ b/src/main/resources/templates/main/fragment/mypageSidebar.html @@ -26,7 +26,7 @@

    회원 정보

    주문 정보

    • - 주문 내역 + 주문 내역
    • 반품/교환 내역 From 93ea3f91928c5f57ec0e20455f0f761125286290 Mon Sep 17 00:00:00 2001 From: parkjonggyeong18 Date: Tue, 7 May 2024 10:43:51 +0900 Subject: [PATCH 090/127] =?UTF-8?q?fix:=20=EC=A3=BC=EC=86=8C=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 --- .../elastic/adaptor/ElasticAdaptor.java | 17 ++++++++++------- .../elastic/controller/ElasticController.java | 12 +++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java b/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java index 9211b0c..29820b1 100644 --- a/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java +++ b/src/main/java/com/t3t/frontserver/elastic/adaptor/ElasticAdaptor.java @@ -16,15 +16,18 @@ @FeignClient(name = "ElasticAdaptor", url = "${t3t.feignClient.url}") public interface ElasticAdaptor { - /**\ + /** * - * @param query - * @param searchType - * @param pageNo - * @param sortBy - * @return + * elasticsearch 기반 text 검색 + * + * @param query text 검색어 + * @param searchType 검색 유형 + * @param pageNo 페이지 번호 + * @param categoryId 카테고리 검색을 위한 카테고리번호 + * @param sortBy 정렬 기준 (기본값: "_socre") + * @return 서버의 데이터를 가지고 옴 */ - @GetMapping("/search") + @GetMapping("/t3t/bookstore/search") ResponseEntity>> getSearchPage(@RequestParam String query, @RequestParam String searchType, diff --git a/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java b/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java index 7c737c7..0b0a92c 100644 --- a/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java +++ b/src/main/java/com/t3t/frontserver/elastic/controller/ElasticController.java @@ -23,7 +23,17 @@ @RequiredArgsConstructor public class ElasticController { private final ElasticAdaptor elasticAdaptor; - + /** + * + * elasticsearch 기반 text 검색 + * + * @param query text 검색어 + * @param searchType 검색 유형 + * @param pageNo 페이지 번호 + * @param categoryId 카테고리 검색을 위한 카테고리번호 + * @param sortBy 정렬 기준 (기본값: "_socre") + * @return 페이지로 정보를 가지고 이동 + */ @GetMapping("/search") public String searchBooks(@RequestParam(value = "query") String query, @RequestParam("searchType") String searchType, From 0c8d7d1337869a4374236661b351ca27e8a39138 Mon Sep 17 00:00:00 2001 From: joohyun Date: Tue, 7 May 2024 12:59:07 +0900 Subject: [PATCH 091/127] =?UTF-8?q?fix:#81=20mypage=20=EC=A0=91=EA=B7=BC?= =?UTF-8?q?=EC=8B=9C=20whitelabel=20=EC=97=90=EB=9F=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../t3t/frontserver/auth/error/CustomAuthenticationPoint.java | 4 ++++ src/main/java/com/t3t/frontserver/config/SecurityConfig.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/auth/error/CustomAuthenticationPoint.java b/src/main/java/com/t3t/frontserver/auth/error/CustomAuthenticationPoint.java index 415b4a7..e402d14 100644 --- a/src/main/java/com/t3t/frontserver/auth/error/CustomAuthenticationPoint.java +++ b/src/main/java/com/t3t/frontserver/auth/error/CustomAuthenticationPoint.java @@ -24,6 +24,10 @@ public void commence(HttpServletRequest request, HttpServletResponse response, A return; } + if(Objects.isNull(authentication) && request.getRequestURI().startsWith("/mypage")){ + response.sendRedirect("/login"); + } + if(response.getStatus()==HttpServletResponse.SC_FORBIDDEN || response.getStatus()==HttpServletResponse.SC_UNAUTHORIZED){ request.setAttribute("errorMessage", "인증시간이 지났습니다. 다시 로그인 해주세요"); response.sendRedirect("/login"); diff --git a/src/main/java/com/t3t/frontserver/config/SecurityConfig.java b/src/main/java/com/t3t/frontserver/config/SecurityConfig.java index 7ed04c9..dd3c556 100644 --- a/src/main/java/com/t3t/frontserver/config/SecurityConfig.java +++ b/src/main/java/com/t3t/frontserver/config/SecurityConfig.java @@ -54,7 +54,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .httpBasic().disable() .authorizeRequests((auth) -> auth .antMatchers("/admin/**").hasRole("ADMIN") - .antMatchers("/myPage/**").authenticated() + .antMatchers("/mypage/**").authenticated() .antMatchers("/logout").authenticated() .antMatchers("/**").permitAll()) .addFilterAt(new GlobalTokenFilter(), SessionManagementFilter.class) @@ -74,7 +74,7 @@ public void handle(HttpServletRequest request, HttpServletResponse response, Acc // 관리자 권한이 없습니다. 메시지 추가 response.sendRedirect("/"); } - if (request.getRequestURI().startsWith("/myPage")){ + if (request.getRequestURI().startsWith("/mypage")){ response.sendRedirect("/login"); } } From 17ca4856363ea028a3100f92cf4b5b51911e91a7 Mon Sep 17 00:00:00 2001 From: woody35545 Date: Tue, 7 May 2024 13:40:55 +0900 Subject: [PATCH 092/127] =?UTF-8?q?fix:=20=EC=BD=94=EB=93=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/exception/GlobalExceptionHandler.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java index 35c75ce..c5eb552 100644 --- a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java @@ -1,10 +1,7 @@ package com.t3t.frontserver.common.exception; -import com.t3t.frontserver.member.client.MemberApiClient; -import com.t3t.frontserver.member.exception.MemberApiClientException; -import feign.FeignException; -import lombok.extern.slf4j.Slf4j; import com.t3t.frontserver.auth.exception.RestApiClientException; +import lombok.extern.slf4j.Slf4j; import org.json.JSONObject; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.ui.Model; @@ -12,20 +9,20 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -@Slf4j import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; +@Slf4j @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) - public String handleException(RedirectAttributes redirectAttributes, Exception e){ + public String handleException(RedirectAttributes redirectAttributes, Exception e) { redirectAttributes.addAttribute("message", e.getMessage()); return "redirect:/message"; } @ExceptionHandler(RestApiClientException.class) - public String handleRestApiClientException(Model model, RestApiClientException e, HttpServletResponse response){ + public String handleRestApiClientException(Model model, RestApiClientException e, HttpServletResponse response) { JSONObject json = new JSONObject(e.getResponseBody()); String message = json.getString("message"); @@ -37,7 +34,7 @@ public String handleRestApiClientException(Model model, RestApiClientException e response.addCookie(cookie); return "redirect:/"; - }else { + } else { model.addAttribute("message", e.getResponseBody()); return "main/page/message"; } From 8ee29fe867d25820b24d41f03d78b2666e13c075 Mon Sep 17 00:00:00 2001 From: yujinKim Date: Tue, 7 May 2024 14:22:32 +0900 Subject: [PATCH 093/127] =?UTF-8?q?style=20:=20css=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/script.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/script.html b/src/main/resources/templates/main/fragment/script.html index cb99652..b72cfa2 100644 --- a/src/main/resources/templates/main/fragment/script.html +++ b/src/main/resources/templates/main/fragment/script.html @@ -14,7 +14,7 @@ - ` + From ca959cb7c7e699adf9295cd5514040523f72cb4c Mon Sep 17 00:00:00 2001 From: yujinKim Date: Tue, 7 May 2024 14:24:54 +0900 Subject: [PATCH 094/127] =?UTF-8?q?style=20:=20css=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/main/fragment/topbar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/main/fragment/topbar.html b/src/main/resources/templates/main/fragment/topbar.html index 8bed08a..4d71f7a 100644 --- a/src/main/resources/templates/main/fragment/topbar.html +++ b/src/main/resources/templates/main/fragment/topbar.html @@ -4,7 +4,7 @@