bug
This commit is contained in:
parent
b6a7befa56
commit
2e193072eb
@ -188,6 +188,10 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
*/
|
||||
@Override
|
||||
public boolean isDrawDown(CardFavorableRecord cardFavorableRecord) {
|
||||
|
||||
LambdaQueryWrapper<CardFavorable> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(CardFavorable::getStoreId,cardFavorableRecord.getStoreId());
|
||||
List<CardFavorable> list1 = cardFavorableService.list(queryWrapper1);
|
||||
boolean isDrawDown = false;
|
||||
//登录用户信息
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -196,7 +200,7 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
queryWrapper.eq(CardFavorableRecord::getStoreId,cardFavorableRecord.getStoreId());
|
||||
//如果领过券 就不让领了
|
||||
List<CardFavorableRecord> list = list(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
if (CollectionUtils.isEmpty(list) && CollectionUtils.isNotEmpty(list1) && list.size() <list1.size()){
|
||||
isDrawDown = true;
|
||||
}
|
||||
return isDrawDown;
|
||||
|
@ -3,13 +3,16 @@ package com.fuint.business.marketingActivity.cardFavorable.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO;
|
||||
@ -19,10 +22,12 @@ import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -40,6 +45,9 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
||||
private StoreService storeService;
|
||||
@Resource
|
||||
private CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
@Resource
|
||||
@Lazy
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param cardFavorableDTO
|
||||
@ -95,9 +103,26 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
||||
queryWrapper.eq(CardFavorable::getStoreId,storeId);
|
||||
queryWrapper.orderByDesc(CardFavorable::getCreateTime);
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
//本店所有的优惠券
|
||||
List<CardFavorable> records = page1.getRecords();
|
||||
if (records.size()>3){
|
||||
List<CardFavorable> cardFavorables = records.subList(0, 3);
|
||||
ArrayList<CardFavorable> cardFavorableArrayList = new ArrayList<>();
|
||||
//登录人已领优惠券
|
||||
LambdaQueryWrapper<CardFavorableRecord> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(CardFavorableRecord::getMtUserId,TokenUtil.getNowAccountInfo().getId());
|
||||
queryWrapper1.eq(CardFavorableRecord::getStoreId,storeId);
|
||||
List<CardFavorableRecord> list = cardFavorableRecordService.list(queryWrapper1);
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
for (CardFavorableRecord cardFavorableRecord : list) {
|
||||
for (CardFavorable record : records) {
|
||||
if(!cardFavorableRecord.getCardFavorableId().equals(record.getId())){
|
||||
CardFavorable one = getById(record.getId());
|
||||
cardFavorableArrayList.add(one);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cardFavorableArrayList.size()>3){
|
||||
List<CardFavorable> cardFavorables = cardFavorableArrayList.subList(0, 3);
|
||||
page1.setRecords(cardFavorables);
|
||||
}
|
||||
return page1;
|
||||
|
Loading…
Reference in New Issue
Block a user