From aed297a5fbc8df9dab01b28da21f872ee546b43c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 13 十月 2025 16:15:11 +0800
Subject: [PATCH] 2025.10.13 1. 统一调整controller层的返回类型,通过添加全局响应增强器GlobalResponseAdvice来管理返回结果; 2. 新增mybatis-generator自定义插件,实现给数据库实体entity自动添加swagger注解@ApiModel和@ApiModelProperty
---
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 76 +++++++++++++++++++-------------------
1 files changed, 38 insertions(+), 38 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 92f0633..96f71fa 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -59,7 +59,7 @@
*/
fun reset() {
rowData.index = 0
- rowData.subTask = sourceList.first()
+ rowData.subTask = if (sourceList.isEmpty()) null else sourceList.first()
rowData.clear()
}
@@ -68,7 +68,7 @@
*/
fun areaName(): String {
val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid)
- return "${DateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}"
+ return "${DateUtil.DateToString(config.startTime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}"
}
/**
@@ -85,52 +85,52 @@
})?.takeIf { it.isNotEmpty() }?.get(0)?.let { area = it.townname ?: "" }
}
- dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid).let {
+ dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid)?.let {
val time = LocalDateTime.ofInstant(it.starttime?.toInstant(), ZoneId.systemDefault())
this.year = time.year
this.month = time.monthValue
if (area.isBlank()) area = it.districtname ?: ""
}
- //1. 鏌ユ壘鐗瑰畾鐨勫贰鏌ヤ换鍔℃垨鑰呮墍鏈夌殑璁″垝宸℃煡浠诲姟
- var taskSceneIdList = listOf<String>()
- val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true ||
- (config.startTime != null || config.endTime != null)
- ) {
- dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
- createCriteria().apply {
- if (config.subTaskIdList?.isNotEmpty() == true) {
- andIn("stguid", config.subTaskIdList)
- }
- config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
- config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
- config.districtCode?.let { andEqualTo("districtcode", it) }
-// andEqualTo("tguid", config.topTaskGuid)
- }
- })
- } else {
- taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config
- .sceneType, config.townCode).map { it.guid ?: "" }
- dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
- createCriteria().andIn("scenseid", taskSceneIdList)
- .andEqualTo("tguid", config.topTaskGuid)
- })
- }
+ // 缁熻鎬讳换鍔′笅鎵�鏈夊満鏅�
+ if (config.allScene) {
+ //1. 鏌ユ壘鐗瑰畾鐨勫贰鏌ヤ换鍔℃垨鑰呮墍鏈夌殑璁″垝宸℃煡浠诲姟
+ val taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType,
+ config.townCode).map { it.guid ?: "" }
- if (taskSceneIdList.isNotEmpty()) {
- taskSceneIdList.forEach {
- var subtask: Subtask? = null
- for (s in subTaskList) {
- if (s.scenseid == it) {
- subtask = s
- result.add(s)
+ val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+ createCriteria().apply {
+ if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList)
+ }.andEqualTo("tguid", config.topTaskGuid)
+ })
+ // 缁欒繕鏈贰鏌ョ殑鍦烘櫙鐢熸垚绌虹殑瀛愪换鍔″璞�
+ if (taskSceneIdList.isNotEmpty()) {
+ taskSceneIdList.forEach {
+ var subtask: Subtask? = null
+ for (s in subTaskList) {
+ if (s.scenseid == it) {
+ subtask = s
+ result.add(s)
+ }
+ }
+ if (subtask == null) {
+ result.add(Subtask().apply { scenseid = it })
}
}
- if (subtask == null) {
- result.add(Subtask().apply { scenseid = it })
- }
+ } else {
+ result.addAll(subTaskList)
}
- } else {
+ }
+ else {
+ val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+ createCriteria().apply {
+ if (config.subTaskIdList?.isNotEmpty() == true) andIn("stguid", config.subTaskIdList)
+ config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
+ config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
+ config.districtCode?.let { andEqualTo("districtcode", it) }
+ andEqualTo("tguid", config.topTaskGuid)
+ }
+ })
result.addAll(subTaskList)
}
--
Gitblit v1.9.3