Authored by LUOXC

fixbug

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;
}
... ...