From 61fd49e3c47f9f67101bab46f39fbd4eabb5a39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Mon, 20 Nov 2023 09:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=A1=E5=87=8F=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ActiveExchangeServiceImpl.java | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index 4eecd4558..1a1699159 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -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 selectConsumptionList(Integer pageNo, Integer pageSize, TransferDTO transferDTO) { + ArrayList maxoutVOArrayList = new ArrayList<>(); //构造满减券查询条件 LambdaQueryWrapper 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 activeFullminusList = activeFullminusService.list(fullminusLambdaQueryWrapper); + for (ActiveFullminus activeFullminus : activeFullminusList) { + MaxoutVO maxoutVO = new MaxoutVO(); + BeanUtils.copyProperties(activeFullminus,maxoutVO); + LambdaQueryWrapper 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 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 activeDiscountList = activeDiscountService.list(discountLambdaQueryWrapper); + //获取兑换物品信息 + for (ActiveDiscount activeDiscount : activeDiscountList) { + MaxoutVO maxoutVO = new MaxoutVO(); + BeanUtils.copyProperties(activeDiscount,maxoutVO); + LambdaQueryWrapper 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; } }