From fe031e01cc1737c2f05a133fde7c36c7a2a7b4b4 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 21 一月 2026 17:38:32 +0800
Subject: [PATCH] 2026.1.21 1. 新增完善台账复制逻辑
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScheduleVo.kt | 49 +++++++++++++++++++++++++------------------------
1 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScheduleVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScheduleVo.kt
index b147a6c..1c24fd6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScheduleVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScheduleVo.kt
@@ -77,16 +77,17 @@
}
fun toScheduleVoList(schedule: EnvironmentalSchedule, option: ScheduleOption): List<ScheduleVo> {
- val sT = LocalDateTime.ofInstant(option.startTime.toInstant(), ZoneId.systemDefault()).toLocalDate()
+ var sT = LocalDateTime.ofInstant(option.startTime.toInstant(), ZoneId.systemDefault()).toLocalDate()
val eT = LocalDateTime.ofInstant(option.endTime.toInstant(), ZoneId.systemDefault()).toLocalDate()
+ .plusDays(1)
val dateList = mutableListOf<Date>()
when (schedule.scPeriodType.toInt()) {
// 姣忔棩
0 -> {
do {
dateList.add(Date.from(sT.atTime(0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))
- sT.plusDays(1)
- } while (sT.isAfter(eT))
+ sT = sT.plusDays(1)
+ } while (sT.isBefore(eT))
}
// 姣忓懆
1 -> {
@@ -95,30 +96,30 @@
if (weekList.contains(sT.dayOfWeek.value.toString())) {
dateList.add(Date.from(sT.atTime(0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))
}
- sT.plusDays(1)
- } while (sT.isAfter(eT))
+ sT = sT.plusDays(1)
+ } while (sT.isBefore(eT))
}
// 姣忔湀
2 -> {
val dayList = schedule.scEveryMonth.split(";")
-// do {
-// if (dayList.contains(sT.dayOfMonth.toString())) {
-// dateList.add(Date.from(sT.atTime(0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))
-// }
-// sT.plusDays(1)
-// } while (sT.isAfter(eT))
- var diffDays: Int? = null
- var mostRecentSchedule: Date? = null
- dayList.forEach {
- val diff = abs(it.toInt() - sT.dayOfMonth)
- if (diffDays == null || diff < diffDays!!) {
- mostRecentSchedule = Date.from(sT.withDayOfMonth(it.toInt()).atTime(0, 0, 0).atZone(ZoneId
- .systemDefault())
- .toInstant())
- diffDays = diff
+ do {
+ if (dayList.contains(sT.dayOfMonth.toString())) {
+ dateList.add(Date.from(sT.atTime(0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))
}
- }
- mostRecentSchedule?.let { dateList.add(it) }
+ sT = sT.plusDays(1)
+ } while (sT.isBefore(eT))
+// var diffDays: Int? = null
+// var mostRecentSchedule: Date? = null
+// dayList.forEach {
+// val diff = abs(it.toInt() - sT.dayOfMonth)
+// if (diffDays == null || diff < diffDays!!) {
+// mostRecentSchedule = Date.from(sT.withDayOfMonth(it.toInt()).atTime(0, 0, 0).atZone(ZoneId
+// .systemDefault())
+// .toInstant())
+// diffDays = diff
+// }
+// }
+// mostRecentSchedule?.let { dateList.add(it) }
}
// 姣忓勾
3 -> {
@@ -128,8 +129,8 @@
if (dayList.contains(timeFormat)) {
dateList.add(Date.from(sT.atTime(0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))
}
- sT.plusDays(1)
- } while (sT.isAfter(eT))
+ sT = sT.plusDays(1)
+ } while (sT.isBefore(eT))
}
// 鍥哄畾鏃ユ湡
4 -> {
--
Gitblit v1.9.3