Kaynağa Gözat

单机偏差分析

王波 1 hafta önce
ebeveyn
işleme
cded30aa10

+ 1 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/WindDirection/WindDirectionController.java

@@ -56,7 +56,7 @@ public class WindDirectionController {
     }
 
     /**
-     * 单机偏差分析
+     * 单机偏差分析计算
 
      * @return
      */

+ 7 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WindDirection/WindMachineService.java

@@ -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();