Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
35c8fa42
Commit
35c8fa42
authored
Apr 19, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券列表优化
parent
8b02c8be
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
2 deletions
+71
-2
shopping-cart-application-service/src/main/java/cn/freemud/adapter/CouponAdapter.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/DistributeAdapter.java
+8
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/ListCartGoodsRequestDTO.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/list/ListCartGoodsBO.java
+4
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractListCartGoodsService.java
+54
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/CouponAdapter.java
View file @
35c8fa42
...
...
@@ -573,6 +573,7 @@ public class CouponAdapter {
couponPromotionVO
.
setCouponCode
(
baseRequestDTO
.
getCouponCode
());
couponPromotionVO
.
setOrderType
(
baseRequestDTO
.
getOrderType
());
couponPromotionVO
.
setFlg
(
baseRequestDTO
.
getFlag
());
couponPromotionVO
.
setUnChooseCouponCode
(
baseRequestDTO
.
getUnChooseCouponCode
());
return
couponPromotionVO
;
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/DistributeAdapter.java
View file @
35c8fa42
...
...
@@ -15,6 +15,7 @@ import cn.freemud.enums.CouponFlag;
import
cn.freemud.enums.GoodsTypeEnum
;
import
cn.freemud.service.CouponService
;
import
cn.freemud.service.impl.AssortmentSdkService
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -56,6 +57,12 @@ public class DistributeAdapter {
List
<
CartGoods
>
tmpCartGoods
=
cartGoodsList
.
parallelStream
().
filter
(
k
->
CommonUtils
.
isProductCoupon
(
k
.
getCouponCode
(),
k
.
getCartGoodsUid
())).
collect
(
Collectors
.
toList
());
// 是否存在商品券
boolean
hasGoodssCoupon
=
CollectionUtils
.
isNotEmpty
(
tmpCartGoods
);
String
chooseCouponCode
=
""
;
if
(
StringUtils
.
isBlank
(
couponPromotionVO
.
getUnChooseCouponCode
())
&&
hasGoodssCoupon
){
chooseCouponCode
=
tmpCartGoods
.
get
(
0
).
getGoodsId
().
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
}
// 构建可用不可用优惠券
ActivityClassifyCouponBean
activityClassifyCouponBean
=
couponService
.
availableCoupon
(
cartGoodsList
,
couponPromotionVO
.
getPartnerId
()
...
...
@@ -65,7 +72,7 @@ public class DistributeAdapter {
,
hasGoodssCoupon
,
couponPromotionVO
.
getOrderType
()
,
1
,
bo
.
getAppId
(),
bo
.
getMenuType
(),
""
,
bo
.
getAppId
(),
bo
.
getMenuType
(),
chooseCouponCode
);
if
(
Objects
.
equals
(
activityClassifyCouponBean
,
null
))
{
// 构建一个空得订单券信息
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/ListCartGoodsRequestDTO.java
View file @
35c8fa42
...
...
@@ -105,6 +105,10 @@ public class ListCartGoodsRequestDTO extends BaseRequestDTO {
*/
private
String
monthlyCardCode
;
/**
* 取消选择的商品券
*/
private
String
unChooseCouponCode
;
@Data
public
final
static
class
BuyMemberCard
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/list/ListCartGoodsBO.java
View file @
35c8fa42
...
...
@@ -101,7 +101,10 @@ public class ListCartGoodsBO extends BaseBo {
private
String
tableNumber
;
/**
* 取消选择的商品券
*/
private
String
unChooseCouponCode
;
}
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractListCartGoodsService.java
View file @
35c8fa42
...
...
@@ -25,6 +25,7 @@ import cn.freemud.entities.vo.*;
import
cn.freemud.enums.*
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.service.CouponService
;
import
cn.freemud.service.impl.AssortmentSdkService
;
import
cn.freemud.service.impl.calculate.CalculationCommonService
;
import
cn.freemud.utils.LogUtil
;
...
...
@@ -87,6 +88,9 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
@Autowired
private
MessageService
messageService
;
@Autowired
private
CouponService
couponService
;
private
static
final
String
limitCartKey
=
"ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_"
;
...
...
@@ -210,6 +214,29 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
List
<
CartGoods
>
allCartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
baseRequestBO
.
getPartnerId
(),
baseRequestBO
.
getShopId
(),
userInfo
.
getUserId
(),
baseRequestBO
.
getSessionId
(),
null
,
shoppingCartBaseService
);
if
(
CollectionUtils
.
isEmpty
(
allCartGoodsList
))
{
allCartGoodsList
=
new
ArrayList
<>();
}
else
{
// check是否反选取消商品券
if
(
StringUtils
.
isNotBlank
(
baseRequestBO
.
getUnChooseCouponCode
())){
// 遍历该商品券选择的商品,并将商品券替换为普通商品
for
(
int
i
=
allCartGoodsList
.
size
()
-
1
;
i
>=
0
;
i
--){
CartGoods
cartGoods
=
allCartGoodsList
.
get
(
i
);
if
(
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
||
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())){
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
baseRequestBO
.
getPartnerId
(),
baseRequestBO
.
getShopId
(),
cartGoods
.
getSpuId
(),
baseRequestBO
.
getMenuType
());
GetProductsVo
productInfo
=
null
;
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
productInfo
=
couponService
.
getSpqProductInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
else
{
productInfo
=
couponService
.
getSpqProductInfo
(
checkSpqInfoRequestDto
);
}
if
(
productInfo
==
null
){
allCartGoodsList
.
remove
(
i
);
}
else
{
convert2CartGoods
(
cartGoods
,
productInfo
);
}
}
}
}
}
bo
.
setCartGoods
(
allCartGoodsList
);
...
...
@@ -1643,4 +1670,31 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
return
chooseGoods
;
}
private
void
convert2CartGoods
(
CartGoods
cartGoods
,
GetProductsVo
productInfo
)
{
cartGoods
.
setCartGoodsUid
(
UUID
.
randomUUID
().
toString
());
Integer
goodsType
=
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
();
if
(
productInfo
.
getType
()
==
null
||
productInfo
.
getType
()
==
1
)
{
goodsType
=
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
();
}
else
{
goodsType
=
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
}
cartGoods
.
setGoodsType
(
goodsType
);
cartGoods
.
setAmount
(
productInfo
.
getFinalPrice
());
cartGoods
.
setCategoryName
(
productInfo
.
getCategoryName
());
cartGoods
.
setCustomerCode
(
productInfo
.
getCustomerCode
());
cartGoods
.
setFinalPrice
(
null
);
cartGoods
.
setGoodsId
(
cartGoods
.
getSkuId
());
cartGoods
.
setMaterialAmount
(
0
l
);
cartGoods
.
setName
(
goodsType
==
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
?
productInfo
.
getSpuName
()
:
productInfo
.
getSkuName
());
cartGoods
.
setOriginalPrice
(
productInfo
.
getFinalPrice
());
cartGoods
.
setOriginalMaterialAmount
(
0
l
);
cartGoods
.
setSpuId
(
productInfo
.
getSpuId
());
cartGoods
.
setSkuId
(
cartGoods
.
getSkuId
());
cartGoods
.
setSpuName
(
productInfo
.
getSpuName
());
cartGoods
.
setSkuName
(
productInfo
.
getSkuName
());
cartGoods
.
setCouponCode
(
null
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment