修改可用优惠券

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