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
a3c00a62
Commit
a3c00a62
authored
Jun 08, 2021
by
王世昌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调试日志
parent
4d3ce39a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/CheckAdapter.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractAddGoodsService.java
+19
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+0
-3
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/CheckAdapter.java
View file @
a3c00a62
...
@@ -63,7 +63,7 @@ public class CheckAdapter {
...
@@ -63,7 +63,7 @@ public class CheckAdapter {
useCoupon
=
false
;
useCoupon
=
false
;
}
}
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
bo
.
getPartnerId
(),
bo
.
getShopId
(),
couponCode
,
bo
.
getMenuType
());
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
bo
.
getPartnerId
(),
bo
.
getShopId
(),
couponCode
,
bo
.
getMenuType
());
CheckSpqInfoResponseDto
checkSpqInfo
=
null
;
CheckSpqInfoResponseDto
checkSpqInfo
;
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
else
{
}
else
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractAddGoodsService.java
View file @
a3c00a62
...
@@ -104,15 +104,19 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
...
@@ -104,15 +104,19 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
public
final
ShoppingCartGoodsBO
addGoods
(
BaseAddGoodsBO
addGoodsBO
)
{
public
final
ShoppingCartGoodsBO
addGoods
(
BaseAddGoodsBO
addGoodsBO
)
{
// 基本参数校验
// 基本参数校验
this
.
checkParams
(
addGoodsBO
);
this
.
checkParams
(
addGoodsBO
);
LogUtil
.
info
(
"addGoodsBO >>> "
,
JsonUtil
.
toJSONString
(
addGoodsBO
),
null
);
// 获取购物车和加车商品信息
// 获取购物车和加车商品信息
CheckBussinessRulesBO
checkBussinessRulesBO
=
this
.
getShoppingCartInfo
(
addGoodsBO
);
CheckBussinessRulesBO
checkBussinessRulesBO
=
this
.
getShoppingCartInfo
(
addGoodsBO
);
LogUtil
.
info
(
"getShoppingCartInfo >>> "
,
JsonUtil
.
toJSONString
(
addGoodsBO
),
JsonUtil
.
toJSONString
(
checkBussinessRulesBO
));
// 业务校验,例如商品数量库存之类的信息
// 业务校验,例如商品数量库存之类的信息
AddGoodsToShoppingCartBO
addGoodsToShoppingCartBO
=
this
.
checkBusinessRules
(
addGoodsBO
,
checkBussinessRulesBO
);
AddGoodsToShoppingCartBO
addGoodsToShoppingCartBO
=
this
.
checkBusinessRules
(
addGoodsBO
,
checkBussinessRulesBO
);
LogUtil
.
info
(
"checkBusinessRules >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
addGoodsBO
,
addGoodsBO
)),
JsonUtil
.
toJSONString
(
addGoodsToShoppingCartBO
));
// 添加商品到购物车
// 添加商品到购物车
DiscountResultBO
discountResultBO
=
this
.
addGoodsToShoppingCart
(
addGoodsBO
,
addGoodsToShoppingCartBO
);
DiscountResultBO
discountResultBO
=
this
.
addGoodsToShoppingCart
(
addGoodsBO
,
addGoodsToShoppingCartBO
);
LogUtil
.
info
(
"addGoodsToShoppingCart >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
addGoodsBO
,
addGoodsToShoppingCartBO
)),
JsonUtil
.
toJSONString
(
discountResultBO
));
// 去促销计算优惠
// 去促销计算优惠
CalCostBO
calCostBO
=
this
.
getDiscountResult
(
addGoodsBO
,
discountResultBO
);
CalCostBO
calCostBO
=
this
.
getDiscountResult
(
addGoodsBO
,
discountResultBO
);
...
@@ -330,7 +334,9 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
...
@@ -330,7 +334,9 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
*/
*/
public
final
AddGoodsToShoppingCartBO
checkBusinessRules
(
BaseAddGoodsBO
baseRequestDTO
,
CheckBussinessRulesBO
checkBussinessRulesBO
)
{
public
final
AddGoodsToShoppingCartBO
checkBusinessRules
(
BaseAddGoodsBO
baseRequestDTO
,
CheckBussinessRulesBO
checkBussinessRulesBO
)
{
AddGoodsToShoppingCartBO
commAddGoodsToShoppingCartBO
=
this
.
checkCommBusinessRules
(
baseRequestDTO
,
checkBussinessRulesBO
);
AddGoodsToShoppingCartBO
commAddGoodsToShoppingCartBO
=
this
.
checkCommBusinessRules
(
baseRequestDTO
,
checkBussinessRulesBO
);
LogUtil
.
info
(
"checkCommBusinessRules >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
baseRequestDTO
,
checkBussinessRulesBO
)),
JsonUtil
.
toJSONString
(
commAddGoodsToShoppingCartBO
));
AddGoodsToShoppingCartBO
customAddGoodsToShoppingCartBO
=
this
.
checkCustomBusinessRules
(
baseRequestDTO
,
checkBussinessRulesBO
,
commAddGoodsToShoppingCartBO
);
AddGoodsToShoppingCartBO
customAddGoodsToShoppingCartBO
=
this
.
checkCustomBusinessRules
(
baseRequestDTO
,
checkBussinessRulesBO
,
commAddGoodsToShoppingCartBO
);
LogUtil
.
info
(
"checkCustomBusinessRules >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
baseRequestDTO
,
checkBussinessRulesBO
)),
JsonUtil
.
toJSONString
(
customAddGoodsToShoppingCartBO
));
return
customAddGoodsToShoppingCartBO
;
return
customAddGoodsToShoppingCartBO
;
}
}
...
@@ -361,22 +367,31 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
...
@@ -361,22 +367,31 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
private
AddGoodsToShoppingCartBO
checkCommBusinessRules
(
BaseAddGoodsBO
baseRequestDTO
,
CheckBussinessRulesBO
checkBussinessRulesBO
)
{
private
AddGoodsToShoppingCartBO
checkCommBusinessRules
(
BaseAddGoodsBO
baseRequestDTO
,
CheckBussinessRulesBO
checkBussinessRulesBO
)
{
AddGoodsToShoppingCartBO
bo
=
new
AddGoodsToShoppingCartBO
();
AddGoodsToShoppingCartBO
bo
=
new
AddGoodsToShoppingCartBO
();
LogUtil
.
info
(
"checkCommBusinessRules111 >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
baseRequestDTO
,
checkBussinessRulesBO
)),
null
);
//购物车添加数量限制
//购物车添加数量限制
CartGoods
addGoods
=
baseRequestDTO
.
getAddGoods
();
CartGoods
addGoods
=
baseRequestDTO
.
getAddGoods
();
this
.
limitGoodsQty
(
checkBussinessRulesBO
.
getCartGoods
(),
addGoods
,
baseRequestDTO
.
getAppId
());
this
.
limitGoodsQty
(
checkBussinessRulesBO
.
getCartGoods
(),
addGoods
,
baseRequestDTO
.
getAppId
());
// 校验数量, 库存
// 校验数量, 库存
this
.
checkStocks
(
baseRequestDTO
,
checkBussinessRulesBO
);
this
.
checkStocks
(
baseRequestDTO
,
checkBussinessRulesBO
);
// 校验套餐
// 校验套餐
this
.
checkMeal
(
checkBussinessRulesBO
.
getCartGoods
(),
baseRequestDTO
.
getAddGoods
());
this
.
checkMeal
(
checkBussinessRulesBO
.
getCartGoods
(),
baseRequestDTO
.
getAddGoods
());
// 检查商品小料数量
// 检查商品小料数量
this
.
checkMaterialQty
(
addGoods
,
checkBussinessRulesBO
.
getProduct
());
this
.
checkMaterialQty
(
addGoods
,
checkBussinessRulesBO
.
getProduct
());
// 检查校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
// 检查校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
ShoppingCartContext
cartContext
=
convert2ShopingCartContext
(
baseRequestDTO
);
ShoppingCartContext
cartContext
=
convert2ShopingCartContext
(
baseRequestDTO
);
LogUtil
.
info
(
"checkShoppingCart1111 >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
checkBussinessRulesBO
)),
null
);
LogUtil
.
info
(
"checkShoppingCart2222 >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
addGoods
)),
null
);
LogUtil
.
info
(
"checkShoppingCart3333 >>> "
,
JsonUtil
.
toJSONString
(
Arrays
.
asList
(
cartContext
)),
null
);
CheckCartRequest
checkCartRequest
=
shoppingBaseService
.
checkShoppingCart
(
checkBussinessRulesBO
.
getCartGoods
(),
addGoods
,
cartContext
);
CheckCartRequest
checkCartRequest
=
shoppingBaseService
.
checkShoppingCart
(
checkBussinessRulesBO
.
getCartGoods
(),
addGoods
,
cartContext
);
LogUtil
.
info
(
"checkShoppingCart >>> "
,
null
,
JsonUtil
.
toJSONString
(
checkCartRequest
));
checkBussinessRulesBO
.
setChanged
(
checkCartRequest
.
getChanged
());
checkBussinessRulesBO
.
setChanged
(
checkCartRequest
.
getChanged
());
checkBussinessRulesBO
.
setToastMsg
(
checkCartRequest
.
getToastMsg
());
checkBussinessRulesBO
.
setToastMsg
(
checkCartRequest
.
getToastMsg
());
...
@@ -393,18 +408,18 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
...
@@ -393,18 +408,18 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
private
void
checkMaterialQty
(
CartGoods
addGoods
,
ProductBO
product
){
private
void
checkMaterialQty
(
CartGoods
addGoods
,
ProductBO
product
){
Integer
materialMaxQty
=
product
.
getMaxNum
();
Integer
materialMaxQty
=
product
.
getMaxNum
();
Integer
addProductq
ty
=
0
;
int
addProductQ
ty
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
addGoods
.
getProductMaterialList
())){
if
(
CollectionUtils
.
isNotEmpty
(
addGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialRequestVo
:
addGoods
.
getProductMaterialList
()){
for
(
CartGoods
.
MaterialGoods
materialRequestVo
:
addGoods
.
getProductMaterialList
()){
addProduct
qty
=
addProductq
ty
+
(
materialRequestVo
.
getQty
()
==
null
?
0
:
materialRequestVo
.
getQty
());
addProduct
Qty
=
addProductQ
ty
+
(
materialRequestVo
.
getQty
()
==
null
?
0
:
materialRequestVo
.
getQty
());
}
}
}
}
if
(
materialMaxQty
==
null
||
ObjectUtils
.
equals
(
materialMaxQty
,
0
)
||
addProductqty
==
null
||
ObjectUtils
.
equals
(
addProductqty
,
0
)){
if
(
materialMaxQty
==
null
||
ObjectUtils
.
equals
(
materialMaxQty
,
0
)
||
ObjectUtils
.
equals
(
addProductQty
,
0
)){
return
;
return
;
}
}
if
(
(
addProductqty
.
intValue
()
<
materialMaxQty
.
intValue
())
||
(
addProductqty
.
intValue
()
==
materialMaxQty
.
intValue
())
){
if
(
addProductQty
<=
materialMaxQty
){
return
;
return
;
}
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
a3c00a62
...
@@ -915,9 +915,6 @@ public class CouponServiceImpl implements CouponService {
...
@@ -915,9 +915,6 @@ public class CouponServiceImpl implements CouponService {
if
(
couponDetailResponseDto
==
null
||
!
couponDetailResponseDto
.
getResult
().
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_1
)
||
CollectionUtils
.
isEmpty
(
couponDetailResponseDto
.
getDetails
()))
{
if
(
couponDetailResponseDto
==
null
||
!
couponDetailResponseDto
.
getResult
().
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_1
)
||
CollectionUtils
.
isEmpty
(
couponDetailResponseDto
.
getDetails
()))
{
return
null
;
return
null
;
}
}
if
(
CollectionUtils
.
isEmpty
(
couponDetailResponseDto
.
getDetails
()))
{
return
null
;
}
boolean
productValid
=
false
;
boolean
productValid
=
false
;
Integer
couponType
=
0
;
Integer
couponType
=
0
;
GetCouponDetailResponseDto
.
Details
couponActivityDetail
=
null
;
GetCouponDetailResponseDto
.
Details
couponActivityDetail
=
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