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
1e10653b
Commit
1e10653b
authored
Aug 18, 2021
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
买m赠n券
parent
12c89263
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
0 deletions
+172
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+172
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+0
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
1e10653b
...
...
@@ -1357,4 +1357,176 @@ public class CouponServiceImpl implements CouponService {
}
}
}
// @Override
public
CheckSpqInfoResponseDto
checkSpqInfo
(
CheckSpqInfoRequestDto
requestDto
,
String
goodsId
,
Integer
goodsType
)
{
String
partnerId
=
requestDto
.
getPartnerId
();
String
couponCode
=
requestDto
.
getCouponCode
();
String
storeId
=
requestDto
.
getStoreId
();
//TODO 查询券详情券是否存在
GetMemberCouponRequestVo
requestVo
=
new
GetMemberCouponRequestVo
();
requestVo
.
setPartnerId
(
partnerId
);
requestVo
.
setCouponCode
(
couponCode
);
requestVo
.
setStoreId
(
requestDto
.
getStoreId
());
GetCouponDetailResponseDto
couponDetailResponseDto
=
couponService
.
getMemberCoupon
(
requestVo
);
if
(
couponDetailResponseDto
==
null
||
!
couponDetailResponseDto
.
getResult
().
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_1
)
||
CollectionUtils
.
isEmpty
(
couponDetailResponseDto
.
getDetails
()))
{
return
null
;
}
GetCouponDetailResponseDto
.
Details
details
=
couponDetailResponseDto
.
getDetails
().
get
(
0
);
//校验商品券是否可用
if
(!
Objects
.
equals
(
details
.
getStatus
(),
CouponStatus
.
STATUS_0
.
getCode
())
&&
!
Objects
.
equals
(
details
.
getStatus
(),
CouponStatus
.
STATUS_2
.
getCode
()))
{
return
null
;
}
List
<
String
>
couPonstoreIds
=
Lists
.
newArrayList
();
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用)
if
(
CollectionUtils
.
isNotEmpty
(
details
.
getActiveRestrictionVOS
()))
{
details
.
getActiveRestrictionVOS
().
forEach
(
activeRestrictionVOS
->
{
couPonstoreIds
.
add
(
activeRestrictionVOS
.
getStoreIdPartner
());
});
}
if
(
CollectionUtils
.
isNotEmpty
(
couPonstoreIds
)
&&
!
couPonstoreIds
.
contains
(
storeId
))
{
return
null
;
}
//券返回的商品id
List
<
String
>
skuIds
=
Lists
.
newArrayList
();
String
skuId
=
details
.
getActiveProduct
().
get
(
0
).
getProductIdPartner
();
skuIds
.
add
(
String
.
valueOf
(
skuId
));
//TODO 通过skuid查询spuid
Map
<
String
,
GetProductsVo
>
productsVoMap
=
itemService
.
getProducts
(
skuIds
,
partnerId
,
storeId
,
requestDto
.
getMenuType
());
GetProductsVo
productsVo
=
productsVoMap
.
get
(
skuId
);
if
(
null
==
productsVo
||
!
Objects
.
equals
(
productsVo
.
getStatus
(),
StoreItemStatus
.
PUT_ON_SALE
.
getCode
()))
{
return
null
;
}
// 校验券的可用时间
List
<
GetCouponDetailResponseDto
.
ActiveRedeemTimeInterval
>
activeRedeemTimeIntervalList
=
details
.
getActiveRedeemTimeIntervalList
();
boolean
verificationPassed
=
checkCouonRedeemTime
(
activeRedeemTimeIntervalList
);
if
(!
verificationPassed
){
return
null
;
}
// 校验商品可用时间
ValidateShopProductRequest
request
=
getValidateShopProductRequest
(
productsVo
,
requestDto
);
ProductResponseDTO
<
ValiadShopProductResponse
>
valiadProductResponse
=
storeItemClient
.
validateShopProduct
(
request
);
if
(
null
==
valiadProductResponse
||
!
Objects
.
equals
(
ResponseConstant
.
SUCCESS_RESPONSE_CODE
,
valiadProductResponse
.
getErrcode
())
||
valiadProductResponse
.
getData
()
==
null
||
CollectionUtils
.
isEmpty
(
valiadProductResponse
.
getData
().
getSuccessList
()))
{
return
null
;
}
// CheckSpqInfoResponseDto dto = new CheckSpqInfoResponseDto();
// dto.setCouponCode(couponCode);
// dto.setActiveCode(details.getActive().getActiveCode());
// dto.setCouponName(details.getTitle());
// dto.setActivityName(details.getActive().getActiveName());
// if (details.getActive().getMaxRedeemTimes() != null && details.getActive().getMaxRedeemTimes() > 1){
// if (details.getToday_available_times() != null){
// dto.setTodayAvailableTimes(details.getToday_available_times());
// } else {
// dto.setTodayAvailableTimes(1);
// }
// } else {
// dto.setTodayAvailableTimes(1);
// }
// dto.setPrice(productsVo.getFinalPrice());
// dto.setSpuId(productsVo.getSpuId());
// dto.setSpuName(productsVo.getSkuName());
// dto.setStockLimit(ObjectUtils.equals(1, productsVo.getStockLimit()));
// dto.setSkuId(productsVo.getSkuId());
// dto.setSkuName(StringUtils.isNotBlank(productsVo.getSkuName()) ? productsVo.getSkuName() : productsVo.getSpuName());
// dto.setPicture(productsVo.getSpuPicture());
// dto.setCouponType(0);
// return dto;
boolean
productValid
=
false
;
Integer
couponType
=
0
;
for
(
GetCouponDetailResponseDto
.
Details
detail
:
couponDetailResponseDto
.
getDetails
())
{
if
(
productValid
)
break
;
if
(!
CouponStatus
.
STATUS_0
.
getCode
().
equals
(
detail
.
getStatus
())
&&
!
CouponStatus
.
STATUS_2
.
getCode
().
equals
(
detail
.
getStatus
()))
continue
;
for
(
GetCouponDetailResponseDto
.
ActiveProduct
activeProduct
:
detail
.
getActiveProduct
())
{
if
(
goodsId
.
equals
(
activeProduct
.
getProductIdPartner
()))
{
productValid
=
true
;
couponType
=
CouponTypeEnum
.
TYPE_4
.
getCode
();
break
;
}
}
if
(
CouponTypeEnum
.
TYPE_7
.
getCode
().
equals
(
detail
.
getType
())){
for
(
GetCouponDetailResponseDto
.
ActiveProduct
activeProduct
:
detail
.
getActiveProduct
())
{
if
(
goodsId
.
equals
(
activeProduct
.
getProductIdPartner
()))
{
productValid
=
true
;
couponType
=
CouponTypeEnum
.
TYPE_7
.
getCode
();
break
;
}
}
}
}
//检查商品是否有效
if
(!
productValid
)
{
return
null
;
}
//判断该券是否在这个门店下(一个券可以在多个门店下使用)
List
<
String
>
couponStoreIds
=
Lists
.
newArrayList
();
for
(
GetCouponDetailResponseDto
.
Details
detail
:
couponDetailResponseDto
.
getDetails
())
{
if
(!
CouponStatus
.
STATUS_0
.
getCode
().
equals
(
detail
.
getStatus
())
&&
!
CouponStatus
.
STATUS_2
.
getCode
().
equals
(
detail
.
getStatus
()))
continue
;
for
(
GetCouponDetailResponseDto
.
ActiveRestrictionVOS
activeRestrictionVO
:
detail
.
getActiveRestrictionVOS
())
{
couponStoreIds
.
add
(
activeRestrictionVO
.
getStoreIdPartner
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
couponStoreIds
)
&&
!
couponStoreIds
.
contains
(
storeId
))
{
return
null
;
}
//券返回的商品id
// List<String> skuIds = Lists.newArrayList();
// String skuId = goodsId;
// skuIds.add(skuId);
//通过skuid查询spuid
// Map<String, GetProductsVo> productsVoMap = itemService.getProducts(skuIds, partnerId, storeId, requestDto.getMenuType());
// GetProductsVo productsVo = productsVoMap.get(skuId);
// if (null == productsVo || !Objects.equals(productsVo.getStatus(), StoreItemStatus.PUT_ON_SALE.getCode())) {
// return null;
// }
// 校验券的可用时间
// List<GetCouponDetailResponseDto.ActiveRedeemTimeInterval> activeRedeemTimeIntervalList = couponDetailResponseDto.getDetails().get(0).getActiveRedeemTimeIntervalList();
// boolean verificationPassed = checkCouonRedeemTime(activeRedeemTimeIntervalList);
// if (!verificationPassed){
// return null;
// }
// 校验商品可用时间
// ValidateShopProductRequest request = getValidateShopProductRequest(productsVo, requestDto);
// ProductResponseDTO<ValiadShopProductResponse> valiadProductResponse = storeItemClient.validateShopProduct(request);
// if (null == valiadProductResponse || !Objects.equals(ResponseConstant.SUCCESS_RESPONSE_CODE, valiadProductResponse.getErrcode())
// || valiadProductResponse.getData() == null || CollectionUtils.isEmpty(valiadProductResponse.getData().getSuccessList())) {
// return null;
// }
CheckSpqInfoResponseDto
dto
=
new
CheckSpqInfoResponseDto
();
if
(
details
.
getActive
().
getMaxRedeemTimes
()
!=
null
&&
details
.
getActive
().
getMaxRedeemTimes
()
>
1
){
if
(
details
.
getToday_available_times
()
!=
null
){
dto
.
setTodayAvailableTimes
(
details
.
getToday_available_times
());
}
else
{
dto
.
setTodayAvailableTimes
(
1
);
}
}
else
{
dto
.
setTodayAvailableTimes
(
1
);
}
dto
.
setCouponCode
(
couponCode
);
dto
.
setActiveCode
(
details
.
getActive
().
getActiveCode
());
dto
.
setCouponName
(
details
.
getTitle
());
dto
.
setActivityName
(
details
.
getActive
().
getActiveName
());
dto
.
setPrice
(
productsVo
.
getFinalPrice
());
dto
.
setSpuId
(
productsVo
.
getSpuId
());
dto
.
setSpuName
(
productsVo
.
getSkuName
());
dto
.
setSkuId
(
productsVo
.
getSkuId
());
dto
.
setSkuName
(
StringUtils
.
isNotBlank
(
productsVo
.
getSkuName
())
?
productsVo
.
getSkuName
()
:
productsVo
.
getSpuName
());
dto
.
setPicture
(
productsVo
.
getSpuPicture
());
dto
.
setDefaultSpecName
(
productsVo
.
getDefaultSpecName
());
dto
.
setDefaultSpecId
(
productsVo
.
getDefaultSpecId
());
dto
.
setStockLimit
(
ObjectUtils
.
equals
(
1
,
productsVo
.
getStockLimit
()));
dto
.
setExtras
(
productsVo
.
getExtra
());
dto
.
setCouponType
(
couponType
);
return
dto
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
1e10653b
This diff is collapsed.
Click to expand it.
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