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/test/kotlin/cn/flightfeather/supervision/CommonTest.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt | 6 +-
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt | 3 +
src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt | 8 +++
src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt | 5 +-
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt | 20 +++++++--
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt | 4 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt | 7 +++
src/main/resources/mapper/UserSettingMapper.xml | 57 ++++++++++++++++++++++++++++
9 files changed, 99 insertions(+), 13 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt
index 9474f2a..2724381 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt
@@ -5,4 +5,10 @@
import org.apache.ibatis.annotations.Mapper
@Mapper
-interface UserSettingMapper : MyMapper<UserSetting?>
\ No newline at end of file
+interface UserSettingMapper : MyMapper<UserSetting?> {
+
+ /**
+ * 鏌ヨ琛屾斂鍖哄垝鏈�閫傞厤鐨勯厤缃俊鎭�
+ */
+ fun selectBestConfig(setting: UserSetting): UserSetting?
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
index 1622240..335d27c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
@@ -93,8 +93,9 @@
districtName = baseInfo?.biDistrictName ?: userInfo.extension1
sceneTypeId = userInfo.extension2?.toInt()
}
- val res = userSettingMapper.select(userSetting)
+ val res = userSettingMapper.selectBestConfig(userSetting)
- return if (res.isNotEmpty()) res[0] else null
+// return if (res.isNotEmpty()) res[0] else null
+ return res
}
}
\ No newline at end of file
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)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
index ce1b327..4cc188e 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
@@ -144,6 +144,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
@@ -368,6 +369,9 @@
ledgerType = type?.get(0)?.getlTypename()
ledgerFinished = true
isUpLoad = true
+ this.year = it.srYear
+ this.month = it.srMonth
+ this.day = it.srDay
updateDate = it.srSubmitdate
updateType = it.srUpdatetype
fileType = it.srEasubmitkind.toInt()
@@ -418,6 +422,9 @@
ledgerType = type.getlTypename()
ledgerFinished = it != null
isUpLoad = it != null
+ this.year = it?.srYear
+ this.month = it?.srMonth
+ this.day = it?.srDay
updateDate = it?.srSubmitdate
updateType = it?.srUpdatetype
fileType = it?.srEasubmitkind?.toInt()
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt
index 24a1620..8659125 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt
@@ -20,7 +20,7 @@
var ledgerType: String? = null,
//鍙拌处瀹屾垚鐘舵��
var ledgerFinished: Boolean = false,
- //鍙拌处鏄惁涓婁紶
+ //鍙拌处鏄惁涓婁紶(蹇呭~鎴栭�夊~)
var upLoad: Boolean = false,
//鍙拌处鏄惁闇�瑕佷笂浼�
var needUpdate: Boolean = true,
@@ -34,6 +34,8 @@
var iconUrl: String? = null,
//鍙拌处鏄惁鏈夊疄鏃舵�ц姹傦紝娌℃湁瀹炴椂鎬ц姹傜殑鍙拌处鎵嶅彲浠ュ鍒�
var realTime: Boolean = false,
+ //鍙拌处鏄惁鍙互寤剁画鍘嗗彶璁板綍澶嶅埗
+ var copy: Boolean = false,
//鍙拌处璇存槑
var description: String? = null,
//鍙拌处鏄惁寮�鍚笉娑夊強閫夐」锛堥粯璁ゅ紑鍚級
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt
index f91b6d7..5e67807 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt
@@ -32,6 +32,9 @@
//鍙拌处鏄惁涓婁紶
var isUpLoad: Boolean = false,
//鍙拌处鏇存柊鏃ユ湡
+ var year: Int? = null,
+ var month: Byte? = null,
+ var day: Byte? = null,
var updateDate: Date? = null,
//鍙拌处鏇存柊绫诲瀷锛�0閮ㄥ垎鏇存柊锛堥儴鍒嗙己澶便�侀仐澶憋級銆�1宸叉洿鏂般��2鏃犳洿鏂扮瓑锛�
var updateType: Byte? = null,
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt
index 66405a0..09d4541 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt
@@ -90,9 +90,9 @@
@ApiOperation("澶嶅埗鍦烘櫙鐨勫彴璐�")
@PostMapping("/copy")
fun copyLedger(
- @RequestParam("userId") userId: String,
- @RequestParam("time") time: String,
- @RequestBody copyLedgerList: List<CopyLedgerVo>
+ @ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String,
+ @ApiParam("澶嶅埗鐨勭洰鏍囨湀浠�") @RequestParam("time") time: String,
+ @ApiParam("闇�瑕佸鍒剁殑婧愬彴璐�") @RequestBody copyLedgerList: List<CopyLedgerVo>
) = ledgerService.copyLedger(userId, time, copyLedgerList)
@ApiOperation("瀹℃牳鍙拌处")
diff --git a/src/main/resources/mapper/UserSettingMapper.xml b/src/main/resources/mapper/UserSettingMapper.xml
index 8c70f93..554486c 100644
--- a/src/main/resources/mapper/UserSettingMapper.xml
+++ b/src/main/resources/mapper/UserSettingMapper.xml
@@ -47,4 +47,61 @@
-->
sp_promise_content
</sql>
+
+ <!-- 琛屾斂鍖哄垝鏈�鍖归厤鏌ヨ鏉′欢 -->
+ <select id="selectBestConfig" resultMap="ResultMapWithBLOBs">
+ select
+ <include refid="Base_Column_List" />, <include refid="Blob_Column_List" />
+ FROM sm_t_setting
+ <where>
+ <if test="userTypeId != null">
+ AND User_Type_Id = #{userTypeId}
+ </if>
+ <if test="sceneTypeId != null">
+ AND (scene_type_id = #{sceneTypeId} OR scene_type_id IS NULL)
+ </if>
+ <if test="provinceName != null">
+ AND (Province_Name = #{provinceName} OR Province_Name IS NULL)
+ </if>
+ <if test="cityName != null">
+ AND (City_Name = #{cityName} OR City_Name IS NULL)
+ </if>
+ <if test="districtName != null">
+ AND (District_Name = #{districtName} OR District_Name IS NULL)
+ </if>
+ <if test="townName != null">
+ AND (Town_Name = #{townName} OR Town_Name IS NULL)
+ </if>
+ <if test="area != null">
+ AND (Area = #{area} OR Area IS NULL)
+ </if>
+ <if test="managementCompany != null">
+ AND (Management_Company = #{managementCompany} OR Management_Company IS NULL)
+ </if>
+ </where>
+ ORDER BY
+ CASE
+ WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
+ AND District_Name = #{districtName} AND Town_Name = #{townName} THEN 1
+ WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
+ AND District_Name = #{districtName} AND Town_Name IS NULL THEN 2
+ WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
+ AND District_Name IS NULL AND Town_Name IS NULL THEN 3
+ WHEN Province_Name = #{provinceName} AND City_Name IS NULL
+ AND District_Name IS NULL AND Town_Name IS NULL THEN 4
+ END,
+ CASE
+ WHEN Area = #{area} THEN 1
+ WHEN Area IS NULL THEN 2
+ END,
+ CASE
+ WHEN Management_Company = #{managementCompany} THEN 1
+ WHEN Management_Company IS NULL THEN 2
+ END,
+ CASE
+ WHEN scene_type_id = #{sceneTypeId} THEN 1
+ WHEN scene_type_id IS NULL THEN 2
+ END
+ LIMIT 1;
+ </select>
</mapper>
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
index f4fab7a..7b19214 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
@@ -155,7 +155,7 @@
@Test
fun foo11(){
- val s = DateUtil.getStartMonthByPeriod(5, 12)
+ val s = "02".toInt()
println(s)
}
}
\ No newline at end of file
--
Gitblit v1.9.3