生日有礼修改
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -36,6 +35,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -173,7 +173,12 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
queryWrapper.eq(ShopUser::getIsVip, 1);
|
||||
}
|
||||
|
||||
shopUserService.list(queryWrapper).forEach(shopUser -> {
|
||||
for (ShopUser shopUser : shopUserService.list(queryWrapper)) {
|
||||
long count = birthdayGiftRecordService.count(new QueryWrapper().eq(MkBirthdayGiftRecord::getUserId, shopUser.getUserId()).eq(MkBirthdayGiftRecord::getBirthday, current));
|
||||
if (count > 1) {
|
||||
log.info("用户{}已领取过生日礼包", shopUser.getUserId());
|
||||
continue;
|
||||
}
|
||||
// 发放记录
|
||||
MkBirthdayGiftRecord giftRecord = new MkBirthdayGiftRecord().setUserId(shopUser.getUserId()).setShopUserId(shopUser.getId())
|
||||
.setPushStatus(birthdayGift.getSendSms() == 1 ?
|
||||
@@ -211,7 +216,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -222,7 +227,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public MkBirthdayGiftVO getInfo(long userId, Integer shopId) {
|
||||
public List<ShopCoupon> getInfo(long userId, Integer shopId) {
|
||||
MkBirthdayGift birthdayGift = getOne(new QueryWrapper().eq(MkBirthdayGift::getMainShopId, shopId).eq(MkBirthdayGift::getIsEnable, 1));
|
||||
if (birthdayGift == null) {
|
||||
return null;
|
||||
@@ -248,9 +253,8 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
}
|
||||
|
||||
if (DateUtil.parseDate(shopUser.getBirthDay()).toLocalDateTime().toLocalDate().isEqual(current)) {
|
||||
MkBirthdayGiftVO vo = BeanUtil.copyProperties(birthdayGift, MkBirthdayGiftVO.class, "configList");
|
||||
vo.setConfigList(CollUtil.toList(config));
|
||||
return vo;
|
||||
List<CouponInfoDTO> couponInfoList = config.getCouponInfoList();
|
||||
return shopCouponService.list(new QueryWrapper().in(ShopCoupon::getId, couponInfoList.stream().map(CouponInfoDTO::getId).toList()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user