parent
29fff03f93
commit
e5c4c747a4
@ -1,21 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.price;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* Title:
|
||||
* Description:
|
||||
*
|
||||
* @author zhuyang
|
||||
* @version 1.0 2021/10/9
|
||||
*/
|
||||
@FeignClient("promotion-service")
|
||||
public interface PriceFeign {
|
||||
@PostMapping("/promotion/price/calcProductPrice")
|
||||
public CommonResult<PriceProductCalcRespDTO> calcProductPrice(@RequestBody PriceProductCalcReqDTO calcReqDTO) ;
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.price.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品价格计算 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PriceProductCalcReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
private Integer couponCardId;
|
||||
|
||||
/**
|
||||
* 商品 SKU 数组
|
||||
*/
|
||||
@NotNull(message = "商品数组不能为空")
|
||||
private List<Item> items;
|
||||
|
||||
/**
|
||||
* 商品 SKU
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Item implements Serializable {
|
||||
|
||||
/**
|
||||
* SKU 编号
|
||||
*/
|
||||
@NotNull(message = "商品 SKU 编号不能为空")
|
||||
private Integer skuId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@NotNull(message = "商品 SKU 数量不能为空")
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
@NotNull(message = "是否选中不能为空")
|
||||
private Boolean selected;
|
||||
|
||||
public Item() {
|
||||
}
|
||||
|
||||
public Item(Integer skuId, Integer quantity, Boolean selected) {
|
||||
this.skuId = skuId;
|
||||
this.quantity = quantity;
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,83 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.shopweb.controller.trade.vo.cart.CartDetailVO;
|
||||
import cn.iocoder.mall.shopweb.service.trade.CartManager;
|
||||
import cn.iocoder.security.annotations.RequiresAuthenticate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@Api(tags = "购物车 API")
|
||||
@RestController
|
||||
@RequestMapping("/cart")
|
||||
@Validated
|
||||
public class CartController {
|
||||
|
||||
@Autowired
|
||||
private CartManager cartManager;
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("添加商品到购物车")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> addCartItem(@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity) {
|
||||
cartManager.addCartItem(UserSecurityContextHolder.getUserId(), skuId, quantity);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("sum-quantity")
|
||||
@ApiOperation("查询用户在购物车中的商品数量")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> sumCartItemQuantity() {
|
||||
return success(cartManager.sumCartItemQuantity(UserSecurityContextHolder.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/get-detail")
|
||||
@ApiOperation("查询用户的购物车的商品列表")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<CartDetailVO> getCartDetail() {
|
||||
return success(cartManager.getCartDetail(UserSecurityContextHolder.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("update-quantity")
|
||||
@ApiOperation("更新购物车商品数量")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> updateCartItemQuantity(@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity) {
|
||||
cartManager.updateCartItemQuantity(UserSecurityContextHolder.getUserId(), skuId, quantity);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("update-selected")
|
||||
@ApiOperation("更新购物车商品是否选中")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuIds", value = "商品 SKU 编号数组", required = true, example = "1,3"),
|
||||
@ApiImplicitParam(name = "selected", value = "是否选中", required = true, example = "true")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> updateCartItemSelected(@RequestParam("skuIds") Set<Integer> skuIds,
|
||||
@RequestParam("selected") Boolean selected) {
|
||||
cartManager.updateCartItemSelected(UserSecurityContextHolder.getUserId(), skuIds, selected);
|
||||
// 获得目前购物车明细
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
### /trade-order/confirm-create-order-info 基于商品,确认创建订单
|
||||
GET {{shop-api-base-url}}/trade-order/confirm-create-order-info?skuId=33&quantity=1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单
|
||||
GET {{shop-api-base-url}}/trade-order/confirm-create-order-info-from-cart
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单
|
||||
POST {{shop-api-base-url}}/trade-order/create
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
{
|
||||
"userAddressId": 19,
|
||||
"remark": "我是备注",
|
||||
"orderItems": [
|
||||
{
|
||||
"skuId": 3,
|
||||
"quantity": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
### /trade-order/page 获得订单交易分页
|
||||
GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
###
|
||||
@ -1,84 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade;
|
||||
|
||||
import cn.iocoder.common.framework.util.HttpUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.shopweb.controller.trade.vo.order.*;
|
||||
import cn.iocoder.mall.shopweb.service.trade.TradeOrderService;
|
||||
import cn.iocoder.security.annotations.RequiresAuthenticate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@Api(tags = "交易订单 API")
|
||||
@RestController
|
||||
@RequestMapping("/trade-order")
|
||||
@Validated
|
||||
public class TradeOrderController {
|
||||
|
||||
@Autowired
|
||||
private TradeOrderService tradeOrderService;
|
||||
|
||||
@GetMapping("confirm-create-order-info")
|
||||
@ApiOperation("基于商品,确认创建订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", required = true, value = "商品 SKU 编号", example = "1024"),
|
||||
@ApiImplicitParam(name = "quantity", required = true, value = "购买数量", example = "2"),
|
||||
@ApiImplicitParam(name = "couponCardId", value = "优惠劵编号", example = "1"),
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<TradeOrderConfirmCreateInfoRespVO> getTradeOrderConfirmCreateInfo(
|
||||
@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity,
|
||||
@RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
|
||||
return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId));
|
||||
}
|
||||
|
||||
@GetMapping("confirm-create-order-info-from-cart")
|
||||
@ApiOperation("基于购物车,确认创建订单")
|
||||
@ApiImplicitParam(name = "couponCardId", value = "优惠劵编号", example = "1")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<TradeOrderConfirmCreateInfoRespVO> getTradeOrderConfirmCreateInfoFromCart(
|
||||
@RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
|
||||
return success(tradeOrderService.getOrderConfirmCreateInfoFromCart(UserSecurityContextHolder.getUserId(), couponCardId));
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation("基于商品,创建订单")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> createTradeOrder(@RequestBody TradeOrderCreateReqVO createReqVO,
|
||||
HttpServletRequest servletRequest) {
|
||||
return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(),
|
||||
HttpUtil.getIp(servletRequest), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("create-from-cart")
|
||||
@ApiOperation("基于购物车,创建订单")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> createTradeOrder(TradeOrderCreateFromCartReqVO createReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得交易订单")
|
||||
@ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true)
|
||||
public CommonResult<TradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
|
||||
return success(tradeOrderService.getTradeOrder(tradeOrderId));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得订单交易分页")
|
||||
public CommonResult<PageResult<TradeOrderRespVO>> pageTradeOrder(TradeOrderPageReqVO pageVO) {
|
||||
return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("交易订单项 Response VO")
|
||||
@Data
|
||||
public class TradeOrderItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "id自增长", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer orderId;
|
||||
@ApiModelProperty(value = "订单项状态", required = true)
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "商品 SKU 编号", required = true)
|
||||
private Integer skuId;
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true)
|
||||
private Integer spuId;
|
||||
@ApiModelProperty(value = "商品名字", required = true)
|
||||
private String skuName;
|
||||
@ApiModelProperty(value = "图片名字", required = true)
|
||||
private String skuImage;
|
||||
@ApiModelProperty(value = "商品数量", required = true)
|
||||
private Integer quantity;
|
||||
@ApiModelProperty(value = "原始单价,单位:分", required = true)
|
||||
private Integer originPrice;
|
||||
@ApiModelProperty(value = "购买单价,单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "最终价格,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "购买总金额,单位:分", required = true)
|
||||
private Integer buyTotal;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountTotal;
|
||||
@ApiModelProperty(value = "最终总金额,单位:分", required = true)
|
||||
private Integer presentTotal;
|
||||
@ApiModelProperty(value = "退款总金额,单位:分", required = true)
|
||||
private Integer refundTotal;
|
||||
@ApiModelProperty(value = "物流id")
|
||||
private Integer logisticsId;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "售后订单编号")
|
||||
private Integer afterSaleOrderId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("交易订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TradeOrderPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
|
||||
private Integer orderStatus;
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("订单交易 Response VO")
|
||||
@Data
|
||||
public class TradeOrderRespVO {
|
||||
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "用户编号", required = true)
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "订单单号", required = true)
|
||||
private String orderNo;
|
||||
@ApiModelProperty(value = "订单状态", required = true)
|
||||
private Integer orderStatus;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "订单结束时间")
|
||||
private Date endTime;
|
||||
@ApiModelProperty(value = "订单金额(总金额),单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountPrice;
|
||||
@ApiModelProperty(value = "物流金额,单位:分", required = true)
|
||||
private Integer logisticsPrice;
|
||||
@ApiModelProperty(value = "最终金额,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "支付金额,单位:分", required = true)
|
||||
private Integer payPrice;
|
||||
@ApiModelProperty(value = "退款金额,单位:分", required = true)
|
||||
private Integer refundPrice;
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
private Date payTime;
|
||||
@ApiModelProperty(value = "支付订单编号")
|
||||
private Integer payTransactionId;
|
||||
@ApiModelProperty(value = "支付渠道")
|
||||
private Integer payChannel;
|
||||
@ApiModelProperty(value = "配送类型", required = true)
|
||||
private Integer deliveryType;
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private Date deliveryTime;
|
||||
@ApiModelProperty(value = "收货时间")
|
||||
private Date receiveTime;
|
||||
@ApiModelProperty(value = "收件人名称", required = true)
|
||||
private String receiverName;
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String receiverMobile;
|
||||
@ApiModelProperty(value = "地区编码", required = true)
|
||||
private Integer receiverAreaCode;
|
||||
@ApiModelProperty(value = "收件详细地址", required = true)
|
||||
private String receiverDetailAddress;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "优惠劵编号")
|
||||
private Integer couponCardId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*
|
||||
* // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
|
||||
*/
|
||||
private List<TradeOrderItemRespVO> orderItems;
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue