feiyu02
2025-05-08 9a9a27f185bc0cf9dc0001cfc6839e6d13dbccd9
1. 添加了动态污染溯源相关功能逻辑
已修改25个文件
已添加5个文件
682 ■■■■ 文件已修改
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-test.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/generator/generatorConfig.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/GridGroupMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/MissionMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
@@ -124,32 +124,6 @@
                }
            }
        }
//        repeat(config.factorCount) { i ->
//            eIndex[i]++
//            // èµ·å§‹æ•°æ®
//            if (lastData == null) {
//                refreshAfterCheckResult(i, data)
//            }
//            // åˆ¤æ–­ç›¸é‚»æ•°æ®æ˜¯å¦è¿žç»­å¹¶ä¸”是否满足异常判断
//            if (!isContinue) {
//                checkResult()
//                // æ•°æ®ä¸è¿žç»­æ—¶ï¼Œè®°å½•异常情况
//                if (eIndex[i] - sIndex[i] >= durationCount) {
//                    refreshAfterCheckResult(i, data)
//                }
//            } else {
//                if (hasException[i]) {
//                    existException[i] = true
//                    exceptionData[i].add(data)
//                } else {
//                    // å¼‚常不再重复出现时,记录异常情况
//                    checkResult()
//                    if (eIndex[i] - sIndex[i] >= durationCount) {
//                        refreshAfterCheckResult(i, data)
//                    }
//                }
//            }
//        }
        lastData = data
    }
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt
@@ -1,7 +1,6 @@
package com.flightfeather.uav.biz.dataanalysis
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionDataExceed
import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionSlideAverage
import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionValueMutation
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
@@ -12,15 +11,12 @@
import com.flightfeather.uav.domain.repository.RealTimeDataRep
import com.flightfeather.uav.domain.repository.SegmentInfoRep
import com.flightfeather.uav.socket.eunm.UWDeviceType
import org.springframework.stereotype.Component
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
/**
 * æ•°æ®å¼‚常分析控制器
 */
@Component
class  ExceptionAnalysisController(
    private val realTimeDataRep: RealTimeDataRep,
    private val locationRoadNearby: LocationRoadNearby,
@@ -34,13 +30,13 @@
    private fun initTask(config: DataAnalysisConfig) {
        taskList.clear()
        taskList.apply {
            add(ExceptionDataExceed(config))
//            add(ExceptionDataExceed(config))
            add(ExceptionValueMutation(config))
            add(ExceptionSlideAverage(config))
        }
    }
    fun run(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
    fun execute(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
        running = true
        val config = DataAnalysisConfig(mission, ExceptionSetting(), factorFilter)
        initTask(config)
@@ -63,7 +59,9 @@
                // æŸ¥è¯¢å¼‚常周边可能污染源
                nearBy(r, config)
                // æŸ¥è¯¢æ—¶æ®µæ‰€åœ¨è·¯æ®µ
                road(r)
//                road(r)
                // å°†æ•°æ®è½¬æ¢ä¸ºé€šç”¨æ ¼å¼
                r.dataVoList = r.dataList.map { e-> e.toDataVo() }
            }
            // å­˜å‚¨åˆ†æžç»“æžœ
            result.addAll(it.resultList)
@@ -71,6 +69,8 @@
        running = false
        return result
    }
//    private fun
    private fun nearBy(r: ExceptionResult, config: DataAnalysisConfig) {
        if (r.longitude != null && r.latitude != null) {
@@ -85,6 +85,7 @@
                }
                r.relatedSceneId = idList
                r.relatedSceneName = nameList
                r.relatedSceneList = sceneList
            }
        }
    }
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.flightfeather.uav.biz.dataanalysis
import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionSlideAverage
import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionValueMutation
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
import com.flightfeather.uav.common.location.LocationRoadNearby
import com.flightfeather.uav.domain.repository.RealTimeDataRep
import com.flightfeather.uav.domain.repository.SegmentInfoRep
/**
 *
 * @date 2025/5/8
 * @author feiyu02
 */
class RealTimeExceptionAnalysisController (
    private val realTimeDataRep: RealTimeDataRep,
    private val locationRoadNearby: LocationRoadNearby,
    private val segmentInfoRep: SegmentInfoRep,
){
    private val taskList = mutableListOf<BaseExceptionAnalysis>()
    private fun initTask(config: DataAnalysisConfig) {
        taskList.clear()
        taskList.apply {
            add(ExceptionValueMutation(config))
            add(ExceptionSlideAverage(config))
        }
    }
    // è®¡ç®—历史任务
}
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt
@@ -9,6 +9,7 @@
/**
 * æ•°æ®è¶…标异常分析
 */
@Deprecated("原超标判定逻辑设定的超标值有漏洞,")
class ExceptionDataExceed(config: DataAnalysisConfig) : BaseExceptionContinuousSingle(config) {
    override fun getExceptionType(): ExceptionType = ExceptionType.TYPE2
@@ -25,16 +26,6 @@
            }
            res[f] = bool
        }
//        repeat(config.factorCount) { i ->
//            val data = n.getByFactorIndex(i)
//            val limit = config.exceptionSetting.getByFactorIndex(i)
//            val bool = if (data != null && limit != null) {
//                data >= limit
//            } else {
//                false
//            }
//            res.add(bool)
//        }
        return res
    }
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
@@ -34,21 +34,8 @@
            val b2 = r >= config.mutationRate
            if (b1) special = true
            res[f] = (b1 || b2)
            if (res[f] == true) println("p: $pValue --- n: $nValue --- r: $r")
//            if (res[f] == true) println("p: $pValue --- n: $nValue --- r: $r")
        }
//        repeat(config.factorCount) { i->
//            if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) {
//                res.add(false)
//                return@repeat
//            }
//            val pValue = p.getByFactorIndex(i)!!
//            val nValue = n.getByFactorIndex(i)!!
//            val r = abs((pValue - nValue) / pValue)
//            val b1 = r >= (2 * config.mutationRate)
//            val b2 = r >= config.mutationRate
//            if (b1) special = true
//            res.add(b1 || b2)
//        }
        return res
    }
@@ -57,7 +44,7 @@
        val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2)
        val b2 = (eIndex - sIndex) >= config.mutationNum
        special = false
        println("sIndex: $sIndex --- eIndex: $eIndex --- special: $special")
//        println("sIndex: $sIndex --- eIndex: $eIndex --- special: $special")
        return b1 || b2
    }
}
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt
@@ -15,7 +15,7 @@
    val factorFilter: FactorFilter,
){
    // è¿žç»­çªå˜æ•°æ®ä¸ªæ•°
    var mutationNum = 6
    var mutationNum = 2
    // çªå˜çއ
    var mutationRate = .5
@@ -23,7 +23,7 @@
    var changeTrendGroup = 12
    // æ»‘动平均值连续
    var changeTrendInterval = 12
    var changeTrendRate = 1
    var changeTrendRate = .5
    // æ»‘动平均值变化率异常连续次数
    var changeTrendTimes = 3
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt
@@ -2,6 +2,8 @@
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.domain.entity.BaseRealTimeData
import com.flightfeather.uav.domain.entity.SceneInfo
import com.flightfeather.uav.lightshare.bean.DataVo
import java.math.BigDecimal
import java.util.*
@@ -37,6 +39,8 @@
    var relatedSceneId: List<String>? = null
    // ç›¸å…³ä¼ä¸šåç§°ï¼ˆåç§°ä¹‹é—´;分隔)
    var relatedSceneName: List<String>? = null
    var relatedSceneList: List<SceneInfo?>? = null
    // å¼‚常数据,头尾可能包含一定量的偏移
    var dataList: MutableList<BaseRealTimeData> = mutableListOf()
    var dataVoList: List<DataVo>? = null
}
src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt
@@ -97,7 +97,7 @@
    private fun saveResult(segmentInfoList:List<SegmentInfo>) {
        val res = mutableListOf<SegmentInfo>()
        segmentInfoList.forEach { s ->
            // åˆ¤æ–­å½“前记录和上个记录是否数据同一条道路
            // åˆ¤æ–­å½“前记录和上个记录是否属于同一条道路
            if (res.isNotEmpty()) {
                val lastOne = res.last()
                // è‹¥å±žäºŽåŒä¸€é“路,合并
src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
@@ -6,12 +6,14 @@
import com.flightfeather.uav.biz.dataprocess.PreData
import com.flightfeather.uav.common.chart.DataToChartUtil
import com.flightfeather.uav.common.exception.BizException
import com.flightfeather.uav.common.location.LocationRoadNearby
import com.flightfeather.uav.common.pdf.GeneratePdfUtil
import com.flightfeather.uav.common.utils.DateUtil
import com.flightfeather.uav.common.utils.ImageUtil
import com.flightfeather.uav.domain.entity.Mission
import com.flightfeather.uav.domain.repository.MissionRep
import com.flightfeather.uav.domain.repository.RealTimeDataRep
import com.flightfeather.uav.domain.repository.SegmentInfoRep
import org.springframework.beans.BeanUtils
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
@@ -24,12 +26,17 @@
 */
@Component
class MissionReport(
    private val exceptionAnalysisController: ExceptionAnalysisController,
    private val missionRep: MissionRep,
    private val realTimeDataRep: RealTimeDataRep,
    private val locationRoadNearby: LocationRoadNearby,
    private val segmentInfoRep: SegmentInfoRep,
    @Value("\${filePath}")
    private val filePath: String,
) {
    private val exceptionAnalysisController =
        ExceptionAnalysisController(realTimeDataRep, locationRoadNearby, segmentInfoRep)
    data class Param(
        val district: String,
        val town: String,
@@ -105,7 +112,7 @@
    // èŽ·å–å¼‚å¸¸åˆ†æžç»“æžœ
    fun exceptionAnalysis(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
        return exceptionAnalysisController.run(mission, factorFilter)
        return exceptionAnalysisController.execute(mission, factorFilter)
    }
    // è®¡ç®—均值和数据范围
src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt
@@ -36,9 +36,6 @@
        val closeList = mutableListOf<BaseRealTimeData>()
        records.add(mutableListOf())
        data.forEachIndexed { i, d ->
//            if (records.size == 23) {
//                println(records.size)
//            }
            var isSame = false
            if (i > 0) {
                // å‰ä¸€ä¸ªæœ‰æ•ˆç›‘测点
@@ -66,28 +63,17 @@
                    }
                    if (distance >= MIN_DISTANCE) {
                        // ä¸¤ç‚¹è·ç¦»è¾ƒå¤§æ—¶ï¼Œè®¡ç®—夹角
                        val deg = CoordinateUtil.getAngle(
                            lastData.longitude!!.toDouble(), lastData.latitude!!.toDouble(),
                            d.longitude!!.toDouble(), d.latitude!!.toDouble(),
                        )
                        // è®¡ç®—
                        isSame = if (lastDegList.isNotEmpty()) {
                            var bool = true
//                            // å‡ºçŽ°è§’åº¦æŽ¥è¿‘åž‚ç›´çŠ¶æ€çš„æ¬¡æ•°
//                            var unSameCount = 0
//                            // æ¯”较当前方位角和上一组每个方位角的差值是否都处于范围内
//                            for (lastDeg in lastDegList) {
//                                val diffDeg = abs(deg - lastDeg)
//                                if (diffDeg in (90.0 - VERTICAL_OFFSET_DEG)..(90.0 + VERTICAL_OFFSET_DEG)
//                                    || diffDeg in (270.0 - VERTICAL_OFFSET_DEG)..(270.0 + VERTICAL_OFFSET_DEG)
//                                ) {
//                                    unSameCount++
//                                }
//                            }
//                            // å½“接近垂直的角度超过上一组平行角度的一半时,认为从该点轨迹转弯(消除个别坐标点由于定位误差导致的错误影响)
//                            bool = unSameCount < (lastDegList.size / 3 + 1)
                            // å°†å½“前坐标点的角度和之前所有属于同一道路的坐标点的角度的均值做比较,
                            // è§£å†³å½“车辆行驶轨迹为弧线时(例如立交桥的弧线转弯等),一直被判定为转向幅度不大属于同一路段的问题
                            val avgDeg = avgDegree(lastDegList)
                            val diffDeg = abs(deg - avgDeg)
                            if (diffDeg in (90.0 - VERTICAL_OFFSET_DEG)..(90.0 + VERTICAL_OFFSET_DEG)
@@ -104,17 +90,19 @@
                            }
                            bool
                        } else {
                            // å½“坐标点形成有效路径时,记录为上一个坐标点
                            // å½“没有历史角度时,直接保存,并认为是同一路段
                            lastDegList.add(deg)
                            true
                        }
                        // æ¸…空上一组距离接近的坐标点
                        closeList.clear()
                    } else {
                        // ä¸¤ç‚¹è·ç¦»æŽ¥è¿‘时,添加记录
                        closeList.add(d)
                        isSame = true
                    }
                }
                // å¦åˆ™è®¤ä¸ºåŒä¸€è·¯æ®µ
                // ä¸¤ç‚¹åæ ‡ä¸åˆæ³•,则认为同一路段
                else {
                    isSame = true
                }
src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
@@ -58,6 +58,18 @@
    private Integer fatherGroupId;
    /**
     * æœ€å¤§æ¨ªåæ ‡
     */
    @Column(name = "max_xaxis")
    private Integer maxXaxis;
    /**
     * æœ€å¤§çºµåæ ‡
     */
    @Column(name = "max_yaxis")
    private Integer maxYaxis;
    /**
     * @return id
     */
    public Integer getId() {
@@ -268,4 +280,40 @@
    public void setFatherGroupId(Integer fatherGroupId) {
        this.fatherGroupId = fatherGroupId;
    }
    /**
     * èŽ·å–æœ€å¤§æ¨ªåæ ‡
     *
     * @return max_xaxis - æœ€å¤§æ¨ªåæ ‡
     */
    public Integer getMaxXaxis() {
        return maxXaxis;
    }
    /**
     * è®¾ç½®æœ€å¤§æ¨ªåæ ‡
     *
     * @param maxXaxis æœ€å¤§æ¨ªåæ ‡
     */
    public void setMaxXaxis(Integer maxXaxis) {
        this.maxXaxis = maxXaxis;
    }
    /**
     * èŽ·å–æœ€å¤§çºµåæ ‡
     *
     * @return max_yaxis - æœ€å¤§çºµåæ ‡
     */
    public Integer getMaxYaxis() {
        return maxYaxis;
    }
    /**
     * è®¾ç½®æœ€å¤§çºµåæ ‡
     *
     * @param maxYaxis æœ€å¤§çºµåæ ‡
     */
    public void setMaxYaxis(Integer maxYaxis) {
        this.maxYaxis = maxYaxis;
    }
}
src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java
@@ -20,14 +20,35 @@
    @Column(name = "end_time")
    private Date endTime;
    @Column(name = "district_name")
    private String districtName;
    /**
     * æ•°æ®æ˜¯å¦å·²ç»æ‹‰å–入库
     */
    @Column(name = "data_pulled")
    private Boolean dataPulled;
    @Column(name = "province_code")
    private String provinceCode;
    @Column(name = "province_name")
    private String provinceName;
    @Column(name = "city_code")
    private String cityCode;
    @Column(name = "city_name")
    private String cityName;
    @Column(name = "district_code")
    private String districtCode;
    @Column(name = "district_name")
    private String districtName;
    @Column(name = "town_code")
    private String townCode;
    @Column(name = "town_name")
    private String townName;
    /**
     * @return mission_code
@@ -100,20 +121,6 @@
    }
    /**
     * @return district_name
     */
    public String getDistrictName() {
        return districtName;
    }
    /**
     * @param districtName
     */
    public void setDistrictName(String districtName) {
        this.districtName = districtName == null ? null : districtName.trim();
    }
    /**
     * èŽ·å–æ•°æ®æ˜¯å¦å·²ç»æ‹‰å–å…¥åº“
     *
     * @return data_pulled - æ•°æ®æ˜¯å¦å·²ç»æ‹‰å–入库
@@ -130,4 +137,116 @@
    public void setDataPulled(Boolean dataPulled) {
        this.dataPulled = dataPulled;
    }
    /**
     * @return province_code
     */
    public String getProvinceCode() {
        return provinceCode;
    }
    /**
     * @param provinceCode
     */
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode == null ? null : provinceCode.trim();
    }
    /**
     * @return province_name
     */
    public String getProvinceName() {
        return provinceName;
    }
    /**
     * @param provinceName
     */
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName == null ? null : provinceName.trim();
    }
    /**
     * @return city_code
     */
    public String getCityCode() {
        return cityCode;
    }
    /**
     * @param cityCode
     */
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode == null ? null : cityCode.trim();
    }
    /**
     * @return city_name
     */
    public String getCityName() {
        return cityName;
    }
    /**
     * @param cityName
     */
    public void setCityName(String cityName) {
        this.cityName = cityName == null ? null : cityName.trim();
    }
    /**
     * @return district_code
     */
    public String getDistrictCode() {
        return districtCode;
    }
    /**
     * @param districtCode
     */
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode == null ? null : districtCode.trim();
    }
    /**
     * @return district_name
     */
    public String getDistrictName() {
        return districtName;
    }
    /**
     * @param districtName
     */
    public void setDistrictName(String districtName) {
        this.districtName = districtName == null ? null : districtName.trim();
    }
    /**
     * @return town_code
     */
    public String getTownCode() {
        return townCode;
    }
    /**
     * @param townCode
     */
    public void setTownCode(String townCode) {
        this.townCode = townCode == null ? null : townCode.trim();
    }
    /**
     * @return town_name
     */
    public String getTownName() {
        return townName;
    }
    /**
     * @param townName
     */
    public void setTownName(String townName) {
        this.townName = townName == null ? null : townName.trim();
    }
}
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt
@@ -3,8 +3,16 @@
import com.flightfeather.uav.domain.MyMapper
import com.flightfeather.uav.domain.entity.GridDataDetail
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Select
@Mapper
interface GridDataDetailMapper : MyMapper<GridDataDetail?> {
    fun updatePM25Batch(gridDataDetails: List<GridDataDetail>)
    /**
     * é‡ç½®è‡ªå¢žid
     */
    @Select("alter table grid_data_detail auto_increment = #{param1}")
    fun resetAutoIncrement(id: Int)
}
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt
@@ -3,6 +3,14 @@
import com.flightfeather.uav.domain.MyMapper
import com.flightfeather.uav.domain.entity.GridData
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Select
@Mapper
interface GridDataMapper : MyMapper<GridData?>
interface GridDataMapper : MyMapper<GridData?> {
    /**
     * é‡ç½®è‡ªå¢žid
     */
    @Select("alter table grid_data auto_increment = #{param1}")
    fun resetAutoIncrement(id: Int)
}
src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
@@ -8,6 +8,7 @@
import com.flightfeather.uav.domain.mapper.GridDataMapper
import com.flightfeather.uav.domain.mapper.GridGroupMapper
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.github.pagehelper.PageHelper
import org.springframework.stereotype.Repository
import org.springframework.transaction.annotation.Transactional
import tk.mybatis.mapper.entity.Example
@@ -54,12 +55,14 @@
    @Transactional
    fun deleteGridGroup(groupId: Int) {
        gridCellMapper.delete(GridCell().apply { this.groupId = groupId })
        PageHelper.startPage<GridCell>(1, 1)
        gridCellMapper.selectByExample(
            Example(GridCell::class.java).apply { orderBy("id").desc() }
        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
            gridCellMapper.resetAutoIncrement(id + 1)
        }
        gridGroupMapper.deleteByPrimaryKey(groupId)
        PageHelper.startPage<GridGroup>(1, 1)
        gridGroupMapper.selectByExample(
            Example(GridGroup::class.java).apply { orderBy("id").desc() }
        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
@@ -136,6 +139,25 @@
        gridDataDetailMapper.updatePM25Batch(gridDataDetails)
    }
    @Transactional
    @Throws
    fun deleteGridData(dataId: Int?) {
        gridDataDetailMapper.delete(GridDataDetail().apply { this.dataId = dataId })
        // Fixme 2025.4.16 æ­¤å¤„的重置自增id只在删除最新数据的情况下有效,后续考虑不适用自增主键,改为新的主键生成方式
//        PageHelper.startPage<GridDataDetail>(1, 1)
//        gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply { orderBy("id").desc() })
//            .takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
//                gridDataDetailMapper.resetAutoIncrement(id + 1)
//            }
        gridDataMapper.deleteByPrimaryKey(dataId)
//        PageHelper.startPage<GridData>(1, 1)
//        gridDataMapper.selectByExample(
//            Example(GridData::class.java).apply { orderBy("id").desc() }
//        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
//            gridDataMapper.resetAutoIncrement(id + 1)
//        }
    }
    /*****************************************************************/
    //    aod ç›¸å…³æ“ä½œ
src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.flightfeather.uav.lightshare.service
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
/**
 *
 * @date 2025/5/8
 * @author feiyu02
 */
interface DataAnalysisService {
    /**
     * æ±¡æŸ“溯源分析
     * @param missionCode èµ°èˆªä»»åŠ¡ç¼–å·
     */
    fun pollutionTrace(missionCode: String): List<ExceptionResult>
}
src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
@@ -1,6 +1,7 @@
package com.flightfeather.uav.lightshare.service
import com.flightfeather.uav.domain.entity.GridCell
import com.flightfeather.uav.domain.entity.GridData
import com.flightfeather.uav.domain.entity.GridDataDetail
import com.flightfeather.uav.lightshare.bean.GridDataDetailMixVo
@@ -33,10 +34,9 @@
    /**
     * å°†èµ°èˆªç›‘测数据和卫星网格进行融合计算
     * @param missionCode
     * @param groupId
     * @param gridData
     */
    fun dataFusion(missionCode: String, groupId: Int): List<GridDataDetail?>
    fun dataFusion(gridData: GridData): List<GridDataDetail?>
    /**
     * èµ°èˆªæ•°æ®èžåˆ
@@ -44,7 +44,7 @@
     * @param dataIdList èžåˆçš„æ•°æ®id索引数组
     */
    // Fixme 2025.3.28: éœ€è¦å’Œ[SatelliteTelemetryService.mixGridData]函数合并
    fun mixGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo>
    fun mixUnderwayGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo>
    /**
     * å°†èµ°èˆªç½‘格数据生成对应的热力网格图
src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt
@@ -29,18 +29,19 @@
    fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?>
    fun fetchGridData(gridData: GridData): List<GridData?>
    fun deleteGridData(dataId: Int): Boolean
    fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?>
    fun createGridDataAndDataDetail(
        groupId: Int,
        dataTime: LocalDateTime?,
        gridDataDetail: List<GridDataDetail>,
    ): Boolean
        groupId: Int, dataTime: LocalDateTime?, gridDataDetail: List<GridDataDetail>): Boolean
    /**
     * æ•°æ®èžåˆ
     */
    // Fixme 2025.3.28: éœ€è¦å’Œ[SatelliteDataCalculateService.mixGridData]函数合并
    // Fixme 2025.3.28: éœ€è¦å’Œ[SatelliteDataCalculateService.mixUnderwayGridData]函数合并
    fun mixGridData(dataIdList: List<Int>): List<GridData?>
    @Throws(BizException::class)
@@ -52,12 +53,6 @@
    fun importGridAOD(groupId: Int, dataTime: LocalDateTime?, update: Boolean, file: MultipartFile): GridDataImportResult?
    fun downloadAODTemplate(response: HttpServletResponse): Boolean
    /**
     * æ ¹æ®å«æ˜Ÿé¥æµ‹ç½‘格的中心坐标点,计算网格4个顶点坐标
     * @param groupId ç½‘格组索引id
     */
    fun calGridVertex(groupId: Int): List<GridCell?>
    /**AOD数据相关**************************************************************/
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package com.flightfeather.uav.lightshare.service.impl
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.biz.dataanalysis.ExceptionAnalysisController
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
import com.flightfeather.uav.common.exception.BizException
import com.flightfeather.uav.common.location.LocationRoadNearby
import com.flightfeather.uav.domain.repository.MissionRep
import com.flightfeather.uav.domain.repository.RealTimeDataRep
import com.flightfeather.uav.domain.repository.SegmentInfoRep
import com.flightfeather.uav.lightshare.service.DataAnalysisService
import com.flightfeather.uav.socket.eunm.FactorType
import org.springframework.stereotype.Service
/**
 *
 * @date 2025/5/8
 * @author feiyu02
 */
@Service
class DataAnalysisServiceImpl(
    private val missionRep: MissionRep,
    private val realTimeDataRep: RealTimeDataRep,
    private val locationRoadNearby: LocationRoadNearby,
    private val segmentInfoRep: SegmentInfoRep,
) : DataAnalysisService {
    override fun pollutionTrace(missionCode: String): List<ExceptionResult> {
        val mission = missionRep.findOne(missionCode) ?: throw BizException("走航任务不存在")
        val exceptionAnalysisController =
            ExceptionAnalysisController(realTimeDataRep, locationRoadNearby, segmentInfoRep)
        return exceptionAnalysisController.execute(
            mission, FactorFilter.builder()
//                .withMain(FactorType.NO2)
                .withMain(FactorType.CO)
//                .withMain(FactorType.H2S)
//                .withMain(FactorType.SO2)
//                .withMain(FactorType.O3)
                .withMain(FactorType.PM25)
                .withMain(FactorType.PM10)
                .withMain(FactorType.VOC)
                .create()
        )
    }
}
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
@@ -60,6 +60,7 @@
        return cellList
    }
    @Transactional
    override fun splitGrid(groupId: Int, scale: Int): List<GridCell?> {
        // æ£€æŸ¥è¯¥ç½‘格属性是否合规
        val gridGroup =
@@ -134,7 +135,10 @@
    }
    @Transactional
    override fun dataFusion(missionCode: String, groupId: Int): List<GridDataDetail?> {
    override fun dataFusion(gridData: GridData): List<GridDataDetail?> {
        val missionCode = gridData.missionCode ?: throw BizException("缺少任务编号")
        val groupId = gridData.groupId ?: throw BizException("缺少网格组id")
        // æŸ¥è¯¢èµ°èˆªä»»åŠ¡åŠå¯¹åº”èµ°èˆªç›‘æµ‹æ•°æ®
        val mission = missionRep.findOne(missionCode) ?: throw BizException("任务不存在")
        val data = realTimeDataRep.fetchData(mission)
@@ -142,25 +146,24 @@
        // æŸ¥æ‰¾æ˜¯å¦å·²æœ‰èµ°èˆªèžåˆè®°å½•
        val oldGridDataList = satelliteGridRep.fetchGridData(GridData().apply {
            this.groupId = groupId
            mixDataId = missionCode
            this.missionCode = missionCode
            this.type = SatelliteDataType.Monitor.value.toByte()
        })
        if (oldGridDataList.isEmpty()) {
            // åˆ›å»ºèžåˆæ•°æ®ç´¢å¼•对象
            val newGridData = GridData().apply {
            val newGridData = gridData.apply {
                this.groupId = groupId
                dataTime = mission.startTime
                type = SatelliteDataType.Monitor.value.toByte()
                this.missionCode = mission.missionCode
                // Fixme 2025.3.27: è¡Œæ”¿åŒºåˆ’在走航任务添加对应字段后进行赋值
                provinceCode
                provinceName
                cityCode
                cityName
                districtCode
                provinceCode = mission.provinceCode
                provinceName = mission.provinceName
                cityCode = mission.cityCode
                cityName = mission.cityName
                districtCode = mission.districtCode
                districtName = mission.districtName
                // Fixme 2025.3.27: æ‰€å±žç›‘测点区域目前需要通过用户选择确定
                // 2025.3.27: æ‰€å±žç›‘测点区域需要通过用户选择确定
                zone
                pollutionDegreeIndex
                pollutionDegree
@@ -199,7 +202,7 @@
        }
    }
    override fun mixGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo> {
    override fun mixUnderwayGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo> {
        // èŽ·å–æ‰€ä½¿ç”¨çš„ç½‘æ ¼ç»„ç½‘æ ¼ä¿¡æ¯
        val gridCellList = satelliteGridRep.fetchGridCell(groupId)
@@ -248,10 +251,11 @@
        gridDataDetailList: List<GridDataDetail>,
        searchLength: Int,
    ): List<GridDataDetail> {
        val gridGroup =satelliteGridRep.fetchGridGroup(groupId)
        val gridCellList = satelliteGridRep.fetchGridCell(groupId)
        val originCellIdList = gridDataDetailList.map { it.cellId }
        // Fixme 2025.3.24: æ­¤å¤„根据现有的网格信息设计方式,使用临时的参数,后续将网格通过二维坐标形式表示,此处参数去除
        val option = GridGroupOption(120, 90, 10, 10)
        val option = GridGroupOption(gridGroup?.maxXaxis ?: 120, gridGroup?.maxYaxis ?: 90, 10, 10)
        val resMap = mutableMapOf<Int, MutableList<GridDataDetail>>()
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
@@ -54,6 +54,20 @@
        return satelliteGridRep.fetchGridData(groupId, dataTime, type)
    }
    override fun fetchGridData(gridData: GridData): List<GridData?> {
        return satelliteGridRep.fetchGridData(gridData)
    }
    override fun deleteGridData(dataId: Int): Boolean {
        try {
            satelliteGridRep.deleteGridData(dataId)
        } catch (e: Exception) {
            // todo: åŠ å…¥æ—¥å¿—å­˜å‚¨é€»è¾‘
            return false
        }
        return true
    }
    override fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> {
        val res =  satelliteGridRep.fetchGridDataDetail(dataId, groupId, cellId)
        res.forEach {
@@ -234,35 +248,6 @@
            response.outputStream.write(file.readBytes())
        }
        return true
    }
    override fun calGridVertex(groupId: Int): List<GridCell?> {
        val cellList = satelliteGridRep.fetchGridCell(groupId)
        val vertexList = SatelliteGridManage.calGridVertex(cellList.map {
            if (it?.longitude == null || it.latitude == null) {
                throw BizException("卫星遥测网格计算顶点坐标点失败,存在中心点坐标为空的情况")
            }
            it.longitude?.toDouble()!! to it.latitude?.toDouble()!!
        })
        cellList.forEachIndexed { i, c ->
            val v = vertexList[i]
            c?.point1Lon = v.point1Lon.toBigDecimal()
            c?.point1Lat = v.point1Lat.toBigDecimal()
            c?.point2Lon = v.point2Lon.toBigDecimal()
            c?.point2Lat = v.point2Lat.toBigDecimal()
            c?.point3Lon = v.point3Lon.toBigDecimal()
            c?.point3Lat = v.point3Lat.toBigDecimal()
            c?.point4Lon = v.point4Lon.toBigDecimal()
            c?.point4Lat = v.point4Lat.toBigDecimal()
        }
        satelliteGridRep.updateGridCellBatch(cellList)
        return cellList
    }
    override fun fetchGridAod(groupId: Int, dataTime: LocalDateTime?): List<GridAod?> {
src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.flightfeather.uav.lightshare.web
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.DataAnalysisService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
/**
 * èµ°èˆªæ•°æ®åˆ†æž
 * @date 2025/5/8
 * @author feiyu02
 */
@Api(tags = ["走航数据分析API接口"])
@RestController
@RequestMapping("air/analysis")
class DataAnalysisController(private val dataAnalysisService: DataAnalysisService) {
    @ApiOperation(value = "污染溯源分析")
    @GetMapping("/pollution/trace")
    fun pollutionTrace(
        @ApiParam("走航任务编号") @RequestParam missionCode: String,
//        @RequestParam("page", required = false) page: Int?,
//        @RequestParam("per_page", required = false) perPage: Int?,
    ) = resPack { dataAnalysisService.pollutionTrace(missionCode) }
}
src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
@@ -1,5 +1,6 @@
package com.flightfeather.uav.lightshare.web
import com.flightfeather.uav.domain.entity.GridData
import com.flightfeather.uav.domain.entity.GridDataDetail
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService
@@ -48,11 +49,21 @@
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("遥测数据时间")
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
        @ApiParam(
            "遥测数据类型",
            allowableValues = "0:原始卫星遥测数据;1:融合数据"
        ) @RequestParam(required = false) type: Int?,
        @ApiParam("遥测数据类型", allowableValues = "0:原始卫星遥测数据;1:融合数据")
        @RequestParam(required = false) type: Int?,
    ) = resPack { satelliteTelemetryService.fetchGridData(groupId, dataTime, type) }
    @ApiOperation(value = "获取网格组下的卫星遥测数据")
    @PostMapping("/grid/data2")
    fun fetchGridData2(
        @ApiParam("网格数据") @RequestBody gridData: GridData,
    ) = resPack { satelliteTelemetryService.fetchGridData(gridData) }
    @ApiOperation(value = "删除网格数据")
    @DeleteMapping("/grid/data/delete")
    fun deleteGridData(
        @ApiParam("数据id") @RequestParam dataId: Int,
    ) = resPack { satelliteTelemetryService.deleteGridData(dataId) }
    @ApiOperation(value = "获取网格组下的卫星遥测具体数据")
    @GetMapping("/grid/data/detail")
@@ -144,18 +155,19 @@
    /**遥测产品制作相关**************************************************************/
    @ApiOperation(value = "生成走航融合产品")
    @GetMapping("/product/underway/build")
    @PostMapping("/product/underway/build")
    fun buildUnderwayProduct(
        @ApiParam("走航任务编号") @RequestParam missionCode: String,
        @ApiParam("网格组id") @RequestParam groupId: Int,
    ) = resPack { satelliteDataCalculateService.dataFusion(missionCode, groupId) }
//        @ApiParam("走航任务编号") @RequestParam missionCode: String,
//        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("网格数据") @RequestBody gridData: GridData,
    ) = resPack { satelliteDataCalculateService.dataFusion(gridData) }
    @ApiOperation(value = "进行走航融合产品的融合分析")
    @PostMapping("/product/underway/mix")
    fun mixGridData(
        @ApiParam("网格组id") @RequestParam groupId: Int,
        @ApiParam("需要融合的数据id") @RequestBody dataIdList: List<Int>,
    ) = resPack { satelliteDataCalculateService.mixGridData(groupId, dataIdList) }
    ) = resPack { satelliteDataCalculateService.mixUnderwayGridData(groupId, dataIdList) }
    @ApiOperation(value = "生成走航热力图")
    @PostMapping("/product/underway/heatmap/build")
src/main/resources/application-test.yml
@@ -7,13 +7,13 @@
    #    password: cn.FLIGHTFEATHER
    #   è¿œç¨‹æœåС噍
#    url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
#    username: remoteU1
#    password: eSoF8DnzfGTlhAjE
    url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
    url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
    username: remoteU1
    password: feiyu2024
    password: eSoF8DnzfGTlhAjE
#    url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
#    username: remoteU1
#    password: feiyu2024
springfox:
  documentation:
src/main/resources/generator/generatorConfig.xml
@@ -52,7 +52,7 @@
        </javaClientGenerator>
        <!-- è¦ç”Ÿæˆçš„表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!--        <table tableName="air_real_time_data" domainObjectName="RealTimeData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
        <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
<!--        <table tableName="el_minutevalue" domainObjectName="ElectricMinuteValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="el_company_device" domainObjectName="CompanyDevice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="co_complaint" domainObjectName="Complaint" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
@@ -68,7 +68,7 @@
<!--        <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="grid_group" domainObjectName="GridGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="grid_cell" domainObjectName="GridCell" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
        <table tableName="grid_data" domainObjectName="GridData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
<!--        <table tableName="grid_data" domainObjectName="GridData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!--        <table tableName="grid_data_detail" domainObjectName="GridDataDetail" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
    </context>
</generatorConfiguration>
src/main/resources/mapper/GridGroupMapper.xml
@@ -19,12 +19,14 @@
    <result column="length" jdbcType="DOUBLE" property="length" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="father_group_id" jdbcType="INTEGER" property="fatherGroupId" />
    <result column="max_xaxis" jdbcType="INTEGER" property="maxXaxis" />
    <result column="max_yaxis" jdbcType="INTEGER" property="maxYaxis" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    id, name, province_code, province_name, city_code, city_name, district_code, district_name, 
    town_code, town_name, create_time, length, type, father_group_id
    town_code, town_name, create_time, length, type, father_group_id, max_xaxis, max_yaxis
  </sql>
</mapper>
src/main/resources/mapper/MissionMapper.xml
@@ -10,13 +10,21 @@
    <result column="device_code" jdbcType="VARCHAR" property="deviceCode" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
    <result column="data_pulled" jdbcType="BIT" property="dataPulled" />
    <result column="province_code" jdbcType="VARCHAR" property="provinceCode" />
    <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
    <result column="city_code" jdbcType="VARCHAR" property="cityCode" />
    <result column="city_name" jdbcType="VARCHAR" property="cityName" />
    <result column="district_code" jdbcType="VARCHAR" property="districtCode" />
    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
    <result column="town_code" jdbcType="VARCHAR" property="townCode" />
    <result column="town_name" jdbcType="VARCHAR" property="townName" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    mission_code, device_type, device_code, start_time, end_time, district_name, data_pulled
    mission_code, device_type, device_code, start_time, end_time, data_pulled, province_code,
    province_name, city_code, city_name, district_code, district_name, town_code, town_name
  </sql>
</mapper>
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.flightfeather.uav.lightshare.service.impl
import com.flightfeather.uav.lightshare.service.DataAnalysisService
import junit.framework.TestCase
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@SpringBootTest
class DataAnalysisServiceImplTest{
    @Autowired
    lateinit var dataAnalysisService: DataAnalysisService
    @Test
    fun testPollutionTrace() {
        dataAnalysisService.pollutionTrace("SH-CN-20250116")
    }
}
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt
@@ -51,8 +51,13 @@
    }
    @Test
    fun calGridVertex() {
        satelliteDataCalculateService.calGridVertex(5)
    }
    @Test
    fun splitGrid() {
        val res = satelliteDataCalculateService.splitGrid(1, 4)
        val res = satelliteDataCalculateService.splitGrid(1, 10)
//        println(res)
    }
@@ -100,7 +105,10 @@
                "SH-CN-20250120"
            )
        missionList.forEach { m ->
            satelliteDataCalculateService.dataFusion(m, 3)
            satelliteDataCalculateService.dataFusion(GridData().apply {
                missionCode = m
                type = 3
            })
        }
//        val res = satelliteDataCalculateService.dataFusion("SH-CN-20241216", 3)
    }
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt
@@ -24,12 +24,7 @@
    }
    @Test
    fun calGridVertex() {
        satelliteTelemetryService.calGridVertex(1)
    }
    @Test
    fun deleteGridGroup() {
        satelliteTelemetryService.deleteGridGroup(2)
        satelliteTelemetryService.deleteGridGroup(6)
    }
}