feiyu02
2024-12-16 b3e273990fda27b68dfcf2c7f9d78311a5279885
1. 新增卫星遥测相关接口逻辑
已修改7个文件
已添加17个文件
1154 ■■■■■ 文件已修改
src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java 286 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/entity/GridData.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/entity/GridDataDetail.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridCellMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/mapper/GridGroupMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-test.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/generator/generatorConfig.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/GridCellMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/GridDataDetailMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/GridDataMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/GridGroupMapper.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/com/flightfeather/uav/Test.kt 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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}")
        }
    }
}