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/service/Impl/LedgerServiceImpl.kt |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt
index 6e3f009..90ddb5a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt
@@ -97,6 +97,7 @@
                 sceneType = it.getlScenetype(),
                 iconUrl = it.getlIconurl(),
                 realTime = it.getlRealTime(),
+                copy = it.getlAutoCopy() ?: false,
                 description = it.getlDescription(),
                 notRelated = it.getlNotRelatedSwitch() ?: true,
                 multigroup = it.getlMultiGroup() ?: false
@@ -188,6 +189,9 @@
                 ledgerType = type?.get(0)?.getlTypename()
                 ledgerFinished = true
                 isUpLoad = true
+                this.year = it.lrYear
+                this.month = it.lrMonth
+                this.day = it.lrDay
                 updateDate = it.lrSubmitdate
                 updateType = it.lrUpdatetype
                 fileType = it.lrEasubmitkind.toInt()
@@ -248,6 +252,9 @@
                 ledgerType = type?.get(0)?.getlTypename()
                 ledgerFinished = true
                 isUpLoad = true
+                this.year = it.lrYear
+                this.month = it.lrMonth
+                this.day = it.lrDay
                 updateDate = it.lrSubmitdate
                 updateType = it.lrUpdatetype
                 fileType = it.lrEasubmitkind.toInt()
@@ -576,8 +583,8 @@
     }
 
     override fun copyLedger(userId: String, time: String, copyLedgerList: List<CopyLedgerVo>): BaseResponse<String> {
-        val year = time.split("-")[0]
-        val month = time.split("-")[1]
+        val year = time.split("-")[0].toIntOrNull() ?: return BaseResponse(false, "骞翠唤鏍煎紡閿欒")
+        val month = time.split("-")[1].toIntOrNull() ?: return BaseResponse(false, "鏈堜唤鏍煎紡閿欒")
         val date = DateUtil.StringToDate(time, DateUtil.DateStyle.YYYY_MM)
         copyLedgerList.forEach {
             //鍘婚噸鍒ゆ柇
@@ -591,14 +598,17 @@
                 return@forEach
             }
 
-            val y = it.time?.split("-")?.get(0) ?: return@forEach
-            val m = it.time?.split("-")?.get(1) ?: return@forEach
+            val y = it.time?.split("-")?.get(0)
+            val m = it.time?.split("-")?.get(1)
             ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
                 createCriteria().andEqualTo("lrSubmitid", userId)
                     .andEqualTo("lsSubtypeid", it.subTypeId)
                     .andEqualTo("lrYear", y)
                     .andEqualTo("lrMonth", m)
-            }).forEach record@{ lr ->
+                orderBy("lrYear").desc()
+                    .orderBy("lrMonth").desc()
+                    .orderBy("lrSubmitdate").desc()
+            }).takeIf { list-> list.isNotEmpty() }?.get(0)?.let record@{ lr ->
                 //鑾峰彇璁板綍瀵瑰簲鐨勬枃浠朵俊鎭�
                 val fileList = ledgerMediaFileMapper.selectByExample(Example(LedgerMediaFile::class.java).apply {
                     createCriteria().andEqualTo("lrGuid", lr.lrGuid)

--
Gitblit v1.9.3