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
f4648599
Commit
f4648599
authored
Oct 15, 2020
by
huiyang.chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2020/10/14-商品券-huiyang' into 2020/10/15-mccafeCoupon-huiyang
parents
b7f0be9c
01e08146
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
15 deletions
+42
-15
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+4
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+15
-14
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeProductIdsVo.java
+23
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
f4648599
...
@@ -497,7 +497,10 @@ public class ShoppingCartConvertAdapter {
...
@@ -497,7 +497,10 @@ public class ShoppingCartConvertAdapter {
}
}
ValidateShopProductType
productType
=
new
ValidateShopProductType
();
ValidateShopProductType
productType
=
new
ValidateShopProductType
();
productType
.
setSpuId
(
cartGoods
.
getSpuId
());
productType
.
setSpuId
(
cartGoods
.
getSpuId
());
productType
.
setSkuId
(
ObjectUtils
.
equals
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())
?
cartGoods
.
getSkuId
()
:
cartGoods
.
getSpuId
());
// 多规格商品券
productType
.
setSkuId
((
ObjectUtils
.
equals
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())
||
ObjectUtils
.
equals
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
()))
?
cartGoods
.
getSkuId
()
:
cartGoods
.
getSpuId
());
// 应产品要求
// 应产品要求
// 普通商品,取商品的finalePrice(普通商品售价);套餐商品,取originalPrice(套餐价格)
// 普通商品,取商品的finalePrice(普通商品售价);套餐商品,取originalPrice(套餐价格)
productType
.
setPrice
(
cartGoods
.
getFinalPrice
()
==
null
?
0
:
cartGoods
.
getFinalPrice
().
intValue
());
productType
.
setPrice
(
cartGoods
.
getFinalPrice
()
==
null
?
0
:
cartGoods
.
getFinalPrice
().
intValue
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
f4648599
...
@@ -22,11 +22,7 @@ import cn.freemud.service.impl.AssortmentSdkService;
...
@@ -22,11 +22,7 @@ import cn.freemud.service.impl.AssortmentSdkService;
import
cn.freemud.service.impl.FullSubtractionActivityServiceImpl
;
import
cn.freemud.service.impl.FullSubtractionActivityServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation
;
import
cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation
;
import
cn.freemud.service.impl.mcoffee.entity.CopyShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.*
;
import
cn.freemud.service.impl.mcoffee.entity.CouponState
;
import
cn.freemud.service.impl.mcoffee.entity.CouponAvailableReq
;
import
cn.freemud.service.impl.mcoffee.entity.MCoffeeAddGoodsRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.SwitchShoppingCartRequestVo
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
import
cn.freemud.service.thirdparty.ProductClient
;
import
cn.freemud.service.thirdparty.ProductClient
;
import
cn.freemud.utils.ResponseUtil
;
import
cn.freemud.utils.ResponseUtil
;
...
@@ -136,12 +132,14 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -136,12 +132,14 @@ public class ShoppingCartMCoffeeServiceImpl {
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
String
spuId2
=
spuId
;
String
spuId2
=
spuId
;
MCoffeeProductIdsVo
vo
=
new
MCoffeeProductIdsVo
();
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
//商品券校验
//商品券校验
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
couponCode
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
couponCode
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
spuId2
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
vo
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
goodsId
=
spuId2
;
spuId2
=
vo
.
getSkuId
();
goodsId
=
vo
.
getSkuId
();
}
}
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
// 获取添加商品的详细信息
// 获取添加商品的详细信息
...
@@ -155,7 +153,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -155,7 +153,7 @@ public class ShoppingCartMCoffeeServiceImpl {
//商品券已添加情况校验
//商品券已添加情况校验
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
,
goodsId
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
,
goodsId
);
CartGoods
addCartGoods
=
convent2CartGoods
(
addShoppingCartGoodsRequestVo
,
goodsId
);
CartGoods
addCartGoods
=
convent2CartGoods
(
addShoppingCartGoodsRequestVo
,
goodsId
,
vo
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
if
(
StringUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getGroupName
()))
{
if
(
StringUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getGroupName
()))
{
addCartGoods
.
setSkuName
(
addShoppingCartGoodsRequestVo
.
getGroupName
());
addCartGoods
.
setSkuName
(
addShoppingCartGoodsRequestVo
.
getGroupName
());
...
@@ -183,8 +181,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -183,8 +181,7 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
}
private
String
validCoupon
(
String
partnerId
,
String
storeId
,
String
spuId
,
List
<
Long
>
productIds
,
String
menuType
)
{
private
MCoffeeProductIdsVo
validCoupon
(
String
partnerId
,
String
storeId
,
String
spuId
,
List
<
Long
>
productIds
,
String
menuType
)
{
String
spuId2
;
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
()),
menuType
);
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
()),
menuType
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
);
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
);
...
@@ -192,8 +189,12 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -192,8 +189,12 @@ public class ShoppingCartMCoffeeServiceImpl {
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
}
}
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
String
skuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
return
spuId2
;
String
spuId2
=
checkSpqInfoResponseDto
.
getSpuId
();
MCoffeeProductIdsVo
vo
=
new
MCoffeeProductIdsVo
();
vo
.
setSkuId
(
skuId2
);
vo
.
setSpuId
(
spuId2
);
return
vo
;
}
}
...
@@ -1042,7 +1043,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1042,7 +1043,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
public
static
CartGoods
convent2CartGoods
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
String
goodsId
)
{
public
static
CartGoods
convent2CartGoods
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
String
goodsId
,
MCoffeeProductIdsVo
mCoffeeProductIdsVo
)
{
String
spuId
=
addShoppingCartGoodsRequestVo
.
getSpuId
();
String
spuId
=
addShoppingCartGoodsRequestVo
.
getSpuId
();
String
skuId
=
addShoppingCartGoodsRequestVo
.
getSkuId
();
String
skuId
=
addShoppingCartGoodsRequestVo
.
getSkuId
();
// String goodsId = StringUtils.isEmpty(skuId) ? spuId : skuId;
// String goodsId = StringUtils.isEmpty(skuId) ? spuId : skuId;
...
@@ -1056,7 +1057,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1056,7 +1057,7 @@ public class ShoppingCartMCoffeeServiceImpl {
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
goodsType
=
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
();
goodsType
=
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
();
cartGoods
.
setSpuId
(
goodsId
);
cartGoods
.
setSpuId
(
mCoffeeProductIdsVo
.
getSpuId
()
);
cartGoods
.
setSkuId
(
goodsId
);
cartGoods
.
setSkuId
(
goodsId
);
cartGoods
.
setCouponCode
(
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
()));
cartGoods
.
setCouponCode
(
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
()));
// cartGoods.setCartGoodsUid(spuId);
// cartGoods.setCartGoodsUid(spuId);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeProductIdsVo.java
0 → 100644
View file @
f4648599
package
cn
.
freemud
.
service
.
impl
.
mcoffee
.
entity
;
import
lombok.Data
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: MCoffeeAddGoodsRequestVo
* @Package cn.freemud.service.impl.mcoffee.entity
* @Description:
* @author: ping1.wu
* @date: 2020/8/8 21:04
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public
class
MCoffeeProductIdsVo
{
private
String
spuId
;
private
String
skuId
;
}
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