囤油锁价

This commit is contained in:
齐天大圣 2024-05-11 08:38:33 +08:00
parent fa64cf61b6
commit 29e40a4132

View File

@ -64,11 +64,16 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Period;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 燃油充值表(CardFuelRecord)表服务实现类
*
@ -496,7 +501,16 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
//查询囤油卡信息
CardFuelDiesel cardFuelDiesel = cardFuelDieselService.getById(cardFuelRecordDTO.getId());
cardFuleOrders.setCardFuleId(cardFuelDiesel.getId());
cardFuleOrders.setExpireTime(cardFuelDiesel.getExpireTime());
if ("2".equals(cardFuelDiesel.getActiveTime())){
cardFuleOrders.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);
cardFuleOrders.setExpireTime(from);
}
cardFuleOrders.setAmount(cardFuelDiesel.getRechargeBalance());
cardFuleOrders.setPayAmount(cardFuelDiesel.getRechargeBalance());
cardFuleOrders.setPoints(cardFuelDiesel.getPoints());