Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
yohoufo-fore
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
LUOXC
5 years ago
Commit
76b07768b712e63794d32594c4fa044d6ed4c1b7
1 parent
4c02e33c
fixbug
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
promotion/src/main/java/com/yohoufo/promotion/service/impl/CollectiveCouponService.java
promotion/src/main/java/com/yohoufo/promotion/service/impl/CollectiveCouponService.java
View file @
76b0776
package
com
.
yohoufo
.
promotion
.
service
.
impl
;
import
com.google.common.collect.Maps
;
import
com.yohobuy.ufo.model.promotion.CouponSimpleBo
;
import
com.yohobuy.ufo.model.promotion.constant.CouponTypeEnum
;
import
com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum
;
...
...
@@ -18,6 +19,7 @@ import com.yohoufo.promotion.service.ProductLimitValueFilter;
import
com.yohoufo.promotion.service.cache.CollectiveCouponCacheService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -106,16 +108,19 @@ public class CollectiveCouponService {
return
couponListBo
;
}
Map
<
Integer
,
UserCoupon
>
buildCouponIdUserCouponMap
(
Integer
uid
,
Set
<
Integer
>
couponIds
){
Map
<
Integer
,
UserCoupon
>
buildCouponIdUserCouponMap
(
Integer
uid
,
Set
<
Integer
>
couponIds
)
{
if
(
ObjectUtils
.
defaultIfNull
(
uid
,
0
)
==
0
||
CollectionUtils
.
isEmpty
(
couponIds
))
{
return
Maps
.
newHashMap
();
}
final
Map
<
Integer
,
UserCoupon
>
couponIdUserCouponMap
=
new
HashMap
<>(
couponIds
.
size
());
List
<
UserCoupon
>
userCoupons
=
userCouponMapper
.
selectUserCouponListByCouponIds
(
uid
,
couponIds
);
Set
<
Integer
>
couponIdOfUser
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
userCoupons
)){
userCoupons
.
forEach
(
uc
->
couponIdUserCouponMap
.
put
(
uc
.
getCouponId
(),
uc
));
if
(
CollectionUtils
.
isNotEmpty
(
userCoupons
))
{
userCoupons
.
forEach
(
uc
->
couponIdUserCouponMap
.
put
(
uc
.
getCouponId
(),
uc
));
couponIdOfUser
=
couponIdUserCouponMap
.
keySet
();
}
logger
.
info
(
"buildCouponIdUserCouponMap selectUserCouponListByCouponIds find couponIdOfUser {} uid {} couponIds {}"
,
couponIdOfUser
,
uid
,
couponIds
);
couponIdOfUser
,
uid
,
couponIds
);
return
couponIdUserCouponMap
;
}
...
...
Please
register
or
login
to post a comment