diff --git a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseCase.java b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseCase.java index ac291da4..f25f1efa 100644 --- a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseCase.java +++ b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseCase.java @@ -15,6 +15,7 @@ import com.postgraduate.domain.wish.application.mapper.WishMapper; import com.postgraduate.domain.wish.domain.entity.Wish; import com.postgraduate.domain.wish.domain.service.WishSaveService; +import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage; import com.postgraduate.global.bizppurio.application.usecase.BizppurioSeniorMessage; import com.postgraduate.global.slack.SlackSignUpMessage; import lombok.RequiredArgsConstructor; @@ -43,6 +44,7 @@ public class SignUpUseCase { private final UserUtils userUtils; private final SeniorUtils seniorUtils; private final BizppurioSeniorMessage bizppurioSeniorMessage; + private final BizppurioJuniorMessage bizppurioJuniorMessage; public User userSignUp(SignUpRequest request) { userUtils.checkPhoneNumber(request.phoneNumber()); @@ -50,6 +52,8 @@ public User userSignUp(SignUpRequest request) { Wish wish = WishMapper.mapToWish(user, request); wishSaveService.save(wish); userSaveService.save(user); + if (request.matchingReceive()) + bizppurioJuniorMessage.matchingWaiting(user); slackSignUpMessage.sendJuniorSignUp(user, wish); return user; } @@ -72,6 +76,8 @@ public User changeSenior(User user, SeniorChangeRequest changeRequest) { public void changeUser(User user, UserChangeRequest changeRequest) { Wish wish = WishMapper.mapToWish(user, changeRequest); wishSaveService.save(wish); + if (changeRequest.matchingReceive()) + bizppurioJuniorMessage.matchingWaiting(user); slackSignUpMessage.sendJuniorSignUp(user, wish); } diff --git a/src/main/java/com/postgraduate/global/bizppurio/application/mapper/BizppurioMapper.java b/src/main/java/com/postgraduate/global/bizppurio/application/mapper/BizppurioMapper.java index f8182d9b..397eca38 100644 --- a/src/main/java/com/postgraduate/global/bizppurio/application/mapper/BizppurioMapper.java +++ b/src/main/java/com/postgraduate/global/bizppurio/application/mapper/BizppurioMapper.java @@ -1,11 +1,10 @@ package com.postgraduate.global.bizppurio.application.mapper; -import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest; -import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest; -import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest; import com.postgraduate.domain.user.domain.entity.User; import com.postgraduate.global.bizppurio.application.dto.req.CommonRequest; import com.postgraduate.global.bizppurio.application.dto.req.ContentRequest; +import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest; +import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest; import com.postgraduate.global.bizppurio.application.dto.req.content.*; import com.postgraduate.global.bizppurio.application.dto.req.content.button.WebLinkButton; import org.springframework.beans.factory.annotation.Value; @@ -239,19 +238,19 @@ public CommonRequest mapToJuniorMatchingSuccess(JuniorMatchingSuccessRequest req return createCommonRequest(messageBody, request.phoneNumber()); } - public CommonRequest mapToJuniorMatchingWaiting(JuniorMatchingWaitingRequest request) { + public CommonRequest mapToJuniorMatchingWaiting(User user) { String message = ( - "안녕하세요, " + request.name() + "님.\n" + + "안녕하세요, " + user.getNickName() + "님.\n" + "\n" + "김선배와 함께 해주셔서 감사드립니다.\n" + "\n" + - request.name() + "님이 신청한 선배를 저희 김선배에서 찾고 있어요 !\n" + + user.getNickName() + "님이 신청한 선배를 저희 김선배에서 찾고 있어요 !\n" + "\n" + "신청해주신 선배를 찾는데에는 3~7일 정도 소요되어요 \uD83D\uDE0A" - ); + ); JuniorMatchingWaitingMessage messageBody = new JuniorMatchingWaitingMessage(message, senderKey, juniorMatchingWaiting); - return createCommonRequest(messageBody, request.phoneNumber()); + return createCommonRequest(messageBody, user.getPhoneNumber()); } private CommonRequest createCommonRequest(Message messageBody, String phoneNumber) { diff --git a/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioJuniorMessage.java b/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioJuniorMessage.java index 658e40f2..6cc445a8 100644 --- a/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioJuniorMessage.java +++ b/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioJuniorMessage.java @@ -4,7 +4,6 @@ import com.postgraduate.domain.user.domain.entity.User; import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest; import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest; -import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest; import com.postgraduate.global.bizppurio.application.mapper.BizppurioMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -36,8 +35,8 @@ public void mentoringFinish(User user) { bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorFinish(user)); } - public void matchingWaiting(JuniorMatchingWaitingRequest request) { - bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorMatchingWaiting(request)); + public void matchingWaiting(User user) { + bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorMatchingWaiting(user)); } public void matchingFail(JuniorMatchingFailRequest request) { diff --git a/src/main/java/com/postgraduate/global/bizppurio/presantation/BizppurioController.java b/src/main/java/com/postgraduate/global/bizppurio/presantation/BizppurioController.java index 493bd2be..396a62ca 100644 --- a/src/main/java/com/postgraduate/global/bizppurio/presantation/BizppurioController.java +++ b/src/main/java/com/postgraduate/global/bizppurio/presantation/BizppurioController.java @@ -2,9 +2,9 @@ import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest; import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest; -import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest; import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage; import com.postgraduate.global.dto.ResponseDto; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; @@ -19,19 +19,15 @@ public class BizppurioController { private final BizppurioJuniorMessage bizppurioJuniorMessage; - @PostMapping("/matching/waiting") - public ResponseDto matchingWaiting(@RequestBody JuniorMatchingWaitingRequest request) { - bizppurioJuniorMessage.matchingWaiting(request); - return ResponseDto.create("200", request.phoneNumber() + " 번호로 " + request.name() + " 님께 알림톡 전송 완료"); - } - @PostMapping("/matching/fail") + @Operation(summary = "매칭 실패시 전송") public ResponseDto matchingFail(@RequestBody JuniorMatchingFailRequest request) { bizppurioJuniorMessage.matchingFail(request); return ResponseDto.create("200", request.phoneNumber() + " 번호로 " + request.name() + " 님께 알림톡 전송 완료"); } @PostMapping("/matching/success") + @Operation(summary = "매칭 성공시 전송") public ResponseDto matchingSuccess(@RequestBody JuniorMatchingSuccessRequest request) { bizppurioJuniorMessage.matchingSuccess(request); return ResponseDto.create("200", request.phoneNumber() + " 번호로 " + request.name() + " 님께 알림톡 전송 완료"); diff --git a/src/test/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseTypeTest.java b/src/test/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseTypeTest.java index 79efe126..53f357b5 100644 --- a/src/test/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseTypeTest.java +++ b/src/test/java/com/postgraduate/domain/auth/application/usecase/oauth/SignUpUseTypeTest.java @@ -19,6 +19,7 @@ import com.postgraduate.domain.wish.domain.entity.Wish; import com.postgraduate.domain.wish.domain.entity.constant.Status; import com.postgraduate.domain.wish.domain.service.WishSaveService; +import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage; import com.postgraduate.global.bizppurio.application.usecase.BizppurioSeniorMessage; import com.postgraduate.global.slack.SlackSignUpMessage; import org.junit.jupiter.api.BeforeEach; @@ -56,6 +57,8 @@ class SignUpUseTypeTest { @Mock private BizppurioSeniorMessage bizppurioSeniorMessage; @Mock + private BizppurioJuniorMessage bizppurioJuniorMessage; + @Mock private SeniorSaveService seniorSaveService; @Mock private SalarySaveService salarySaveService;