feiyu02
2025-06-09 c17e9978745cfe6c983f3aff75c9182fffef32fd
1. 修复部分数据统计接口bug
已修改7个文件
114 ■■■■ 文件已修改
pom.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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)
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)
        //如果有type信息,就构建type查询
        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)
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())
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)
        }
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
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("荣东路", 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("汶水路万荣路", 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)
        }