交易改造
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.mall.tradeservice.rpc.cart;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.tradeservice.rpc.cart.dto.*;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Title:
|
||||
* Description:
|
||||
*
|
||||
* @author zhuyang
|
||||
* @version 1.0 2021/10/9
|
||||
*/
|
||||
@FeignClient(value = "trade-service")
|
||||
public interface CartFeign {
|
||||
/**
|
||||
* 添加商品到购物车
|
||||
*
|
||||
* @param addReqDTO 添加商品信息
|
||||
* @return 成功
|
||||
*/
|
||||
@PostMapping("addCartItem")
|
||||
CommonResult<Boolean> addCartItem(@RequestBody CartItemAddReqDTO addReqDTO);
|
||||
|
||||
/**
|
||||
* 更新购物车商品数量
|
||||
*
|
||||
* @param updateQuantityReqDTO 更新商品数量 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
@PostMapping("updateCartItemQuantity")
|
||||
CommonResult<Boolean> updateCartItemQuantity(@RequestBody CartItemUpdateQuantityReqDTO updateQuantityReqDTO);
|
||||
|
||||
/**
|
||||
* 更新购物车商品是否选中
|
||||
*
|
||||
* @param updateSelectedReqDTO 更新商品是否选中 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
@PostMapping("updateCartItemSelected")
|
||||
CommonResult<Boolean> updateCartItemSelected(@RequestBody CartItemUpdateSelectedReqDTO updateSelectedReqDTO);
|
||||
|
||||
/**
|
||||
* 删除购物车商品列表
|
||||
*
|
||||
* @param deleteListReqDTO 删除商品列表 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
@PostMapping("deleteCartItems")
|
||||
CommonResult<Boolean> deleteCartItems(@RequestBody CartItemDeleteListReqDTO deleteListReqDTO);
|
||||
@GetMapping("/sumCartItemQuantity")
|
||||
public CommonResult<Integer> sumCartItemQuantity(@RequestParam("userId") Integer userId) ;
|
||||
@PostMapping("/listCartItems")
|
||||
public CommonResult<List<CartItemRespDTO>> listCartItems(@RequestBody CartItemListReqDTO listReqDTO) ;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package cn.iocoder.mall.tradeservice.rpc.cart;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.tradeservice.rpc.cart.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车 Rpc 接口
|
||||
*/
|
||||
public interface CartRpc {
|
||||
|
||||
/**
|
||||
* 添加商品到购物车
|
||||
*
|
||||
* @param addReqDTO 添加商品信息
|
||||
* @return 成功
|
||||
*/
|
||||
CommonResult<Boolean> addCartItem(CartItemAddReqDTO addReqDTO);
|
||||
|
||||
/**
|
||||
* 更新购物车商品数量
|
||||
*
|
||||
* @param updateQuantityReqDTO 更新商品数量 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
CommonResult<Boolean> updateCartItemQuantity(CartItemUpdateQuantityReqDTO updateQuantityReqDTO);
|
||||
|
||||
/**
|
||||
* 更新购物车商品是否选中
|
||||
*
|
||||
* @param updateSelectedReqDTO 更新商品是否选中 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
CommonResult<Boolean> updateCartItemSelected(CartItemUpdateSelectedReqDTO updateSelectedReqDTO);
|
||||
|
||||
/**
|
||||
* 删除购物车商品列表
|
||||
*
|
||||
* @param deleteListReqDTO 删除商品列表 DTO
|
||||
* @return 成功
|
||||
*/
|
||||
CommonResult<Boolean> deleteCartItems(CartItemDeleteListReqDTO deleteListReqDTO);
|
||||
|
||||
/**
|
||||
* 查询用户在购物车中的商品数量
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @return 商品数量
|
||||
*/
|
||||
CommonResult<Integer> sumCartItemQuantity(Integer userId);
|
||||
|
||||
/**
|
||||
* 查询用户在购物车种的商品列表
|
||||
*
|
||||
* @param listReqDTO 查询条件 DTO
|
||||
* @return 购物车中商品列表信息
|
||||
*/
|
||||
CommonResult<List<CartItemRespDTO>> listCartItems(CartItemListReqDTO listReqDTO);
|
||||
|
||||
}
|
||||
@@ -5,13 +5,23 @@ import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO;
|
||||
import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO;
|
||||
import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 交易订单 Rpc 接口
|
||||
* Title:
|
||||
* Description:
|
||||
*
|
||||
* @author zhuyang
|
||||
* @version 1.0 2021/10/9
|
||||
*/
|
||||
public interface TradeOrderRpc {
|
||||
@FeignClient(value = "trade-service")
|
||||
public interface TradeOrderFeign {
|
||||
|
||||
/**
|
||||
* 创建交易订单
|
||||
@@ -19,7 +29,8 @@ public interface TradeOrderRpc {
|
||||
* @param createReqDTO 订单信息
|
||||
* @return 订单编号
|
||||
*/
|
||||
CommonResult<Integer> createTradeOrder(TradeOrderCreateReqDTO createReqDTO);
|
||||
@PostMapping("createTradeOrder")
|
||||
CommonResult<Integer> createTradeOrder(@RequestBody TradeOrderCreateReqDTO createReqDTO);
|
||||
|
||||
/**
|
||||
* 获得订单交易
|
||||
@@ -28,16 +39,16 @@ public interface TradeOrderRpc {
|
||||
* @param fields 额外返回字段,可见 {@link cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum}
|
||||
* @return 订单交易
|
||||
*/
|
||||
CommonResult<TradeOrderRespDTO> getTradeOrder(Integer tradeOrderId, Collection<String> fields);
|
||||
|
||||
@GetMapping("getTradeOrder")
|
||||
CommonResult<TradeOrderRespDTO> getTradeOrder(@RequestParam("tradeOrderId")Integer tradeOrderId, @RequestParam("fields") Collection<String> fields);
|
||||
/**
|
||||
* 获得交易订单分页
|
||||
*
|
||||
* @param pageDTO 订单交易分页查询
|
||||
* @return 订单交易分页结果
|
||||
*/
|
||||
CommonResult<PageResult<TradeOrderRespDTO>> pageTradeOrder(TradeOrderPageReqDTO pageDTO);
|
||||
|
||||
@PostMapping("pageTradeOrder")
|
||||
CommonResult<PageResult<TradeOrderRespDTO>> pageTradeOrder(@RequestBody TradeOrderPageReqDTO pageDTO);
|
||||
// TODO 芋艿:需要重构成入参是 DTO,方便后续升级;返回是 CommonResult,用于返回失败的原因
|
||||
|
||||
/**
|
||||
@@ -49,6 +60,6 @@ public interface TradeOrderRpc {
|
||||
* @param payAmount 支付金额
|
||||
* @return 成功
|
||||
*/
|
||||
CommonResult<Boolean> updateTradeOrderPaySuccess(String tradeOrderId, Integer payAmount);
|
||||
|
||||
@PostMapping("updateTradeOrderPaySuccess")
|
||||
CommonResult<Boolean> updateTradeOrderPaySuccess(@RequestParam("tradeOrderId") String tradeOrderId, @RequestParam("payAmount")Integer payAmount);
|
||||
}
|
||||
Reference in New Issue
Block a user