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
85ae8129
Commit
85ae8129
authored
Aug 06, 2021
by
胡博文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
87d7fdfa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
69 deletions
+69
-69
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+69
-69
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
85ae8129
...
@@ -353,7 +353,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -353,7 +353,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
//购物车添加数量限制
//购物车添加数量限制
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
//
Integer productsCount = limitGoodsQty(allCartGoodsList, cartGoods, appId);
//查询多个商品库存信息 TODO
//查询多个商品库存信息 TODO
queryManyGoodsStocks
(
addShoppingCartGoodsRequestVo
,
productIds
,
productBeanListSpuClass
,
skuId
,
checkQty
);
queryManyGoodsStocks
(
addShoppingCartGoodsRequestVo
,
productIds
,
productBeanListSpuClass
,
skuId
,
checkQty
);
String
productName
=
null
;
String
productName
=
null
;
...
@@ -404,9 +404,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -404,9 +404,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
);
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
);
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());
}
//
}
// 当商品数量被设为0时
// 当商品数量被设为0时
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
...
@@ -2619,39 +2619,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2619,39 +2619,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
Objects
.
nonNull
(
cartGoods
))
{
if
(
Objects
.
nonNull
(
cartGoods
))
{
qty
+=
cartGoods
.
getQty
();
qty
+=
cartGoods
.
getQty
();
}
}
String
redisKey
=
limitCartKey
+
appid
;
//
String redisKey = limitCartKey + appid;
//
Object
value
=
redisCache
.
hashGet
(
redisKey
,
"2"
);
//
Object value = redisCache.hashGet(redisKey, "2");
if
(
value
==
null
)
{
//
if (value == null) {
return
qty
;
//
return qty;
}
else
{
//
} else {
boolean
bool
=
value
.
getClass
().
getName
().
equals
(
"java.lang.String"
);
//
boolean bool = value.getClass().getName().equals("java.lang.String");
if
(
bool
)
{
//
if (bool) {
return
qty
;
//
return qty;
}
//
}
JSONArray
jsonArray
=
(
JSONArray
)
value
;
//
JSONArray jsonArray = (JSONArray) value;
int
cartLimitFlag
=
0
;
//
int cartLimitFlag = 0;
int
cartLimitCount
=
0
;
//
int cartLimitCount = 0;
for
(
Object
object
:
jsonArray
)
{
//
for (Object object : jsonArray) {
JSONObject
jsonObject
=
(
JSONObject
)
object
;
//
JSONObject jsonObject = (JSONObject) object;
HashMap
hashMap
=
JSONObject
.
parseObject
(
jsonObject
.
toJSONString
(),
HashMap
.
class
);
//
HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(), HashMap.class);
if
(
"cartLimitFlag"
.
equals
(
hashMap
.
get
(
"appKey"
)))
{
//
if ("cartLimitFlag".equals(hashMap.get("appKey"))) {
if
(
StringUtils
.
isBlank
((
String
)
hashMap
.
get
(
"appValue"
)))
{
//
if (StringUtils.isBlank((String) hashMap.get("appValue"))) {
return
qty
;
//
return qty;
}
//
}
cartLimitFlag
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
//
cartLimitFlag = Integer.parseInt((String) hashMap.get("appValue"));
}
//
}
if
(
"cartLimitCount"
.
equals
(
hashMap
.
get
(
"appKey"
)))
{
//
if ("cartLimitCount".equals(hashMap.get("appKey"))) {
if
(
StringUtils
.
isBlank
((
String
)
hashMap
.
get
(
"appValue"
)))
{
//
if (StringUtils.isBlank((String) hashMap.get("appValue"))) {
return
qty
;
//
return qty;
}
//
}
cartLimitCount
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
//
cartLimitCount = Integer.parseInt((String) hashMap.get("appValue"));
}
//
}
}
//
}
if
(
cartLimitFlag
==
1
&&
cartLimitCount
!=
0
&&
qty
>
cartLimitCount
)
{
//
if (cartLimitFlag == 1 && cartLimitCount != 0 && qty > cartLimitCount) {
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_LIMIT_ADD
);
//
throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD);
}
//
}
}
//
}
return
qty
;
return
qty
;
}
}
...
@@ -2671,38 +2671,38 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2671,38 +2671,38 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
String
redisKey
=
limitCartKey
+
appid
;
String
redisKey
=
limitCartKey
+
appid
;
Object
value
=
redisCache
.
hashGet
(
redisKey
,
"2"
);
//
Object value = redisCache.hashGet(redisKey, "2");
if
(
value
==
null
)
{
//
if (value == null) {
return
;
//
return;
}
else
{
//
} else {
boolean
bool
=
value
.
getClass
().
getName
().
equals
(
"java.lang.String"
);
//
boolean bool = value.getClass().getName().equals("java.lang.String");
if
(
bool
)
{
//
if (bool) {
return
;
//
return;
}
//
}
JSONArray
jsonArray
=
(
JSONArray
)
value
;
//
JSONArray jsonArray = (JSONArray) value;
int
cartLimitFlag
=
0
;
//
int cartLimitFlag = 0;
int
cartLimitCount
=
0
;
//
int cartLimitCount = 0;
for
(
Object
object
:
jsonArray
)
{
//
for (Object object : jsonArray) {
JSONObject
jsonObject
=
(
JSONObject
)
object
;
//
JSONObject jsonObject = (JSONObject) object;
HashMap
hashMap
=
JSONObject
.
parseObject
(
jsonObject
.
toJSONString
(),
HashMap
.
class
);
//
HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(), HashMap.class);
if
(
"cartLimitFlag"
.
equals
(
hashMap
.
get
(
"appKey"
)))
{
//
if ("cartLimitFlag".equals(hashMap.get("appKey"))) {
if
(
StringUtils
.
isBlank
((
String
)
hashMap
.
get
(
"appValue"
)))
{
//
if (StringUtils.isBlank((String) hashMap.get("appValue"))) {
return
;
//
return;
}
//
}
cartLimitFlag
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
//
cartLimitFlag = Integer.parseInt((String) hashMap.get("appValue"));
}
//
}
if
(
"cartLimitCount"
.
equals
(
hashMap
.
get
(
"appKey"
)))
{
//
if ("cartLimitCount".equals(hashMap.get("appKey"))) {
if
(
StringUtils
.
isBlank
((
String
)
hashMap
.
get
(
"appValue"
)))
{
//
if (StringUtils.isBlank((String) hashMap.get("appValue"))) {
return
;
//
return;
}
//
}
cartLimitCount
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
//
cartLimitCount = Integer.parseInt((String) hashMap.get("appValue"));
}
//
}
}
//
}
if
(
cartLimitFlag
==
1
&&
cartLimitCount
!=
0
&&
checkQty
+
sendQty
>
cartLimitCount
)
{
//
if (cartLimitFlag == 1 && cartLimitCount != 0 && checkQty + sendQty > cartLimitCount) {
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
shoppingCartService
);
//
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, oldCartGoodsList, null, tableNumber, shoppingCartService);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_LIMIT_ADD
);
//
throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD);
}
//
}
}
//
}
}
}
...
...
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