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
c814fa9f
Commit
c814fa9f
authored
Sep 15, 2020
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车加入数量限制
parent
a2a4bc16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/OpenPlatformPartnerWxappConfig.java
+26
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+48
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/OpenPlatformPartnerWxappConfig.java
0 → 100644
View file @
c814fa9f
package
cn
.
freemud
.
entities
.
dto
;
import
lombok.Data
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: OpenPlatformPartnerWxappConfig
* @Package cn.freemud.entities.dto
* @Description:
* @author: ping1.wu
* @date: 2020/9/15 15:59
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public
class
OpenPlatformPartnerWxappConfig
{
private
String
wxAppid
;
private
String
appKey
;
private
String
appValue
;
private
Integer
state
;
}
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
c814fa9f
...
...
@@ -87,6 +87,7 @@ public enum ResponseResult {
SHOPPING_CART_SEAT_EMPTY
(
"44020"
,
"键位为空"
),
SHOPPING_CART_COUPON_USED
(
"44021"
,
"优惠券已加入餐盘"
),
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
(
"44022"
,
"已加入同样优惠券,第二张暂不可用"
),
SHOPPING_CART_LIMIT_ADD
(
"44025"
,
"加购数量超过限制"
),
/**
* 订单状态码
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
c814fa9f
...
...
@@ -30,6 +30,7 @@ import cn.freemud.entities.vo.*;
import
cn.freemud.enums.*
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.interceptor.BizServiceException
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.service.*
;
import
cn.freemud.service.thirdparty.*
;
import
cn.freemud.utils.PromotionFactory
;
...
...
@@ -39,6 +40,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerStoreDeliveryConfig
;
import
com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerWxappConfig
;
import
com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager
;
import
com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
...
...
@@ -67,6 +69,8 @@ import org.apache.commons.lang.ObjectUtils;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.BoundHashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.awt.geom.Point2D
;
...
...
@@ -254,6 +258,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
*/
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
//购物车添加数量限制
limitGoodsQty
(
checkQty
,
appId
);
//查询多个商品库存信息
queryManyGoodsStocks
(
addShoppingCartGoodsRequestVo
,
productIds
,
productBeanListSpuClass
,
skuId
,
checkQty
);
String
productName
=
null
;
...
...
@@ -1627,4 +1633,46 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo
.
setToastMsg
(
""
);
}
}
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
RedisCache
redisCache
;
/**
* 查询生态配置限制加购开关与限制数量
*/
public
void
limitGoodsQty
(
Integer
qty
,
String
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"
);
List
<
AssortmentOpenPlatformPartnerWxappConfig
>
configs
=
null
;
if
(
value
==
null
)
{
return
;
}
else
{
String
json
=
JSONObject
.
toJSONString
(
value
);
configs
=
JSONArray
.
parseArray
(
json
,
AssortmentOpenPlatformPartnerWxappConfig
.
class
);
}
List
<
OpenPlatformPartnerWxappConfig
>
configs2
=
operations
.
get
(
"2"
);
if
(
CollectionUtils
.
isNotEmpty
(
configs
)){
int
cartLimitFlag
=
0
;
int
cartLimitCount
=
0
;
for
(
AssortmentOpenPlatformPartnerWxappConfig
config
:
configs
){
if
(
"cartLimitFlag"
.
equals
(
config
.
getAppKey
())){
cartLimitFlag
=
Integer
.
parseInt
(
config
.
getAppValue
());
}
if
(
"cartLimitCount"
.
equals
(
config
.
getAppKey
())){
cartLimitCount
=
Integer
.
parseInt
(
config
.
getAppValue
());
}
}
if
(
cartLimitFlag
==
1
&&
cartLimitCount
!=
0
&&
qty
>
cartLimitCount
){
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