From 10354d880bd447731c934db008ba64b58a15dabb Mon Sep 17 00:00:00 2001 From: kyukong <92148749+kyukong@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:30:53 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20=EC=82=AC=EC=97=85=EC=B2=B4=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20API=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(#29)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FEAT] 광고 주문자 상세정보 조회 * [FEAT] 사업체 팝업스토어 현황 API 구현 * [FEAT] 사업체 팝업스토어 현황 API 구현 --- .../kr/community/mapper/CommunityMapper.java | 2 ++ .../repository/CommunityRepository.java | 13 +++++++++ .../kr/popup/controller/PopupController.java | 15 ++++++++++ .../response/StatisticsCommunityResponse.java | 21 ++++++++++++++ .../dto/response/StatisticsPlanResponse.java | 29 +++++++++++++++++++ .../dto/response/StatisticsPopupResponse.java | 21 ++++++++++++++ .../dto/response/StatisticsResponse.java | 25 ++++++++++++++++ .../com/oya/kr/popup/mapper/PlanMapper.java | 3 ++ .../com/oya/kr/popup/mapper/PopupMapper.java | 3 ++ .../StatisticsCommunityMapperResponse.java | 12 ++++++++ .../StatisticsPlanMapperResponse.java | 16 ++++++++++ .../StatisticsPopupMapperResponse.java | 12 ++++++++ .../kr/popup/repository/PlanRepository.java | 13 +++++++++ .../kr/popup/repository/PopupRepository.java | 13 +++++++++ .../oya/kr/popup/service/PopupService.java | 23 +++++++++++++++ .../kr/user/controller/UserController.java | 15 ++++++++++ .../dto/response/AdUserDetailResponse.java | 27 +++++++++++++++++ .../com/oya/kr/user/mapper/UserMapper.java | 3 ++ .../response/AdUserDetailMapperResponse.java | 15 ++++++++++ .../kr/user/repository/UserRepository.java | 13 ++++++++- .../com/oya/kr/user/service/UserService.java | 16 ++++++++++ .../kr/community/mapper/CommunityMapper.xml | 9 ++++++ .../com/oya/kr/popup/mapper/PlanMapper.xml | 12 ++++++++ .../com/oya/kr/popup/mapper/PopupMapper.xml | 8 +++++ .../com/oya/kr/user/mapper/UserMapper.xml | 8 +++++ src/main/resources/mybatis/mybatis-config.xml | 4 +++ 26 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsCommunityResponse.java create mode 100644 src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPlanResponse.java create mode 100644 src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPopupResponse.java create mode 100644 src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsResponse.java create mode 100644 src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsCommunityMapperResponse.java create mode 100644 src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPlanMapperResponse.java create mode 100644 src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPopupMapperResponse.java create mode 100644 src/main/java/com/oya/kr/user/controller/dto/response/AdUserDetailResponse.java create mode 100644 src/main/java/com/oya/kr/user/mapper/dto/response/AdUserDetailMapperResponse.java diff --git a/src/main/java/com/oya/kr/community/mapper/CommunityMapper.java b/src/main/java/com/oya/kr/community/mapper/CommunityMapper.java index 44d6d4b..469c382 100644 --- a/src/main/java/com/oya/kr/community/mapper/CommunityMapper.java +++ b/src/main/java/com/oya/kr/community/mapper/CommunityMapper.java @@ -10,6 +10,7 @@ import com.oya.kr.community.mapper.dto.response.CommunityBasicMapperResponse; import com.oya.kr.community.mapper.dto.request.ReadCommunityMapperRequest; import com.oya.kr.community.mapper.dto.response.StatisticsResponseMapper; +import com.oya.kr.popup.mapper.dto.response.StatisticsCommunityMapperResponse; /** * @author 이상민 @@ -27,6 +28,7 @@ public interface CommunityMapper { void saveImage(@Param("imageUrl") String imageUrl, @Param("communityId") long communityId); List findByImage(long communityId); List statistics(); + StatisticsCommunityMapperResponse statisticsForBusiness(Long userId); int findSizeByAll(); int findSizeByType(String type); int findSizeByCollection(Long userId); diff --git a/src/main/java/com/oya/kr/community/repository/CommunityRepository.java b/src/main/java/com/oya/kr/community/repository/CommunityRepository.java index 1531c51..a5dd270 100644 --- a/src/main/java/com/oya/kr/community/repository/CommunityRepository.java +++ b/src/main/java/com/oya/kr/community/repository/CommunityRepository.java @@ -20,6 +20,7 @@ import com.oya.kr.community.mapper.dto.response.CommunityBasicMapperResponse; import com.oya.kr.community.mapper.dto.response.StatisticsResponseMapper; import com.oya.kr.global.exception.ApplicationException; +import com.oya.kr.popup.mapper.dto.response.StatisticsCommunityMapperResponse; import com.oya.kr.user.domain.User; import lombok.RequiredArgsConstructor; @@ -224,4 +225,16 @@ public int findSizeByType(User loginUser, String type) { public boolean existCollection(long communityId, Long userId) { return communityMapper.existCollection(communityId, userId); } + + /** + * 커뮤니티 게시글 통계 정보 조회 + * + * @parameter Long + * @return StatisticsCommunityMapperResponse + * @author 김유빈 + * @since 2024.02.28 + */ + public StatisticsCommunityMapperResponse statisticsForBusiness(Long userId) { + return communityMapper.statisticsForBusiness(userId); + } } diff --git a/src/main/java/com/oya/kr/popup/controller/PopupController.java b/src/main/java/com/oya/kr/popup/controller/PopupController.java index ae83e4f..014cd63 100644 --- a/src/main/java/com/oya/kr/popup/controller/PopupController.java +++ b/src/main/java/com/oya/kr/popup/controller/PopupController.java @@ -18,6 +18,7 @@ import com.oya.kr.popup.controller.dto.response.PopupImageResponse; import com.oya.kr.popup.controller.dto.response.PopupsListResponse; import com.oya.kr.popup.controller.dto.response.PopupResponse; +import com.oya.kr.popup.controller.dto.response.StatisticsResponse; import com.oya.kr.popup.service.PopupService; import lombok.AccessLevel; @@ -126,4 +127,18 @@ public ResponseEntity> collect(Principal principal, @P popupService.collect(principal.getName(), popupId); return ResponseEntity.ok(ApplicationResponse.success(null)); } + + /** + * 사업체 팝업스토어 현황 조회 기능 구현 + * + * @parameter Principal + * @return ResponseEntity> + * @author 김유빈 + * @since 2024.02.28 + */ + @GetMapping("/statistics") + public ResponseEntity> statistics(Principal principal) { + StatisticsResponse response = popupService.statistics(principal.getName()); + return ResponseEntity.ok(ApplicationResponse.success(response)); + } } diff --git a/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsCommunityResponse.java b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsCommunityResponse.java new file mode 100644 index 0000000..1b796cb --- /dev/null +++ b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsCommunityResponse.java @@ -0,0 +1,21 @@ +package com.oya.kr.popup.controller.dto.response; + +import com.oya.kr.popup.mapper.dto.response.StatisticsCommunityMapperResponse; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsCommunityResponse { + + private final int total; + private final int ad; + + public static StatisticsCommunityResponse from(StatisticsCommunityMapperResponse communities) { + return new StatisticsCommunityResponse( + communities.getTotal(), + communities.getAd() + ); + } +} diff --git a/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPlanResponse.java b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPlanResponse.java new file mode 100644 index 0000000..9db806a --- /dev/null +++ b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPlanResponse.java @@ -0,0 +1,29 @@ +package com.oya.kr.popup.controller.dto.response; + +import com.oya.kr.popup.mapper.dto.response.StatisticsPlanMapperResponse; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsPlanResponse { + + private final int total; + private final int request; + private final int waiting; + private final int approval; + private final int rejection; + private final int withdrawal; + + public static StatisticsPlanResponse from(StatisticsPlanMapperResponse plans) { + return new StatisticsPlanResponse( + plans.getTotal(), + plans.getRequest(), + plans.getWaiting(), + plans.getApproval(), + plans.getRejection(), + plans.getWithdrawal() + ); + } +} diff --git a/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPopupResponse.java b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPopupResponse.java new file mode 100644 index 0000000..07d3858 --- /dev/null +++ b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsPopupResponse.java @@ -0,0 +1,21 @@ +package com.oya.kr.popup.controller.dto.response; + +import com.oya.kr.popup.mapper.dto.response.StatisticsPopupMapperResponse; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsPopupResponse { + + private final int total; + private final int ad; + + public static StatisticsPopupResponse from(StatisticsPopupMapperResponse popups) { + return new StatisticsPopupResponse( + popups.getTotal(), + popups.getAd() + ); + } +} diff --git a/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsResponse.java b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsResponse.java new file mode 100644 index 0000000..8f96423 --- /dev/null +++ b/src/main/java/com/oya/kr/popup/controller/dto/response/StatisticsResponse.java @@ -0,0 +1,25 @@ +package com.oya.kr.popup.controller.dto.response; + +import com.oya.kr.popup.mapper.dto.response.StatisticsCommunityMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPlanMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPopupMapperResponse; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsResponse { + + private final StatisticsPlanResponse plan; + private final StatisticsPopupResponse popup; + private final StatisticsCommunityResponse community; + + public static StatisticsResponse from(StatisticsPlanMapperResponse plans, StatisticsPopupMapperResponse popups, StatisticsCommunityMapperResponse communities) { + return new StatisticsResponse( + StatisticsPlanResponse.from(plans), + StatisticsPopupResponse.from(popups), + StatisticsCommunityResponse.from(communities) + ); + } +} diff --git a/src/main/java/com/oya/kr/popup/mapper/PlanMapper.java b/src/main/java/com/oya/kr/popup/mapper/PlanMapper.java index 0720138..7363201 100644 --- a/src/main/java/com/oya/kr/popup/mapper/PlanMapper.java +++ b/src/main/java/com/oya/kr/popup/mapper/PlanMapper.java @@ -10,6 +10,7 @@ import com.oya.kr.popup.mapper.dto.response.AllPlanMapperResponse; import com.oya.kr.popup.mapper.dto.response.PlanAboutMeMapperResponse; import com.oya.kr.popup.mapper.dto.response.PlanMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPlanMapperResponse; /** * @author 김유빈 @@ -25,6 +26,8 @@ public interface PlanMapper { List findAll(AllPlanMapperRequest request); + StatisticsPlanMapperResponse statistics(Long userId); + int countAboutMe(PlanAboutMeMapperRequest request); int countAboutAll(AllPlanMapperRequest request); diff --git a/src/main/java/com/oya/kr/popup/mapper/PopupMapper.java b/src/main/java/com/oya/kr/popup/mapper/PopupMapper.java index d30c860..82b40cb 100644 --- a/src/main/java/com/oya/kr/popup/mapper/PopupMapper.java +++ b/src/main/java/com/oya/kr/popup/mapper/PopupMapper.java @@ -8,6 +8,7 @@ import com.oya.kr.popup.mapper.dto.request.PopupSearchMapperRequest; import com.oya.kr.popup.mapper.dto.response.PopupDetailMapperResponse; import com.oya.kr.popup.mapper.dto.response.PopupMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPopupMapperResponse; /** * @author 김유빈 @@ -31,6 +32,8 @@ public interface PopupMapper { List findAllRecommended(PopupSearchMapperRequest request); + StatisticsPopupMapperResponse statistics(Long userId); + void save(PopupSaveMapperRequest request); void deleteAll(); diff --git a/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsCommunityMapperResponse.java b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsCommunityMapperResponse.java new file mode 100644 index 0000000..7de9c57 --- /dev/null +++ b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsCommunityMapperResponse.java @@ -0,0 +1,12 @@ +package com.oya.kr.popup.mapper.dto.response; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsCommunityMapperResponse { + + private final int total; + private final int ad; +} diff --git a/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPlanMapperResponse.java b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPlanMapperResponse.java new file mode 100644 index 0000000..4fff250 --- /dev/null +++ b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPlanMapperResponse.java @@ -0,0 +1,16 @@ +package com.oya.kr.popup.mapper.dto.response; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsPlanMapperResponse { + + private final int total; + private final int request; + private final int waiting; + private final int approval; + private final int rejection; + private final int withdrawal; +} diff --git a/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPopupMapperResponse.java b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPopupMapperResponse.java new file mode 100644 index 0000000..889d6a4 --- /dev/null +++ b/src/main/java/com/oya/kr/popup/mapper/dto/response/StatisticsPopupMapperResponse.java @@ -0,0 +1,12 @@ +package com.oya.kr.popup.mapper.dto.response; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StatisticsPopupMapperResponse { + + private final int total; + private final int ad; +} diff --git a/src/main/java/com/oya/kr/popup/repository/PlanRepository.java b/src/main/java/com/oya/kr/popup/repository/PlanRepository.java index e3d936a..27ea79d 100644 --- a/src/main/java/com/oya/kr/popup/repository/PlanRepository.java +++ b/src/main/java/com/oya/kr/popup/repository/PlanRepository.java @@ -18,6 +18,7 @@ import com.oya.kr.popup.mapper.dto.request.PlanUpdateEntranceStatusMapperRequest; import com.oya.kr.popup.mapper.dto.response.AllPlanMapperResponse; import com.oya.kr.popup.mapper.dto.response.PlanAboutMeMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPlanMapperResponse; import com.oya.kr.user.domain.User; import lombok.RequiredArgsConstructor; @@ -135,4 +136,16 @@ public void updateEntranceStatus(Plan plan) { PlanUpdateEntranceStatusMapperRequest mapperRequest = PlanUpdateEntranceStatusMapperRequest.from(plan); planMapper.updateEntranceStatus(mapperRequest); } + + /** + * 사업계획서 통계 정보 조회 + * + * @parameter Long + * @return StatisticsPlanMapperResponse + * @author 김유빈 + * @since 2024.02.28 + */ + public StatisticsPlanMapperResponse statistics(Long userId) { + return planMapper.statistics(userId); + } } diff --git a/src/main/java/com/oya/kr/popup/repository/PopupRepository.java b/src/main/java/com/oya/kr/popup/repository/PopupRepository.java index 8e521d7..14af6a6 100644 --- a/src/main/java/com/oya/kr/popup/repository/PopupRepository.java +++ b/src/main/java/com/oya/kr/popup/repository/PopupRepository.java @@ -27,6 +27,7 @@ import com.oya.kr.popup.mapper.dto.response.PopupCollectionMapperResponse; import com.oya.kr.popup.mapper.dto.response.PopupDetailMapperResponse; import com.oya.kr.popup.mapper.dto.response.PopupMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPopupMapperResponse; import com.oya.kr.user.domain.User; import lombok.RequiredArgsConstructor; @@ -158,6 +159,18 @@ public void collect(Popup popup, User user) { } } + /** + * 팝업스토어 게시글 통계 정보 조회 + * + * @parameter Long + * @return StatisticsPopupMapperResponse + * @author 김유빈 + * @since 2024.02.28 + */ + public StatisticsPopupMapperResponse statistics(Long userId) { + return popupMapper.statistics(userId); + } + private void countView(Long id, Long userId) { PopupViewCreateOrUpdateMapperRequest request = new PopupViewCreateOrUpdateMapperRequest(userId, id); popupViewMapper.createOrUpdatePopupView(request); diff --git a/src/main/java/com/oya/kr/popup/service/PopupService.java b/src/main/java/com/oya/kr/popup/service/PopupService.java index 7e69fd5..0d4daa0 100644 --- a/src/main/java/com/oya/kr/popup/service/PopupService.java +++ b/src/main/java/com/oya/kr/popup/service/PopupService.java @@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import com.oya.kr.community.repository.CommunityRepository; import com.oya.kr.global.dto.request.PaginationRequest; import com.oya.kr.global.exception.ApplicationException; import com.oya.kr.global.support.S3Connector; @@ -15,10 +16,14 @@ import com.oya.kr.popup.controller.dto.response.PopupImageResponse; import com.oya.kr.popup.controller.dto.response.PopupResponse; import com.oya.kr.popup.controller.dto.response.PopupsListResponse; +import com.oya.kr.popup.controller.dto.response.StatisticsResponse; import com.oya.kr.popup.domain.Plan; import com.oya.kr.popup.domain.Popup; import com.oya.kr.popup.domain.enums.PopupSort; import com.oya.kr.popup.mapper.dto.response.PopupDetailMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsCommunityMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPlanMapperResponse; +import com.oya.kr.popup.mapper.dto.response.StatisticsPopupMapperResponse; import com.oya.kr.popup.repository.PlanRepository; import com.oya.kr.popup.repository.PopupRepository; import com.oya.kr.user.domain.User; @@ -39,6 +44,7 @@ public class PopupService { private final UserRepository userRepository; private final PlanRepository planRepository; private final PopupRepository popupRepository; + private final CommunityRepository communityRepository; private final S3Connector s3Connector; /** @@ -136,6 +142,23 @@ public void collect(String email, Long popupId) { popupRepository.collect(savedPopup, savedUser); } + /** + * 사업체 팝업스토어 현황 조회 기능 구현 + * + * @parameter String + * @author 김유빈 + * @since 2024.02.28 + */ + public StatisticsResponse statistics(String email) { + User savedUser = userRepository.findByEmail(email); + + StatisticsPlanMapperResponse planMapperResponse = planRepository.statistics(savedUser.getId()); + StatisticsPopupMapperResponse popupMapperResponse = popupRepository.statistics(savedUser.getId()); + StatisticsCommunityMapperResponse communityMapperResponse = communityRepository.statisticsForBusiness(savedUser.getId()); + + return StatisticsResponse.from(planMapperResponse, popupMapperResponse, communityMapperResponse); + } + private void validatePlanDoesNotHavePopup(Plan plan) { if (!popupRepository.findAllByPlanId(plan.getId()).isEmpty()) { throw new ApplicationException(PLAN_HAS_POPUP); diff --git a/src/main/java/com/oya/kr/user/controller/UserController.java b/src/main/java/com/oya/kr/user/controller/UserController.java index 19e4574..a3b7f6c 100644 --- a/src/main/java/com/oya/kr/user/controller/UserController.java +++ b/src/main/java/com/oya/kr/user/controller/UserController.java @@ -22,6 +22,7 @@ import com.oya.kr.user.controller.dto.request.DuplicatedNicknameRequest; import com.oya.kr.user.controller.dto.request.JoinRequest; import com.oya.kr.user.controller.dto.request.LoginRequest; +import com.oya.kr.user.controller.dto.response.AdUserDetailResponse; import com.oya.kr.user.controller.dto.response.BasicUserResponse; import com.oya.kr.user.controller.dto.response.JwtTokenResponse; import com.oya.kr.user.service.UserService; @@ -151,6 +152,20 @@ public ResponseEntity>> re return ResponseEntity.ok(ApplicationResponse.success(userService.reads(type))); } + /** + * 결제 주문자 상세정보 조회 + * + * @parameter Principal + * @return ResponseEntity> + * @author 김유빈 + * @since 2024.02.28 + */ + @GetMapping("/ad/users") + public ResponseEntity> findMeForAb(Principal principal) { + AdUserDetailResponse response = userService.findMeForAb(principal.getName()); + return ResponseEntity.ok(ApplicationResponse.success(response)); + } + private String getAccessToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication.getCredentials().toString(); diff --git a/src/main/java/com/oya/kr/user/controller/dto/response/AdUserDetailResponse.java b/src/main/java/com/oya/kr/user/controller/dto/response/AdUserDetailResponse.java new file mode 100644 index 0000000..c70a8f4 --- /dev/null +++ b/src/main/java/com/oya/kr/user/controller/dto/response/AdUserDetailResponse.java @@ -0,0 +1,27 @@ +package com.oya.kr.user.controller.dto.response; + +import com.oya.kr.user.mapper.dto.response.AdUserDetailMapperResponse; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class AdUserDetailResponse { + + private final long id; + private final String nickname; + private final String email; + private final String businessRegistrationNumber; + private final String connectedNumber; + + public static AdUserDetailResponse from(AdUserDetailMapperResponse response) { + return new AdUserDetailResponse( + response.getId(), + response.getNickname(), + response.getEmail(), + response.getBusinessRegistrationNumber(), + response.getConnectedNumber() + ); + } +} diff --git a/src/main/java/com/oya/kr/user/mapper/UserMapper.java b/src/main/java/com/oya/kr/user/mapper/UserMapper.java index a30f308..7a33fd7 100644 --- a/src/main/java/com/oya/kr/user/mapper/UserMapper.java +++ b/src/main/java/com/oya/kr/user/mapper/UserMapper.java @@ -7,6 +7,7 @@ import com.oya.kr.user.mapper.dto.request.SignupBasicMapperRequest; import com.oya.kr.user.mapper.dto.request.SignupAdministratorMapperRequest; +import com.oya.kr.user.mapper.dto.response.AdUserDetailMapperResponse; import com.oya.kr.user.mapper.dto.response.BasicMapperResponse; import com.oya.kr.user.mapper.dto.response.BusinessMapperResponse; import com.oya.kr.user.mapper.dto.response.UserMapperResponse; @@ -36,4 +37,6 @@ public interface UserMapper { List findByBasic(Long userId); List findByBusiness(Long userId); + + Optional findMeForAb(Long userId); } diff --git a/src/main/java/com/oya/kr/user/mapper/dto/response/AdUserDetailMapperResponse.java b/src/main/java/com/oya/kr/user/mapper/dto/response/AdUserDetailMapperResponse.java new file mode 100644 index 0000000..f798a77 --- /dev/null +++ b/src/main/java/com/oya/kr/user/mapper/dto/response/AdUserDetailMapperResponse.java @@ -0,0 +1,15 @@ +package com.oya.kr.user.mapper.dto.response; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class AdUserDetailMapperResponse { + + private final long id; + private final String nickname; + private final String email; + private final String businessRegistrationNumber; + private final String connectedNumber; +} diff --git a/src/main/java/com/oya/kr/user/repository/UserRepository.java b/src/main/java/com/oya/kr/user/repository/UserRepository.java index ddcb4c5..65ef413 100644 --- a/src/main/java/com/oya/kr/user/repository/UserRepository.java +++ b/src/main/java/com/oya/kr/user/repository/UserRepository.java @@ -2,7 +2,6 @@ import static com.oya.kr.user.exception.UserErrorCodeList.NOT_EXIST_USER; -import java.util.HashMap; import java.util.List; import java.util.function.Supplier; @@ -16,6 +15,7 @@ import com.oya.kr.user.mapper.UserMapper; import com.oya.kr.user.mapper.dto.request.SignupAdministratorMapperRequest; import com.oya.kr.user.mapper.dto.request.SignupBasicMapperRequest; +import com.oya.kr.user.mapper.dto.response.AdUserDetailMapperResponse; import com.oya.kr.user.mapper.dto.response.BasicMapperResponse; import com.oya.kr.user.mapper.dto.response.BusinessMapperResponse; import com.oya.kr.user.mapper.dto.response.UserMapperResponse; @@ -157,4 +157,15 @@ public List findByBusiness(Long userId) { public List findByBasic(Long userId) { return userMapper.findByBasic(userId); } + + /** + * 결제 주문자 상세정보 조회 + * + * @author 김유빈 + * @since 2024.02.28 + */ + public AdUserDetailMapperResponse findMeForAd(Long userId) { + return userMapper.findMeForAb(userId) + .orElseThrow(() -> new ApplicationException(NOT_EXIST_USER)); + } } diff --git a/src/main/java/com/oya/kr/user/service/UserService.java b/src/main/java/com/oya/kr/user/service/UserService.java index 73cd2ac..4c5dc9b 100644 --- a/src/main/java/com/oya/kr/user/service/UserService.java +++ b/src/main/java/com/oya/kr/user/service/UserService.java @@ -18,11 +18,13 @@ import com.oya.kr.global.jwt.TokenProvider; import com.oya.kr.user.controller.dto.request.JoinRequest; import com.oya.kr.user.controller.dto.request.LoginRequest; +import com.oya.kr.user.controller.dto.response.AdUserDetailResponse; import com.oya.kr.user.controller.dto.response.BusinessUserResponse; import com.oya.kr.user.controller.dto.response.JwtTokenResponse; import com.oya.kr.user.controller.dto.response.BasicUserResponse; import com.oya.kr.user.domain.User; import com.oya.kr.user.domain.enums.UserType; +import com.oya.kr.user.mapper.dto.response.AdUserDetailMapperResponse; import com.oya.kr.user.mapper.dto.response.BasicMapperResponse; import com.oya.kr.user.mapper.dto.response.BusinessMapperResponse; import com.oya.kr.user.repository.UserRepository; @@ -190,6 +192,20 @@ public List reads(String type) { return getUserResponses(null, userType); } + /** + * 결제 주문자 상세정보 조회 + * + * @parameter String + * @return AdUserDetailResponse + * @author 김유빈 + * @since 2024.02.28 + */ + public AdUserDetailResponse findMeForAb(String email) { + User savedUser = userRepository.findByEmail(email); + AdUserDetailMapperResponse response = userRepository.findMeForAd(savedUser.getId()); + return AdUserDetailResponse.from(response); + } + private List getUserResponses(Long userId, UserType userType) { List result; List basicMapperResponses; diff --git a/src/main/resources/com/oya/kr/community/mapper/CommunityMapper.xml b/src/main/resources/com/oya/kr/community/mapper/CommunityMapper.xml index 8350d3f..6d3191d 100644 --- a/src/main/resources/com/oya/kr/community/mapper/CommunityMapper.xml +++ b/src/main/resources/com/oya/kr/community/mapper/CommunityMapper.xml @@ -95,6 +95,15 @@ GROUP BY CATEGORY_CODE + + + + + + INSERT INTO POPUP(TITLE, DESCRIPTION, WITHDRAWAL_STATUS, PLAN_ID) VALUES (#{title}, #{description}, #{withdrawalStatus}, #{planId}) diff --git a/src/main/resources/com/oya/kr/user/mapper/UserMapper.xml b/src/main/resources/com/oya/kr/user/mapper/UserMapper.xml index 1e266bb..8dc746e 100644 --- a/src/main/resources/com/oya/kr/user/mapper/UserMapper.xml +++ b/src/main/resources/com/oya/kr/user/mapper/UserMapper.xml @@ -176,4 +176,12 @@ ORDER BY U.CREATED_DATE DESC + + diff --git a/src/main/resources/mybatis/mybatis-config.xml b/src/main/resources/mybatis/mybatis-config.xml index 1b23f2f..20b4b2a 100644 --- a/src/main/resources/mybatis/mybatis-config.xml +++ b/src/main/resources/mybatis/mybatis-config.xml @@ -79,9 +79,13 @@ + + + +