Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
31a2489
refactor : ProductDetailsResponseDto 응답 필드명에 "product" prefix 추가
vanillacake369 Jan 20, 2024
fda7f7e
refactor : ProductLikesResponseDto 응답 필드명 "product" prefix 추가
vanillacake369 Jan 20, 2024
f59006f
refactor : ProductPreviewByNameResponseDto 응답 필드명 "product" prefix 추가
vanillacake369 Jan 20, 2024
3330a01
refactor : ProductPreviewResponseDto 응답 필드명 "product" prefix 추가
vanillacake369 Jan 20, 2024
951bf75
refactor : ProductMapper 각각의 메소드에 @Mapping 추가
vanillacake369 Jan 20, 2024
c9f7520
refactor : BuyBidResponseDto "buy" prefix 추가
vanillacake369 Jan 20, 2024
d01c5f2
refactor : BuyNowResponseDto "order" prefix 추가
vanillacake369 Jan 20, 2024
72baf28
refactor : BuyTradeResponseDto "buy" prefix 추가
vanillacake369 Jan 20, 2024
64e3cc5
refactor : BuyMapper @Mapping 추가
vanillacake369 Jan 20, 2024
e2736a9
refactor : CouponAvailableResponseDto "coupon" prefix 추가
vanillacake369 Jan 20, 2024
7868fd5
refactor : CouponUnavailableResponseDto "coupon" prefix 추가
vanillacake369 Jan 20, 2024
f6e4246
refactor : CouponMapper @Mapping 추가
vanillacake369 Jan 20, 2024
2aac117
refactor : GifticonQueryService "gifticon" prefix 추가
vanillacake369 Jan 20, 2024
c8558fc
refactor : GifticonMapper @Mapping 추가
vanillacake369 Jan 20, 2024
a30eb2f
refactor : OrderTradeResponseDto "order" prefix 추가
vanillacake369 Jan 20, 2024
c8ded0a
refactor : OrderMapper @Mapping 추가
vanillacake369 Jan 20, 2024
732c85b
refactor : SellBidResponseDto "sell" prefix 추가
vanillacake369 Jan 20, 2024
5475023
refactor : SellTradeResponseDto "sell" prefix 추가
vanillacake369 Jan 20, 2024
ff475d2
refactor : SellPriceToQuantityResponseDto "sell" prefix 추가
vanillacake369 Jan 20, 2024
1fbacf7
refactor : SellNowResponseDto "sell" prefix 추가
vanillacake369 Jan 20, 2024
1b2d7ba
refactor : SellMapper @Mapping 추가
vanillacake369 Jan 20, 2024
b75e5c2
refactor : (이전) BuyCheckBidResponseDto -> (이후) UserBuyBidOnProgressRe…
vanillacake369 Jan 20, 2024
b64f5c2
refactor : UserSellOnProgressResponseDto 에 "sell" prefix 추가
vanillacake369 Jan 20, 2024
85ebe79
refactor : UserSalesHistroyResponseDto 에 "order","product" prefix 추가
vanillacake369 Jan 20, 2024
52913c7
refactor : UserPurchaseHistoryResponseDto 에 "order" prefix 추가
vanillacake369 Jan 20, 2024
27b5eb6
refactor : UserPointResponseDto 에 "user" prefix 추가
vanillacake369 Jan 20, 2024
524ea39
refactor : UserMapper 에 @Mapping 추가
vanillacake369 Jan 20, 2024
c0b57f4
refactor : OrderMapper 에 finalPrice @Mapping 추가
vanillacake369 Jan 20, 2024
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bc1.gream.domain.buy.controller;

import bc1.gream.domain.buy.dto.response.BuyCheckBidResponseDto;
import bc1.gream.domain.buy.dto.response.BuyCheckOrderResponseDto;
import bc1.gream.domain.buy.dto.response.UserBuyBidOnProgressResponseDto;
import bc1.gream.domain.buy.dto.response.UserPurchaseHistoryResponseDto;
import bc1.gream.domain.buy.service.query.BuyQueryService;
import bc1.gream.domain.gifticon.service.query.GifticonQueryService;
import bc1.gream.global.common.RestResponse;
Expand All @@ -24,7 +24,7 @@ public class UserBoughtHistoryController {

@GetMapping("/end")
@Operation(summary = "구매자 구매완료상품 조회 요청", description = "구매자의 구매완료한 상품 조회요청을 처리합니다.")
public RestResponse<List<BuyCheckOrderResponseDto>> getBoughtOrder(
public RestResponse<List<UserPurchaseHistoryResponseDto>> getBoughtOrder(
@AuthenticationPrincipal UserDetailsImpl userDetails
) {
return RestResponse.success(gifticonQueryService.getBoughtOrder(userDetails.getUser()));
Expand All @@ -33,7 +33,7 @@ public RestResponse<List<BuyCheckOrderResponseDto>> getBoughtOrder(

@GetMapping("/onprogress")
@Operation(summary = "구매자 진행 중인 구매입찰 조회 요청", description = "구매자의 진행 중인 구매입찰에 대한 조회요청을 처리합니다.")
public RestResponse<List<BuyCheckBidResponseDto>> getBuyBid(
public RestResponse<List<UserBuyBidOnProgressResponseDto>> getBuyBid(
@AuthenticationPrincipal UserDetailsImpl userDetails
) {
return RestResponse.success(buyQueryService.findAllBuyBidCoupon(userDetails.getUser()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bc1.gream.domain.buy.dto.response;

public record BuyBidResponseDto(
Long price,
Long buyPrice,
Long buyId
) {

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

public record BuyNowResponseDto(
Long orderId,
Long expectedPrice,
Long finalPrice
Long orderExpectedPrice,
Long orderFinalPrice
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

import bc1.gream.domain.coupon.entity.Coupon;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.time.LocalDateTime;
import lombok.Builder;

@Builder
public record BuyCheckBidResponseDto(
public record UserBuyBidOnProgressResponseDto(
Long buyId,
Long productId,
String productBrand,
String productName,
Long couponId,
String couponName,
Long price,
Long buyPrice,
Long discountPrice,
@JsonIgnore
Coupon coupon
Coupon coupon,
LocalDateTime buyBidStartedAt,
LocalDateTime buyBidDeadlineAt
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.time.LocalDateTime;

public record BuyCheckOrderResponseDto(
public record UserPurchaseHistoryResponseDto(
Long orderId,
LocalDateTime orderCreatedAt,
Long expectedPrice,
Long finalPrice,
Long orderExpectedPrice,
Long orderFinalPrice,
Long productId,
String productBrand,
String productName,
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/bc1/gream/domain/buy/mapper/BuyMapper.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bc1.gream.domain.buy.mapper;

import bc1.gream.domain.buy.dto.response.BuyBidResponseDto;
import bc1.gream.domain.buy.dto.response.BuyCheckBidResponseDto;
import bc1.gream.domain.buy.dto.response.UserBuyBidOnProgressResponseDto;
import bc1.gream.domain.buy.entity.Buy;
import bc1.gream.domain.product.dto.response.BuyTradeResponseDto;
import org.mapstruct.Mapper;
Expand All @@ -14,13 +14,13 @@ public interface BuyMapper {
BuyMapper INSTANCE = Mappers.getMapper(BuyMapper.class);

@Mapping(source = "id", target = "buyId")
@Mapping(source = "price", target = "buyPrice")
BuyBidResponseDto toBuyBidResponseDto(Buy buy);

@Mapping(source = "id", target = "buyId")
@Mapping(source = "price", target = "buyPrice")
@Mapping(source = "createdAt", target = "tradeDate")
@Mapping(source = "createdAt", target = "buyTradeDate")
BuyTradeResponseDto toBuyTradeResponseDto(Buy buy);

@Mapping(source = "discountPrice", target = "discountPrice")
BuyCheckBidResponseDto toBuyCheckBidResponseDto(BuyCheckBidResponseDto bid, Long discountPrice);
UserBuyBidOnProgressResponseDto toBuyCheckBidResponseDto(UserBuyBidOnProgressResponseDto bid, Long discountPrice);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package bc1.gream.domain.buy.repository;

import bc1.gream.domain.buy.dto.response.BuyCheckBidResponseDto;
import bc1.gream.domain.buy.dto.response.UserBuyBidOnProgressResponseDto;
import bc1.gream.domain.buy.entity.Buy;
import bc1.gream.domain.product.dto.response.BuyPriceToQuantityResponseDto;
import bc1.gream.domain.product.entity.Product;
import java.time.LocalDateTime;
import bc1.gream.domain.user.entity.User;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Page;
Expand All @@ -21,5 +21,5 @@ public interface BuyRepositoryCustom {

void deleteBuysOfDeadlineBefore(LocalDateTime now);

List<BuyCheckBidResponseDto> findAllBuyBidCoupon(User user);
List<UserBuyBidOnProgressResponseDto> findAllBuyBidCoupon(User user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static bc1.gream.domain.buy.entity.QBuy.buy;
import static bc1.gream.domain.product.entity.QProduct.product;

import bc1.gream.domain.buy.dto.response.BuyCheckBidResponseDto;
import bc1.gream.domain.buy.dto.response.UserBuyBidOnProgressResponseDto;
import bc1.gream.domain.buy.entity.Buy;
import bc1.gream.domain.buy.entity.QBuy;
import bc1.gream.domain.buy.repository.helper.BuyQueryOrderFactory;
Expand Down Expand Up @@ -131,13 +131,15 @@ public void deleteBuysOfDeadlineBefore(LocalDateTime dateTime) {
}

@Override
public List<BuyCheckBidResponseDto> findAllBuyBidCoupon(User user) {
public List<UserBuyBidOnProgressResponseDto> findAllBuyBidCoupon(User user) {
return queryFactory.select(
buy.id,
buy.price,
buy.product.id,
buy.product.brand,
buy.product.name,
buy.createdAt,
buy.deadlineAt,
QCoupon.coupon.id,
QCoupon.coupon.name,
QCoupon.coupon
Expand All @@ -148,16 +150,18 @@ public List<BuyCheckBidResponseDto> findAllBuyBidCoupon(User user) {
.where(buy.user.eq(user))
.fetch()
.stream()
.map(tuple -> BuyCheckBidResponseDto.builder()
.map(tuple -> UserBuyBidOnProgressResponseDto.builder()
.buyId(tuple.get(buy.id))
.price(tuple.get(buy.price))
.productId(tuple.get(buy.product.id))
.productName(tuple.get(buy.product.name))
.productBrand(tuple.get(buy.product.brand))
.productName(tuple.get(buy.product.name))
.couponId(tuple.get(QCoupon.coupon.id))
.couponName(tuple.get(QCoupon.coupon.name))
.buyPrice(tuple.get(buy.price))
.discountPrice(tuple.get(buy.price))
.coupon(tuple.get(QCoupon.coupon))
.buyBidStartedAt(tuple.get(buy.createdAt))
.buyBidDeadlineAt(tuple.get(buy.deadlineAt))
.build()
).toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static bc1.gream.global.common.ResultCase.BUY_BID_NOT_FOUND;
import static bc1.gream.global.common.ResultCase.NOT_ENOUGH_POINT;

import bc1.gream.domain.buy.dto.response.BuyCheckBidResponseDto;
import bc1.gream.domain.buy.dto.response.UserBuyBidOnProgressResponseDto;
import bc1.gream.domain.buy.entity.Buy;
import bc1.gream.domain.buy.mapper.BuyMapper;
import bc1.gream.domain.buy.repository.BuyRepository;
Expand Down Expand Up @@ -57,10 +57,9 @@ public Buy getRecentBuyBidOf(Long productId, Long price) {
.orElseThrow(() -> new GlobalException(BUY_BID_NOT_FOUND));
}

public List<BuyCheckBidResponseDto> findAllBuyBidCoupon(User user) {
List<BuyCheckBidResponseDto> buyCheckBidResponseDtos = buyRepository.findAllBuyBidCoupon(user);

return buyCheckBidResponseDtos.stream()
public List<UserBuyBidOnProgressResponseDto> findAllBuyBidCoupon(User user) {
List<UserBuyBidOnProgressResponseDto> userBuyBidOnProgressResponseDtos = buyRepository.findAllBuyBidCoupon(user);
return userBuyBidOnProgressResponseDtos.stream()
.map(bid -> BuyMapper.INSTANCE.toBuyCheckBidResponseDto(bid, getFinalPrice(bid.coupon(), bid.discountPrice())))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

@Builder
public record CouponAvailableResponseDto(
String name,
String discountType,
Long discount
Long couponId,
String couponName,
String couponDiscountType,
Long couponDiscount
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

@Builder
public record CouponUnavailableResponseDto(
String name,
String discountType,
Long discount
Long couponId,
String couponName,
String couponDiscountType,
Long couponDiscount
) {

}
10 changes: 10 additions & 0 deletions src/main/java/bc1/gream/domain/coupon/mapper/CouponMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@
import bc1.gream.domain.coupon.dto.response.CouponUnavailableResponseDto;
import bc1.gream.domain.coupon.entity.Coupon;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface CouponMapper {

CouponMapper INSTANCE = Mappers.getMapper(CouponMapper.class);

@Mapping(source = "id", target = "couponId")
@Mapping(source = "name", target = "couponName")
@Mapping(source = "discountType", target = "couponDiscountType")
@Mapping(source = "discount", target = "couponDiscount")
CouponAvailableResponseDto toCouponListResponseDto(Coupon coupon);


@Mapping(source = "id", target = "couponId")
@Mapping(source = "name", target = "couponName")
@Mapping(source = "discountType", target = "couponDiscountType")
@Mapping(source = "discount", target = "couponDiscount")
CouponUnavailableResponseDto toCouponUsedListResponseDto(Coupon coupon);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bc1.gream.domain.gifticon.mapper;

import bc1.gream.domain.buy.dto.response.BuyCheckOrderResponseDto;
import bc1.gream.domain.buy.dto.response.UserPurchaseHistoryResponseDto;
import bc1.gream.domain.gifticon.entity.Gifticon;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
Expand All @@ -15,10 +15,10 @@ public interface GifticonMapper {
@Mapping(source = "id", target = "gifticonId")
@Mapping(expression = "java(gifticon.getOrder().getId())", target = "orderId")
@Mapping(expression = "java(gifticon.getOrder().getCreatedAt())", target = "orderCreatedAt")
@Mapping(expression = "java(gifticon.getOrder().getExpectedPrice())", target = "expectedPrice")
@Mapping(expression = "java(gifticon.getOrder().getFinalPrice())", target = "finalPrice")
@Mapping(expression = "java(gifticon.getOrder().getExpectedPrice())", target = "orderExpectedPrice")
@Mapping(expression = "java(gifticon.getOrder().getFinalPrice())", target = "orderFinalPrice")
@Mapping(expression = "java(gifticon.getOrder().getProduct().getId())", target = "productId")
@Mapping(expression = "java(gifticon.getOrder().getProduct().getName())", target = "productBrand")
@Mapping(expression = "java(gifticon.getOrder().getProduct().getBrand())", target = "productName")
BuyCheckOrderResponseDto toBuyCheckOrderResponseDto(Gifticon gifticon);
UserPurchaseHistoryResponseDto toBuyCheckOrderResponseDto(Gifticon gifticon);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bc1.gream.domain.gifticon.service.query;


import bc1.gream.domain.buy.dto.response.BuyCheckOrderResponseDto;
import bc1.gream.domain.buy.dto.response.UserPurchaseHistoryResponseDto;
import bc1.gream.domain.gifticon.entity.Gifticon;
import bc1.gream.domain.gifticon.mapper.GifticonMapper;
import bc1.gream.domain.gifticon.repository.GifticonRepository;
Expand All @@ -20,7 +20,7 @@ public List<Gifticon> findAllSoldBySeller(User user) {
return gifticonRepository.findAllSoldBySeller(user);
}

public List<BuyCheckOrderResponseDto> getBoughtOrder(User user) {
public List<UserPurchaseHistoryResponseDto> getBoughtOrder(User user) {
List<Gifticon> gifticons = gifticonRepository.findAllBoughtByBuyer(user);

return gifticons.stream().map(GifticonMapper.INSTANCE::toBuyCheckOrderResponseDto).toList();
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/bc1/gream/domain/order/mapper/OrderMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import bc1.gream.domain.buy.dto.response.BuyNowResponseDto;
import bc1.gream.domain.order.entity.Order;
import bc1.gream.domain.product.dto.response.OrderTradeResponseDto;
import bc1.gream.domain.sell.dto.response.OrderAsSellerResponseDto;
import bc1.gream.domain.sell.dto.response.SellNowResponseDto;
import bc1.gream.domain.sell.dto.response.UserSalesHistroyResponseDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
Expand All @@ -15,21 +15,26 @@ public interface OrderMapper {

OrderMapper INSTANCE = Mappers.getMapper(OrderMapper.class);

@Mapping(target = "tradeDate", source = "createdAt")
@Mapping(source = "id", target = "orderId")
@Mapping(source = "finalPrice", target = "orderFinalPrice")
@Mapping(source = "createdAt", target = "orderTradeDate")
OrderTradeResponseDto toOrderTradeResponseDto(Order order);

@Mapping(source = "id", target = "orderId")
@Mapping(source = "expectedPrice", target = "orderExpectedPrice")
@Mapping(source = "finalPrice", target = "orderFinalPrice")
BuyNowResponseDto toBuyNowResponseDto(Order order);

@Mapping(source = "id", target = "orderId")
@Mapping(source = "finalPrice", target = "price")
@Mapping(source = "finalPrice", target = "orderFinalPrice")
SellNowResponseDto toSellNowResponseDto(Order order);

@Mapping(source = "id", target = "orderId")
@Mapping(source = "createdAt", target = "tradedDate")
@Mapping(source = "createdAt", target = "orderTradedDate")
@Mapping(source = "finalPrice", target = "orderFinalPrice")
@Mapping(expression = "java(order.getProduct().getId())", target = "productId")
@Mapping(expression = "java(order.getProduct().getBrand())", target = "productBrand")
@Mapping(expression = "java(order.getProduct().getName())", target = "productName")
@Mapping(expression = "java(order.getProduct().getImageUrl())", target = "iamgeUrl")
OrderAsSellerResponseDto toOrderAsSellerResponseDto(Order order);
@Mapping(expression = "java(order.getProduct().getImageUrl())", target = "productIamgeUrl")
UserSalesHistroyResponseDto toOrderAsSellerResponseDto(Order order);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public record BuyTradeResponseDto(
Long buyId,
Long buyPrice,
LocalDateTime tradeDate
LocalDateTime buyTradeDate
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

@Builder
public record OrderTradeResponseDto(
Long id,
Long finalPrice,
LocalDateTime tradeDate
Long orderId,
Long orderFinalPrice,
LocalDateTime orderTradeDate
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

@Builder
public record ProductDetailsResponseDto(
Long id,
String brand,
String name,
String imageUrl,
String description,
Long price
Long productId,
String productBrand,
String productName,
String productImageUrl,
String productDescription,
Long productPrice
) {

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bc1.gream.domain.product.dto.response;

public record ProductLikesResponseDto(
Long id,
Long productId,
String productBrand,
String productName,
String productImageUrl,
Expand Down
Loading