满减优惠券

This commit is contained in:
齐天大圣 2023-11-20 09:22:14 +08:00
parent 22ce14d906
commit 61fd49e3c4

View File

@ -2,7 +2,10 @@ package com.fuint.business.marketingActivity.activeExchange.service.impl;
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.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService;
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService;
import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO;
@ -138,17 +141,53 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
@Override
public List<MaxoutVO> selectConsumptionList(Integer pageNo, Integer pageSize, TransferDTO transferDTO) {
ArrayList<MaxoutVO> maxoutVOArrayList = new ArrayList<>();
//构造满减券查询条件
LambdaQueryWrapper<ActiveFullminus> fullminusLambdaQueryWrapper = new LambdaQueryWrapper<>();
fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStoreId,transferDTO.getStoreId());
fullminusLambdaQueryWrapper.eq(ActiveFullminus::getIsonline,0);
fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStatus,0);
fullminusLambdaQueryWrapper.orderByDesc(ActiveFullminus::getCreateTime);
//会员等级判断
fullminusLambdaQueryWrapper.in(ActiveFullminus::getDieselUserLevel,userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId());
//符合油号判断
fullminusLambdaQueryWrapper.in(ActiveFullminus::getAdaptOil,transferDTO.getOilName());
List<ActiveFullminus> activeFullminusList = activeFullminusService.list(fullminusLambdaQueryWrapper);
for (ActiveFullminus activeFullminus : activeFullminusList) {
MaxoutVO maxoutVO = new MaxoutVO();
BeanUtils.copyProperties(activeFullminus,maxoutVO);
LambdaQueryWrapper<ActiveDiscountChild> queryWrappers = new LambdaQueryWrapper<>();
queryWrappers.eq(ActiveDiscountChild::getActiveDiscountId,activeFullminus.getId());
//判断符合金额
queryWrappers.le(ActiveDiscountChild::getAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters());
queryWrappers.orderByDesc(ActiveDiscountChild::getCreateTime);
maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers));
maxoutVOArrayList.add(maxoutVO);
}
fullminusLambdaQueryWrapper.eq(ActiveFullminus::getDieselUserLevel,transferDTO.getGradeId());
//activeFullminusService.list()
return null;
//构造折扣券查询条件
LambdaQueryWrapper<ActiveDiscount> discountLambdaQueryWrapper = new LambdaQueryWrapper<>();
discountLambdaQueryWrapper.eq(ActiveDiscount::getStoreId,transferDTO.getStoreId());
discountLambdaQueryWrapper.eq(ActiveDiscount::getIsonline,0);
discountLambdaQueryWrapper.eq(ActiveDiscount::getStatus,0);
discountLambdaQueryWrapper.orderByDesc(ActiveDiscount::getCreateTime);
//会员等级判断
discountLambdaQueryWrapper.in(ActiveDiscount::getDieselUserLevel,userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId());
//符合油号判断
discountLambdaQueryWrapper.in(ActiveDiscount::getAdaptOil,transferDTO.getOilName());
List<ActiveDiscount> activeDiscountList = activeDiscountService.list(discountLambdaQueryWrapper);
//获取兑换物品信息
for (ActiveDiscount activeDiscount : activeDiscountList) {
MaxoutVO maxoutVO = new MaxoutVO();
BeanUtils.copyProperties(activeDiscount,maxoutVO);
LambdaQueryWrapper<ActiveDiscountChild> queryWrappers = new LambdaQueryWrapper<>();
queryWrappers.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscount.getId());
//判断符合金额
queryWrappers.le(ActiveDiscountChild::getAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters());
queryWrappers.orderByDesc(ActiveDiscountChild::getCreateTime);
maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers));
maxoutVOArrayList.add(maxoutVO);
}
return maxoutVOArrayList;
}
}