优惠统计

This commit is contained in:
齐天大圣 2024-05-17 10:50:07 +08:00
parent 8dad55a71a
commit 8759010ef0

View File

@ -211,6 +211,29 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
cardFuelRecordDTO.setStoreId(nowAccountInfo.getStoreId());
cardFuelRecordDTO.setChainStoreId(nowAccountInfo.getChainStoreId());
cardFuelRecordDTO.setPayAmount(cardFuelRecordDTO.getRechargeBalance());
LambdaQueryWrapper<CardFuelRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFuelRecord::getStoreId,cardFuelRecordDTO.getStoreId());
queryWrapper.eq(CardFuelRecord::getMtUserId,cardFuelRecordDTO.getMtUserId());
List<CardFuelRecord> cardFuelRecords = cardFuelRecordMapper.selectList(queryWrapper);
if (ObjectUtils.isNotEmpty(cardFuelRecords)){
Integer cardFuelId = cardFuelRecords.get(0).getCardFuelId();
CardFuelDiesel cardFuelDiesel = cardFuelDieselService.getById(cardFuelId);
if ("2".equals(cardFuelDiesel.getActiveTime())){
cardFuelRecordDTO.setExpireTime(cardFuelDiesel.getEndTime());
}else {
LocalDate today = LocalDate.now(); // 获取当前日期
Period tenYears = Period.ofYears(10); // 创建一个10年的时间段
LocalDate tenYearsLater = today.plus(tenYears);
Instant instant1 = Timestamp.valueOf(tenYearsLater.atTime(LocalTime.MIDNIGHT)).toInstant();
Date from = Date.from(instant1);
cardFuelRecordDTO.setExpireTime(from);
}
}
cardFuelRecordDTO.setExpireTime(cardFuelRecordDTO.getExpireTime());
if (ObjectUtil.isEmpty(cardFuelRecordDTO.getMtStaffId())) {