Skip to content

Commit

Permalink
Merge pull request #196 from TEAMMatchDev/dev
Browse files Browse the repository at this point in the history
Dev 변경사항 Aligo 서버 배포
  • Loading branch information
imenuuu authored Nov 30, 2023
2 parents 909a384 + d0325f9 commit 9ae7a5b
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public CommonResponse<String> checkPhone(@RequestParam String phone, @RequestPar
}

@PostMapping("/alim-talk")
public CommonResponse<String> sendAlimTalㄴk(@RequestParam AlimType alimType, @RequestBody AlimTalkDto alimTalk){
public CommonResponse<String> sendAlimTalk(@RequestParam AlimType alimType, @RequestBody AlimTalkDto alimTalk){
aligoInfraService.sendAlimTalk(alimTalk, alimType);
return CommonResponse.onSuccess("알림톡 전송 성공");
}
Expand Down
2 changes: 1 addition & 1 deletion Match-Aligo/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
port: 9000
port: 9001
servlet:
context-path: /

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import com.example.matchcommon.reponse.CommonResponse;
import com.example.matchinfrastructure.aligo.service.AligoInfraService;
import com.example.matchinfrastructure.match_aligo.dto.AlimTalkDto;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static com.example.matchinfrastructure.aligo.dto.AlimType.EXECUTION;
import static com.example.matchinfrastructure.aligo.dto.AlimType.PAYMENT;

@RestController
Expand All @@ -21,6 +23,8 @@ public CommonResponse<String> testAlimTalk(
@RequestParam("name") String name,
@RequestParam("phone") String phone) {
aligoInfraService.sendAlimTalkTest(phone, name, PAYMENT);

//aligoInfraService.sendAlimTalk(new AlimTalkDto(1L,name, phone, "TBT", "강아지 사료"), EXECUTION);
return CommonResponse.onSuccess("성공");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ public class ReviewController {
@GetMapping("")
@Operation(summary = "13-01 Review 작성 유무 팝업 창 띄우기 유무",description = "매 번 스플레시 단 or 홈화면에서 호출 하여 팝업창 띄우기")
public CommonResponse<ReviewRes.PopUpInfo> checkPopUp(@AuthenticationPrincipal User user){
ReviewRes.PopUpInfo popUpInfo = reviewService.checkPopUp(user);

return CommonResponse.onSuccess(reviewService.checkPopUp(user));
if(popUpInfo == null){
return CommonResponse.onSuccessesFail(null);
}
return CommonResponse.onSuccess(popUpInfo);
}

@ApiErrorCodeExample({UserAuthErrorCode.class, RequestErrorCode.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,17 @@ public class ReviewService {
public ReviewRes.PopUpInfo checkPopUp(User user) {
List<DonationExecution> donationExecutions = donationExecutionAdaptor.checkPopUp(user);

DonationExecution donationExecution = checkExecution(donationExecutions);
if(donationExecutions.isEmpty()){
return null;
}

return reviewConverter.convertToPopUp(donationExecution.getDonationUser(), donationExecution.getId());
}

private DonationExecution checkExecution(List<DonationExecution> donationExecutions) {
if(donationExecutions.isEmpty()) throw new NotFoundException(NOT_EXISTS_DONATION);
DonationExecution donationExecution = donationExecutions.get(0);

DonationExecution donationExecution =donationExecutions.get(0);
if(donationExecution.getReview() != null){
return null;
}

if(donationExecution.getReview() != null) throw new NotFoundException(NOT_EXISTS_DONATION);

return donationExecution;
return reviewConverter.convertToPopUp(donationExecution.getDonationUser(), donationExecution.getId());
}

public void postReview(User user, ReviewReq.ReviewUpload reviewUpload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public UserRes.UserToken appleLogin(UserReq.SocialLoginToken socialLoginToken) {
HashMap<String, String> userInfo = new HashMap<>();

userInfo.put("socialId", appleUserRes.getSocialId());
userInfo.put("email", appleUserRes.getEmail());

throw new BaseDynamicException(NOT_EXISTS_APPLE_USER, userInfo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public static <T> CommonResponse<T> onSuccess(T data) {
return new CommonResponse<>(true, "요청에 성공하였습니다.","1000", data);
}

public static <T> CommonResponse<T> onSuccessesFail(T data) {
return new CommonResponse<>(false,"요청에 성공하였습니다.", "1000", data);
}

public static <T> CommonResponse<T> onFailure(String code, String message, T data) {
return new CommonResponse<>(false, message, code, data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public List<DonationExecution> getDonationExecutionForPopUp(User user) {
.from(qDonationExecution)
.leftJoin(qDonationUser).on(qDonationExecution.id.eq(qDonationUser.id)).fetchJoin()
.leftJoin(qReview).on(qDonationExecution.id.eq(qReview.donationExecution.id))
.where(qReview.isNull()) // 필터링: Review가 존재하지 않는 경우
.where(qReview.isNull().and(qDonationExecution.donationUser.userId.eq(user.getId())))
.orderBy(qDonationExecution.createdAt.desc())
.limit(1)
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public class AligoStatic {
public static final String PAYMENT_BUTTON_NAME = "내 불꽃이 보러 가기";
public static final String PAYMENT_EM_TITLE = "기부가 시작되었습니다";
public static final String PAYMENT_SUBJECT = "결제 알림";
public static final String PAYMENT_MESSAGE = "%s님의 마음 속 따뜻함이\n" +
public static final String PAYMENT_MESSAGE =
"%s님! 기부 신청이 완료되었습니다.\n\n" +
"%s님의 마음 속 따뜻함이\n" +
"세상을 따뜻하게 할 불꽃이가 되었습니다.\n" +
"\n" +
"어떤 불꽃이가 탄생했는지 \n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public AlimTalkReq convertToAlimTalkTest(String phone, String name, AligoPropert
String tplCode = alimType.equals(AlimType.PAYMENT) ? PAYMENT_TEMPLATE : EXECUTION_TEMPLATE;
String emTitle = alimType.equals(AlimType.PAYMENT) ? PAYMENT_EM_TITLE : EXECUTION_EM_TITLE;
String subject = alimType.equals(AlimType.PAYMENT) ? PAYMENT_SUBJECT : EXECUTION_SUBJECT;
String message = alimType.equals(AlimType.PAYMENT) ? String.format(PAYMENT_MESSAGE, name) : String.format(EXECUTION_MESSAGE, name, "", "");
String message = alimType.equals(AlimType.PAYMENT) ? String.format(PAYMENT_MESSAGE, name, name) : String.format(EXECUTION_MESSAGE, name, "", "");

return createAlimTalkReq(aligoProperties, token, alimType, phone, name, tplCode, emTitle, subject, message, json);
}
Expand All @@ -70,7 +70,7 @@ public AlimTalkReq convertToAlimTalk(AligoProperties aligoProperties, String tok
String tplCode = alimType.equals(AlimType.PAYMENT) ? PAYMENT_TEMPLATE : EXECUTION_TEMPLATE;
String emTitle = alimType.equals(AlimType.PAYMENT) ? PAYMENT_EM_TITLE : EXECUTION_EM_TITLE;
String subject = alimType.equals(AlimType.PAYMENT) ? PAYMENT_SUBJECT : EXECUTION_SUBJECT;
String message = alimType.equals(AlimType.PAYMENT) ? String.format(PAYMENT_MESSAGE, alimTalkDto.getName()) : String.format(EXECUTION_MESSAGE, alimTalkDto.getName(), alimTalkDto.getArticle(), alimTalkDto.getUsages());
String message = alimType.equals(AlimType.PAYMENT) ? String.format(PAYMENT_MESSAGE, alimTalkDto.getName(), alimTalkDto.getName()) : String.format(EXECUTION_MESSAGE, alimTalkDto.getName(), alimTalkDto.getArticle(), alimTalkDto.getUsages());

return createAlimTalkReq(aligoProperties, token, alimType, alimTalkDto.getPhone(), alimTalkDto.getName(), tplCode, emTitle, subject, message, json);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private CreateTokenRes getAligoToken() {
}

public void sendAlimTalk(AlimTalkDto alimTalkDto, AlimType alimType) {

CreateTokenRes token = getAligoToken();

AlimTalkReq alimTalkReq = aligoConverter.convertToAlimTalk(aligoProperties, token.getToken(), alimType, alimTalkDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CommonResponse<String> sendSmsAuth(@RequestHeader(name = "X-AUTH-TOKEN") String
@RequestParam("code") String code);


@PostMapping("/alim-talk")
@PostMapping("/send/alim-talk")
CommonResponse<String> sendAlimTalk(@RequestHeader(name = "X-AUTH-TOKEN") String token,
@RequestParam("alimType")AlimType alimType,
@RequestBody AlimTalkDto alimTalkDto);
Expand Down

0 comments on commit 9ae7a5b

Please sign in to comment.