Skip to content

Commit

Permalink
Merge pull request #175 from Try-AngIe/cicd
Browse files Browse the repository at this point in the history
[KAN-229] cicd(-): test
  • Loading branch information
rlatkd authored Jul 24, 2024
2 parents 4de30fc + fc081ac commit 5cd8435
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 118 deletions.
2 changes: 1 addition & 1 deletion client/src/labs/Test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Test = () => {
const result = await confrimComp('회원정보가 수정되었습니다!');
};

console.log("123123");
console.log("121113123");

return (
<div>
Expand Down
102 changes: 0 additions & 102 deletions server-kafka/1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package kr.or.kosa.cmsplusmessaging;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonGetter;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public interface BaseEnum {
@JsonGetter("code") String getCode();
@JsonGetter("title") String getTitle();
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package kr.or.kosa.cmsplusmessaging;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum MessageSendMethod {

SMS("SMS"), EMAIL("EMAIL");
SMS("문자"), EMAIL("이메일");

private final String title;

MessageSendMethod(String title) {
this.title = title;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ private void sendManyEmails(List<EmailMessageDto> emailMessageDtoList) {

@KafkaListener(topics = "messaging-topic", groupId = "messaging-group", containerFactory = "messagingKafkaListenerContainerFactory")
public void consumeMessage(List<ConsumerRecord<String, MessageDto>> consumerRecords) {
log.error("컨슘 메시징 시작");
log.error(consumerRecords.toString());
List<SmsMessageDto> smsMessages = new ArrayList<>();
List<EmailMessageDto> emailMessages = new ArrayList<>();
for (ConsumerRecord<String, MessageDto> consumerRecord : consumerRecords) {
MessageDto messageDto = consumerRecord.value();
log.error("[컨슘 DTO]: {}", messageDto.toString());

switch (messageDto.getMethod()) {
case SMS -> smsMessages.add((SmsMessageDto) messageDto);
case EMAIL -> emailMessages.add((EmailMessageDto) messageDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class InfraTestController {

@GetMapping("/infra-test-msg")
public String infraTest() {
return "infra-test 12312asd3111111123123123";
}
return "infra-test 12312a";

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class InfraTestController {

@GetMapping("/infra-test-payment")
public String infraTest() {
return "infra-test 1231211112311asd11231231113";
return "infra-test 1231211231231113";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ public void sendEmail(@RequestBody EmailMessageDto emailMessageDto) {

@PostMapping("/payment/card")
public void getCardPaymentResult(@RequestBody CardPaymentDto cardPaymentDto) {
log.error("cardPaymentDto: {}", cardPaymentDto);
kafkaPaymentService.producePayment(cardPaymentDto);
}

@PostMapping("/payment/account")
public void getAccountPaymentResult(@RequestBody AccountPaymentDto accountPaymentDto) {
log.error("accountPaymentDto: {}", accountPaymentDto);
kafkaPaymentService.producePayment(accountPaymentDto);
}

@PostMapping("/payment/virtual-account")
public void getVirtualAccountPaymentResult(@RequestBody VirtualAccountPaymentDto virtualAccountPaymentDto) {
log.error("virtualAccountPaymentDto: {}", virtualAccountPaymentDto);
kafkaPaymentService.producePayment(virtualAccountPaymentDto);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.validation.constraints.NotNull;
import kr.or.kosa.cmsplusmain.domain.kafka.MessageSendMethod;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
Expand All @@ -12,13 +13,13 @@
public abstract class MessageDto { // sms, email은 이걸 상속해서 각자 타입에 맞는 핸드폰번호, email주소를 주입해야함

@NotNull
private MessageSendMethod method;
private String method;

@NotNull
private String text;

public MessageDto(MessageSendMethod method, String text) {
this.method = method;
this.method = method.getCode();
this.text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Getter
@Setter
@ToString
@ToString(callSuper = true)
public class SmsMessageDto extends MessageDto {

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ public void consumePaymentResult(List<ConsumerRecord<String, PaymentResultDto>>
MessageDto messageDto = new SmsMessageDto(paymentResultDto.getResult(), paymentResultDto.getPhoneNumber());
Billing billing = billingRepository.findById(paymentResultDto.getBillingId())
.orElseThrow(() -> new EntityNotFoundException(paymentResultDto.getBillingId().toString()));
log.error("[billing 결과]: {}", billing.getId());

try {
if (paymentResultDto.getResult().equals("결제성공")) {
billing.setPaid(); // 결제결과가 성공이면 청구상태를 결제완료로 바꿈
log.info("결제성공");
log.info("paymentREsultDto{}", paymentResultDto.toString());
} else {
log.error("결제실패");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class InfraTestController {

@GetMapping("/infra-test")
public String infraTest() {
return "infra-test 111111111112123312311231231";
return "infra-test 11111131";
}

}

0 comments on commit 5cd8435

Please sign in to comment.