Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
4bfb7c2e
提交
4bfb7c2e
authored
8月 15, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
清理部分 cart 冗余代码~
上级
9fb42136
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
1 行增加
和
571 行删除
+1
-571
UsersCalcSkuPriceResponse.java
...r/mall/order/rest/response/UsersCalcSkuPriceResponse.java
+0
-33
UsersCartDetailResponse.java
...der/mall/order/rest/response/UsersCartDetailResponse.java
+0
-209
CartService.java
.../src/main/java/cn/iocoder/mall/order/api/CartService.java
+0
-84
CalcOrderPriceBO.java
...n/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
+0
-181
CartItemStatusEnum.java
...n/iocoder/mall/order/api/constant/CartItemStatusEnum.java
+0
-46
ErrorCodeInterval.java
...cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java
+0
-17
pom.xml
pom.xml
+1
-1
没有找到文件。
order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCalcSkuPriceResponse.java
deleted
100644 → 0
浏览文件 @
9fb42136
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
;
}
order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCartDetailResponse.java
deleted
100644 → 0
浏览文件 @
9fb42136
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*800像素,你可以拖拽图片调整顺序,最多上传15张
*/
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
;
}
}
order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/CartService.java
浏览文件 @
4bfb7c2e
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 的金额,并返回计算结果
*
...
...
order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
deleted
100644 → 0
浏览文件 @
9fb42136
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
;
}
}
order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java
deleted
100644 → 0
浏览文件 @
9fb42136
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
;
}
}
order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java
deleted
100644 → 0
浏览文件 @
9fb42136
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]
}
pom.xml
浏览文件 @
4bfb7c2e
...
...
@@ -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>-->
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论