修改可用优惠券
This commit is contained in:
parent
19fc2fdb2b
commit
90b80a1290
@ -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<>();
|
||||||
|
if (ObjectUtils.isNotEmpty(transferDTO.getUserId())){
|
||||||
recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId,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,22 +247,25 @@ 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.getOilType().contains(oilName.getOilName())) {
|
||||||
if (cardFavorable.getTimeType().equals("0") &&
|
if (cardFavorable.getTimeType().equals("0") &&
|
||||||
new Date().getTime()<=cardFavorable.getCreateTime().getTime()+ 86400000L * cardFavorable.getValidityZero() ){
|
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + 86400000L * cardFavorable.getValidityZero()) {
|
||||||
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
||||||
}
|
}
|
||||||
if (cardFavorable.getTimeType().equals("1") &&
|
if (cardFavorable.getTimeType().equals("1") &&
|
||||||
new Date().getTime()<=cardFavorable.getEffectiveDate().getTime()+ 86400000L * cardFavorable.getValidityOne() ){
|
new Date().getTime() <= cardFavorable.getEffectiveDate().getTime() + 86400000L * cardFavorable.getValidityOne()) {
|
||||||
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
||||||
}
|
}
|
||||||
if (cardFavorable.getTimeType().equals("2") &&
|
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 &&
|
||||||
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L + 86400000L * cardFavorable.getValidityTwo()){
|
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L + 86400000L * cardFavorable.getValidityTwo()) {
|
||||||
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
||||||
}
|
}
|
||||||
/*if (){
|
/*if (){
|
||||||
@ -265,6 +274,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
|||||||
exchangeFavorableVOArrayList.add(exchangeFavorableVO);
|
exchangeFavorableVOArrayList.add(exchangeFavorableVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return exchangeFavorableVOArrayList;
|
return exchangeFavorableVOArrayList;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user