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
b4200483
Commit
b4200483
authored
Jun 15, 2021
by
王世昌
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210608-修复频次券可用门店判断' into develop
parents
7c787849
e9f6cb39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
30 deletions
+35
-30
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+6
-5
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+29
-25
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
b4200483
...
@@ -766,7 +766,8 @@ public class CouponServiceImpl implements CouponService {
...
@@ -766,7 +766,8 @@ public class CouponServiceImpl implements CouponService {
return
null
;
return
null
;
}
}
//校验商品券是否可用
//校验商品券是否可用
if
(!
Objects
.
equals
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getStatus
(),
CouponStatus
.
STATUS_0
.
getCode
()))
{
if
(!
Objects
.
equals
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getStatus
(),
CouponStatus
.
STATUS_0
.
getCode
())
&&
!
Objects
.
equals
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getStatus
(),
CouponStatus
.
STATUS_2
.
getCode
()))
{
return
null
;
return
null
;
}
}
List
<
String
>
couPonstoreIds
=
Lists
.
newArrayList
();
List
<
String
>
couPonstoreIds
=
Lists
.
newArrayList
();
...
@@ -940,14 +941,14 @@ public class CouponServiceImpl implements CouponService {
...
@@ -940,14 +941,14 @@ public class CouponServiceImpl implements CouponService {
return
null
;
return
null
;
}
}
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用)
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用)
List
<
String
>
cou
Pons
toreIds
=
Lists
.
newArrayList
();
List
<
String
>
cou
ponS
toreIds
=
Lists
.
newArrayList
();
for
(
GetCouponDetailResponseDto
.
Details
detail
:
couponDetailResponseDto
.
getDetails
())
{
for
(
GetCouponDetailResponseDto
.
Details
detail
:
couponDetailResponseDto
.
getDetails
())
{
if
(!
CouponStatus
.
STATUS_0
.
getCode
().
equals
(
detail
.
getStatus
()))
continue
;
if
(!
CouponStatus
.
STATUS_0
.
getCode
().
equals
(
detail
.
getStatus
())
&&
!
CouponStatus
.
STATUS_2
.
getCode
().
equals
(
detail
.
getStatus
())
)
continue
;
for
(
GetCouponDetailResponseDto
.
ActiveRestrictionVOS
activeRestrictionVO
:
detail
.
getActiveRestrictionVOS
())
{
for
(
GetCouponDetailResponseDto
.
ActiveRestrictionVOS
activeRestrictionVO
:
detail
.
getActiveRestrictionVOS
())
{
cou
Pons
toreIds
.
add
(
activeRestrictionVO
.
getStoreIdPartner
());
cou
ponS
toreIds
.
add
(
activeRestrictionVO
.
getStoreIdPartner
());
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
cou
PonstoreIds
)
&&
!
couPons
toreIds
.
contains
(
storeId
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cou
ponStoreIds
)
&&
!
couponS
toreIds
.
contains
(
storeId
))
{
return
null
;
return
null
;
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
b4200483
...
@@ -590,15 +590,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -590,15 +590,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
requestDto
.
setStoreId
(
storeId
);
requestDto
.
setStoreId
(
storeId
);
requestDto
.
setProductIds
(
Collections
.
singletonList
(
Long
.
parseLong
(
cartGoods
.
getGoodsId
())));
requestDto
.
setProductIds
(
Collections
.
singletonList
(
Long
.
parseLong
(
cartGoods
.
getGoodsId
())));
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
if
(
(
availableStocks
!=
null
)
&&
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()
)))
{
if
(
availableStocks
==
null
||
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
(
)))
{
if
((
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
()))
||
(
availableStocks
.
getResult
().
get
(
0
).
getQty
()
!=
null
&&
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
qty
>
availableStocks
.
getResult
().
get
(
0
).
getQty
()))
{
}
Integer
stock
=
0
;
int
stock
=
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
?
0
:
if
(!
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
&&
(
stock
=
availableStocks
.
getResult
().
get
(
0
).
getQty
())
>
0
)
{
availableStocks
.
getResult
().
get
(
0
).
getQty
();
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
if
(
stock
<=
0
)
{
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
else
if
(
stock
<
qty
)
{
}
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
}
}
}
...
@@ -1968,35 +1968,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1968,35 +1968,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
*/
private
void
queryManyGoodsStocks
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
Long
>
productIds
private
void
queryManyGoodsStocks
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
Long
>
productIds
,
List
<
ProductBean
>
productBeanListSpuClass
,
String
skuId
,
Integer
qty
)
{
,
List
<
ProductBean
>
productBeanListSpuClass
,
String
skuId
,
Integer
qty
)
{
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
boolean
isLimit
=
false
;
requestDto
.
setChannel
(
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
requestDto
.
setPartnerId
(
addShoppingCartGoodsRequestVo
.
getPartnerId
());
requestDto
.
setStoreId
(
addShoppingCartGoodsRequestVo
.
getShopId
());
requestDto
.
setProductIds
(
productIds
);
GetProductStockResponseDto
availableStocks
=
null
;
if
(
productBeanListSpuClass
.
get
(
0
).
getType
()
==
ProductType
.
NOSPEC
.
getCode
()
if
(
productBeanListSpuClass
.
get
(
0
).
getType
()
==
ProductType
.
NOSPEC
.
getCode
()
&&
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
)
{
&&
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
)
{
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
)
;
isLimit
=
true
;
}
else
{
}
else
{
for
(
ProductBean
.
SkuProductBean
skuProductBean
:
productBeanListSpuClass
.
get
(
0
).
getSkuList
())
{
for
(
ProductBean
.
SkuProductBean
skuProductBean
:
productBeanListSpuClass
.
get
(
0
).
getSkuList
())
{
if
(
skuId
.
equals
(
skuProductBean
.
getSkuId
())
&&
skuProductBean
.
getStockLimit
()
==
1
)
{
if
(
skuId
.
equals
(
skuProductBean
.
getSkuId
())
&&
skuProductBean
.
getStockLimit
()
==
1
)
{
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
)
;
isLimit
=
true
;
break
;
break
;
}
}
}
}
}
}
if
(
availableStocks
!=
null
&&
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()))
{
// 不限制库存
if
(!
isLimit
){
return
;
}
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
requestDto
.
setChannel
(
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
requestDto
.
setPartnerId
(
addShoppingCartGoodsRequestVo
.
getPartnerId
());
requestDto
.
setStoreId
(
addShoppingCartGoodsRequestVo
.
getShopId
());
requestDto
.
setProductIds
(
productIds
);
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
if
(
availableStocks
==
null
||
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
}
if
(
availableStocks
!=
null
&&
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
())
&&
int
stock
=
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
?
0
:
(
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
availableStocks
.
getResult
().
get
(
0
).
getQty
();
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
<
qty
))
{
if
(
stock
<=
0
)
{
Integer
stock
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
&&
(
stock
=
availableStocks
.
getResult
().
get
(
0
).
getQty
())
>
0
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
else
if
(
stock
<
qty
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
}
}
}
/**
/**
...
...
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