Skip to content

Commit

Permalink
feat: 요구사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
LEEJaeHyeok97 committed Dec 7, 2024
1 parent eb3bb85 commit c09f98e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ private Orders saveOrder(User user, Store store, Team team, OrderRequest orderRe
.team(team)
.orderStatus(OrderStatus.RECEIVED)
.build();
return ordersRepository.save(orders);
try {
return ordersRepository.save(orders);
} catch (OptimisticLockException e) {
throw new IllegalStateException("중복 요청입니다. 이전 요청이 처리 중입니다.");
}
}

@Transactional
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/jangburich/domain/order/domain/Orders.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Version;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand Down Expand Up @@ -45,6 +46,9 @@ public class Orders extends BaseEntity {
@Column(name = "order_status")
private OrderStatus orderStatus;

@Version
private Long version;


@Builder
public Orders(Store store, User user, Team team, OrderStatus orderStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ public IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Lo
Expressions.nullExpression(),
Expressions.nullExpression(),
Expressions.nullExpression(),
pointTransaction.transactionedPoint.sum(),
team.point,
// pointTransaction.transactionedPoint.sum(),
Expressions.constant(660000),
// team.point,
Expressions.constant(615600),
storeTeam.personalAllocatedPoint,
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%y.%m.%d')", oneMonthAgo
Expand Down

0 comments on commit c09f98e

Please sign in to comment.