Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

초기 설정 및 Entity 생성 #2

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR build


on:
pull_request:
branches: [ develop ] # develop branch에 PR을 보낼 때 실행

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

# Gradle wrapper 파일 실행 권한주기
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# Gradle test를 실행한다
- name: build gradle
run: ./gradlew clean build
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation "org.springframework.cloud:spring-cloud-starter-bus-kafka"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'io.github.lotteon-maven', name: 'blooming-blooms-utils', version: '0.1.0-alpha1'
}

dependencyManagement {
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/kr/bb/payment/PaymentServiceApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@SpringBootApplication
@EnableJpaAuditing
@EnableEurekaClient
public class PaymentServiceApplication {

public static void main(String[] args) {
SpringApplication.run(PaymentServiceApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(PaymentServiceApplication.class, args);
}

}

15 changes: 15 additions & 0 deletions src/main/java/kr/bb/payment/entity/OrderType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package kr.bb.payment.entity;

import lombok.Getter;

@Getter
public enum OrderType {
ORDER_DELIVERY("주문 배송"),
ORDER_PICKUP("주문 픽업");

private final String message;

OrderType(String message) {
this.message = message;
}
}
51 changes: 51 additions & 0 deletions src/main/java/kr/bb/payment/entity/Payment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package kr.bb.payment.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "payment")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Payment extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "payment_id")
private Long paymentId;

@Column(name = "user_id", unique = true, nullable = false)
private Long userId;

@Column(name = "order_id", unique = true, nullable = false)
private Long orderId;

@Enumerated(EnumType.STRING)
@Column(name = "orderType", nullable = false)
private String orderType;

@Column(name = "payment_cid", nullable = false)
private String paymentCid;

@Column(name = "payment_tid", nullable = false)
private String paymentTid;

@Column(name = "payment_actual_amount", nullable = false)
private String paymentActualAmount;

@Column(name = "payment_type", nullable = false)
private String paymentType;

@Column(name = "payment_status", nullable = false)
private String paymentStatus;
}
43 changes: 43 additions & 0 deletions src/main/java/kr/bb/payment/entity/PaymentCancel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package kr.bb.payment.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Entity
@Table(name="payment_cancel")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class PaymentCancel extends BaseEntity {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name ="payment_cancel_id")
private Long paymentCancelId;

@OneToOne
@JoinColumn(name = "payment_id")
private Payment paymentId;

@Column(name = "payment_cancel_quantity", unique = true, nullable = false)
private Long paymentCancelQuantity;

@Column(name = "payment_cancel_amount", unique = true, nullable = false)
private Long paymentCancelAmount;

@Column(name = "payment_cancel_reason", unique = true, nullable = false)
private Long paymentCancelReason;

@Column(name = "payment_cancel_status", unique = true, nullable = false)
private Long paymentCancelStatus;
}

52 changes: 52 additions & 0 deletions src/main/java/kr/bb/payment/entity/Subscription.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package kr.bb.payment.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "subscription")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Subscription extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "subscription_id")
private Long subscriptionId;

@Column(name = "order_subscription_id", unique = true, nullable = false)
private Long orderSubscriptionId;

@Column(name = "subscription_cid", nullable = false)
private String subscriptionCid;

@Column(name = "subscription_tid", unique = true, nullable = false)
private String subscriptionTid;

@Column(name = "subscription_sid", unique = true, nullable = false)
private String subscriptionSid;

@Column(name = "subscription_quantity", unique = true, nullable = false)
private Long subscriptionQuantity;

@Column(name = "subscription_total_amount", unique = true, nullable = false)
private Long subscriptionTotalAmount;

@Column(name = "payment_day", unique = true, nullable = false)
private String paymentDay;

@Column(name = "start_date", unique = true, nullable = false)
private Date startDate;

@Column(name = "end_date", unique = true, nullable = true)
private Date endDate;
}
39 changes: 39 additions & 0 deletions src/main/java/kr/bb/payment/entity/SubscriptionRecords.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package kr.bb.payment.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "subscription_records")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class SubscriptionRecords extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "subscription_records_id")
private Long subscriptionRecordsId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "subcription_id")
private Subscription subscriptionId;

@Column(name = "delivery_id", unique = true, nullable = false)
private Long deliveryId;

@Column(name = "subscription_total_amount", unique = true, nullable = false)
private Long subscriptionTotalAmount;

@Column(name = "subscription_status", unique = true, nullable = false)
private String subscriptionStatus;
}
27 changes: 27 additions & 0 deletions src/main/java/kr/bb/payment/entity/common/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package kr.bb.payment.entity.common;

import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity {
@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;

@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@Column(name = "is_deleted")
private Boolean isDeleted;
}

6 changes: 6 additions & 0 deletions src/main/java/kr/bb/payment/repository/PaymentRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package kr.bb.payment.repository;

import kr.bb.payment.entity.Payment;
import org.springframework.data.jpa.repository.JpaRepository;

public interface PaymentRepository extends JpaRepository<Long, Payment> {}
6 changes: 6 additions & 0 deletions src/main/java/kr/bb/payment/service/PaymentService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package kr.bb.payment.service;

import org.springframework.stereotype.Service;

@Service
public class PaymentService {}
Empty file.
13 changes: 0 additions & 13 deletions src/test/java/kr/bb/payment/PaymentServiceApplicationTests.java

This file was deleted.