修改可用优惠券

This commit is contained in:
齐天大圣 2023-12-07 14:01:59 +08:00
parent 19fc2fdb2b
commit 90b80a1290

View File

@ -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<ExchangeFavorableVO> selectCardFavorableList(Integer pageNo, Integer pageSize, TransferDTO transferDTO) {
//查询优惠券领取记录
LambdaQueryWrapper<CardFavorableRecord> recordLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(transferDTO.getUserId())){
recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId,transferDTO.getUserId());
}
recordLambdaQueryWrapper.eq(CardFavorableRecord::getStoreId,transferDTO.getStoreId());
recordLambdaQueryWrapper.eq(CardFavorableRecord::getStatus,"0");
List<CardFavorableRecord> list = cardFavorableRecordService.list();
@ -241,11 +247,14 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
ExchangeFavorableVO exchangeFavorableVO = new ExchangeFavorableVO();
LambdaQueryWrapper<CardFavorable> 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<CardFavorable> list1 = cardFavorableService.list(cardFavorableLambdaQueryWrapper);
if (list1.size()>0) {
CardFavorable cardFavorable = list1.get(0);
//符合油号判断
if (cardFavorable.getOilType().contains(oilName.getOilName())) {
if (cardFavorable.getTimeType().equals("0") &&
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + 86400000L * cardFavorable.getValidityZero()) {
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
@ -265,6 +274,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
exchangeFavorableVOArrayList.add(exchangeFavorableVO);
}
}
}
return exchangeFavorableVOArrayList;
}
/**