清理部分 cart 冗余代码~

pull/4/MERGE
YunaiV 2020-08-15 19:31:53 +08:00
parent 9fb421360f
commit 4bfb7c2e04
7 changed files with 1 additions and 571 deletions

View File

@ -1,33 +0,0 @@
package cn.iocoder.mall.order.rest.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel("计算商品 SKU 价格结果 VO")
@Data
@Accessors(chain = true)
public class UsersCalcSkuPriceResponse {
/**
*
*
* TODO VO
*/
// private PromotionActivityBO fullPrivilege;
/**
*
*
* TODO VO
*/
// private PromotionActivityBO timeLimitedDiscount;
/**
*
*/
private Integer originalPrice;
/**
*
*/
private Integer buyPrice;
}

View File

@ -1,209 +0,0 @@
package cn.iocoder.mall.order.rest.response;
import io.swagger.annotations.ApiModel;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel(value = "购物车明细 VO")
@Data
@Accessors(chain = true)
public class UsersCartDetailResponse {
/**
*
*/
private List<ItemGroup> itemGroups;
/**
*
*/
private Fee fee;
/**
*
*
*
*/
@Data
@Accessors(chain = true)
public static class ItemGroup {
/**
*
*/
// private PromotionActivityBO activity; // TODO 芋艿,偷懒
/**
*
*
* 1. null
* 2. Item discountTotal
*/
private Integer activityDiscountTotal;
/**
*
*/
private List<Sku> items;
}
@Data
@Accessors(chain = true)
public static class Sku {
// SKU 自带信息
/**
* sku
*/
private Integer id;
/**
* SPU
*/
private Spu spu;
/**
*
*/
private String picURL;
/**
*
*/
// private List<ProductAttrAndValuePairBO> attrs; // TODO 后面改下
/**
*
*/
private Integer price;
/**
*
*/
private Integer quantity;
// 非 SKU 自带信息
/**
*
*/
private Integer buyQuantity;
/**
*
*/
private Boolean selected;
/**
*
*/
// private PromotionActivityBO activity;
/**
*
*/
private Integer originPrice;
/**
*
*/
private Integer buyPrice;
/**
*
*/
private Integer presentPrice;
/**
*
*
* {@link #presentTotal}
*/
private Integer buyTotal;
/**
*
*/
private Integer discountTotal;
/**
*
*
* presentPrice * quantity presentTotal
*
* presentPrice = 8.33 quantity = 3 presentTotal 24.99 25
*
*/
private Integer presentTotal;
}
@Data
@Accessors(chain = true)
public static class Spu {
/**
* SPU
*/
private Integer id;
// ========== 基本信息 =========
/**
* SPU
*/
private String name;
/**
*
*/
private Integer cid;
/**
*
*
*
*
* 800*80015
*/
private List<String> picUrls;
}
/**
*
*/
@Data
@Accessors(chain = true)
public static class Fee {
/**
*
*/
private Integer buyTotal;
/**
*
*
*
*/
private Integer discountTotal;
/**
*
*/
private Integer postageTotal;
/**
*
*
* = - +
*/
private Integer presentTotal;
public Fee() {
}
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
this.buyTotal = buyTotal;
this.discountTotal = discountTotal;
this.postageTotal = postageTotal;
this.presentTotal = presentTotal;
}
}
/**
* TODO
*/
@Data
@Accessors(chain = true)
public static class Postage {
/**
*
*/
private Integer threshold;
}
}

View File

@ -1,93 +1,9 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.mall.order.api.bo.CalcOrderPriceBO;
import cn.iocoder.mall.order.api.bo.CalcSkuPriceBO;
import cn.iocoder.mall.order.api.bo.CartItemBO;
import cn.iocoder.mall.order.api.dto.CalcOrderPriceDTO;
import org.springframework.lang.Nullable;
import java.util.Collection;
import java.util.List;
public interface CartService {
// ========== 购物车 Item 的逻辑 ==========
/**
*
*
* @param userId
* @param skuId SKU
* @param quantity
* @return
*/
Boolean add(Integer userId, Integer skuId, Integer quantity);
/**
*
*
* @param userId
* @param skuId SKU
* @param quantity
* @return
*/
Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity);
/**
*
*
* @param userId
* @param skuIds SKU
* @param selected
* @return
*/
Boolean updateSelected(Integer userId, Collection<Integer> skuIds, Boolean selected);
/**
*
*
* @param userId
* @param skuIds SKU
*
* @return
*/
Boolean deleteList(Integer userId, List<Integer> skuIds);
/**
*
*
* @param userId
* @return
*/
Boolean deleteAll(Integer userId);
/**
*
*
* @param userId
* @return
*/
Integer count(Integer userId);
/**
* selected
*
* @param userId
* @param selected
* @return
*/
List<CartItemBO> list(Integer userId, @Nullable Boolean selected);
// ========== 购物车与订单相关的逻辑 ==========
/**
*
*
* @param calcOrderPriceDTO DTO
* @return
*/
CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO);
/**
* SKU
*

View File

@ -1,181 +0,0 @@
package cn.iocoder.mall.order.api.bo;
import cn.iocoder.mall.product.api.bo.ProductSkuDetailBO;
import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* BO
*/
@Data
@Accessors(chain = true)
@Deprecated
public class CalcOrderPriceBO {
/**
*
*/
private List<ItemGroup> itemGroups;
/**
*
*/
private Integer couponCardId;
/**
*
*
* 1. 使 null
* 2. Item discountTotal
*/
private Integer couponCardDiscountTotal;
/**
*
*
* TODO
*/
private Postage postage;
/**
*
*/
private Fee fee;
/**
*
*
*
*/
@Data
@Accessors(chain = true)
public static class ItemGroup {
/**
*
*/
// TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
private PromotionActivityBO activity;
/**
*
*
* 1. null
* 2. Item discountTotal
*/
private Integer activityDiscountTotal;
/**
*
*/
private List<Item> items;
// /**
// * 费用
// *
// * TODO 芋艿这里先偷懒postageTotal 字段用不到。
// */
// private Fee fee; // 注释原因,不用这里了
}
@Data
@Accessors(chain = true)
public static class Item extends ProductSkuDetailBO { // TODO 芋艿,此处先偷懒继承
/**
*
*/
private Boolean selected;
/**
*
*/
private Integer buyQuantity;
/**
*
*/
private PromotionActivityBO activity;
/**
*
*/
private Integer originPrice;
/**
*
*/
private Integer buyPrice;
/**
*
*/
private Integer presentPrice;
/**
*
*
* {@link #presentTotal}
*/
private Integer buyTotal;
/**
*
*/
private Integer discountTotal;
/**
*
*
* presentPrice * quantity presentTotal
*
* presentPrice = 8.33 quantity = 3 presentTotal 24.99 25
*
*/
private Integer presentTotal;
}
/**
*
*/
@Data
@Accessors(chain = true)
public static class Fee {
/**
*
*/
private Integer buyTotal;
/**
*
*
*
*/
private Integer discountTotal;
/**
* TODO postage logistics
*/
private Integer postageTotal;
/**
*
*
* = - +
*/
private Integer presentTotal;
public Fee() {
}
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
this.buyTotal = buyTotal;
this.discountTotal = discountTotal;
this.postageTotal = postageTotal;
this.presentTotal = presentTotal;
}
}
/**
*
*/
@Data
@Accessors(chain = true)
public static class Postage {
/**
*
*/
private Integer threshold;
}
}

View File

@ -1,46 +0,0 @@
package cn.iocoder.mall.order.api.constant;
import java.util.Arrays;
public enum CartItemStatusEnum {
ENABLE(1, "正常"),
DELETE_BY_MANUAL(2, "主动删除"),
DELETE_BY_ORDER(3, "下单删除"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CartItemStatusEnum::getValue).toArray();
/**
*
*/
private Integer value;
/**
*
*/
private String name;
CartItemStatusEnum(Integer value, String name) {
this.value = value;
this.name = name;
}
public Integer getValue() {
return value;
}
public CartItemStatusEnum setValue(Integer value) {
this.value = value;
return this;
}
public String getName() {
return name;
}
public CartItemStatusEnum setName(String name) {
this.name = name;
return this;
}
}

View File

@ -1,17 +0,0 @@
package cn.iocoder.mall.order.api.constant;
import cn.iocoder.common.framework.enums.ModuleErrorCodeInterval;
/**
*
*
* [1-008-000-000 ~ 1-008-000-000]
*
* @author Sin
* @time 2019-03-23 11:35
*/
public class ErrorCodeInterval extends ModuleErrorCodeInterval {
// OrderErrorCodeEnum 错误码区间 [1-008-000-000 ~ 1-008-000-000]
}

View File

@ -14,7 +14,7 @@
<artifactId>onemall</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>order</module>
<!-- <module>order</module>-->
<module>common</module>
<!-- <module>ops</module>-->
<!-- <module>pay</module>-->