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/lightshare/service/impl/ScenseServiceImpl.kt | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
index 8bf1dba..c26f05b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
@@ -83,6 +83,7 @@
val name = scense.name ?: ""
val example = Example(Scense::class.java)
val criteria = example.createCriteria()
+ criteria.andEqualTo("typeid", scense.typeid)
//濡傛灉鏈塼ype淇℃伅,灏辨瀯寤簍ype鏌ヨ
if (StringUtil.isNotEmpty(scense.type)) {
criteria.andEqualTo("type", scense.type)
@@ -99,6 +100,10 @@
if (StringUtil.isNotEmpty(scense.towncode)) {
criteria.andEqualTo("towncode", scense.towncode)
}
+ if (StringUtil.isNotEmpty(scense.extension1)) {
+ criteria.andEqualTo("extension1", scense.extension1)
+ }
+ criteria.andEqualTo("index", scense.index)
//name鏌ヨ
criteria.andLike("name", "%$name%")
val re = scenseMapper.selectByExample(example)
@@ -324,6 +329,7 @@
when (typeId.toString()) {
Constant.SceneType.TYPE1.value -> {
val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneConstructionSite::class.java)
+ subScene.csUpdateTime = Date()
if (subScene.getsGuid() != null) {
val record = sceneConstructionSiteMapper.selectByPrimaryKey(subScene.getsGuid())
isUpdate = record != null
@@ -406,17 +412,22 @@
return locationRoadNearby.searchByRadius(Pair(lng, lat), radius)
}
- override fun importSceneInfo(file: MultipartFile): Boolean {
- val f = ByteArrayInputStream(file.bytes)
+ override fun importSceneInfo(files: Array<MultipartFile>): Boolean {
+ if (files.isEmpty()) throw BizException("鏈纭笂浼犳枃浠讹紝鎺ュ彛璋冪敤閿欒")
+
+ val f = ByteArrayInputStream(files[0].bytes)
val scenes = sceneImport.readFromFile(f)
+ if (scenes.isEmpty()) throw BizException("鏂囦欢鍐呭涓虹┖")
// 鏌ユ壘鍦烘櫙鍚嶇О鏄惁閲嶅
- val names = scenes.map { it.name }
+ val names = scenes.map { it.scense?.name }
sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty {
val str = this.joinToString("锛�")
throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}")
}
scenes.forEach {
- createOneScene(it)
+ it.scense ?: return@forEach
+ createOneScene(it.scense!!)
+ sceneRep.insertOrUpdateSubScene(it.scense!!.typeid?.toInt(), it.scense!!.guid, it.subScene)
}
return true
}
--
Gitblit v1.9.3