src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,286 @@ package com.flightfeather.uav.domain.entity; import java.math.BigDecimal; import javax.persistence.*; @Table(name = "grid_cell") public class GridCell { @Id private Integer id; /** * æå±ç½æ ¼åç»id */ @Column(name = "group_id") private Integer groupId; /** * 纬度 */ private BigDecimal latitude; /** * ç»åº¦ */ private BigDecimal longitude; /** * ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ @Column(name = "point1_lon") private String point1Lon; /** * ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ @Column(name = "point1_lat") private String point1Lat; /** * ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ @Column(name = "point2_lon") private String point2Lon; /** * ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ @Column(name = "point2_lat") private String point2Lat; /** * ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ @Column(name = "point3_lon") private String point3Lon; /** * ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ @Column(name = "point3_lat") private String point3Lat; /** * ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ @Column(name = "point4_lon") private String point4Lon; /** * ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ @Column(name = "point4_lat") private String point4Lat; /** * @return id */ public Integer getId() { return id; } /** * @param id */ public void setId(Integer id) { this.id = id; } /** * è·åæå±ç½æ ¼åç»id * * @return group_id - æå±ç½æ ¼åç»id */ public Integer getGroupId() { return groupId; } /** * 设置æå±ç½æ ¼åç»id * * @param groupId æå±ç½æ ¼åç»id */ public void setGroupId(Integer groupId) { this.groupId = groupId; } /** * è·å纬度 * * @return latitude - 纬度 */ public BigDecimal getLatitude() { return latitude; } /** * 设置纬度 * * @param latitude 纬度 */ public void setLatitude(BigDecimal latitude) { this.latitude = latitude; } /** * è·åç»åº¦ * * @return longitude - ç»åº¦ */ public BigDecimal getLongitude() { return longitude; } /** * 设置ç»åº¦ * * @param longitude ç»åº¦ */ public void setLongitude(BigDecimal longitude) { this.longitude = longitude; } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @return point1_lon - ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public String getPoint1Lon() { return point1Lon; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @param point1Lon ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public void setPoint1Lon(String point1Lon) { this.point1Lon = point1Lon == null ? null : point1Lon.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @return point1_lat - ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public String getPoint1Lat() { return point1Lat; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @param point1Lat ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public void setPoint1Lat(String point1Lat) { this.point1Lat = point1Lat == null ? null : point1Lat.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @return point2_lon - ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public String getPoint2Lon() { return point2Lon; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @param point2Lon ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public void setPoint2Lon(String point2Lon) { this.point2Lon = point2Lon == null ? null : point2Lon.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @return point2_lat - ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public String getPoint2Lat() { return point2Lat; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @param point2Lat ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public void setPoint2Lat(String point2Lat) { this.point2Lat = point2Lat == null ? null : point2Lat.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @return point3_lon - ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public String getPoint3Lon() { return point3Lon; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @param point3Lon ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public void setPoint3Lon(String point3Lon) { this.point3Lon = point3Lon == null ? null : point3Lon.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @return point3_lat - ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public String getPoint3Lat() { return point3Lat; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @param point3Lat ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public void setPoint3Lat(String point3Lat) { this.point3Lat = point3Lat == null ? null : point3Lat.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @return point4_lon - ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public String getPoint4Lon() { return point4Lon; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ * * @param point4Lon ç©å½¢ç½æ ¼é¡¶ç¹ç»åº¦ */ public void setPoint4Lon(String point4Lon) { this.point4Lon = point4Lon == null ? null : point4Lon.trim(); } /** * è·åç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @return point4_lat - ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public String getPoint4Lat() { return point4Lat; } /** * 设置ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ * * @param point4Lat ç©å½¢ç½æ ¼é¡¶ç¹çº¬åº¦ */ public void setPoint4Lat(String point4Lat) { this.point4Lat = point4Lat == null ? null : point4Lat.trim(); } } src/main/kotlin/com/flightfeather/uav/domain/entity/GridData.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,119 @@ package com.flightfeather.uav.domain.entity; import java.util.Date; import javax.persistence.*; @Table(name = "grid_data") public class GridData { @Id private Integer id; /** * ç½æ ¼åç»id */ @Column(name = "group_id") private Integer groupId; /** * æ°æ®æ¶é´ */ @Column(name = "data_time") private Date dataTime; /** * æ°æ®ç±»åï¼0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ® */ private Byte type; /** * èåçæ°æ®ä¸»é®idï¼idä¹é´ç¨,åé */ @Column(name = "mix_data_id") private String mixDataId; /** * @return id */ public Integer getId() { return id; } /** * @param id */ public void setId(Integer id) { this.id = id; } /** * è·åç½æ ¼åç»id * * @return group_id - ç½æ ¼åç»id */ public Integer getGroupId() { return groupId; } /** * è®¾ç½®ç½æ ¼åç»id * * @param groupId ç½æ ¼åç»id */ public void setGroupId(Integer groupId) { this.groupId = groupId; } /** * è·åæ°æ®æ¶é´ * * @return data_time - æ°æ®æ¶é´ */ public Date getDataTime() { return dataTime; } /** * è®¾ç½®æ°æ®æ¶é´ * * @param dataTime æ°æ®æ¶é´ */ public void setDataTime(Date dataTime) { this.dataTime = dataTime; } /** * è·åæ°æ®ç±»åï¼0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ® * * @return type - æ°æ®ç±»åï¼0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ® */ public Byte getType() { return type; } /** * è®¾ç½®æ°æ®ç±»åï¼0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ® * * @param type æ°æ®ç±»åï¼0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ® */ public void setType(Byte type) { this.type = type; } /** * è·åèåçæ°æ®ä¸»é®idï¼idä¹é´ç¨,åé * * @return mix_data_id - èåçæ°æ®ä¸»é®idï¼idä¹é´ç¨,åé */ public String getMixDataId() { return mixDataId; } /** * 设置èåçæ°æ®ä¸»é®idï¼idä¹é´ç¨,åé * * @param mixDataId èåçæ°æ®ä¸»é®idï¼idä¹é´ç¨,åé */ public void setMixDataId(String mixDataId) { this.mixDataId = mixDataId == null ? null : mixDataId.trim(); } } src/main/kotlin/com/flightfeather/uav/domain/entity/GridDataDetail.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,128 @@ package com.flightfeather.uav.domain.entity; import javax.persistence.*; @Table(name = "grid_data_detail") public class GridDataDetail { @Id private Integer id; /** * æå±æ°æ®ç»id */ @Column(name = "data_id") private Integer dataId; /** * æå±ç½æ ¼åç»id */ @Column(name = "group_id") private Integer groupId; /** * æå±ç½æ ¼id */ @Column(name = "cell_id") private Integer cellId; @Column(name = "PM25") private Float pm25; private Integer rank; /** * @return id */ public Integer getId() { return id; } /** * @param id */ public void setId(Integer id) { this.id = id; } /** * è·åæå±æ°æ®ç»id * * @return data_id - æå±æ°æ®ç»id */ public Integer getDataId() { return dataId; } /** * 设置æå±æ°æ®ç»id * * @param dataId æå±æ°æ®ç»id */ public void setDataId(Integer dataId) { this.dataId = dataId; } /** * è·åæå±ç½æ ¼åç»id * * @return group_id - æå±ç½æ ¼åç»id */ public Integer getGroupId() { return groupId; } /** * 设置æå±ç½æ ¼åç»id * * @param groupId æå±ç½æ ¼åç»id */ public void setGroupId(Integer groupId) { this.groupId = groupId; } /** * è·åæå±ç½æ ¼id * * @return cell_id - æå±ç½æ ¼id */ public Integer getCellId() { return cellId; } /** * 设置æå±ç½æ ¼id * * @param cellId æå±ç½æ ¼id */ public void setCellId(Integer cellId) { this.cellId = cellId; } /** * @return PM25 */ public Float getPm25() { return pm25; } /** * @param pm25 */ public void setPm25(Float pm25) { this.pm25 = pm25; } /** * @return rank */ public Integer getRank() { return rank; } /** * @param rank */ public void setRank(Integer rank) { this.rank = rank; } } src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,200 @@ package com.flightfeather.uav.domain.entity; import java.util.Date; import javax.persistence.*; @Table(name = "grid_group") public class GridGroup { @Id private Integer id; /** * ç½æ ¼åç§° */ private String name; @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; @Column(name = "create_time") private Date createTime; /** * @return id */ public Integer getId() { return id; } /** * @param id */ public void setId(Integer id) { this.id = id; } /** * è·åç½æ ¼åç§° * * @return name - ç½æ ¼åç§° */ public String getName() { return name; } /** * è®¾ç½®ç½æ ¼åç§° * * @param name ç½æ ¼åç§° */ public void setName(String name) { this.name = name == null ? null : name.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 towm_name */ public String getTownName() { return townName; } /** * @param townName */ public void setTownName(String townName) { this.townName = townName == null ? null : townName.trim(); } /** * @return create_time */ public Date getCreateTime() { return createTime; } /** * @param createTime */ public void setCreateTime(Date createTime) { this.createTime = createTime; } } src/main/kotlin/com/flightfeather/uav/domain/mapper/GridCellMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.flightfeather.uav.domain.mapper import com.flightfeather.uav.domain.MyMapper import com.flightfeather.uav.domain.entity.GridCell import org.apache.ibatis.annotations.Mapper @Mapper interface GridCellMapper : MyMapper<GridCell?> src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.flightfeather.uav.domain.mapper import com.flightfeather.uav.domain.MyMapper import com.flightfeather.uav.domain.entity.GridDataDetail import org.apache.ibatis.annotations.Mapper @Mapper interface GridDataDetailMapper : MyMapper<GridDataDetail?> src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.flightfeather.uav.domain.mapper import com.flightfeather.uav.domain.MyMapper import com.flightfeather.uav.domain.entity.GridData import org.apache.ibatis.annotations.Mapper @Mapper interface GridDataMapper : MyMapper<GridData?> src/main/kotlin/com/flightfeather/uav/domain/mapper/GridGroupMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.flightfeather.uav.domain.mapper import com.flightfeather.uav.domain.MyMapper import com.flightfeather.uav.domain.entity.GridGroup import org.apache.ibatis.annotations.Mapper @Mapper interface GridGroupMapper : MyMapper<GridGroup?> src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt
@@ -48,37 +48,6 @@ } } } // var result = listOf<BaseRealTimeData>() // when (deviceType) { // UWDeviceType.VEHICLE -> { // result = realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { // getSecondDataExample(this, deviceCode, sTime, eTime) // }) // } // UWDeviceType.UAV -> { // result = realTimeDataUavMapper.selectByExample(Example(RealTimeDataUav::class.java).apply { // getSecondDataExample(this, deviceCode, sTime, eTime) // }) // } // UWDeviceType.GRID -> { // // ç½æ ¼åçæµç§çº§å¼ // result = if (type == null || type == 0) { // realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { // getSecondDataExample(this, deviceCode, sTime, eTime) // }) // } // // ç½æ ¼åçæµåéå¼ // else { // realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { // getSecondDataExample(this, deviceCode, sTime, eTime) // }) // } // } // else -> Unit // } // return result } fun fetchData(mission: Mission) = @@ -87,13 +56,6 @@ fun saveData(deviceType: UWDeviceType?, data: List<BaseRealTimeData>, type: Int? = 0): Int { return delegate.insertByDeviceType(deviceType, type, data) // return when (deviceType) { // UWDeviceType.UAV -> realTimeDataUavMapper.insertList(data as List<RealTimeDataUav>) // UWDeviceType.VEHICLE -> realTimeDataVehicleMapper.insertList(data as List<RealTimeDataVehicle>) // UWDeviceType.GRID -> realTimeDataGridMapper.insertList(data as List<RealTimeDataGrid>) // UWDeviceType.BOAT -> 0 // else -> 0 // } } fun deleteData(mission: Mission, type: Int? = 0): Int { src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,62 @@ package com.flightfeather.uav.domain.repository 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.domain.mapper.GridCellMapper import com.flightfeather.uav.domain.mapper.GridDataDetailMapper import com.flightfeather.uav.domain.mapper.GridDataMapper import com.flightfeather.uav.domain.mapper.GridGroupMapper import com.flightfeather.uav.lightshare.bean.AreaVo import org.springframework.stereotype.Repository import tk.mybatis.mapper.entity.Example import java.time.LocalDateTime /** * å«æç½æ ¼é¥æµæ°æ®åºç¸å ³æä½ * @date 2024/12/11 * @author feiyu02 */ @Repository class SatelliteGridRep( private val gridGroupMapper: GridGroupMapper, private val gridCellMapper: GridCellMapper, private val gridDataMapper: GridDataMapper, private val gridDataDetailMapper: GridDataDetailMapper, ) { fun fetchGridGroup(areaVo: AreaVo): List<GridGroup?> { return gridGroupMapper.selectByExample(Example(GridGroup::class.java).apply { createCriteria() .andEqualTo("provinceCode", areaVo.provinceCode).andEqualTo("provinceName", areaVo.provinceName) .andEqualTo("cityCode", areaVo.cityCode).andEqualTo("cityName", areaVo.cityName) .andEqualTo("districtCode", areaVo.districtCode).andEqualTo("districtName", areaVo.districtName) .andEqualTo("townCode", areaVo.townCode).andEqualTo("townName", areaVo.townName) }) } fun fetchGridCell(groupId: Int): List<GridCell?> { return gridCellMapper.selectByExample(Example(GridCell::class.java).apply { createCriteria().andEqualTo("groupId", groupId) orderBy("id") }) } fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?> { return gridDataMapper.selectByExample(Example(GridData::class.java).apply { createCriteria().andEqualTo("groupId", groupId) .andEqualTo("dataTime", dataTime) .andEqualTo("type", type) }) } fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> { return gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply { createCriteria().andEqualTo("dataId", dataId) .andEqualTo("groupId", groupId) .andEqualTo("cellId", cellId) orderBy("cellId") }) } } src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt
@@ -10,6 +10,8 @@ fun createMission(mission: Mission): BaseResponse<Boolean> fun updateMission(mission: Mission): BaseResponse<Boolean> fun deleteMission(missionCode: String): BaseResponse<Boolean> fun deleteMissionAndData(missionCode: String): Boolean src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ 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.domain.entity.GridGroup import com.flightfeather.uav.lightshare.bean.AreaVo import com.flightfeather.uav.lightshare.bean.DataHead import java.time.LocalDateTime /** * * @date 2024/12/5 * @author feiyu02 */ interface SatelliteTelemetryService { fun fetchGridGroup(areaVo: AreaVo, page: Int?, perPage: Int?): Pair<DataHead, List<GridGroup?>> fun fetchGridCell(groupId: Int): List<GridCell?> fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?> fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> } src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt
@@ -47,6 +47,12 @@ } } override fun updateMission(mission: Mission): BaseResponse<Boolean> { missionMapper.updateByPrimaryKey(mission).let { return BaseResponse(it == 1) } } override fun deleteMission(missionCode: String): BaseResponse<Boolean> { missionMapper.deleteByPrimaryKey(missionCode).let { return BaseResponse(it == 1) src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,40 @@ package com.flightfeather.uav.lightshare.service.impl 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.domain.repository.SatelliteGridRep import com.flightfeather.uav.lightshare.bean.AreaVo import com.flightfeather.uav.lightshare.bean.DataHead import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService import com.github.pagehelper.PageHelper import org.springframework.stereotype.Service import java.time.LocalDateTime /** * * @date 2024/12/5 * @author feiyu02 */ @Service class SatelliteTelemetryServiceImpl(private val satelliteGridRep: SatelliteGridRep) : SatelliteTelemetryService { override fun fetchGridGroup(areaVo: AreaVo, page: Int?, perPage: Int?): Pair<DataHead, List<GridGroup?>> { val pageInfo = PageHelper.startPage<GridGroup>(page ?: 1, perPage ?: 100) val res = satelliteGridRep.fetchGridGroup(areaVo) return DataHead(pageInfo.pageNum, pageInfo.pages) to res } override fun fetchGridCell(groupId: Int): List<GridCell?> { return satelliteGridRep.fetchGridCell(groupId) } override fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?> { return satelliteGridRep.fetchGridData(groupId, dataTime, type) } override fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> { return satelliteGridRep.fetchGridDataDetail(dataId, groupId, cellId) } } src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt
@@ -23,6 +23,11 @@ @RequestBody mission: Mission ) = missionService.createMission(mission) @PostMapping("/update") fun updateMission( @RequestBody mission: Mission ) = missionService.updateMission(mission) @PostMapping("/delete") fun deleteMission( @RequestParam("missionCode") missionCode: String src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,52 @@ package com.flightfeather.uav.lightshare.web import com.fasterxml.jackson.annotation.JsonFormat import com.flightfeather.uav.lightshare.bean.AreaVo import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import org.springframework.web.bind.annotation.* import java.time.LocalDateTime /** * 嫿饿µ * @date 2024/12/5 * @author feiyu02 */ @Api(tags = ["嫿饿µAPIæ¥å£"]) @RestController @RequestMapping("air/satellite") class SatelliteTelemetryController(private val satelliteTelemetryService: SatelliteTelemetryService) { @ApiOperation(value = "è·åç½æ ¼ç»ä¿¡æ¯") @PostMapping("/grid/group") fun fetchGridGroup( @RequestBody areaVo: AreaVo, @RequestParam("page", required = false) page: Int?, @RequestParam("per_page", required = false) perPage: Int? ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, page, perPage) } @ApiOperation(value = "è·åç½æ ¼ç»å å ·ä½ç½æ ¼ä¿¡æ¯") @GetMapping("/grid/cell") fun fetchGridCell( @ApiParam("ç½æ ¼ç»id") @RequestParam groupId: Int, ) = resPack { satelliteTelemetryService.fetchGridCell(groupId) } @ApiOperation(value = "è·åç½æ ¼ç»ä¸ç嫿饿µæ°æ®") @GetMapping("/grid/data") fun fetchGridData( @ApiParam("ç½æ ¼ç»id") @RequestParam groupId: Int, @ApiParam("饿µæ°æ®æ¶é´") @RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?, @ApiParam("饿µæ°æ®ç±»å", allowableValues = "0ï¼åå§å«æé¥æµæ°æ®ï¼1ï¼èåæ°æ®") @RequestParam(required = false) type: Int?, ) = resPack { satelliteTelemetryService.fetchGridData(groupId, dataTime, type) } @ApiOperation(value = "è·åç½æ ¼ç»ä¸ç嫿饿µå ·ä½æ°æ®") @GetMapping("/grid/data/detail") fun fetchGridDataDetail( @ApiParam("饿µæ°æ®id") @RequestParam dataId: Int, @ApiParam("ç½æ ¼ç»id") @RequestParam(required = false) groupId: Int?, @ApiParam("ç½æ ¼åå æ ¼id") @RequestParam(required = false) cellId: Int?, ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) } } 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
@@ -55,12 +55,15 @@ <!-- <table tableName="real_time_data_grid" domainObjectName="RealTimeDataGrid" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="real_time_data_uav" domainObjectName="RealTimeDataUav" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="real_time_data_vehicle" domainObjectName="RealTimeDataVehicle" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <table tableName="device_info" domainObjectName="DeviceInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> <!-- <table tableName="device_info" domainObjectName="DeviceInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="factor_calibration" domainObjectName="FactorCalibration" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="real_time_data_grid_min" domainObjectName="RealTimeDataGridMin" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="real_time_data_grid_opt" domainObjectName="RealTimeDataGridOpt" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="scene_info" domainObjectName="SceneInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false"--> <!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <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"/> </context> </generatorConfiguration> src/main/resources/mapper/GridCellMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.flightfeather.uav.domain.mapper.GridCellMapper"> <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.GridCell"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="INTEGER" property="id" /> <result column="group_id" jdbcType="INTEGER" property="groupId" /> <result column="latitude" jdbcType="DECIMAL" property="latitude" /> <result column="longitude" jdbcType="DECIMAL" property="longitude" /> <result column="point1_lon" jdbcType="VARCHAR" property="point1Lon" /> <result column="point1_lat" jdbcType="VARCHAR" property="point1Lat" /> <result column="point2_lon" jdbcType="VARCHAR" property="point2Lon" /> <result column="point2_lat" jdbcType="VARCHAR" property="point2Lat" /> <result column="point3_lon" jdbcType="VARCHAR" property="point3Lon" /> <result column="point3_lat" jdbcType="VARCHAR" property="point3Lat" /> <result column="point4_lon" jdbcType="VARCHAR" property="point4Lon" /> <result column="point4_lat" jdbcType="VARCHAR" property="point4Lat" /> </resultMap> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> id, group_id, latitude, longitude, point1_lon, point1_lat, point2_lon, point2_lat, point3_lon, point3_lat, point4_lon, point4_lat </sql> </mapper> src/main/resources/mapper/GridDataDetailMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.flightfeather.uav.domain.mapper.GridDataDetailMapper"> <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.GridDataDetail"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="INTEGER" property="id" /> <result column="data_id" jdbcType="INTEGER" property="dataId" /> <result column="group_id" jdbcType="INTEGER" property="groupId" /> <result column="cell_id" jdbcType="INTEGER" property="cellId" /> <result column="PM25" jdbcType="REAL" property="pm25" /> <result column="rank" jdbcType="INTEGER" property="rank" /> </resultMap> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> id, data_id, group_id, cell_id, PM25, rank </sql> </mapper> src/main/resources/mapper/GridDataMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.flightfeather.uav.domain.mapper.GridDataMapper"> <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.GridData"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="INTEGER" property="id" /> <result column="group_id" jdbcType="INTEGER" property="groupId" /> <result column="data_time" jdbcType="TIMESTAMP" property="dataTime" /> <result column="type" jdbcType="TINYINT" property="type" /> <result column="mix_data_id" jdbcType="VARCHAR" property="mixDataId" /> </resultMap> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> id, group_id, data_time, type, mix_data_id </sql> </mapper> src/main/resources/mapper/GridGroupMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.flightfeather.uav.domain.mapper.GridGroupMapper"> <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.GridGroup"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="INTEGER" property="id" /> <result column="name" jdbcType="VARCHAR" property="name" /> <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="create_time" jdbcType="TIMESTAMP" property="createTime" /> </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 </sql> </mapper> src/test/kotlin/com/flightfeather/uav/Test.kt
@@ -127,9 +127,6 @@ @Test fun foo17() { repeat(8) { if (it == 5) return@repeat println(it) } val a = listOf(1, 2, 3) } } src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package com.flightfeather.uav.lightshare.service.impl import com.flightfeather.uav.domain.entity.GridDataDetail import com.flightfeather.uav.domain.mapper.GridDataDetailMapper import org.junit.Assert.* 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 tk.mybatis.mapper.entity.Example @RunWith(SpringRunner::class) @SpringBootTest class SatelliteTelemetryServiceImplTest { @Autowired lateinit var gridDataDetailMapper: GridDataDetailMapper /** * å·æ°æ¯ç»æ°æ®çæ°æ®æå */ @Test fun refreshDataRank() { for (i in 1..25) { val dataDetailList = gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply { createCriteria().andEqualTo("dataId", i) orderBy("pm25").desc() }) dataDetailList.forEachIndexed { i, d -> d?.rank = i + 1 gridDataDetailMapper.updateByPrimaryKey(d) } println("finish --${i}") } } }