|
@@ -8,6 +8,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.ZonedDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -65,7 +67,11 @@ public class WindMachineService {
|
|
|
List<TurbineInfoDay> filteredList = turbineList.stream()
|
|
|
.filter(turbine -> {
|
|
|
// 获取 turbineInfoDay 的 recordDate(类型为 LocalDate)
|
|
|
- LocalDate recordDate = turbine.getRecordDate();
|
|
|
+ Date dateFromTurbine = turbine.getRecordDate();
|
|
|
+
|
|
|
+ // 将 Date 转换为 LocalDate
|
|
|
+ ZonedDateTime zonedDateTime = dateFromTurbine.toInstant().atZone(ZoneId.systemDefault());
|
|
|
+ LocalDate recordDate = zonedDateTime.toLocalDate();
|
|
|
|
|
|
// 获取记录的月份(注意,月份从 1 开始,1 表示1月)
|
|
|
int recordMonth = recordDate.getMonthValue();
|