From e844ef2fdab88508e7dff4bb9e7b1632fcce15b2 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 28 七月 2022 09:11:20 +0800
Subject: [PATCH] 1. 巡查统计清单调试

---
 src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
index da0703a..71f5ce4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -14,6 +14,7 @@
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Component
 import tk.mybatis.mapper.entity.Example
+import java.time.Duration
 import java.time.LocalDateTime
 import java.time.ZoneId
 import javax.annotation.PostConstruct
@@ -332,6 +333,26 @@
         private var _ledgerRecordNum: List<LedgerRecord>? = null
 
         /**
+         * 鑾峰彇褰撳墠宸℃煡浠诲姟鐨勪笂鏈熷贰鏌ヨ褰�
+         */
+        fun lastOne(): RowData {
+            val last = RowData()
+            val r = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+                createCriteria().andEqualTo("scenseid", subTask?.scenseid)
+                    .andLessThan("planstarttime", subTask?.planstarttime)
+                orderBy("planstarttime").desc()
+            })
+            if (r.isNotEmpty()) {
+                val thisMonth = LocalDateTime.ofInstant(subTask?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1).toLocalDate()
+                val lastMonth = LocalDateTime.ofInstant(r[0]?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1).toLocalDate()
+                if (lastMonth.plusMonths(1).isEqual(thisMonth)) {
+                    last.subTask = r[0]
+                }
+            }
+            return last
+        }
+
+        /**
          * 娓呯┖褰撳墠澶勭悊鐨勫璞$殑鐩稿叧鏁版嵁婧�
          */
         fun clear() {

--
Gitblit v1.9.3