From c17e9978745cfe6c983f3aff75c9182fffef32fd Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 09 六月 2025 17:29:23 +0800 Subject: [PATCH] 1. 修复部分数据统计接口bug --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 5 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 25 +++++++++++- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 5 +- src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt | 14 ++++-- pom.xml | 20 +++++++++ src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt | 2 src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt | 43 ++++++++++++++++++--- 7 files changed, 96 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index a439640..e7723c6 100644 --- a/pom.xml +++ b/pom.xml @@ -224,10 +224,28 @@ <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </dependency> +<!-- <dependency>--> +<!-- <groupId>org.junit.jupiter</groupId>--> +<!-- <artifactId>junit-jupiter-api</artifactId>--> +<!-- <version>5.0.0</version>--> +<!-- <scope>test</scope>--> +<!-- </dependency>--> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> - <version>5.0.0</version> + <version>5.8.1</version> <!-- 浣跨敤鏈�鏂扮殑鐗堟湰鍙� --> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <version>5.8.1</version> <!-- 浣跨敤鏈�鏂扮殑鐗堟湰鍙� --> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.8.1</version> <!-- 浣跨敤鏈�鏂扮殑鐗堟湰鍙� --> <scope>test</scope> </dependency> <dependency> diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt b/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt index 80543b4..ee3070c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt @@ -14,7 +14,7 @@ val time: String ) - private val httpMethod = HttpMethod("101.230.224.89", 9006) + private val httpMethod = HttpMethod("114.94.28.171", 9006) fun getFile(time: String): JsonArray? { val params = Params(time) 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..492dbbe 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) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt index 62f46fb..f02a9e1 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt @@ -464,6 +464,7 @@ return res } + @Transactional override fun delete(id: String): Int{ val subtask = subtaskMapper.selectByPrimaryKey(id) val dayTaskId = subtask.tsguid @@ -633,7 +634,7 @@ } - val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) + val p = PageHelper.startPage<SubtaskSearchResultVo>(page ?: 1, perPage ?: 30) val subtasklist = subtaskMapper.getSubtask(_districtCode, _startTime, _endTime, _sceneType?.toByte()) @@ -784,7 +785,7 @@ } - val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) + val p = PageHelper.startPage<SubtaskSearchResultVo>(page ?: 1, perPage ?: 30) val subtasklist = subtaskMapper.getSubtask(_districtCode, _startTime, _endTime, _sceneType?.toByte()) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt index 70db70c..f103925 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt @@ -10,6 +10,7 @@ import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.UUIDGenerator +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.* @@ -26,6 +27,7 @@ val taskMapper: TaskMapper, private val taskRep: TaskRep, private val subTaskRep: SubTaskRep, + private val sceneRep: SceneRep, ) : TaskService { @Autowired @@ -766,14 +768,33 @@ districtName = t.districtname townCode = t.towncode townName = t.townname + var count = 0 + val countByScene = mutableMapOf<String?, Int>() + val allScenes = sceneRep.findSceneList(t.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach { - val c = if (it.extension1 != null) it.extension1!!.toInt() else 1 + val c = it.monitornum ?: 1 count += c + + allScenes.find { s-> s?.guid == it.sguid }?.let { s-> +// if (!countByScene.containsKey(s.type)) { +// countByScene[s.type] = 0 +// } + countByScene[s.type] = (countByScene[s.type] ?: 0) + c + } } totaltask = count - subTaskSummary = subTaskRep.findSummary(areaVo) + totaltaskByScene = countByScene + + subTaskSummary = subTaskRep.findSummary(AreaVo().apply { + topTaskId = t.tguid + }) + val completeByScene = mutableMapOf<String?, Int>() + subTaskSummary?.forEach { + completeByScene[it.sceneType] = (completeByScene[it.sceneType] ?: 0) + 1 + } completetask = this.subTaskSummary?.size + completetaskByScene = completeByScene } res.add(pro) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt index 78071e6..3892089 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt @@ -6,11 +6,13 @@ * 浠诲姟瀹屾垚鎯呭喌缁熻 */ @JsonInclude(JsonInclude.Include.NON_NULL) -class TaskProgressVo{ +class TaskProgressVo { // 浠诲姟id var tguid: String? = null + // 浠诲姟鍚嶇О var name: String? = null + // 浠诲姟绛夌骇(2:鎬讳换鍔★紱null锛氭棩浠诲姟鎴栧瓙浠诲姟) var levelnum: Int? = null @@ -23,13 +25,15 @@ var townCode: String? = null var townName: String? = null - var totaltask:Int? = null + var totaltask: Int? = null + var totaltaskByScene: MutableMap<String?, Int>? = null - var completetask:Int? = null + var completetask: Int? = null + var completetaskByScene: MutableMap<String?, Int>? = null - var mytotaltask:Int? = null + var mytotaltask: Int? = null - var mycompletetask:Int? = null + var mycompletetask: Int? = null var subtaskprogressVo: List<TaskProgressVo>? = null diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt index fd5ce33..3218214 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt @@ -2,8 +2,6 @@ import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper import org.junit.Test -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.extension.ExtendWith import org.junit.runner.RunWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest @@ -12,7 +10,7 @@ import kotlin.math.log @RunWith(SpringRunner::class) -@ExtendWith(SpringExtension::class) +//@ExtendWith(SpringExtension::class) @SpringBootTest class LocationRoadNearbyTest { @@ -47,8 +45,10 @@ // LocationRoadNearby.BasePlace("娉栨咕鏀矾-鍚曢潚璺�-鏈卞钩鍏矾", Pair(121.155048,30.835229), Pair(121.148659,30.829861)), // LocationRoadNearby.BasePlace("寰愭眹涓婂笀澶�", Pair(121.419384, 31.161433), Pair(121.419384, 31.161433)), +// LocationRoadNearby.BasePlace("甯傛帶鐐�-寰愬姹�", Pair(121.44187, 31.19793), Pair(121.44187, 31.19793)), +// LocationRoadNearby.BasePlace("甯傛帶鐐�-鍗庢尘", Pair(121.461985, 31.124359), Pair(121.461985, 31.124359)), // LocationRoadNearby.BasePlace("闈欏畨鐩戞祴绔欏浗鎺х偣", Pair(121.429439, 31.223632), Pair(121.429439, 31.223632)), - LocationRoadNearby.BasePlace("閲戝北澶ч亾2000鍙�", Pair(121.3404, 30.744262), Pair(121.3404, 30.744262)), +// LocationRoadNearby.BasePlace("閲戝北澶ч亾2000鍙�", Pair(121.3404, 30.744262), Pair(121.3404, 30.744262)), // LocationRoadNearby.BasePlace("浠欓湠绔�", Pair(121.394775, 31.203982), Pair(121.394775, 31.203982)), // LocationRoadNearby.BasePlace("绋嬫ˉ绔�", Pair(121.362928, 31.192925), Pair(121.362928, 31.192925)), @@ -75,13 +75,42 @@ // LocationRoadNearby.BasePlace("鐝犳腐琛�", Pair(121.337652, 30.847802), Pair(121.345829, 30.846835)), // LocationRoadNearby.BasePlace("鑽d笢璺�", Pair(121.249271, 30.832921), Pair(121.249176, 30.835928)), // LocationRoadNearby.BasePlace("涔濅赴璺�", Pair(121.254114, 30.903438), Pair(121.254715, 30.893363)), + +// 灏忓井绔� + LocationRoadNearby.BasePlace("姘稿拰浜屾潙", Pair(121.43165,31.29083), Pair(121.43165,31.29083)), + LocationRoadNearby.BasePlace("鑺锋睙涓矾529鍙�", Pair(121.468446,31.258494), Pair(121.468446,31.258494)), + LocationRoadNearby.BasePlace("搴峰畞璺�18鍙�", Pair(121.43447,31.306374), Pair(121.43447,31.306374)), + LocationRoadNearby.BasePlace("鍗忎俊鏄熷厜骞垮満", Pair(121.457125,31.297407), Pair(121.457125,31.297407)), + LocationRoadNearby.BasePlace("鍏卞悍鍓嶈繘鍏瘬", Pair(121.441018,31.319358), Pair(121.441018,31.319358)), + LocationRoadNearby.BasePlace("闈欏畨鐩戞祴绔�", Pair(121.429872,31.224094), Pair(121.429872,31.224094)), + LocationRoadNearby.BasePlace("鍏卞拰鏂拌矾鍦轰腑璺�", Pair(121.449074,31.306086), Pair(121.449074,31.306086)), + LocationRoadNearby.BasePlace("宀崡璺満涓矾", Pair(121.455317,31.304615), Pair(121.455317,31.304615)), + LocationRoadNearby.BasePlace("楂樺钩璺睙鍦鸿タ璺�", Pair(121.427832,31.296076), Pair(121.427832,31.296076)), + LocationRoadNearby.BasePlace("骞夸腑瑗胯矾鍏卞拰鏂拌矾", Pair(121.451879,31.278988), Pair(121.451879,31.278988)), + LocationRoadNearby.BasePlace("闂稿寳鍏洯", Pair(121.46179,31.271121), Pair(121.46179,31.271121)), + LocationRoadNearby.BasePlace("鏌宠惀璺叡鍜屾柊璺�", Pair(121.459427,31.265294), Pair(121.459427,31.265294)), + LocationRoadNearby.BasePlace("涓北鍖楄矾鍏卞拰鏂拌矾", Pair(121.46149,31.260937), Pair(121.46149,31.260937)), + LocationRoadNearby.BasePlace("涓滃疂鍏磋矾涓叴璺�2024骞�7鏈�24鏃ョЩ浣嶈嚦瀹濋�氳矾539鍙�", Pair(121.475521,31.261383), Pair(121.475521,31.261383)), + LocationRoadNearby.BasePlace("澶ф偊鍩�", Pair(121.472183,31.243488), Pair(121.472183,31.243488)), + LocationRoadNearby.BasePlace("闄曡タ鍖楄矾娴烽槻璺�", Pair(121.446472,31.238458), Pair(121.446472,31.238458)), + LocationRoadNearby.BasePlace("甯稿痉璺柊闂歌矾", Pair(121.447048,31.229643), Pair(121.447048,31.229643)), + LocationRoadNearby.BasePlace("寤跺畨涓矾瀵屾皯璺�", Pair(121.449711,31.221563), Pair(121.449711,31.221563)), + LocationRoadNearby.BasePlace("寤跺畨瑗胯矾闀囧畞璺�", Pair(121.439025,31.218146), Pair(121.439025,31.218146)), + LocationRoadNearby.BasePlace("骞夸腑瑗胯矾涓囪崳璺�", Pair(121.442032,31.278071), Pair(121.442032,31.278071)), + LocationRoadNearby.BasePlace("骞夸腑瑗胯矾杩愬煄璺�2024骞�9鏈�3鏃ョЩ浣嶈嚦涓叴绀惧尯280-06鍦板潡", Pair(121.473931,31.254645), Pair(121.473931,31.254645)), + LocationRoadNearby.BasePlace("鍢夊埄鏄庣彔鍩�", Pair(121.434364,31.304047), Pair(121.434364,31.304047)), + LocationRoadNearby.BasePlace("姹捐タ璺槼娉夎矾", Pair(121.464122,31.31351), Pair(121.464122,31.31351)), + LocationRoadNearby.BasePlace("娌冲崡鍖楄矾澶╂郊璺�", Pair(121.482241,31.243679), Pair(121.482241,31.243679)), + LocationRoadNearby.BasePlace("姹舵按璺竾鑽h矾", Pair(121.441558,31.291293), Pair(121.441558,31.291293)), + LocationRoadNearby.BasePlace("鐭抽棬涓�璺�348鍙�", Pair(121.462105,31.229639), Pair(121.462105,31.229639)), + LocationRoadNearby.BasePlace("杩愬煄璺疁宸濊矾", Pair(121.439137,31.271005), Pair(121.439137,31.271005)), ) listOf( -// 500.0, -// 1000.0, + 500.0, + 1000.0, // 2000.0, // 3000.0, - 5000.0 +// 5000.0 ).forEach { locationRoadNearby.searchList(bList, it) } -- Gitblit v1.9.3