后端:商品确认下单的信息 api 接口,后续需要结合促销,完善这个接口。

This commit is contained in:
YunaiV
2019-04-11 00:44:46 +08:00
parent 50d8ec33ee
commit 4300ce141d
29 changed files with 688 additions and 75 deletions

View File

@@ -16,8 +16,13 @@
<groupId>cn.iocoder.mall</groupId>
<artifactId>common-framework</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>product-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
@@ -34,5 +39,6 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
</project>

View File

@@ -1,9 +1,11 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.bo.CalcOrderPriceBO;
import cn.iocoder.mall.order.api.bo.CartBO;
import cn.iocoder.mall.order.api.bo.CartItemBO;
import cn.iocoder.mall.order.api.bo.OrderCreateBO;
import cn.iocoder.mall.order.api.dto.CalcOrderPriceDTO;
import org.springframework.lang.Nullable;
import java.util.List;
@@ -78,6 +80,14 @@ public interface CartService {
// ========== 购物车与订单相关的逻辑 ==========
/**
* 计算订单金额,返回计算结果
*
* @param calcOrderPriceDTO 计算订单金额 DTO
* @return 计算订单金额结果
*/
CommonResult<CalcOrderPriceBO> calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO);
/**
* 获得购物车明细
*

View File

@@ -38,14 +38,6 @@ public interface OrderService {
*/
CommonResult<OrderRecipientBO> getOrderRecipientBO(Integer orderId);
/**
* 计算订单金额,返回计算结果
*
* @param calcOrderPriceDTO 计算订单金额 DTO
* @return 计算订单金额结果
*/
CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO);
/**
* 订单 - 创建
*

View File

@@ -1,5 +1,6 @@
package cn.iocoder.mall.order.api.bo;
import cn.iocoder.mall.product.api.bo.ProductSkuDetailBO;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -45,10 +46,16 @@ public class CalcOrderPriceBO {
@Data
@Accessors(chain = true)
public static class Item {
// TODO 信息要相当完整
public static class Item extends ProductSkuDetailBO { // TODO 芋艿,此处先偷懒继承
/**
* 是否选中
*/
private Boolean selected;
/**
* 购买数量
*/
private Integer buyQuantity;
}
@@ -80,6 +87,15 @@ public class CalcOrderPriceBO {
*/
private Integer presentTotal;
public Fee() {
}
public Fee(Integer originalTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
this.originalTotal = originalTotal;
this.discountTotal = discountTotal;
this.postageTotal = postageTotal;
this.presentTotal = presentTotal;
}
}
/**

View File

@@ -25,7 +25,7 @@ public enum OrderErrorCodeEnum {
// order item
ORDER_ITEM_ONLY_ONE(1008000004, "订单Item只有一个!"),
ORDER_ITEM_SOME_NOT_EXISTS(-1, "有不存在的商品"), // TODO 芋艿 后面改下错误码
;

View File

@@ -15,11 +15,11 @@ public class CalcOrderPriceDTO {
/**
* 商品数组
*/
private List<Integer> items;
private List<Item> items;
@Data
@Accessors(chain = true)
private static class Item {
public static class Item {
/**
* SKU 编号
@@ -36,6 +36,14 @@ public class CalcOrderPriceDTO {
*/
private Boolean selected;
public Item() {
}
public Item(Integer skuId, Integer quantity, Boolean selected) {
this.skuId = skuId;
this.quantity = quantity;
this.selected = selected;
}
}
}