riku
2025-08-25 2de612e9b260df2e76d4dd620ca739aa3b6e8c57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.flightfeather.uav
 
import com.flightfeather.uav.domain.entity.GridAod
import com.flightfeather.uav.domain.entity.GridAodDetail
import com.flightfeather.uav.domain.entity.GridData
import com.flightfeather.uav.domain.entity.GridDataDetail
import com.flightfeather.uav.domain.mapper.GridAodDetailMapper
import com.flightfeather.uav.domain.mapper.GridAodMapper
import com.flightfeather.uav.domain.mapper.GridDataDetailMapper
import com.flightfeather.uav.domain.mapper.GridDataMapper
import com.flightfeather.uav.lightshare.eunm.GridType
import com.flightfeather.uav.lightshare.eunm.SatelliteDataType
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
import org.springframework.transaction.annotation.Transactional
 
/**
 * 卫星遥测测试数据管理
 * @date 2025/3/2
 * @author feiyu02
 */
@RunWith(SpringRunner::class)
@SpringBootTest
class SatelliteDebugData {
 
 
    @Autowired
    lateinit var gridDataMapper: GridDataMapper
 
    @Autowired
    lateinit var gridDataDetailMapper: GridDataDetailMapper
 
    @Autowired
    lateinit var gridAodMapper: GridAodMapper
 
    @Autowired
    lateinit var gridAodDetailMapper: GridAodDetailMapper
 
    /**
     * 反向生成AOD数据
     */
    @Test
    fun createAODData() {
        gridDataMapper.select(GridData().apply { type = SatelliteDataType.Original.value.toByte() }).forEach {gridData ->
            val gridAod = GridAod().apply {
                groupId = gridData?.groupId
                dataTime = gridData?.dataTime
            }
            gridAodMapper.insert(gridAod)
 
            gridDataDetailMapper.select(GridDataDetail().apply {
                dataId = gridData?.id
            }).forEach { gridDataDetail->
                val girdAodDetail = GridAodDetail().apply {
                    aodId = gridAod.id
                    groupId = gridAod.groupId
                    cellId = gridDataDetail?.cellId
                    aod = gridDataDetail?.pm25?.div(2)
                }
                gridAodDetailMapper.insert(girdAodDetail)
            }
        }
 
    }
}