订单相关接口

This commit is contained in:
litianxiang
2026-05-20 11:42:32 +08:00
parent f3da0eef9a
commit 5ca83caaff
5 changed files with 39 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ package com.aida.buyer.module.order.controller;
import com.aida.buyer.common.result.PageResponse;
import com.aida.buyer.common.result.Response;
import com.aida.buyer.module.order.dto.BuyerOrdersDTO;
import com.aida.buyer.module.order.service.IBuyerOrderService;
import com.aida.buyer.module.order.vo.BuyerOrderVO;
import io.swagger.v3.oas.annotations.Operation;
@@ -30,7 +31,11 @@ public class BuyerOrderController {
@RequestParam(defaultValue = "1") long page,
@RequestParam(defaultValue = "10") long size,
@RequestParam(required = false) Integer status) {
return buyerOrderService.getMyOrders(page, size, status);
BuyerOrdersDTO dto = new BuyerOrdersDTO();
dto.setPage(page);
dto.setSize(size);
dto.setStatus(status);
return buyerOrderService.getMyOrders(dto);
}
@PostMapping("/create")

View File

@@ -0,0 +1,25 @@
package com.aida.buyer.module.order.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
@Schema(description = "根据买家ID查询订单列表请求参数")
public class BuyerOrdersDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "买家ID")
private Long buyerId;
@Schema(description = "页码默认1")
private long page = 1;
@Schema(description = "每页数量默认10")
private long size = 10;
@Schema(description = "订单状态0-未支付1-已支付2-已取消")
private Integer status;
}

View File

@@ -3,6 +3,7 @@ package com.aida.buyer.module.order.feign;
import com.aida.buyer.common.result.PageResponse;
import com.aida.buyer.common.result.Response;
import com.aida.buyer.module.feign.annotation.InternalCall;
import com.aida.buyer.module.order.dto.BuyerOrdersDTO;
import com.aida.buyer.module.order.dto.CreateOrderDTO;
import com.aida.buyer.module.order.vo.BuyerOrderVO;
import com.aida.buyer.module.order.vo.CreateOrderResultVO;
@@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 订单服务 Feign Client
@@ -24,11 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
public interface OrderFeignClient {
@PostMapping("/buyer/orders")
Response<PageResponse<BuyerOrderVO>> getOrdersByBuyerId(
@RequestParam Long buyerId,
@RequestParam(defaultValue = "1") long page,
@RequestParam(defaultValue = "10") long size,
@RequestParam(required = false) Integer status);
Response<PageResponse<BuyerOrderVO>> getOrdersByBuyerId(@RequestBody BuyerOrdersDTO dto);
@PostMapping("/create")
Response<CreateOrderResultVO> createOrder(@RequestBody CreateOrderDTO dto);

View File

@@ -2,13 +2,14 @@ package com.aida.buyer.module.order.service;
import com.aida.buyer.common.result.PageResponse;
import com.aida.buyer.common.result.Response;
import com.aida.buyer.module.order.dto.BuyerOrdersDTO;
import com.aida.buyer.module.order.vo.BuyerOrderVO;
import java.util.List;
public interface IBuyerOrderService {
Response<PageResponse<BuyerOrderVO>> getMyOrders(long page, long size, Integer status);
Response<PageResponse<BuyerOrderVO>> getMyOrders(BuyerOrdersDTO dto);
Response<Void> createOrder(List<Long> listingIds);
}

View File

@@ -6,6 +6,7 @@ import com.aida.buyer.common.result.PageResponse;
import com.aida.buyer.common.result.Response;
import com.aida.buyer.module.account.entity.BuyerAccount;
import com.aida.buyer.module.account.mapper.BuyerAccountMapper;
import com.aida.buyer.module.order.dto.BuyerOrdersDTO;
import com.aida.buyer.module.order.dto.CreateOrderDTO;
import com.aida.buyer.module.order.feign.OrderFeignClient;
import com.aida.buyer.module.order.service.IBuyerOrderService;
@@ -24,9 +25,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private final BuyerAccountMapper buyerAccountMapper;
@Override
public Response<PageResponse<BuyerOrderVO>> getMyOrders(long page, long size, Integer status) {
Long buyerId = UserContext.getBuyerId();
return orderFeignClient.getOrdersByBuyerId(buyerId, page, size, status);
public Response<PageResponse<BuyerOrderVO>> getMyOrders(BuyerOrdersDTO dto) {
dto.setBuyerId(UserContext.getBuyerId());
return orderFeignClient.getOrdersByBuyerId(dto);
}
@Override