From 5feb130cd826c6a7f90c72b9e551f5710c2a3089 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 21:12:56 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=EC=B6=9C=EA=B8=88=20=EC=B5=9C?= =?UTF-8?q?=EC=86=8C=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/sinitto/point/entity/PointLog.java | 2 +- .../example/sinitto/point/service/PointService.java | 10 ++++++++-- .../sinitto/point/service/PointServiceTest.java | 12 +++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/sinitto/point/entity/PointLog.java b/src/main/java/com/example/sinitto/point/entity/PointLog.java index d7389503..40f1aeef 100644 --- a/src/main/java/com/example/sinitto/point/entity/PointLog.java +++ b/src/main/java/com/example/sinitto/point/entity/PointLog.java @@ -15,7 +15,7 @@ @EntityListeners(AuditingEntityListener.class) public class PointLog { - public static final double WITHDRAWAL_FEE_RATE = 0.8; + private static final double WITHDRAWAL_FEE_RATE = 0.8; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/src/main/java/com/example/sinitto/point/service/PointService.java b/src/main/java/com/example/sinitto/point/service/PointService.java index 53ef6ce5..4aa39372 100644 --- a/src/main/java/com/example/sinitto/point/service/PointService.java +++ b/src/main/java/com/example/sinitto/point/service/PointService.java @@ -24,6 +24,8 @@ @Service public class PointService { + private static final int MINIMUM_WITHDRAW_POINT = 5000; + private final MemberRepository memberRepository; private final PointRepository pointRepository; private final PointLogRepository pointLogRepository; @@ -79,7 +81,7 @@ public PointChargeResponse savePointChargeRequest(Long memberId, int price) { String title = "포인트 충전 요청"; String description = String.format("%s님이 %d 포인트를 충전 요청했습니다.", member.getName(), price); - slackMessageService.sendStyledSlackMessage(title, description,"충전"); + slackMessageService.sendStyledSlackMessage(title, description, "충전"); return new PointChargeResponse(member.getDepositMessage()); } @@ -87,6 +89,10 @@ public PointChargeResponse savePointChargeRequest(Long memberId, int price) { @Transactional public void savePointWithdrawRequest(Long memberId, int price) { + if (price < MINIMUM_WITHDRAW_POINT) { + throw new BadRequestException(String.format("출금시 최소 %d 이상 요청하셔야합니다.", MINIMUM_WITHDRAW_POINT)); + } + Member member = memberRepository.findById(memberId) .orElseThrow(() -> new NotFoundException("요청한 멤버를 찾을 수 없습니다")); @@ -115,7 +121,7 @@ public void savePointWithdrawRequest(Long memberId, int price) { String title = "포인트 출금 요청"; String description = String.format("%s님이 %d 포인트를 출금 요청했습니다.\n은행: %s, 계좌번호: %s", member.getName(), price, sinittoBankInfo.getBankName(), sinittoBankInfo.getAccountNumber()); - slackMessageService.sendStyledSlackMessage(title, description,"출금"); + slackMessageService.sendStyledSlackMessage(title, description, "출금"); } @Transactional diff --git a/src/test/java/com/example/sinitto/point/service/PointServiceTest.java b/src/test/java/com/example/sinitto/point/service/PointServiceTest.java index e73e7d10..3f6962b5 100644 --- a/src/test/java/com/example/sinitto/point/service/PointServiceTest.java +++ b/src/test/java/com/example/sinitto/point/service/PointServiceTest.java @@ -48,7 +48,7 @@ class PointServiceTest { @Mock KakaoMessageService kakaoMessageService; @Mock - private SlackMessageService slackMessageService; + SlackMessageService slackMessageService; @Nested @DisplayName("포인트 조회 테스트") @@ -234,6 +234,16 @@ void savePointWithdrawRequest4() { //when then assertThrows(BadRequestException.class, () -> pointService.savePointWithdrawRequest(1L, 10000)); } + + @Test + @DisplayName("최소 출금 포인트보다 모자라면 예외를 발생시켜야한다.") + void savePointWithdrawRequest5() { + //given + int withdrawPoint = 4999; + + //when then + assertThrows(BadRequestException.class, () -> pointService.savePointWithdrawRequest(1L, withdrawPoint)); + } } @Nested From b9bb7d7e43beb1464836f9865921af67497ed732 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 21:39:52 +0900 Subject: [PATCH 2/8] refactor: String -> Content --- .../com/example/sinitto/point/dto/PointLogResponse.java | 2 +- .../java/com/example/sinitto/point/entity/PointLog.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java b/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java index f563100c..71536ae8 100644 --- a/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java +++ b/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java @@ -6,7 +6,7 @@ public record PointLogResponse( LocalDateTime postTime, - String content, + PointLog.Content content, int price, PointLog.Status status ) { diff --git a/src/main/java/com/example/sinitto/point/entity/PointLog.java b/src/main/java/com/example/sinitto/point/entity/PointLog.java index 40f1aeef..f7fd568c 100644 --- a/src/main/java/com/example/sinitto/point/entity/PointLog.java +++ b/src/main/java/com/example/sinitto/point/entity/PointLog.java @@ -21,7 +21,7 @@ public class PointLog { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull - private String content; + private PointLog.Content content; @NotNull private int price; @CreatedDate @@ -36,7 +36,7 @@ public class PointLog { private Member member; - public PointLog(String content, Member member, int price, Status status) { + public PointLog(Content content, Member member, int price, Status status) { this.content = content; this.member = member; this.price = price; @@ -120,7 +120,7 @@ public Status getStatus() { return status; } - public String getContent() { + public Content getContent() { return content; } @@ -145,7 +145,8 @@ public enum Content { SPEND_COMPLETE_HELLO_CALL("안부전화 신청"), SPEND_CANCEL_HELLO_CALL("안부전화 신청 취소"), CHARGE_REQUEST("포인트 충전"), - WITHDRAW_REQUEST("포인트 출금"); + WITHDRAW_REQUEST("포인트 출금"), + WELCOME_POINT("환영 포인트"); private final String message; From 932b1b647b1d41e7c517120b1b982a0f733a4728 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 22:25:20 +0900 Subject: [PATCH 3/8] =?UTF-8?q?refactor:=20String=20->=20Content=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EC=97=B0=EC=87=84=20=EC=BD=94=EB=93=9C=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 --- .../sinitto/common/dummy/InitialData.java | 262 +++++++++--------- .../sinitto/point/service/PointService.java | 10 +- .../sinitto/point/entity/PointLogTest.java | 24 +- .../point/service/PointServiceTest.java | 2 +- 4 files changed, 149 insertions(+), 149 deletions(-) diff --git a/src/main/java/com/example/sinitto/common/dummy/InitialData.java b/src/main/java/com/example/sinitto/common/dummy/InitialData.java index d75fe0f0..a289c44d 100644 --- a/src/main/java/com/example/sinitto/common/dummy/InitialData.java +++ b/src/main/java/com/example/sinitto/common/dummy/InitialData.java @@ -151,155 +151,155 @@ protected void initial() { //포인트와 포인트로그 pointRepository.save(new Point(50000, memberSinitto1)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), memberSinitto1, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), memberSinitto1, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), memberSinitto1, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), memberSinitto1, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), memberSinitto1, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto1, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto1, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto1, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto1, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto1, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, memberSinitto1, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, memberSinitto1, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, memberSinitto1, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, memberSinitto1, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, memberSinitto1, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto1, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto1, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto1, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto1, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, memberSinitto2)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), memberSinitto2, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), memberSinitto2, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), memberSinitto2, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), memberSinitto2, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), memberSinitto2, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto2, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto2, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto2, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto2, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto2, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, memberSinitto2, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, memberSinitto2, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, memberSinitto2, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, memberSinitto2, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, memberSinitto2, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto2, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto2, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto2, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto2, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, memberSinitto3)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), memberSinitto3, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), memberSinitto3, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), memberSinitto3, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), memberSinitto3, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), memberSinitto3, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto3, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto3, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto3, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto3, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto3, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, memberSinitto3, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, memberSinitto3, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, memberSinitto3, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, memberSinitto3, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, memberSinitto3, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto3, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto3, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto3, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto3, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto3, 50000, PointLog.Status.CHARGE_COMPLETE)); pointRepository.save(new Point(50000, memberSinitto4)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), memberSinitto4, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), memberSinitto4, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), memberSinitto4, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), memberSinitto4, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), memberSinitto4, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto4, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto4, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto4, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto4, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto4, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, memberSinitto4, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, memberSinitto4, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, memberSinitto4, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, memberSinitto4, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, memberSinitto4, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto4, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto4, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto4, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto4, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, memberSinitto5)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), memberSinitto5, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), memberSinitto5, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), memberSinitto5, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), memberSinitto5, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), memberSinitto5, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), memberSinitto5, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto5, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto5, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto5, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, memberSinitto5, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, memberSinitto5, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, memberSinitto5, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, memberSinitto5, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, memberSinitto5, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, memberSinitto5, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto5, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto5, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto5, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, memberSinitto5, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, guard1)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard1, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard1, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard1, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard1, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), guard1, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), guard1, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), guard1, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), guard1, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), guard1, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard1, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard1, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard1, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard1, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard1, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard1, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard1, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard1, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, guard1, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, guard1, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, guard1, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, guard1, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, guard1, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard1, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard1, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard1, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard1, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, guard2)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard2, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard2, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard2, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard2, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), guard2, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), guard2, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), guard2, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), guard2, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), guard2, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard2, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard2, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard2, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard2, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard2, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard2, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard2, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard2, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, guard2, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, guard2, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, guard2, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, guard2, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, guard2, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard2, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard2, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard2, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard2, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, guard3)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard3, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard3, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard3, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard3, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), guard3, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), guard3, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), guard3, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), guard3, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), guard3, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard3, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard3, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard3, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard3, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard3, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard3, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard3, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard3, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, guard3, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, guard3, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, guard3, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, guard3, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, guard3, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard3, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard3, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard3, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard3, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, guard4)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard4, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard4, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard4, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard4, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), guard4, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), guard4, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), guard4, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), guard4, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), guard4, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard4, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard4, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard4, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard4, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard4, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard4, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard4, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard4, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, guard4, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, guard4, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, guard4, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, guard4, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, guard4, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard4, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard4, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard4, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard4, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); pointRepository.save(new Point(50000, guard5)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard5, 50000, PointLog.Status.CHARGE_FAIL)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard5, 50000, PointLog.Status.CHARGE_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard5, 50000, PointLog.Status.CHARGE_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), guard5, 50000, PointLog.Status.CHARGE_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN.getMessage(), guard5, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN.getMessage(), guard5, 50000, PointLog.Status.EARN)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL.getMessage(), guard5, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK.getMessage(), guard5, 50000, PointLog.Status.SPEND_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL.getMessage(), guard5, 50000, PointLog.Status.SPEND_CANCEL)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard5, 50000, PointLog.Status.WITHDRAW_REQUEST)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard5, 50000, PointLog.Status.WITHDRAW_WAITING)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard5, 50000, PointLog.Status.WITHDRAW_COMPLETE)); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), guard5, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard5, 50000, PointLog.Status.CHARGE_FAIL)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard5, 50000, PointLog.Status.CHARGE_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard5, 50000, PointLog.Status.CHARGE_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, guard5, 50000, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_CALLBACK_AND_EARN, guard5, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.COMPLETE_HELLO_CALL_AND_EARN, guard5, 50000, PointLog.Status.EARN)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_HELLO_CALL, guard5, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_COMPLETE_CALLBACK, guard5, 50000, PointLog.Status.SPEND_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.SPEND_CANCEL_HELLO_CALL, guard5, 50000, PointLog.Status.SPEND_CANCEL)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard5, 50000, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard5, 50000, PointLog.Status.WITHDRAW_WAITING)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard5, 50000, PointLog.Status.WITHDRAW_COMPLETE)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, guard5, 50000, PointLog.Status.WITHDRAW_FAIL_AND_RESTORE_POINT)); //콜백 callbackRepository.save(new Callback(Callback.Status.COMPLETE, senior1)); diff --git a/src/main/java/com/example/sinitto/point/service/PointService.java b/src/main/java/com/example/sinitto/point/service/PointService.java index 4aa39372..5d3cec2a 100644 --- a/src/main/java/com/example/sinitto/point/service/PointService.java +++ b/src/main/java/com/example/sinitto/point/service/PointService.java @@ -75,7 +75,7 @@ public PointChargeResponse savePointChargeRequest(Long memberId, int price) { Member member = memberRepository.findById(memberId) .orElseThrow(() -> new NotFoundException("요청한 멤버를 찾을 수 없습니다")); - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), member, price, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, member, price, PointLog.Status.CHARGE_REQUEST)); kakaoMessageService.sendPointChargeRequestReceivedMessage(member.getEmail(), price, member.getName(), member.getDepositMessage()); @@ -113,7 +113,7 @@ public void savePointWithdrawRequest(Long memberId, int price) { point.deduct(price); - pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST.getMessage(), member, price, PointLog.Status.WITHDRAW_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.WITHDRAW_REQUEST, member, price, PointLog.Status.WITHDRAW_REQUEST)); SinittoBankInfo sinittoBankInfo = sinittoBankInfoRepository.findByMemberId(memberId).orElseThrow(() -> new NotFoundException("시니또의 은행 계좌 정보가 없습니다.")); kakaoMessageService.sendPointWithdrawRequestReceivedMessage(member.getEmail(), price, member.getName(), sinittoBankInfo.getBankName(), sinittoBankInfo.getAccountNumber()); @@ -134,7 +134,7 @@ public void earnPoint(Long memberId, int price, PointLog.Content contentForPoint pointLogRepository.save( new PointLog( - contentForPointLog.getMessage(), + contentForPointLog, point.getMember(), price, PointLog.Status.EARN) @@ -155,7 +155,7 @@ public void deductPoint(Long memberId, int price, PointLog.Content contentForPoi pointLogRepository.save( new PointLog( - contentForPointLog.getMessage(), + contentForPointLog, point.getMember(), price, PointLog.Status.SPEND_COMPLETE @@ -176,7 +176,7 @@ public void refundPointByDelete(Long memberId, int price, PointLog.Content conte pointLogRepository.save( new PointLog( - contentForPointLog.getMessage(), + contentForPointLog, point.getMember(), price, PointLog.Status.SPEND_CANCEL diff --git a/src/test/java/com/example/sinitto/point/entity/PointLogTest.java b/src/test/java/com/example/sinitto/point/entity/PointLogTest.java index c415f672..5ec2ec64 100644 --- a/src/test/java/com/example/sinitto/point/entity/PointLogTest.java +++ b/src/test/java/com/example/sinitto/point/entity/PointLogTest.java @@ -19,7 +19,7 @@ class PointLogTest { @DisplayName("포인트 로그 ChargeWaiting 상태로 전환 성공") void changeStatusToChargeWaiting() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.CHARGE_REQUEST); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.CHARGE_REQUEST); //when pointLog.changeStatusToChargeWaiting(); @@ -34,7 +34,7 @@ void changeStatusToChargeWaiting() { void changeStatusToChargeWaiting_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToChargeWaiting); @@ -44,7 +44,7 @@ void changeStatusToChargeWaiting_fail(String initialStatus) { @DisplayName("포인트 로그 ChargeComplete 상태로 전환 성공") void changeStatusToChargeComplete() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.CHARGE_WAITING); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.CHARGE_WAITING); //when pointLog.changeStatusToChargeComplete(); @@ -59,7 +59,7 @@ void changeStatusToChargeComplete() { void changeStatusToChargeComplete_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToChargeComplete); @@ -69,7 +69,7 @@ void changeStatusToChargeComplete_fail(String initialStatus) { @DisplayName("포인트 로그 ChargeFail 상태로 전환 성공") void changeStatusToChargeFail() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.CHARGE_WAITING); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.CHARGE_WAITING); //when pointLog.changeStatusToChargeFail(); @@ -84,7 +84,7 @@ void changeStatusToChargeFail() { void changeStatusToChargeFail_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToChargeFail); @@ -94,7 +94,7 @@ void changeStatusToChargeFail_fail(String initialStatus) { @DisplayName("포인트 로그 WithdrawWaiting 상태로 전환 성공") void changeStatusToWithdrawWaiting() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.WITHDRAW_REQUEST); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.WITHDRAW_REQUEST); //when pointLog.changeStatusToWithdrawWaiting(); @@ -109,7 +109,7 @@ void changeStatusToWithdrawWaiting() { void changeStatusToWithdrawWaiting_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToWithdrawWaiting); @@ -119,7 +119,7 @@ void changeStatusToWithdrawWaiting_fail(String initialStatus) { @DisplayName("포인트 로그 WithdrawComplete 상태로 전환 성공") void changeStatusToWithdrawComplete() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.WITHDRAW_WAITING); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.WITHDRAW_WAITING); //when pointLog.changeStatusToWithdrawComplete(); @@ -134,7 +134,7 @@ void changeStatusToWithdrawComplete() { void changeStatusToWithdrawComplete_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToWithdrawComplete); @@ -144,7 +144,7 @@ void changeStatusToWithdrawComplete_fail(String initialStatus) { @DisplayName("포인트 로그 WithdrawFail 상태로 전환 성공") void changeStatusToWithdrawFail() { //given - PointLog pointLog = new PointLog("content", member, 1000, PointLog.Status.WITHDRAW_WAITING); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, PointLog.Status.WITHDRAW_WAITING); //when pointLog.changeStatusToWithdrawFail(); @@ -159,7 +159,7 @@ void changeStatusToWithdrawFail() { void changeStatusToWithdrawFail_fail(String initialStatus) { //given PointLog.Status status = PointLog.Status.valueOf(initialStatus); - PointLog pointLog = new PointLog("content", member, 1000, status); + PointLog pointLog = new PointLog(PointLog.Content.CHARGE_REQUEST, member, 1000, status); //when then assertThrows(ConflictException.class, pointLog::changeStatusToWithdrawFail); diff --git a/src/test/java/com/example/sinitto/point/service/PointServiceTest.java b/src/test/java/com/example/sinitto/point/service/PointServiceTest.java index 3f6962b5..5c1b6fca 100644 --- a/src/test/java/com/example/sinitto/point/service/PointServiceTest.java +++ b/src/test/java/com/example/sinitto/point/service/PointServiceTest.java @@ -107,7 +107,7 @@ void getPointLogs1() { when(memberRepository.findById(1L)).thenReturn(Optional.of(member)); PointLog pointLog = mock(PointLog.class); - when(pointLog.getContent()).thenReturn("content"); + when(pointLog.getContent()).thenReturn(PointLog.Content.WELCOME_POINT); when(pointLog.getPrice()).thenReturn(10000); when(pointLog.getStatus()).thenReturn(PointLog.Status.EARN); From 417ace88099b0b7e6b90cad8e1b2d8cb40787211 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 22:26:07 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=EC=8B=9C=20=ED=99=98=EC=98=81=20=ED=8F=AC=EC=9D=B8?= =?UTF-8?q?=ED=8A=B8=20=EC=A0=81=EB=A6=BD=20=EB=A1=9C=EC=A7=81=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 --- .../sinitto/member/service/MemberService.java | 14 ++++++++------ .../sinitto/member/service/MemberServiceTest.java | 9 ++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/example/sinitto/member/service/MemberService.java b/src/main/java/com/example/sinitto/member/service/MemberService.java index 22e32d49..a90e4977 100644 --- a/src/main/java/com/example/sinitto/member/service/MemberService.java +++ b/src/main/java/com/example/sinitto/member/service/MemberService.java @@ -14,8 +14,8 @@ import com.example.sinitto.member.dto.RegisterResponse; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; -import com.example.sinitto.point.entity.Point; -import com.example.sinitto.point.repository.PointRepository; +import com.example.sinitto.point.entity.PointLog; +import com.example.sinitto.point.service.PointService; import jakarta.servlet.http.HttpServletRequest; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -25,24 +25,26 @@ @Service public class MemberService implements MemberIdProvider { + private static final int WELCOME_POINT = 10000; + private final MemberRepository memberRepository; private final TokenService tokenService; private final KakaoApiService kakaoApiService; private final KakaoTokenService kakaoTokenService; - private final PointRepository pointRepository; private final RedisTemplate redisTemplate; private final CallbackService callbackService; private final HelloCallService helloCallService; + private final PointService pointService; - public MemberService(MemberRepository memberRepository, TokenService tokenService, KakaoApiService kakaoApiService, KakaoTokenService kakaoTokenService, PointRepository pointRepository, RedisTemplate redisTemplate, CallbackService callbackService, HelloCallService helloCallService) { + public MemberService(MemberRepository memberRepository, TokenService tokenService, KakaoApiService kakaoApiService, KakaoTokenService kakaoTokenService, RedisTemplate redisTemplate, CallbackService callbackService, HelloCallService helloCallService, PointService pointService) { this.memberRepository = memberRepository; this.tokenService = tokenService; this.kakaoApiService = kakaoApiService; this.kakaoTokenService = kakaoTokenService; - this.pointRepository = pointRepository; this.redisTemplate = redisTemplate; this.callbackService = callbackService; this.helloCallService = helloCallService; + this.pointService = pointService; } @Override @@ -84,7 +86,7 @@ public RegisterResponse registerNewMember(String name, String phoneNumber, Strin Member newMember = new Member(name, phoneNumber, email, isSinitto); memberRepository.save(newMember); - pointRepository.save(new Point(0, newMember)); + pointService.earnPoint(newMember.getId(), WELCOME_POINT, PointLog.Content.WELCOME_POINT); String accessToken = tokenService.generateAccessToken(email); String refreshToken = tokenService.generateRefreshToken(email); diff --git a/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java b/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java index 50b9f6d1..9ad3df9f 100644 --- a/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java +++ b/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java @@ -8,8 +8,7 @@ import com.example.sinitto.member.dto.RegisterResponse; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; -import com.example.sinitto.point.entity.Point; -import com.example.sinitto.point.repository.PointRepository; +import com.example.sinitto.point.service.PointService; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; @@ -30,8 +29,6 @@ public class MemberServiceTest { @Mock MemberRepository memberRepository; @Mock - PointRepository pointRepository; - @Mock TokenService tokenService; @Mock RedisTemplate redisTemplate; @@ -45,6 +42,8 @@ public class MemberServiceTest { CallbackService callbackService; @Mock HelloCallService helloCallService; + @Mock + PointService pointService; @Test @@ -95,7 +94,7 @@ void registerNewMemberTest() { //then verify(memberRepository, times(1)).save(any(Member.class)); - verify(pointRepository, times(1)).save(any(Point.class)); + verify(pointService, times(1)).earnPoint(any(), anyInt(), any()); assertEquals(isSinitto, result.isSinitto()); } From 16be887e31acedde76522aa0f6b36909b2e1d062 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 22:40:15 +0900 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=20=EC=95=88=EC=A7=93=EB=8D=98=EA=B1=B0=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 --- .../sinitto/member/service/MemberService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/sinitto/member/service/MemberService.java b/src/main/java/com/example/sinitto/member/service/MemberService.java index a90e4977..509188fe 100644 --- a/src/main/java/com/example/sinitto/member/service/MemberService.java +++ b/src/main/java/com/example/sinitto/member/service/MemberService.java @@ -14,8 +14,10 @@ import com.example.sinitto.member.dto.RegisterResponse; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; +import com.example.sinitto.point.entity.Point; import com.example.sinitto.point.entity.PointLog; -import com.example.sinitto.point.service.PointService; +import com.example.sinitto.point.repository.PointLogRepository; +import com.example.sinitto.point.repository.PointRepository; import jakarta.servlet.http.HttpServletRequest; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -34,9 +36,10 @@ public class MemberService implements MemberIdProvider { private final RedisTemplate redisTemplate; private final CallbackService callbackService; private final HelloCallService helloCallService; - private final PointService pointService; + private final PointRepository pointRepository; + private final PointLogRepository pointLogRepository; - public MemberService(MemberRepository memberRepository, TokenService tokenService, KakaoApiService kakaoApiService, KakaoTokenService kakaoTokenService, RedisTemplate redisTemplate, CallbackService callbackService, HelloCallService helloCallService, PointService pointService) { + public MemberService(MemberRepository memberRepository, TokenService tokenService, KakaoApiService kakaoApiService, KakaoTokenService kakaoTokenService, RedisTemplate redisTemplate, CallbackService callbackService, HelloCallService helloCallService, PointRepository pointRepository, PointLogRepository pointLogRepository) { this.memberRepository = memberRepository; this.tokenService = tokenService; this.kakaoApiService = kakaoApiService; @@ -44,7 +47,8 @@ public MemberService(MemberRepository memberRepository, TokenService tokenServic this.redisTemplate = redisTemplate; this.callbackService = callbackService; this.helloCallService = helloCallService; - this.pointService = pointService; + this.pointRepository = pointRepository; + this.pointLogRepository = pointLogRepository; } @Override @@ -86,7 +90,8 @@ public RegisterResponse registerNewMember(String name, String phoneNumber, Strin Member newMember = new Member(name, phoneNumber, email, isSinitto); memberRepository.save(newMember); - pointService.earnPoint(newMember.getId(), WELCOME_POINT, PointLog.Content.WELCOME_POINT); + pointRepository.save(new Point(WELCOME_POINT, newMember)); + pointLogRepository.save(new PointLog(PointLog.Content.WELCOME_POINT, newMember, WELCOME_POINT, PointLog.Status.EARN)); String accessToken = tokenService.generateAccessToken(email); String refreshToken = tokenService.generateRefreshToken(email); From b45c0d2b5fe964ff9170958ef5802cafcbe0a955 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 22:40:36 +0900 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20`@Enumerated(EnumType.STRING)`=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/sinitto/point/entity/PointLog.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/example/sinitto/point/entity/PointLog.java b/src/main/java/com/example/sinitto/point/entity/PointLog.java index f7fd568c..77958c48 100644 --- a/src/main/java/com/example/sinitto/point/entity/PointLog.java +++ b/src/main/java/com/example/sinitto/point/entity/PointLog.java @@ -21,6 +21,7 @@ public class PointLog { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull + @Enumerated(EnumType.STRING) private PointLog.Content content; @NotNull private int price; From 7ca4c7f0e56db02c5bfb15498f931daa2dfb2450 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 8 Nov 2024 22:45:59 +0900 Subject: [PATCH 7/8] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=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 --- .../sinitto/member/service/MemberServiceTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java b/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java index 9ad3df9f..bfb5aef1 100644 --- a/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java +++ b/src/test/java/com/example/sinitto/member/service/MemberServiceTest.java @@ -8,7 +8,8 @@ import com.example.sinitto.member.dto.RegisterResponse; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; -import com.example.sinitto.point.service.PointService; +import com.example.sinitto.point.repository.PointLogRepository; +import com.example.sinitto.point.repository.PointRepository; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; @@ -43,7 +44,9 @@ public class MemberServiceTest { @Mock HelloCallService helloCallService; @Mock - PointService pointService; + PointRepository pointRepository; + @Mock + PointLogRepository pointLogRepository; @Test @@ -94,7 +97,8 @@ void registerNewMemberTest() { //then verify(memberRepository, times(1)).save(any(Member.class)); - verify(pointService, times(1)).earnPoint(any(), anyInt(), any()); + verify(pointRepository, times(1)).save(any()); + verify(pointLogRepository, times(1)).save(any()); assertEquals(isSinitto, result.isSinitto()); } From efc64f9410cda28d41c49687e911e82788623043 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Sat, 9 Nov 2024 17:07:16 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=EB=A8=B8=EC=A7=80=20=EC=8B=A4?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/sinitto/point/service/PointService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/sinitto/point/service/PointService.java b/src/main/java/com/example/sinitto/point/service/PointService.java index e4b2f00d..d53840be 100644 --- a/src/main/java/com/example/sinitto/point/service/PointService.java +++ b/src/main/java/com/example/sinitto/point/service/PointService.java @@ -82,7 +82,7 @@ public PointChargeResponse savePointChargeRequest(Long memberId, int price) { throw new ConflictException("이미 진행중인 포인트 충전 요청이 존재합니다."); } - pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST.getMessage(), member, price, PointLog.Status.CHARGE_REQUEST)); + pointLogRepository.save(new PointLog(PointLog.Content.CHARGE_REQUEST, member, price, PointLog.Status.CHARGE_REQUEST)); kakaoMessageService.sendPointChargeRequestReceivedMessage(member.getEmail(), price, member.getName(), member.getDepositMessage());