Pārlūkot izejas kodu

更改日期返回格式2

Reiskuchen 5 gadi atpakaļ
vecāks
revīzija
d42f50d463

+ 1 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -128,11 +128,8 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
                     .orderByAsc("start_time"));
             //先把所有的日期搞到一个list里面
             ArrayList<String> dateList = new ArrayList<>();
-            LocalDate currentDate = start;
-            int i = 0;/*防止死循环的机制*/
-            while (currentDate == end.plusDays(1) && ++i < 1000) {
+            for (LocalDate currentDate = start; currentDate != end.plusDays(1); currentDate = currentDate.plusDays(1)) {
                 dateList.add(currentDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                currentDate = currentDate.plusDays(1);
             }
             List<Map<String, Object>> resultList = new ArrayList<>();
             for (String date : dateList) {