| | |
| | | // ç½æ ¼é«åº¦ï¼æååæ¹åä¸çç½æ ¼æ°é |
| | | val height: Int, |
| | | // ç»åç½æ ¼å®½åº¦ï¼å¦æç½æ ¼ç»æ¯ç»åç½æ ¼ï¼å表示对åºåå§ç½æ ¼ä¸åä¸ªç½æ ¼ä¸ç»åçç½æ ¼æ°é |
| | | val eachWith: Int, |
| | | val eachWidth: Int, |
| | | // ç»åç½æ ¼é«åº¦ï¼å¦æç½æ ¼ç»æ¯ç»åç½æ ¼ï¼å表示对åºåå§ç½æ ¼ä¸åä¸ªç½æ ¼ä¸ç»åçç½æ ¼æ°é |
| | | val eachHeight: Int, |
| | | ) |
| | |
| | | |
| | | import com.flightfeather.uav.common.utils.MapUtil |
| | | import com.flightfeather.uav.domain.entity.* |
| | | import com.flightfeather.uav.model.underwaygrid.GridCellAndData |
| | | import com.flightfeather.uav.model.underwaygrid.GridCellSop |
| | | import com.flightfeather.uav.model.underwaygrid.UnderwayGridModel |
| | | import com.flightfeather.uav.socket.eunm.FactorType |
| | | import org.springframework.beans.BeanUtils |
| | | import kotlin.math.PI |
| | | import kotlin.math.sqrt |
| | |
| | | dataId = gridData?.id |
| | | groupId = k.groupId |
| | | cellId = k.cellIndex |
| | | // no2 = avgData.no2 |
| | | // co = avgData.co |
| | | // h2s = avgData.h2s |
| | | // so2 = avgData.so2 |
| | | // o3 = avgData.o3 |
| | | // pm25 = avgData.pm25 |
| | | // pm10 = avgData.pm10 |
| | | // temperature = avgData.temperature |
| | | // humidity = avgData.humidity |
| | | // voc = avgData.voc |
| | | // noi = avgData.noi |
| | | // no = avgData.no |
| | | // windSpeed |
| | | // windDirection |
| | | rank |
| | | } |
| | | gridDataDetailList.add(dataDetail) |
| | |
| | | return gridDataDetailList |
| | | } |
| | | |
| | | /** |
| | | * 计ç®çåå¾ç½æ ¼ï¼å³ç½æ ¼å¨è¾¹æ©æ£å½±åæéè®¡ç® |
| | | * @param gridDataDetail ç½æ ¼çæµæ°æ® |
| | | * @param gridCellList åºåç½æ ¼æ°ç» |
| | | * @param option åºåç½æ ¼åæ°ä¿¡æ¯ |
| | | * @param searchLength 计ç®å¨è¾¹å
«æ¹åï¼ä¸ä¸å·¦å³åå个对è§ï¼ç½æ ¼çé¿åº¦ |
| | | * @return å¨è¾¹ç½æ ¼å对åºççæµæ°æ®ç»æ |
| | | */ |
| | | fun heatMap( |
| | | gridDataDetail: GridDataDetail, gridCellList: List<GridCell?>, |
| | | option: GridGroupOption, searchLength: Int, |
| | | ): List<GridDataDetail> { |
| | | // æ¾å°ç½æ ¼æ°æ®å¯¹åºçç½æ ¼ä¿¡æ¯ |
| | | val gridCell = gridCellList.find { it?.cellIndex == gridDataDetail.cellId } |
| | | ?: throw IllegalArgumentException("ç½æ ¼æ°æ®åç»å®çåºåç½æ ¼ä¸å¹é
") |
| | | |
| | | // è·åå¨è¾¹ç½æ ¼ |
| | | val surroundGridCellList = |
| | | SatelliteGridUtil.searchDiffuseGrid(gridDataDetail.cellId, gridCellList, option, searchLength) |
| | | |
| | | // 使ç¨èµ°èªç½æ ¼æé模åï¼è®¡ç®å¨è¾¹ç½æ ¼ççæµæ°æ®å¼ |
| | | val underwayGridModel = UnderwayGridModel() |
| | | val dataList = listOf(GridCellAndData(gridCell, gridDataDetail)) |
| | | val gridCellSopList = surroundGridCellList.map { |
| | | GridCellSop( |
| | | it, |
| | | it.id.toString(), |
| | | it.cellIndex.toString(), |
| | | it.cellIndex.toString() |
| | | ) } |
| | | underwayGridModel.execute(dataList, gridCellSopList) |
| | | val resMap = underwayGridModel.outputResult() |
| | | |
| | | // æ ¼å¼åç»æå¹¶è¿å |
| | | val result = mutableListOf<GridDataDetail>() |
| | | gridCellSopList.forEach { |
| | | val resGridDataDetail = GridDataDetail().apply { |
| | | dataId = gridDataDetail.dataId |
| | | groupId = gridDataDetail.groupId |
| | | cellId = it.gridCell.cellIndex |
| | | } |
| | | |
| | | val key = "${it.sourceName};${it.index}" |
| | | val d = resMap[key] |
| | | d?.forEach { (t, u) -> |
| | | val avg = u["综å(${t})"]?.average ?: .0 |
| | | resGridDataDetail.setFactorValue(FactorType.getByName(t), avg.toFloat()) |
| | | } |
| | | result.add(resGridDataDetail) |
| | | } |
| | | |
| | | return result |
| | | } |
| | | |
| | | } |
| | |
| | | import com.flightfeather.uav.common.utils.MapUtil |
| | | import com.flightfeather.uav.domain.entity.GridCell |
| | | import kotlin.math.ceil |
| | | import kotlin.math.floor |
| | | |
| | | /** |
| | | * å«æç½æ ¼è®¡ç®å·¥å
· |
| | |
| | | option: GridGroupOption, |
| | | searchLength: Int, |
| | | ): List<GridCell> { |
| | | return emptyList() |
| | | val hOffset = option.eachWidth; |
| | | val wOffset = 1; |
| | | |
| | | val cellIdMin = 1 |
| | | val cellIdMax = option.width * option.height |
| | | |
| | | val searchWidth = 0 - searchLength |
| | | val searchHeight = 0 - searchLength |
| | | |
| | | val result = mutableListOf<GridCell>() |
| | | |
| | | val eachRange = getCellWidthRange(gridCellIndex, option.eachWidth, option.eachHeight)?: return emptyList() |
| | | val groupRange = getCellWidthRange( |
| | | ceil(gridCellIndex.toDouble() / (option.eachWidth * option.eachHeight)).toInt(), |
| | | option.width / option.eachWidth, |
| | | option.height / option.eachHeight |
| | | ) ?: return emptyList() |
| | | |
| | | for (w in searchWidth..searchLength) { |
| | | // å
è¿è¡æ¨ªåçåæ åæ¢ |
| | | var _cellId = gridCellIndex + w * wOffset; |
| | | if (_cellId < eachRange.first || _cellId > eachRange.second) { |
| | | val cellOffset = if (_cellId < eachRange.first) _cellId - eachRange.first else _cellId - eachRange.second |
| | | |
| | | val groupOffset = if (cellOffset / option.eachWidth > 0) { |
| | | ceil(cellOffset.toDouble() / option.eachWidth).toInt() |
| | | } else { |
| | | floor(cellOffset.toDouble() / option.eachWidth).toInt() |
| | | } |
| | | |
| | | val newEachRange = |
| | | (eachRange.first + groupOffset * option.eachWidth * option.eachHeight) to |
| | | (eachRange.second + groupOffset * option.eachWidth * option.eachHeight) |
| | | |
| | | _cellId = if (groupOffset > 0) { |
| | | newEachRange.first + cellOffset - wOffset |
| | | } else { |
| | | newEachRange.second + cellOffset + wOffset; |
| | | } |
| | | |
| | | val _groupId = ceil(_cellId.toDouble() / (option.eachWidth * option.eachHeight)).toInt() |
| | | |
| | | if (_groupId < groupRange.first || _groupId > groupRange.second) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | for (h in searchHeight..searchLength) { |
| | | if (w == 0 && h == 0) continue; |
| | | |
| | | val _eachRange = getCellWidthRange(_cellId, option.eachWidth, option.eachHeight) ?: return emptyList() |
| | | |
| | | val wOffset = _cellId - _eachRange.first; |
| | | var _resCellId = _cellId + h * hOffset; |
| | | if (_resCellId < cellIdMin || _resCellId > cellIdMax) continue; |
| | | |
| | | val total = option.eachWidth * option.eachHeight; |
| | | val x = ceil(_cellId.toDouble() / total).toInt() - 1; |
| | | val eachCellIdMin = 1 + x * total; |
| | | val eachCellIdMax = total + x * total; |
| | | val topCell = eachCellIdMin + wOffset; |
| | | val bottomCell = eachCellIdMax - option.eachWidth + 1 + wOffset; |
| | | if (_resCellId < eachCellIdMin || _resCellId > eachCellIdMax) { |
| | | val cellOffset = if (_resCellId < eachCellIdMin) { |
| | | _resCellId - topCell |
| | | } else { |
| | | _resCellId - bottomCell; |
| | | } |
| | | |
| | | val newTopCell = if (cellOffset > 0) { |
| | | topCell + option.width * option.eachHeight |
| | | } else { |
| | | topCell - option.width * option.eachHeight; |
| | | } |
| | | |
| | | val newBottomCell = if (cellOffset > 0) { |
| | | bottomCell + option.width * option.eachHeight |
| | | } else { |
| | | bottomCell - option.width * option.eachHeight; |
| | | } |
| | | |
| | | _resCellId = if (cellOffset > 0) { |
| | | newTopCell + cellOffset - hOffset |
| | | } else { |
| | | newBottomCell + cellOffset + hOffset; |
| | | } |
| | | } |
| | | gridCellList.find { it?.cellIndex == _resCellId }?.let { result.add(it) } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Fixme 2025.3.14: å¨è¾¹ç½æ ¼çæ¥æ¾ï¼åç»éè¿å°ç½æ ¼ç¨åæ ç¹ç表示æ¹å¼æ¥ç´æ¥è®¡ç®(x, y) |
| | | * æ ¹æ®ç½æ ¼ç´¢å¼ï¼è·åå
¶æå¨ä¸è¥¿æ¹åçç½æ ¼ç´¢å¼èå´ |
| | | * @param cellIndex ç½æ ¼ç´¢å¼ |
| | | * @param width ç½æ ¼å®½åº¦ï¼æä¸è¥¿æ¹åä¸çç½æ ¼æ°é |
| | | * @param height ç½æ ¼é«åº¦ï¼æååæ¹åä¸çç½æ ¼æ°é |
| | | * @return è¿åç½æ ¼ç´¢å¼å¼èå´ |
| | | */ |
| | | fun getCellWidthRange(cellIndex: Int, width: Int, height: Int): Pair<Double, Double>? { |
| | | fun getCellWidthRange(cellIndex: Int, width: Int, height: Int): Pair<Int, Int>? { |
| | | val total = width * height; |
| | | val x = ceil(cellIndex.toDouble() / total) - 1; |
| | | val x = (ceil(cellIndex.toDouble() / total) - 1).toInt() |
| | | val first = 1 + x * total |
| | | val last = width + x * total; |
| | | var scale = 0; |
| | | while (scale < height) { |
| | | val min = first + scale * width; |
| | | val max = last + scale * width; |
| | | if (cellIndex >= min && cellIndex <= max) { |
| | | if (cellIndex in min..max) { |
| | | return min to max |
| | | } |
| | | scale++; |
| | |
| | | package com.flightfeather.uav.common.utils |
| | | |
| | | import java.text.DateFormat |
| | | import java.text.SimpleDateFormat |
| | | import java.time.Duration |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | import kotlin.math.max |
| | | import kotlin.math.min |
| | | |
| | | /** |
| | | * @author riku |
| | | * Date: 2019/9/16 |
| | | */ |
| | | class TimeUtil { |
| | | object TimeUtil { |
| | | |
| | | companion object { |
| | | |
| | | /** |
| | | * æ¯å¦æ¯ç¬¬äºå¤©ææ´æ°çæ¶é´ |
| | |
| | | else -> false |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åææ®µæ¶é´å¨æ¯æ¥ä¸çæ¶æ®µ |
| | | * "忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | * å½è¿æ®µæ¶é´è·¨è¶äºæ¶æ®µæ¶ï¼æç
§60%çæ¶é´æå¨æ¶æ®µä¸ºæç»æ¶æ®µï¼å¦åéç¨åä¸ä¸ªæ¶æ®µ |
| | | * @return æ¶æ®µåæ¶æ®µçèµ·æ¢æ¶é´ <æ¶æ®µ, å¼å§æ¶é´, ç»ææ¶é´> |
| | | */ |
| | | fun getDayTimeTag(start: Date, end: Date): Triple<String, Date, Date>? { |
| | | var sLocal = LocalDateTime.ofInstant(start.toInstant(), ZoneId.systemDefault()) |
| | | var eLocal = LocalDateTime.ofInstant(end.toInstant(), ZoneId.systemDefault()) |
| | | val duration = Duration.between(sLocal, eLocal) |
| | | if (duration.toDays() > 1) return null |
| | | if (duration.isNegative) { |
| | | val temp = sLocal |
| | | sLocal = eLocal |
| | | eLocal = temp |
| | | } |
| | | |
| | | val sDay = sLocal.dayOfMonth |
| | | val eDay = eLocal.dayOfMonth |
| | | val ranges = listOf( |
| | | Triple(0, 6, "忍"), Triple(6, 9, "æ©ä¸"), |
| | | Triple(9, 12, "ä¸å"), Triple(12, 14, "ä¸å"), |
| | | Triple(14, 17, "ä¸å"), Triple(17, 20, "åæ"), Triple(20, 24, "å¤é´") |
| | | ) |
| | | val periodList = mutableListOf<Pair<Triple<String, Date, Date>, Long>>() |
| | | |
| | | if (sDay < eDay) { |
| | | val dayStart = sLocal.plusDays(1).withHour(0).withMinute(0).withSecond(0) |
| | | val firstRange = sLocal to dayStart |
| | | val secondRange = dayStart to eLocal |
| | | ranges.forEachIndexed { i, r -> |
| | | // 夿æ¶é´èå´æ¯å¦åè¯¥æ¶æ®µæäº¤é |
| | | checkPeriodTime(firstRange.first, firstRange.second, r.first to r.second)?.let { |
| | | val t = firstRange.first.withMinute(0).withSecond(0) |
| | | periodList.add( |
| | | Triple( |
| | | r.third, |
| | | Date.from(t.withHour(r.first).atZone(ZoneId.systemDefault()).toInstant()), |
| | | if (r.second == 24) { |
| | | Date.from( |
| | | t.withHour(0).plusDays(1).minusSeconds(1) |
| | | .atZone(ZoneId.systemDefault()).toInstant() |
| | | ) |
| | | } else { |
| | | Date.from(t.withHour(r.second).atZone(ZoneId.systemDefault()).toInstant()) |
| | | } |
| | | ) to it.toMinutes() |
| | | ) |
| | | } |
| | | checkPeriodTime(secondRange.first, secondRange.second, r.first to r.second)?.let { |
| | | val t = secondRange.first.withMinute(0).withSecond(0) |
| | | periodList.add( |
| | | Triple( |
| | | r.third, |
| | | Date.from(t.withHour(r.first).atZone(ZoneId.systemDefault()).toInstant()), |
| | | if (r.second == 24) { |
| | | Date.from( |
| | | t.withHour(0).plusDays(1).minusSeconds(1) |
| | | .atZone(ZoneId.systemDefault()).toInstant() |
| | | ) |
| | | } else { |
| | | Date.from(t.withHour(r.second).atZone(ZoneId.systemDefault()).toInstant()) |
| | | } |
| | | ) to it.toMinutes() |
| | | ) |
| | | } |
| | | } |
| | | } else { |
| | | val range = sLocal to eLocal |
| | | ranges.forEachIndexed { i, r -> |
| | | // 夿æ¶é´èå´æ¯å¦åè¯¥æ¶æ®µæäº¤é |
| | | checkPeriodTime(range.first, range.second, r.first to r.second)?.let { |
| | | val t = range.first.withMinute(0).withSecond(0) |
| | | periodList.add( |
| | | Triple( |
| | | r.third, |
| | | Date.from(t.withHour(r.first).atZone(ZoneId.systemDefault()).toInstant()), |
| | | if (r.second == 24) { |
| | | Date.from( |
| | | t.withHour(0).plusDays(1).minusSeconds(1) |
| | | .atZone(ZoneId.systemDefault()).toInstant() |
| | | ) |
| | | } else { |
| | | Date.from(t.withHour(r.second).atZone(ZoneId.systemDefault()).toInstant()) |
| | | } |
| | | ) to it.toMinutes() |
| | | ) |
| | | } |
| | | } |
| | | } |
| | | if (periodList.isEmpty()) return null |
| | | |
| | | periodList.sortByDescending { it.second } |
| | | val maxOne = periodList.first() |
| | | return maxOne.first |
| | | } |
| | | |
| | | private fun checkPeriodTime(start: LocalDateTime, end: LocalDateTime, hourRange: Pair<Int, Int>): Duration? { |
| | | return if (start.hour in hourRange.first..hourRange.second) { |
| | | Duration.between( |
| | | start, |
| | | end.withHour(min(hourRange.second, end.hour)).withMinute(0).withSecond(0) |
| | | ) |
| | | } else if (start.hour < hourRange.first && end.hour > hourRange.second) { |
| | | Duration.between( |
| | | start.withHour(hourRange.first).withMinute(0).withSecond(0), |
| | | end.withHour(hourRange.second).withMinute(0).withSecond(0), |
| | | ) |
| | | } else if (end.hour in hourRange.first..hourRange.second) { |
| | | Duration.between( |
| | | start.withHour(max(hourRange.first, start.hour)).withMinute(0).withSecond(0), |
| | | end, |
| | | ) |
| | | } else { |
| | | null |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.flightfeather.uav.domain.entity |
| | | |
| | | import com.flightfeather.uav.biz.dataprocess.AvgPair |
| | | import com.flightfeather.uav.common.utils.DateUtil |
| | | import com.flightfeather.uav.common.utils.GsonUtils |
| | | import com.flightfeather.uav.lightshare.bean.DataVo |
| | | import com.flightfeather.uav.socket.bean.AirData |
| | | import com.flightfeather.uav.socket.eunm.FactorType |
| | | import com.flightfeather.uav.socket.eunm.FactorType.* |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | import kotlin.math.atan |
| | | import kotlin.math.cos |
| | | import kotlin.math.round |
| | | import kotlin.math.sin |
| | | |
| | | /** |
| | | * æ°æ®åºè¡¨å®ä½æ©å±æ¹æ³ |
| | |
| | | }, |
| | | ) |
| | | } |
| | | |
| | | |
| | | /** GridDataDetail-start ********************************************************************/ |
| | | /** |
| | | * æ ¹æ®çæµå åç±»åèµå¼ |
| | | */ |
| | | fun GridDataDetail.setFactorValue(type: FactorType?, value: Float) { |
| | | when (type) { |
| | | NO -> no = value |
| | | NO2 -> no2 = value |
| | | CO -> co = value |
| | | H2S -> h2s = value |
| | | SO2 -> so2 = value |
| | | O3 -> o3 = value |
| | | PM25 -> pm25 = value |
| | | PM10 -> pm10 = value |
| | | TEMPERATURE -> temperature = value |
| | | HUMIDITY -> humidity = value |
| | | VOC -> voc = value |
| | | NOI -> noi = value |
| | | WIND_SPEED -> windSpeed = value |
| | | WIND_DIRECTION -> windDirection = value |
| | | LNG -> TODO("no such factor") |
| | | LAT -> TODO("no such factor") |
| | | VELOCITY -> TODO("no such factor") |
| | | TIME -> TODO("no such factor") |
| | | HEIGHT -> TODO("no such factor") |
| | | } |
| | | } |
| | | |
| | | fun List<GridDataDetail>.avg(): GridDataDetail { |
| | | //é£åéç¨åä½ç¢éæ³æ±ååå¼ |
| | | var u = .0//ä¸è¥¿æ¹ä½åéæ»å |
| | | var v = .0//ååæ¹ä½åéæ»å |
| | | var c = 0//é£åæ°æ®è®¡æ° |
| | | |
| | | //é¤é£åå¤çå
¶ä»å åéç¨ç®æ¯å¹³åæ³æ±ååå¼ |
| | | val tmpList = mutableListOf<AvgPair>() |
| | | repeat(18) { |
| | | tmpList.add(AvgPair(0f, 0)) |
| | | } |
| | | |
| | | forEach { f -> |
| | | //é£å |
| | | f.windDirection?.let { w -> |
| | | val r = Math.toRadians(w.toDouble()) |
| | | u += sin(r) |
| | | v += cos(r) |
| | | c++ |
| | | } |
| | | //å
¶ä½å å |
| | | tmpList[0].apply { |
| | | f.no2?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[1].apply { |
| | | f.co?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[2].apply { |
| | | f.h2s?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[3].apply { |
| | | f.so2?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[4].apply { |
| | | f.o3?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[5].apply { |
| | | f.pm25?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[6].apply { |
| | | f.pm10?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[7].apply { |
| | | f.temperature?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[8].apply { |
| | | f.humidity?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[9].apply { |
| | | f.voc?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[10].apply { |
| | | f.noi?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[11].apply { |
| | | f.windSpeed?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[12].apply { |
| | | f.no?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | } |
| | | |
| | | return GridDataDetail().apply { |
| | | no2 = tmpList[0].avg() |
| | | co = tmpList[1].avg() |
| | | h2s = tmpList[2].avg() |
| | | so2 = tmpList[3].avg() |
| | | o3 = tmpList[4].avg() |
| | | pm25 = tmpList[5].avg() |
| | | pm10 = tmpList[6].avg() |
| | | temperature = tmpList[7].avg() |
| | | humidity = tmpList[8].avg() |
| | | voc = tmpList[9].avg() |
| | | noi = tmpList[10].avg() |
| | | windSpeed = tmpList[11].avg() |
| | | no = tmpList[12].avg() |
| | | |
| | | if (c != 0) { |
| | | val avgU = u / c |
| | | val avgV = v / c |
| | | var a = atan(avgU / avgV) |
| | | a = Math.toDegrees(a) |
| | | /** |
| | | * avgU>0;avgV>0: çå®è§åº¦å¤äºç¬¬ä¸è±¡éï¼ä¿®æ£å¼ä¸º+0° |
| | | * avgU>0;avgV<0: çå®è§åº¦å¤äºç¬¬äºè±¡éï¼ä¿®æ£å¼ä¸º+180° |
| | | * avgU<0;avgV<0: çå®è§åº¦å¤äºç¬¬ä¸è±¡éï¼ä¿®æ£å¼ä¸º+180° |
| | | * avgU<0;avgV>0: çå®è§åº¦å¤äºç¬¬å象éï¼ä¿®æ£å¼ä¸º+360° |
| | | */ |
| | | a += if (avgV > 0) { |
| | | if (avgU > 0) 0 else 360 |
| | | } else { |
| | | 180 |
| | | } |
| | | windDirection = round(a.toFloat()) |
| | | } |
| | | } |
| | | } |
| | | /** GridDataDetail-over ********************************************************************/ |
| | |
| | | private String mixDataId; |
| | | |
| | | /** |
| | | * æå±åºåï¼èµ°èªçæµèåç½æ ¼ï¼ |
| | | */ |
| | | private String zone; |
| | | |
| | | /** |
| | | * å¤§æ°æ±¡æç级ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | @Column(name = "pollution_degree") |
| | | private String pollutionDegree; |
| | | |
| | | /** |
| | | * å¤§æ°æ±¡æç级ç¼å·ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | @Column(name = "pollution_degree_index") |
| | | private Integer pollutionDegreeIndex; |
| | | |
| | | /** |
| | | * èµ°èªä»»å¡ç¼å· |
| | | */ |
| | | @Column(name = "mission_code") |
| | | private String missionCode; |
| | | |
| | | @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; |
| | | |
| | | /** |
| | | * æå¤æ¯æ¥çæ¶æ®µï¼"忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | */ |
| | | @Column(name = "day_time_period") |
| | | private String dayTimePeriod; |
| | | |
| | | /** |
| | | * æ¥æ¶æ®µå¼å§æ¶é´ |
| | | */ |
| | | @Column(name = "day_time_period_start") |
| | | private Date dayTimePeriodStart; |
| | | |
| | | /** |
| | | * æ¥æ¶æ®µç»ææ¶é´ |
| | | */ |
| | | @Column(name = "day_time_period_end") |
| | | private Date dayTimePeriodEnd; |
| | | |
| | | /** |
| | | * @return id |
| | | */ |
| | | public Integer getId() { |
| | |
| | | public void setMixDataId(String mixDataId) { |
| | | this.mixDataId = mixDataId == null ? null : mixDataId.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæå±åºåï¼èµ°èªçæµèåç½æ ¼ï¼ |
| | | * |
| | | * @return zone - æå±åºåï¼èµ°èªçæµèåç½æ ¼ï¼ |
| | | */ |
| | | public String getZone() { |
| | | return zone; |
| | | } |
| | | |
| | | /** |
| | | * 设置æå±åºåï¼èµ°èªçæµèåç½æ ¼ï¼ |
| | | * |
| | | * @param zone æå±åºåï¼èµ°èªçæµèåç½æ ¼ï¼ |
| | | */ |
| | | public void setZone(String zone) { |
| | | this.zone = zone == null ? null : zone.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¤§æ°æ±¡æç级ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | * |
| | | * @return pollution_degree - å¤§æ°æ±¡æç级ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | public String getPollutionDegree() { |
| | | return pollutionDegree; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®å¤§æ°æ±¡æç级ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | * |
| | | * @param pollutionDegree å¤§æ°æ±¡æç级ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | public void setPollutionDegree(String pollutionDegree) { |
| | | this.pollutionDegree = pollutionDegree == null ? null : pollutionDegree.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¤§æ°æ±¡æç级ç¼å·ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | * |
| | | * @return pollution_degree_index - å¤§æ°æ±¡æç级ç¼å·ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | public Integer getPollutionDegreeIndex() { |
| | | return pollutionDegreeIndex; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®å¤§æ°æ±¡æç级ç¼å·ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | * |
| | | * @param pollutionDegreeIndex å¤§æ°æ±¡æç级ç¼å·ï¼ä¼ãè¯ã轻度污æãä¸åº¦æ±¡æãé度污æï¼ |
| | | */ |
| | | public void setPollutionDegreeIndex(Integer pollutionDegreeIndex) { |
| | | this.pollutionDegreeIndex = pollutionDegreeIndex; |
| | | } |
| | | |
| | | /** |
| | | * è·åèµ°èªä»»å¡ç¼å· |
| | | * |
| | | * @return mission_code - èµ°èªä»»å¡ç¼å· |
| | | */ |
| | | public String getMissionCode() { |
| | | return missionCode; |
| | | } |
| | | |
| | | /** |
| | | * 设置走èªä»»å¡ç¼å· |
| | | * |
| | | * @param missionCode èµ°èªä»»å¡ç¼å· |
| | | */ |
| | | public void setMissionCode(String missionCode) { |
| | | this.missionCode = missionCode == null ? null : missionCode.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @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(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæå¤æ¯æ¥çæ¶æ®µï¼"忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | * |
| | | * @return day_time_period - æå¤æ¯æ¥çæ¶æ®µï¼"忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | */ |
| | | public String getDayTimePeriod() { |
| | | return dayTimePeriod; |
| | | } |
| | | |
| | | /** |
| | | * 设置æå¤æ¯æ¥çæ¶æ®µï¼"忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | * |
| | | * @param dayTimePeriod æå¤æ¯æ¥çæ¶æ®µï¼"忍 0 - 6", "æ©ä¸ 6 - 9", "ä¸å 9 - 12", "ä¸å 12 - 14", "ä¸å 14 - 17", "åæ 17 - 20", "å¤é´ 20 - 0" |
| | | */ |
| | | public void setDayTimePeriod(String dayTimePeriod) { |
| | | this.dayTimePeriod = dayTimePeriod == null ? null : dayTimePeriod.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥æ¶æ®µå¼å§æ¶é´ |
| | | * |
| | | * @return day_time_period_start - æ¥æ¶æ®µå¼å§æ¶é´ |
| | | */ |
| | | public Date getDayTimePeriodStart() { |
| | | return dayTimePeriodStart; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æ¥æ¶æ®µå¼å§æ¶é´ |
| | | * |
| | | * @param dayTimePeriodStart æ¥æ¶æ®µå¼å§æ¶é´ |
| | | */ |
| | | public void setDayTimePeriodStart(Date dayTimePeriodStart) { |
| | | this.dayTimePeriodStart = dayTimePeriodStart; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥æ¶æ®µç»ææ¶é´ |
| | | * |
| | | * @return day_time_period_end - æ¥æ¶æ®µç»ææ¶é´ |
| | | */ |
| | | public Date getDayTimePeriodEnd() { |
| | | return dayTimePeriodEnd; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æ¥æ¶æ®µç»ææ¶é´ |
| | | * |
| | | * @param dayTimePeriodEnd æ¥æ¶æ®µç»ææ¶é´ |
| | | */ |
| | | public void setDayTimePeriodEnd(Date dayTimePeriodEnd) { |
| | | this.dayTimePeriodEnd = dayTimePeriodEnd; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * å°èµ°èªç½æ ¼æ°æ®çæå¯¹åºççåç½æ ¼å¾ |
| | | * @param groupId 使ç¨çç½æ ¼ç»id |
| | | * @param gridDataDetail 使ç¨çèµ°èªç½æ ¼æ°æ® |
| | | * @param gridDataDetailList 使ç¨çèµ°èªç½æ ¼æ°æ® |
| | | */ |
| | | fun buildHeatmap(groupId: Int, gridDataDetail: List<GridDataDetail>): List<GridDataDetail> |
| | | fun buildHeatmap(groupId: Int, gridDataDetailList: List<GridDataDetail>, searchLength:Int): List<GridDataDetail> |
| | | } |
| | |
| | | package com.flightfeather.uav.lightshare.service.impl |
| | | |
| | | import com.flightfeather.uav.biz.satellite.GridGroupOption |
| | | import com.flightfeather.uav.biz.satellite.SatelliteGridManage |
| | | import com.flightfeather.uav.biz.satellite.SatelliteGridUtil |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | 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.domain.entity.GridGroup |
| | | import com.flightfeather.uav.common.utils.TimeUtil |
| | | import com.flightfeather.uav.domain.entity.* |
| | | import com.flightfeather.uav.domain.repository.MissionRep |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import com.flightfeather.uav.domain.repository.SatelliteGridRep |
| | |
| | | val mission = missionRep.findOne(missionCode) ?: throw BizException("ä»»å¡ä¸åå¨") |
| | | val data = realTimeDataRep.fetchData(mission) |
| | | |
| | | // æ¥æ¾æ¯å¦å·²æèµ°èªèåè®°å½ |
| | | val oldGridDataList = satelliteGridRep.fetchGridData(GridData().apply { |
| | | this.groupId = groupId |
| | | mixDataId = missionCode |
| | | this.type = SatelliteDataType.Monitor.value.toByte() |
| | | }) |
| | | |
| | | if (oldGridDataList.isEmpty()) { |
| | |
| | | this.groupId = groupId |
| | | dataTime = mission.startTime |
| | | type = SatelliteDataType.Monitor.value.toByte() |
| | | mixDataId = mission.missionCode |
| | | this.missionCode = mission.missionCode |
| | | // Fixme 2025.3.27: è¡æ¿åºåå¨èµ°èªä»»å¡æ·»å 对åºå段åè¿è¡èµå¼ |
| | | provinceCode |
| | | provinceName |
| | | cityCode |
| | | cityName |
| | | districtCode |
| | | districtName = mission.districtName |
| | | // Fixme 2025.3.27: æå±çæµç¹åºåç®åéè¦éè¿ç¨æ·éæ©ç¡®å® |
| | | zone |
| | | pollutionDegreeIndex |
| | | pollutionDegree |
| | | |
| | | val period = TimeUtil.getDayTimeTag(mission.startTime, mission.endTime) |
| | | dayTimePeriod = period?.first |
| | | dayTimePeriodStart = period?.second |
| | | dayTimePeriodEnd = period?.third |
| | | } |
| | | satelliteGridRep.insertGridData(newGridData) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | override fun buildHeatmap(groupId: Int, gridDataDetail: List<GridDataDetail>): List<GridDataDetail> { |
| | | override fun buildHeatmap(groupId: Int, gridDataDetailList: List<GridDataDetail>, searchLength:Int): List<GridDataDetail> { |
| | | val gridCellList = satelliteGridRep.fetchGridCell(groupId) |
| | | val originCellIdList = gridDataDetailList.map { it.cellId } |
| | | // Fixme 2025.3.24: æ¤å¤æ ¹æ®ç°æçç½æ ¼ä¿¡æ¯è®¾è®¡æ¹å¼ï¼ä½¿ç¨ä¸´æ¶çåæ°ï¼åç»å°ç½æ ¼éè¿äºç»´åæ å½¢å¼è¡¨ç¤ºï¼æ¤å¤åæ°å»é¤ |
| | | val option = GridGroupOption(120, 90, 10, 10) |
| | | |
| | | val resMap = mutableMapOf<Int, MutableList<GridDataDetail>>() |
| | | |
| | | // 循ç¯è®¡ç®æ¯ä¸ªç½æ ¼çå¨è¾¹æ©æ£ç½æ ¼ç»æ |
| | | gridDataDetailList.forEach {gdd -> |
| | | SatelliteGridManage.heatMap(gdd, gridCellList, option, searchLength).forEach {r -> |
| | | if (!originCellIdList.contains(r.cellId)) { |
| | | if (!resMap.containsKey(r.cellId)) { |
| | | resMap[r.cellId] = mutableListOf() |
| | | } |
| | | resMap[r.cellId]?.add(r) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å°ææç»ææ ¼å¼åï¼åæ¶éå ç½æ ¼è¿è¡çæµæ°æ®åå¼è®¡ç® |
| | | val result = mutableListOf<GridDataDetail>() |
| | | resMap.forEach { (_, v) -> |
| | | result.add(v.avg().apply { |
| | | this.dataId = v.first().dataId |
| | | this.groupId = v.first().groupId |
| | | this.cellId = v.first().cellId |
| | | }) |
| | | } |
| | | result.addAll(gridDataDetailList) |
| | | |
| | | return result |
| | | } |
| | | } |
| | |
| | | @PostMapping("/product/underway/heatmap/build") |
| | | fun buildUnderwayHeatmap( |
| | | @ApiParam("使ç¨çç½æ ¼ç»id") @RequestParam groupId: Int, |
| | | @ApiParam("使ç¨çèµ°èªç½æ ¼æ°æ®") @RequestBody gridDataDetail: List<GridDataDetail> |
| | | ) = resPack { satelliteDataCalculateService.buildHeatmap(groupId, gridDataDetail) } |
| | | @ApiParam("æç´¢ç½æ ¼è·ç¦»") @RequestParam searchLength:Int, |
| | | @ApiParam("使ç¨çèµ°èªç½æ ¼æ°æ®") @RequestBody gridDataDetailList: List<GridDataDetail> |
| | | ) = resPack { satelliteDataCalculateService.buildHeatmap(groupId, gridDataDetailList, searchLength) } |
| | | } |
| | |
| | | return rMap |
| | | } |
| | | |
| | | /** |
| | | * å°è®¡ç®ç»ææ ¼å¼å为å¤å±çº§çé®å¯¹å¼ç»æ |
| | | * 第ä¸å±æç
§ä¸åæ±¡ææºçç´¢å¼å¼è¿è¡åç±» |
| | | * 第äºå±æç
§çæµå åç±»åè¿è¡åç±» |
| | | * 第ä¸å±æç
§èªå®ä¹çæ ç¾è¿è¡åç±» |
| | | */ |
| | | private fun formatConversion2(e: BaseEffect) { |
| | | val rKey = "${e.sourceName};${e.index}" |
| | | if (!rMap.containsKey(rKey)) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.model |
| | | |
| | | /** |
| | | * |
| | | * @date 2025/3/24 |
| | | * @author feiyu02 |
| | | */ |
| | | open class BaseNoSection<M : BaseMData, S : BaseSOP> : BaseSection<M, S>() { |
| | | |
| | | override val sectionValues: List<Double> = listOf(1.0) |
| | | |
| | | override val sectionType: List<String> = listOf("综å") |
| | | |
| | | override val tagClz: Class<out BaseTag> = NoTag::class.java |
| | | |
| | | override fun onSectionValue(mData: M, sop: S, effect: BaseEffect): Double { |
| | | return .0 |
| | | } |
| | | } |
| | |
| | | * Source of pollution |
| | | * æ±¡ææº åºç±» |
| | | */ |
| | | open class BaseSOP() { |
| | | open class BaseSOP(val sourceId: String, val sourceName: String, val index: String) { |
| | | |
| | | // æ±¡ææºæ è¯ |
| | | lateinit var sourceId: String |
| | | lateinit var sourceName: String |
| | | lateinit var index: String |
| | | |
| | | constructor(sourceId: String, sourceName: String, index: String) : this() { |
| | | this.sourceId = sourceId |
| | | this.sourceName = sourceName |
| | | this.index = index |
| | | } |
| | | // lateinit var sourceId: String |
| | | // lateinit var sourceName: String |
| | | // lateinit var index: String |
| | | // |
| | | // constructor() : this() { |
| | | // this.sourceId = sourceId |
| | | // this.sourceName = sourceName |
| | | // this.index = index |
| | | // } |
| | | /** |
| | | * ä¸å¿ç»åº¦ |
| | | */ |
| | |
| | | /** |
| | | * ä¸ååç±»ç»è®¡ |
| | | */ |
| | | class NoSection : BaseSection<DataVo, BaseSOP>() { |
| | | override val sectionValues: List<Double> = listOf(1.0) |
| | | |
| | | override val sectionType: List<String> = listOf("综å") |
| | | |
| | | override val tagClz: Class<out BaseTag> = NoTag::class.java |
| | | |
| | | override fun onSectionValue(mData: DataVo, sop: BaseSOP, effect: BaseEffect): Double { |
| | | return .0 |
| | | } |
| | | } |
| | | class NoSection : BaseNoSection<DataVo, BaseSOP>() |
| | |
| | | |
| | | override fun getFactorData(type: FactorType): Double? { |
| | | return when (type) { |
| | | // NO2 -> NO2 |
| | | // CO -> CO |
| | | // H2S -> H2S |
| | | // SO2 -> SO2 |
| | | // O3 -> O3 |
| | | NO2 -> gridDataDetail.no2.toDouble() |
| | | CO -> gridDataDetail.co.toDouble() |
| | | H2S -> gridDataDetail.h2s.toDouble() |
| | | SO2 -> gridDataDetail.so2.toDouble() |
| | | O3 -> gridDataDetail.o3.toDouble() |
| | | PM25 -> gridDataDetail.pm25.toDouble() |
| | | // PM10 -> PM10 |
| | | // TEMPERATURE -> TEMPERATURE |
| | | // HUMIDITY -> HUMIDITY |
| | | // VOC -> VOC |
| | | // NOI -> NOI |
| | | // LNG -> LNG |
| | | // LAT -> LAT |
| | | // VELOCITY -> VELOCITY |
| | | // TIME -> TIME |
| | | // WIND_SPEED -> WIND_SPEED |
| | | // WIND_DIRECTION -> WIND_DIRECTION |
| | | // HEIGHT -> HEIGHT |
| | | // NO -> NO |
| | | PM10 -> gridDataDetail.pm10.toDouble() |
| | | TEMPERATURE -> gridDataDetail.temperature.toDouble() |
| | | HUMIDITY -> gridDataDetail.humidity.toDouble() |
| | | VOC -> gridDataDetail.voc.toDouble() |
| | | NOI -> gridDataDetail.noi.toDouble() |
| | | WIND_SPEED -> gridDataDetail.windSpeed.toDouble() |
| | | WIND_DIRECTION -> gridDataDetail.windDirection.toDouble() |
| | | NO -> gridDataDetail.no.toDouble() |
| | | else -> null |
| | | } |
| | | } |
| | |
| | | class GridCellSop : BaseSOP { |
| | | val gridCell:GridCell |
| | | |
| | | constructor(gridCell: GridCell) : super(){ |
| | | constructor(gridCell: GridCell) : super("", "", "") { |
| | | this.gridCell = gridCell |
| | | } |
| | | constructor(gridCell: GridCell, sourceId: String, sourceName: String, index: String) : super( |
| | |
| | | package com.flightfeather.uav.model.underwaygrid |
| | | |
| | | import com.flightfeather.uav.model.BaseDataPrep |
| | | import com.flightfeather.uav.model.BaseModel |
| | | import com.flightfeather.uav.model.BaseSection |
| | | import com.flightfeather.uav.model.BaseWeight |
| | | import com.flightfeather.uav.model.* |
| | | import com.flightfeather.uav.model.epw.NoSection |
| | | import com.flightfeather.uav.model.epw.WeightType |
| | | import com.flightfeather.uav.socket.eunm.FactorType |
| | | |
| | |
| | | |
| | | override var weights: List<BaseWeight<GridCellAndData, GridCellSop>> = listOf(GridWindDirWeight(), GridWindDisWeight()) |
| | | |
| | | override var sections: List<BaseSection<GridCellAndData, GridCellSop>> = emptyList() |
| | | override var sections: List<BaseSection<GridCellAndData, GridCellSop>> = listOf(BaseNoSection()) |
| | | |
| | | override fun mDataCheck(m: GridCellAndData): Boolean { |
| | | return m.gridDataDetail.pm25 != null |
| | |
| | | <!-- <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_detail" domainObjectName="GridDataDetail" 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> |
| | |
| | | <result column="data_time" jdbcType="TIMESTAMP" property="dataTime" /> |
| | | <result column="type" jdbcType="TINYINT" property="type" /> |
| | | <result column="mix_data_id" jdbcType="VARCHAR" property="mixDataId" /> |
| | | <result column="zone" jdbcType="VARCHAR" property="zone" /> |
| | | <result column="pollution_degree" jdbcType="VARCHAR" property="pollutionDegree" /> |
| | | <result column="pollution_degree_index" jdbcType="INTEGER" property="pollutionDegreeIndex" /> |
| | | <result column="mission_code" jdbcType="VARCHAR" property="missionCode" /> |
| | | <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" /> |
| | | <result column="day_time_period" jdbcType="VARCHAR" property="dayTimePeriod" /> |
| | | <result column="day_time_period_start" jdbcType="TIMESTAMP" property="dayTimePeriodStart" /> |
| | | <result column="day_time_period_end" jdbcType="TIMESTAMP" property="dayTimePeriodEnd" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, group_id, data_time, type, mix_data_id |
| | | id, group_id, data_time, type, mix_data_id, zone, pollution_degree, pollution_degree_index, |
| | | mission_code, province_code, province_name, city_code, city_name, district_code, |
| | | district_name, town_code, town_name, day_time_period, day_time_period_start, day_time_period_end |
| | | </sql> |
| | | </mapper> |
| | |
| | | import com.flightfeather.uav.common.utils.DateUtil |
| | | import com.flightfeather.uav.common.utils.FileExchange |
| | | import com.flightfeather.uav.common.utils.FileUtil |
| | | import com.flightfeather.uav.common.utils.TimeUtil |
| | | import com.flightfeather.uav.domain.entity.BaseRealTimeData |
| | | import com.flightfeather.uav.domain.entity.Company |
| | | import com.flightfeather.uav.domain.entity.GridDataDetail |
| | |
| | | |
| | | println(dataDetail) |
| | | } |
| | | |
| | | @Test |
| | | fun getDayTimeTag() { |
| | | val period = TimeUtil.getDayTimeTag( |
| | | Date(2024, 10, 10, 10, 25, 0), |
| | | Date(2024, 10, 10, 14, 40, 0) |
| | | ) |
| | | |
| | | println("${period?.first};${period?.second};${period?.third}") |
| | | } |
| | | } |
| | |
| | | package com.flightfeather.uav.lightshare.service.impl |
| | | |
| | | import com.flightfeather.uav.common.utils.TimeUtil |
| | | import com.flightfeather.uav.domain.entity.GridData |
| | | import com.flightfeather.uav.domain.entity.GridDataDetail |
| | | import com.flightfeather.uav.domain.mapper.GridDataDetailMapper |
| | | import com.flightfeather.uav.domain.mapper.GridDataMapper |
| | | import com.flightfeather.uav.domain.mapper.MissionMapper |
| | | import com.flightfeather.uav.lightshare.eunm.SatelliteDataType |
| | | import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService |
| | | import org.junit.Test |
| | | import org.junit.runner.RunWith |
| | |
| | | lateinit var satelliteDataCalculateService: SatelliteDataCalculateService |
| | | |
| | | @Autowired |
| | | lateinit var gridDataMapper: GridDataMapper |
| | | |
| | | @Autowired |
| | | lateinit var gridDataDetailMapper: GridDataDetailMapper |
| | | |
| | | @Autowired |
| | | lateinit var missionMapper: MissionMapper |
| | | |
| | | /** |
| | | * å·æ°æ¯ç»æ°æ®çæ°æ®æå |
| | |
| | | fun dataFusion() { |
| | | val missionList = |
| | | listOf( |
| | | "SH-CN-20241216", |
| | | "SH-CN-20241202", |
| | | "SH-CN-20241127", |
| | | "SH-CN-20241126-1", |
| | | "SH-CN-20241126-2", |
| | | "SH-CN-20241108", |
| | | "SH-CN-20240823" |
| | | // "SH-CN-20241216", |
| | | // "SH-CN-20241202", |
| | | // "SH-CN-20241127", |
| | | // "SH-CN-20241126-1", |
| | | // "SH-CN-20241126-2", |
| | | // "SH-CN-20241108", |
| | | // "SH-CN-20240823" |
| | | "SH-CN-20240723-01", |
| | | "SH-CN-20240723-02", |
| | | "SH-CN-20240830", |
| | | "SH-CN-20240906", |
| | | "SH-CN-20241204", |
| | | "SH-CN-20241210", |
| | | "SH-CN-20241213", |
| | | "SH-CN-20241218", |
| | | "SH-CN-20241220", |
| | | "SH-CN-20241224", |
| | | "SH-CN-20241226", |
| | | "SH-CN-20241227", |
| | | "SH-CN-20241231", |
| | | "SH-CN-20250106", |
| | | "SH-CN-20250108", |
| | | "SH-CN-20250113", |
| | | "SH-CN-20250116", |
| | | "SH-CN-20250120" |
| | | ) |
| | | missionList.forEach { m -> |
| | | satelliteDataCalculateService.dataFusion(m, 3) |
| | |
| | | } |
| | | |
| | | @Test |
| | | fun splitDataAndDataFusion() { |
| | | fun refreshDayTimePeriod() { |
| | | gridDataMapper.select(GridData().apply { type = SatelliteDataType.Monitor.value.toByte() }).forEach { gd -> |
| | | missionMapper.selectByPrimaryKey(gd?.missionCode)?.let { m -> |
| | | TimeUtil.getDayTimeTag(m.startTime, m.endTime)?.let { p -> |
| | | gd?.dayTimePeriod = p.first |
| | | gd?.dayTimePeriodStart = p.second |
| | | gd?.dayTimePeriodEnd = p.third |
| | | |
| | | gridDataMapper.updateByPrimaryKey(gd) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |