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
251f7f70
Commit
251f7f70
authored
Jul 19, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉多余日志
parent
e78a480a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
21 deletions
+3
-21
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+3
-21
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
251f7f70
...
@@ -305,7 +305,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -305,7 +305,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
CartGoods
cartGoods
=
ShoppingCartConvertAdapter
.
convent2CartGoods
(
addShoppingCartGoodsRequestVo
);
CartGoods
cartGoods
=
ShoppingCartConvertAdapter
.
convent2CartGoods
(
addShoppingCartGoodsRequestVo
);
ApiLog
.
printLog
(
"addGoods cartGoods convent2CartGoods"
,
JSONObject
.
toJSONString
(
cartGoods
),
" 1"
,
null
);
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
//商品skuId或者商品券的商品id
//商品skuId或者商品券的商品id
String
spuId2
=
spuId
;
String
spuId2
=
spuId
;
...
@@ -353,16 +352,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -353,16 +352,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
CollectionUtils
.
isEmpty
(
allCartGoodsList
))
{
if
(
CollectionUtils
.
isEmpty
(
allCartGoodsList
))
{
allCartGoodsList
=
new
ArrayList
<>();
allCartGoodsList
=
new
ArrayList
<>();
}
}
ApiLog
.
printLog
(
"addGoods allCartGoodsList"
,
JSONObject
.
toJSONString
(
allCartGoodsList
),
" 2"
,
null
);
List
<
CartGoods
>
oldCartGoodsList
=
BeanUtil
.
convertBeans
(
allCartGoodsList
,
CartGoods:
:
new
);
List
<
CartGoods
>
oldCartGoodsList
=
BeanUtil
.
convertBeans
(
allCartGoodsList
,
CartGoods:
:
new
);
/**
/**
Integer checkQty = allCartGoodsList.indexOf(cartGoods) != -1 ?
Integer checkQty = allCartGoodsList.indexOf(cartGoods) != -1 ?
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
*/
*/
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
ApiLog
.
printLog
(
"addGoods checkQty"
,
JSONObject
.
toJSONString
(
checkQty
),
" 3"
,
null
);
//购物车添加数量限制
//购物车添加数量限制
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
//查询多个商品库存信息 TODO
//查询多个商品库存信息 TODO
...
@@ -420,8 +415,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -420,8 +415,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
()))
{
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
()))
{
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
());
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
());
}
}
ApiLog
.
printLog
(
"addGoods calculationDiscountResult"
,
JSONObject
.
toJSONString
(
calculationDiscountResult
),
" 8"
,
null
);
// 当商品数量被设为0时
// 当商品数量被设为0时
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
...
@@ -1456,9 +1449,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1456,9 +1449,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 换购券传给促销要带code
// 换购券传给促销要带code
String
goodsId
=
StringUtils
.
isEmpty
(
checkSpqInfoResponseDto
.
getSkuId
())
?
checkSpqInfoResponseDto
.
getSpuId
()
:
checkSpqInfoResponseDto
.
getSkuId
();
String
goodsId
=
StringUtils
.
isEmpty
(
checkSpqInfoResponseDto
.
getSkuId
())
?
checkSpqInfoResponseDto
.
getSpuId
()
:
checkSpqInfoResponseDto
.
getSkuId
();
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
goodsId
,
1
,
checkSpqInfoResponseDto
.
getPrice
(),
100
,
cartGoodsUid
,
cartGoods
.
getSpuId
());
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
goodsId
,
cartGoods
.
getQty
()
,
checkSpqInfoResponseDto
.
getPrice
(),
100
,
cartGoodsUid
,
cartGoods
.
getSpuId
());
}
else
{
}
else
{
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
goodsId
,
1
,
checkSpqInfoResponseDto
.
getPrice
(),
100
,
cartGoodsUid
);
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
goodsId
,
cartGoods
.
getQty
()
,
checkSpqInfoResponseDto
.
getPrice
(),
100
,
cartGoodsUid
);
}
}
}
}
}
}
...
@@ -1478,7 +1471,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1478,7 +1471,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
}
}
calculationDiscountGoodsList
.
removeIf
(
calculationDiscountGoods
->
(
calculationDiscountGoods
.
getGoodsQuantity
().
equals
(
0
)));
calculationDiscountGoodsList
.
removeIf
(
calculationDiscountGoods
->
(
calculationDiscountGoods
.
getGoodsQuantity
().
equals
(
0
)));
ApiLog
.
printLog
(
"addGoods calculationDiscountGoodsList2"
,
JSONObject
.
toJSONString
(
calculationDiscountGoodsList
),
" 12"
,
null
);
if
(
CollectionUtils
.
isEmpty
(
calculationDiscountGoodsList
))
{
if
(
CollectionUtils
.
isEmpty
(
calculationDiscountGoodsList
))
{
return
null
;
return
null
;
...
@@ -1666,8 +1658,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1666,8 +1658,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
else
{
}
else
{
calculationDiscountGoodsList
.
add
(
calculationDiscountGoods
);
calculationDiscountGoodsList
.
add
(
calculationDiscountGoods
);
}
}
ApiLog
.
printLog
(
"addGoods calculationDiscountGoodsList"
,
JSONObject
.
toJSONString
(
calculationDiscountGoodsList
),
" 11"
,
null
);
}
}
...
@@ -1986,14 +1976,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1986,14 +1976,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CheckCartRequest
checkCartRequest
=
assortmentSdkService
.
checkShoppingCartSdk
(
oldAllCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getPartnerId
(),
CheckCartRequest
checkCartRequest
=
assortmentSdkService
.
checkShoppingCartSdk
(
oldAllCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getPartnerId
(),
addShoppingCartGoodsRequestVo
.
getShopId
(),
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
.
getOrderType
(),
addShoppingCartGoodsRequestVo
.
getShopId
(),
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
.
getOrderType
(),
""
,
addShoppingCartGoodsRequestVo
.
getMenuType
(),
shoppingCartBaseService
);
""
,
addShoppingCartGoodsRequestVo
.
getMenuType
(),
shoppingCartBaseService
);
ApiLog
.
printLog
(
"addGoods checkCartRequest"
,
JSONObject
.
toJSONString
(
cartGoods
),
JSON
.
toJSONString
(
checkCartRequest
),
" 4"
);
if
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
()
!=
null
)
{
if
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
()
!=
null
)
{
shoppingCartGoodsResponseVo
.
setToastMsg
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getToastMsg
());
shoppingCartGoodsResponseVo
.
setToastMsg
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getToastMsg
());
shoppingCartGoodsResponseVo
.
setChanged
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getChanged
());
shoppingCartGoodsResponseVo
.
setChanged
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getChanged
());
}
}
List
<
CartGoods
>
allCartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
List
<
CartGoods
>
allCartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
ApiLog
.
printLog
(
"addGoods allCartGoodsList"
,
JSONObject
.
toJSONString
(
allCartGoodsList
),
" 5"
,
null
);
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
...
@@ -2004,16 +1992,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2004,16 +1992,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
nowCartGoodsList
.
add
(
oldCartGoods
);
nowCartGoodsList
.
add
(
oldCartGoods
);
}
}
});
});
ApiLog
.
printLog
(
"addGoods nowCartGoodsList"
,
JSONObject
.
toJSONString
(
nowCartGoodsList
),
" 6"
,
null
);
// 重新set购物车信息到缓存中
// 重新set购物车信息到缓存中
assortmentSdkService
.
setShoppingCart
(
addShoppingCartGoodsRequestVo
.
getPartnerId
(),
addShoppingCartGoodsRequestVo
.
getShopId
(),
assortmentSdkService
.
setShoppingCart
(
addShoppingCartGoodsRequestVo
.
getPartnerId
(),
addShoppingCartGoodsRequestVo
.
getShopId
(),
userId
,
nowCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
addShoppingCartGoodsRequestVo
.
getTableNumber
(),
this
.
shoppingCartBaseService
);
userId
,
nowCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
addShoppingCartGoodsRequestVo
.
getTableNumber
(),
this
.
shoppingCartBaseService
);
oldAllCartGoodsList
.
clear
();
oldAllCartGoodsList
.
clear
();
oldAllCartGoodsList
.
addAll
(
nowCartGoodsList
);
oldAllCartGoodsList
.
addAll
(
nowCartGoodsList
);
ApiLog
.
printLog
(
"addGoods nowCartGoodsList2"
,
JSONObject
.
toJSONString
(
nowCartGoodsList
),
" 7"
,
null
);
return
nowCartGoodsList
;
return
nowCartGoodsList
;
}
}
...
@@ -2081,8 +2065,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2081,8 +2065,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_OTHER_ACTIVITY_WHEN_ADD_GOODS_COUPON
);
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_OTHER_ACTIVITY_WHEN_ADD_GOODS_COUPON
);
}
}
//校验合法性,更新缓存中购物车信息
//校验合法性,更新缓存中购物车信息
// LogUtil.info("updateCartGoodsLegal", JSON.toJSONString(cartGoods),JSON.toJSONString(allCartGoodsList));
ApiLog
.
printLog
(
"updateCartGoodsLegal"
,
JSONObject
.
toJSONString
(
cartGoods
),
JSON
.
toJSONString
(
allCartGoodsList
),
null
);
ApiLog
.
printLog
(
"addGoods updateCartGoodsLegal"
,
JSONObject
.
toJSONString
(
cartGoods
),
JSON
.
toJSONString
(
allCartGoodsList
),
null
);
updateCartGoodsLegal
(
cartGoods
,
userId
,
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
,
allCartGoodsList
);
updateCartGoodsLegal
(
cartGoods
,
userId
,
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
,
allCartGoodsList
);
...
@@ -2520,7 +2503,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2520,7 +2503,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
customerInfoVo
==
null
)
throw
new
ServiceException
(
ResponseResult
.
NOT_LOGIN
);
if
(
customerInfoVo
==
null
)
throw
new
ServiceException
(
ResponseResult
.
NOT_LOGIN
);
String
jsonObject
=
JSON
.
toJSONString
(
customerInfoVo
);
String
jsonObject
=
JSON
.
toJSONString
(
customerInfoVo
);
CustomerInfoVo
customerInfoVo1
=
JSON
.
parseObject
(
jsonObject
,
CustomerInfoVo
.
class
);
CustomerInfoVo
customerInfoVo1
=
JSON
.
parseObject
(
jsonObject
,
CustomerInfoVo
.
class
);
LogUtil
.
debug
(
"customerInfoVo"
,
sessionId
,
customerInfoVo
);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return
customerInfoVo1
;
return
customerInfoVo1
;
}
}
...
...
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