From b3e273990fda27b68dfcf2c7f9d78311a5279885 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 16 十二月 2024 17:32:01 +0800 Subject: [PATCH] 1. 新增卫星遥测相关接口逻辑 --- src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java | 200 ++++++++++ src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java | 286 ++++++++++++++ src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt | 38 - src/main/resources/mapper/GridCellMapper.xml | 28 + src/main/kotlin/com/flightfeather/uav/domain/mapper/GridCellMapper.kt | 8 src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt | 8 src/main/resources/mapper/GridDataMapper.xml | 20 + src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt | 37 + src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt | 5 src/main/kotlin/com/flightfeather/uav/domain/entity/GridDataDetail.java | 128 ++++++ src/main/resources/application-test.yml | 12 src/main/kotlin/com/flightfeather/uav/domain/entity/GridData.java | 119 +++++ src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt | 62 +++ src/main/resources/generator/generatorConfig.xml | 9 src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt | 2 src/test/kotlin/com/flightfeather/uav/Test.kt | 5 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt | 40 ++ src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt | 25 + src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt | 6 src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt | 52 ++ src/main/resources/mapper/GridGroupMapper.xml | 27 + src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt | 8 src/main/kotlin/com/flightfeather/uav/domain/mapper/GridGroupMapper.kt | 8 src/main/resources/mapper/GridDataDetailMapper.xml | 21 + 24 files changed, 1,103 insertions(+), 51 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java new file mode 100644 index 0000000..8375cd2 --- /dev/null +++ b/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; + + /** + * 鎵�灞炵綉鏍煎垎缁刬d + */ + @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; + } + + /** + * 鑾峰彇鎵�灞炵綉鏍煎垎缁刬d + * + * @return group_id - 鎵�灞炵綉鏍煎垎缁刬d + */ + public Integer getGroupId() { + return groupId; + } + + /** + * 璁剧疆鎵�灞炵綉鏍煎垎缁刬d + * + * @param groupId 鎵�灞炵綉鏍煎垎缁刬d + */ + 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(); + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridData.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridData.java new file mode 100644 index 0000000..e008649 --- /dev/null +++ b/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; + + /** + * 铻嶅悎鐨勬暟鎹富閿甶d锛宨d涔嬮棿鐢�,鍒嗛殧 + */ + @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; + } + + /** + * 鑾峰彇铻嶅悎鐨勬暟鎹富閿甶d锛宨d涔嬮棿鐢�,鍒嗛殧 + * + * @return mix_data_id - 铻嶅悎鐨勬暟鎹富閿甶d锛宨d涔嬮棿鐢�,鍒嗛殧 + */ + public String getMixDataId() { + return mixDataId; + } + + /** + * 璁剧疆铻嶅悎鐨勬暟鎹富閿甶d锛宨d涔嬮棿鐢�,鍒嗛殧 + * + * @param mixDataId 铻嶅悎鐨勬暟鎹富閿甶d锛宨d涔嬮棿鐢�,鍒嗛殧 + */ + public void setMixDataId(String mixDataId) { + this.mixDataId = mixDataId == null ? null : mixDataId.trim(); + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridDataDetail.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridDataDetail.java new file mode 100644 index 0000000..4545740 --- /dev/null +++ b/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; + + /** + * 鎵�灞炵綉鏍煎垎缁刬d + */ + @Column(name = "group_id") + private Integer groupId; + + /** + * 鎵�灞炵綉鏍糹d + */ + @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; + } + + /** + * 鑾峰彇鎵�灞炵綉鏍煎垎缁刬d + * + * @return group_id - 鎵�灞炵綉鏍煎垎缁刬d + */ + public Integer getGroupId() { + return groupId; + } + + /** + * 璁剧疆鎵�灞炵綉鏍煎垎缁刬d + * + * @param groupId 鎵�灞炵綉鏍煎垎缁刬d + */ + public void setGroupId(Integer groupId) { + this.groupId = groupId; + } + + /** + * 鑾峰彇鎵�灞炵綉鏍糹d + * + * @return cell_id - 鎵�灞炵綉鏍糹d + */ + public Integer getCellId() { + return cellId; + } + + /** + * 璁剧疆鎵�灞炵綉鏍糹d + * + * @param cellId 鎵�灞炵綉鏍糹d + */ + 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; + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java new file mode 100644 index 0000000..8d3bd89 --- /dev/null +++ b/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; + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridCellMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridCellMapper.kt new file mode 100644 index 0000000..489ecf6 --- /dev/null +++ b/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?> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt new file mode 100644 index 0000000..1a6f152 --- /dev/null +++ b/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?> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt new file mode 100644 index 0000000..e44eb7d --- /dev/null +++ b/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?> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridGroupMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridGroupMapper.kt new file mode 100644 index 0000000..f4e429f --- /dev/null +++ b/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?> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt index 718bdd4..b7163b7 100644 --- a/src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRep.kt +++ b/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 { diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt new file mode 100644 index 0000000..2c0db63 --- /dev/null +++ b/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") + }) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt index 1a83248..bd49475 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/MissionService.kt +++ b/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 diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt new file mode 100644 index 0000000..8263119 --- /dev/null +++ b/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?> +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt index a1b05e1..e0f0d8a 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt +++ b/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) diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt new file mode 100644 index 0000000..60ef723 --- /dev/null +++ b/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) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt index 4af2908..d220000 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/MissionController.kt +++ b/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 diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt new file mode 100644 index 0000000..2ac67d6 --- /dev/null +++ b/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("缃戞牸缁刬d") @RequestParam groupId: Int, + ) = resPack { satelliteTelemetryService.fetchGridCell(groupId) } + + @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴嬫暟鎹�") + @GetMapping("/grid/data") + fun fetchGridData( + @ApiParam("缃戞牸缁刬d") @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("缃戞牸缁刬d") @RequestParam(required = false) groupId: Int?, + @ApiParam("缃戞牸鍗曞厓鏍糹d") @RequestParam(required = false) cellId: Int?, + ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) } +} \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 75ca738..02d8369 100644 --- a/src/main/resources/application-test.yml +++ b/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: diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml index d2ff3fc..050233a 100644 --- a/src/main/resources/generator/generatorConfig.xml +++ b/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> \ No newline at end of file diff --git a/src/main/resources/mapper/GridCellMapper.xml b/src/main/resources/mapper/GridCellMapper.xml new file mode 100644 index 0000000..980c616 --- /dev/null +++ b/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> \ No newline at end of file diff --git a/src/main/resources/mapper/GridDataDetailMapper.xml b/src/main/resources/mapper/GridDataDetailMapper.xml new file mode 100644 index 0000000..6312fe3 --- /dev/null +++ b/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> \ No newline at end of file diff --git a/src/main/resources/mapper/GridDataMapper.xml b/src/main/resources/mapper/GridDataMapper.xml new file mode 100644 index 0000000..188f9d0 --- /dev/null +++ b/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> \ No newline at end of file diff --git a/src/main/resources/mapper/GridGroupMapper.xml b/src/main/resources/mapper/GridGroupMapper.xml new file mode 100644 index 0000000..b0e9e5a --- /dev/null +++ b/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> \ No newline at end of file diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt index 64a939e..99f1d8b 100644 --- a/src/test/kotlin/com/flightfeather/uav/Test.kt +++ b/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) } } \ No newline at end of file diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt new file mode 100644 index 0000000..c272769 --- /dev/null +++ b/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}") + } + } +} \ No newline at end of file -- Gitblit v1.9.3