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 f7785a2ca..50f4c9f00 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 @@ -34,6 +34,8 @@ import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableS import com.fuint.business.marketingActivity.cardValue.entity.CardValue; import com.fuint.business.marketingActivity.cardValue.service.CardValueService; import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO; +import com.fuint.business.petrolStationManagement.entity.OilName; +import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.userManager.service.LJUserGradeService; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; @@ -72,6 +74,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { private ActiveRecommendService activeRecommendService; @Resource private CardValueService cardValueService; + @Resource + private OilNameService oilNameService; /** * 分页查询所有 * @param @@ -231,7 +235,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { public List selectCardFavorableList(Integer pageNo, Integer pageSize, TransferDTO transferDTO) { //查询优惠券领取记录 LambdaQueryWrapper recordLambdaQueryWrapper = new LambdaQueryWrapper<>(); - recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId,transferDTO.getUserId()); + if (ObjectUtils.isNotEmpty(transferDTO.getUserId())){ + recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId,transferDTO.getUserId()); + } recordLambdaQueryWrapper.eq(CardFavorableRecord::getStoreId,transferDTO.getStoreId()); recordLambdaQueryWrapper.eq(CardFavorableRecord::getStatus,"0"); List list = cardFavorableRecordService.list(); @@ -241,28 +247,32 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { ExchangeFavorableVO exchangeFavorableVO = new ExchangeFavorableVO(); LambdaQueryWrapper cardFavorableLambdaQueryWrapper = new LambdaQueryWrapper<>(); cardFavorableLambdaQueryWrapper.eq(CardFavorable::getId,cardFavorableRecord.getCardFavorableId()); - cardFavorableLambdaQueryWrapper.in(CardFavorable::getOilType,transferDTO.getOilName()); + //cardFavorableLambdaQueryWrapper.in(CardFavorable::getOilType,transferDTO.getOilName()); cardFavorableLambdaQueryWrapper.le(CardFavorable::getSatisfiedAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters()); + OilName oilName = oilNameService.selectOilNameById(transferDTO.getOilName()); List list1 = cardFavorableService.list(cardFavorableLambdaQueryWrapper); - if (list1.size()>0){ + if (list1.size()>0) { CardFavorable cardFavorable = list1.get(0); - if (cardFavorable.getTimeType().equals("0") && - new Date().getTime()<=cardFavorable.getCreateTime().getTime()+ 86400000L * cardFavorable.getValidityZero() ){ - BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); - } - if (cardFavorable.getTimeType().equals("1") && - new Date().getTime()<=cardFavorable.getEffectiveDate().getTime()+ 86400000L * cardFavorable.getValidityOne() ){ - BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); - } - if (cardFavorable.getTimeType().equals("2") && - new Date().getTime() >= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L && - new Date().getTime() <= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L + 86400000L * cardFavorable.getValidityTwo()){ - BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); - } + //符合油号判断 + if (cardFavorable.getOilType().contains(oilName.getOilName())) { + if (cardFavorable.getTimeType().equals("0") && + new Date().getTime() <= cardFavorable.getCreateTime().getTime() + 86400000L * cardFavorable.getValidityZero()) { + BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); + } + if (cardFavorable.getTimeType().equals("1") && + new Date().getTime() <= cardFavorable.getEffectiveDate().getTime() + 86400000L * cardFavorable.getValidityOne()) { + BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); + } + if (cardFavorable.getTimeType().equals("2") && + new Date().getTime() >= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L && + new Date().getTime() <= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L + 86400000L * cardFavorable.getValidityTwo()) { + BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); + } /*if (){ }*/ - exchangeFavorableVOArrayList.add(exchangeFavorableVO); + exchangeFavorableVOArrayList.add(exchangeFavorableVO); + } } } return exchangeFavorableVOArrayList;