diff --git a/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java b/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java index 30ba5b7..e694c29 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java +++ b/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java @@ -54,7 +54,7 @@ public ResponseEntity postCustom( @RequestBody @Valid PostCustomReq request ) { PostCustomRes response = PostCustomRes.from( - (customFacade.createCustom(request.getHaveDesign(), userId))); + customFacade.createCustom(request.getHaveDesign(), userId)); return BaseResponse.success(SuccessType.CREATE_CUSTOM_SUCCESS, response); } @@ -79,7 +79,10 @@ public ResponseEntity patchCustom( PatchCustomRes response = PatchCustomRes.from( customFacade.updateCustom( - customInfo.newUpdateCustomReq(userId, customImages, handDrawingImage))); + customInfo.newUpdateCustomReq( + userId, + customImages, + handDrawingImage))); return BaseResponse.success(SuccessType.UPDATE_CUSTOM_SUCCESS, response); } diff --git a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/CustomApplyDiscordMessage.java b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/CustomApplyDiscordMessage.java index cecf03f..bf690ef 100644 --- a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/CustomApplyDiscordMessage.java +++ b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/CustomApplyDiscordMessage.java @@ -15,28 +15,29 @@ public class CustomApplyDiscordMessage { DiscordCustomImage image; public static CustomApplyDiscordMessage from(User user, Custom custom) { - String title = "Custom Id : " + custom.getId(); - String description; + String title = "커스텀 도안 번호 : " + custom.getId(); + StringBuilder description = new StringBuilder(); + + description.append("\n\n### [유저 정보]") + .append("\n- 연락처: ").append(user.getPhoneNumber()) + .append("\n- 이름: ").append(custom.getName()) + .append("\n\n### [도안 신청 정보]") + .append("\n- 사이즈: ").append(custom.getSize().getSize()) + .append("\n- 수량: ").append(custom.getCount()); + if (custom.getHaveDesign()) { - description = "유저 전화번호 : " + user.getPhoneNumber() - + "\n이름 : " + custom.getName() - + "\n사이즈 : " + custom.getSize().getSize() - + "\n추가 요청 사항 : " + custom.getDemand() - + "\n수량 : " + custom.getCount() - + "\n그려둔 도안 있음"; + description.append("\n- 추가 요청 사항: ").append(custom.getDemand()) + .append("\n- 도안: ").append("`있음`"); } else { - description = "유저 전화번호 : " + user.getPhoneNumber() - + "이름 : " + custom.getName() - + "\n사이즈 : " + custom.getSize().getSize() - + "\n추가 요청 사항 : " + custom.getDemand() - + "\n색상 : " + custom.getIsColored() - + "\n주제 및 설명 : " + custom.getDescription() - + "\n수량 : " + custom.getCount() - + "\n그려둔 도안 없음"; + description.append("\n- 색상: ").append(custom.getIsColored()) + .append("\n- 주제 및 설명: \n").append(custom.getDescription()) + .append("\n- 추가 요청 사항: ").append(custom.getDemand()) + .append("\n- 도안: ").append("`없음`"); } + return new CustomApplyDiscordMessage( title, - description, + description.toString(), new DiscordCustomImage(custom.getMainImageUrl()) ); } diff --git a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java index d7732fe..220898f 100644 --- a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java +++ b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java @@ -19,27 +19,28 @@ public static OrderStickerDiscordMessage from( List orderedProducts) { String title = "주문 번호: " + orderHistory.getId(); StringBuilder description = new StringBuilder(); + description.append("\n\n### [주문 정보]") - .append("\n유저 번호: ").append(orderHistory.getUser().getId()) - .append("\n상품 금액: ").append(orderHistory.getProductAmount()) - .append("\n총 주문 금액: ").append(orderHistory.getTotalAmount()); + .append("\n- 유저 번호: ").append(orderHistory.getUser().getId()) + .append("\n- 상품 금액: ").append(orderHistory.getProductAmount()) + .append("\n- 총 주문 금액: ").append(orderHistory.getTotalAmount()); description.append("\n\n### [주문 상품 내역]"); orderedProducts.forEach(product -> { description.append("\n"); - description.append("\n상품 번호: ").append(product.getSticker().getId()); - description.append("\n상품명: ").append(product.getSticker().getName()); - description.append("\n가격: ").append(product.getPrice()); - description.append("\n수량: ").append(product.getCount()); + description.append("\n- 상품 번호: ").append(product.getSticker().getId()); + description.append("\n- 상품명: ").append(product.getSticker().getName()); + description.append("\n- 가격: ").append(product.getPrice()); + description.append("\n- 수량: ").append(product.getCount()); }); description.append("\n\n### [배송 정보]") - .append("\n수령인: ").append(orderHistory.getRecipientName()) - .append("\n연락처: ").append(orderHistory.getContact()) - .append("\n우편 번호: ").append(orderHistory.getMailingAddress()) - .append("\n기본 주소: ").append(orderHistory.getBaseAddress()) - .append("\n싱세 주소: ").append(orderHistory.getDetailAddress()) - .append("\n배송비: ").append(orderHistory.getShippingFee()); + .append("\n- 수령인: ").append(orderHistory.getRecipientName()) + .append("\n- 연락처: ").append(orderHistory.getContact()) + .append("\n- 우편 번호: ").append(orderHistory.getMailingAddress()) + .append("\n- 기본 주소: ").append(orderHistory.getBaseAddress()) + .append("\n- 싱세 주소: ").append(orderHistory.getDetailAddress()) + .append("\n- 배송비: ").append(orderHistory.getShippingFee()); return new OrderStickerDiscordMessage(title, description.toString()); } diff --git a/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java b/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java index a26ca08..5144ee5 100644 --- a/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java +++ b/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java @@ -25,10 +25,14 @@ public class DiscordMessageService { @Transactional public void sendCustomApplyMessage(Custom custom) { - CustomApplyDiscordMessage payload = CustomApplyDiscordMessage.from(custom.getUser(), - custom); - sendDiscordMessage(customWebhookProperty.getClientId(), customWebhookProperty.getToken(), - custom.getUser(), "님이 커스텀 도안을 신청했습니다.", payload); + CustomApplyDiscordMessage payload = + CustomApplyDiscordMessage.from(custom.getUser(), custom); + + sendDiscordMessage(customWebhookProperty.getClientId(), + customWebhookProperty.getToken(), + custom.getUser(), + "님이 커스텀 도안을 신청했습니다.", + payload); } @Transactional @@ -36,6 +40,7 @@ public void sendOrderStickerMessage(OrderHistory orderHistory, List orderedProducts) { OrderStickerDiscordMessage payload = OrderStickerDiscordMessage.from(orderHistory, orderedProducts); + sendDiscordMessage( orderWebhookProperty.getClientId(), orderWebhookProperty.getToken(),