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
4259abb4
Commit
4259abb4
authored
Sep 15, 2020
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车加入数量限制
parent
c814fa9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+10
-12
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
4259abb4
...
@@ -351,6 +351,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -351,6 +351,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
cartGoods
==
null
)
{
if
(
cartGoods
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_UPDATE_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_UPDATE_ERROR
);
}
}
//购物车添加数量限制
limitGoodsQty
(
qty
,
appId
);
// 检查购物车商品库存数量
// 检查购物车商品库存数量
checkUpdateStock
(
updateShoppingCartGoodsQtyRequestVo
,
cartGoods
);
checkUpdateStock
(
updateShoppingCartGoodsQtyRequestVo
,
cartGoods
);
...
@@ -1646,27 +1648,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1646,27 +1648,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
*/
public
void
limitGoodsQty
(
Integer
qty
,
String
appid
){
public
void
limitGoodsQty
(
Integer
qty
,
String
appid
){
String
redisKey
=
"ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_"
+
appid
;
String
redisKey
=
"ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_"
+
appid
;
BoundHashOperations
<
String
,
String
,
List
<
OpenPlatformPartnerWxappConfig
>>
operations
=
redisTemplate
.
boundHashOps
(
redisKey
);
Object
value
=
redisCache
.
hashGet
(
redisKey
,
"2"
);
Object
value
=
redisCache
.
hashGet
(
redisKey
,
"2"
);
List
<
AssortmentOpenPlatformPartnerWxappConfig
>
configs
=
null
;
List
<
AssortmentOpenPlatformPartnerWxappConfig
>
configs
=
null
;
if
(
value
==
null
)
{
if
(
value
==
null
)
{
return
;
return
;
}
else
{
}
else
{
String
json
=
JSONObject
.
toJSONString
(
value
);
JSONArray
jsonArray
=
(
JSONArray
)
value
;
configs
=
JSONArray
.
parseArray
(
json
,
AssortmentOpenPlatformPartnerWxappConfig
.
class
);
}
List
<
OpenPlatformPartnerWxappConfig
>
configs2
=
operations
.
get
(
"2"
);
if
(
CollectionUtils
.
isNotEmpty
(
configs
)){
int
cartLimitFlag
=
0
;
int
cartLimitFlag
=
0
;
int
cartLimitCount
=
0
;
int
cartLimitCount
=
0
;
for
(
AssortmentOpenPlatformPartnerWxappConfig
config
:
configs
){
for
(
Object
object
:
jsonArray
){
if
(
"cartLimitFlag"
.
equals
(
config
.
getAppKey
())){
JSONObject
jsonObject
=
(
JSONObject
)
object
;
cartLimitFlag
=
Integer
.
parseInt
(
config
.
getAppValue
());
HashMap
hashMap
=
JSONObject
.
parseObject
(
jsonObject
.
toJSONString
(),
HashMap
.
class
);
if
(
"cartLimitFlag"
.
equals
(
hashMap
.
get
(
"appKey"
))){
cartLimitFlag
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
}
}
if
(
"cartLimitCount"
.
equals
(
config
.
getAppKey
(
))){
if
(
"cartLimitCount"
.
equals
(
hashMap
.
get
(
"appKey"
))){
cartLimitCount
=
Integer
.
parseInt
(
config
.
getAppValue
(
));
cartLimitCount
=
Integer
.
parseInt
((
String
)
hashMap
.
get
(
"appValue"
));
}
}
}
}
if
(
cartLimitFlag
==
1
&&
cartLimitCount
!=
0
&&
qty
>
cartLimitCount
){
if
(
cartLimitFlag
==
1
&&
cartLimitCount
!=
0
&&
qty
>
cartLimitCount
){
...
...
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