diff --git a/src/main/java/com/xkrs/straw/controller/DispatchFirePointController.java b/src/main/java/com/xkrs/straw/controller/DispatchFirePointController.java new file mode 100644 index 0000000..98884f4 --- /dev/null +++ b/src/main/java/com/xkrs/straw/controller/DispatchFirePointController.java @@ -0,0 +1,36 @@ +package com.xkrs.straw.controller; + +import com.xkrs.service.impl.FirePointServiceImpl; +import com.xkrs.straw.model.qo.AllFirePointQo; +import com.xkrs.straw.service.DispatchFirePointService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Locale; + +@RestController +public class DispatchFirePointController { + + public static Logger log = LoggerFactory.getLogger(FirePointServiceImpl.class); + + private final Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private DispatchFirePointService firePointService; + + @PostMapping("/insertFirePointChannelOrdinary") + public String insertFirePointChannelOrdinary(@RequestBody AllFirePointQo firePointQo) { + return firePointService.insertFirePointChannelOrdinary(firePointQo); + } + + @PostMapping("/insertFirePointChannelPrecise") + public String insertFirePointChannelPrecise(@RequestBody AllFirePointQo firePointQo) { + return firePointService.insertFirePointChannelPrecise(firePointQo); + } + +} diff --git a/src/main/java/com/xkrs/straw/dao/FirePointOrdinaryDao.java b/src/main/java/com/xkrs/straw/dao/FirePointOrdinaryDao.java new file mode 100644 index 0000000..1517bf8 --- /dev/null +++ b/src/main/java/com/xkrs/straw/dao/FirePointOrdinaryDao.java @@ -0,0 +1,10 @@ +package com.xkrs.straw.dao; + +import com.xkrs.straw.model.entity.FirePointOrdinaryEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +@Component +public interface FirePointOrdinaryDao extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/xkrs/straw/dao/FirePointPreciseDao.java b/src/main/java/com/xkrs/straw/dao/FirePointPreciseDao.java new file mode 100644 index 0000000..531b5b3 --- /dev/null +++ b/src/main/java/com/xkrs/straw/dao/FirePointPreciseDao.java @@ -0,0 +1,10 @@ +package com.xkrs.straw.dao; + +import com.xkrs.straw.model.entity.FirePointPreciseEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +@Component +public interface FirePointPreciseDao extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/xkrs/straw/model/entity/FirePointOrdinaryEntity.java b/src/main/java/com/xkrs/straw/model/entity/FirePointOrdinaryEntity.java new file mode 100644 index 0000000..4eedc84 --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/entity/FirePointOrdinaryEntity.java @@ -0,0 +1,230 @@ +package com.xkrs.straw.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * 未审核的普通火点 + */ +@Entity +@Table(name = "fire_point_ordinary") +public class FirePointOrdinaryEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_point_ordinary_seq_gen") + @SequenceGenerator(name = "fire_point_ordinary_seq_gen", sequenceName = "fire_point_ordinary_id_seq", allocationSize = 1) + private Integer id; + + /** + * 火点编码 + */ + @Column(length = 32, unique = true, columnDefinition = "varchar(32)") + private String fireCode; + /** + * 省市区的编码 + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private Long countyCode; + /** + * 省市区的名称 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String countyName; + /** + * 卫星监测的时间 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String satelliteTime; + /** + * 经度 + */ + private Double longitude; + /** + * 纬度 + */ + private Double latitude; + /** + * 卫星类型 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String satelliteType; + /** + * 植被类型 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String landType; + /** + * 置信度 + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private String confidence; + /** + * 当前火点的图片 + */ + @Column(length = 512, columnDefinition = "varchar(512)") + private String fireImage; + /** + * 卫星影像图片 + */ + @Column(length = 512, columnDefinition = "varchar(512)") + private String satelliteImage; + /** + * 乡镇街道的编码 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String townCode; + /** + * 乡镇街道的名字 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String townName; + /** + * 添加的时间 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String addTime; + /** + * 详细地址 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String firePointAddress; + + public FirePointOrdinaryEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getFireCode() { + return fireCode; + } + + public void setFireCode(String fireCode) { + this.fireCode = fireCode; + } + + public Long getCountyCode() { + return countyCode; + } + + public void setCountyCode(Long countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getSatelliteTime() { + return satelliteTime; + } + + public void setSatelliteTime(String satelliteTime) { + this.satelliteTime = satelliteTime; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getSatelliteType() { + return satelliteType; + } + + public void setSatelliteType(String satelliteType) { + this.satelliteType = satelliteType; + } + + public String getLandType() { + return landType; + } + + public void setLandType(String landType) { + this.landType = landType; + } + + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public String getFireImage() { + return fireImage; + } + + public void setFireImage(String fireImage) { + this.fireImage = fireImage; + } + + public String getSatelliteImage() { + return satelliteImage; + } + + public void setSatelliteImage(String satelliteImage) { + this.satelliteImage = satelliteImage; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public String getAddTime() { + return addTime; + } + + public void setAddTime(String addTime) { + this.addTime = addTime; + } + + public String getFirePointAddress() { + return firePointAddress; + } + + public void setFirePointAddress(String firePointAddress) { + this.firePointAddress = firePointAddress; + } + + @Override + public String toString() { + return "FirePointOrdinaryEntity{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", countyCode=" + countyCode + ", countyName='" + countyName + '\'' + ", satelliteTime='" + satelliteTime + '\'' + ", longitude=" + longitude + ", latitude=" + latitude + ", satelliteType='" + satelliteType + '\'' + ", landType='" + landType + '\'' + ", confidence='" + confidence + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", townCode='" + townCode + '\'' + ", townName='" + townName + '\'' + ", addTime='" + addTime + '\'' + ", firePointAddress='" + firePointAddress + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/straw/model/entity/FirePointPreciseEntity.java b/src/main/java/com/xkrs/straw/model/entity/FirePointPreciseEntity.java new file mode 100644 index 0000000..f713793 --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/entity/FirePointPreciseEntity.java @@ -0,0 +1,230 @@ +package com.xkrs.straw.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * 审核通过的精准火点 + */ +@Entity +@Table(name = "fire_point_precise") +public class FirePointPreciseEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_point_precise_seq_gen") + @SequenceGenerator(name = "fire_point_precise_seq_gen", sequenceName = "fire_point_precise_id_seq", allocationSize = 1) + private Integer id; + + /** + * 火点编码 + */ + @Column(length = 32, unique = true, columnDefinition = "varchar(32)") + private String fireCode; + /** + * 省市区的编码 + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private Long countyCode; + /** + * 省市区的名称 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String countyName; + /** + * 卫星监测的时间 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String satelliteTime; + /** + * 经度 + */ + private Double longitude; + /** + * 纬度 + */ + private Double latitude; + /** + * 卫星类型 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String satelliteType; + /** + * 植被类型 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String landType; + /** + * 置信度 + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private String confidence; + /** + * 当前火点的图片 + */ + @Column(length = 512, columnDefinition = "varchar(512)") + private String fireImage; + /** + * 卫星影像图片 + */ + @Column(length = 512, columnDefinition = "varchar(512)") + private String satelliteImage; + /** + * 乡镇街道的编码 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String townCode; + /** + * 乡镇街道的名字 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String townName; + /** + * 添加的时间 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String addTime; + /** + * 详细地址 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String firePointAddress; + + public FirePointPreciseEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getFireCode() { + return fireCode; + } + + public void setFireCode(String fireCode) { + this.fireCode = fireCode; + } + + public Long getCountyCode() { + return countyCode; + } + + public void setCountyCode(Long countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getSatelliteTime() { + return satelliteTime; + } + + public void setSatelliteTime(String satelliteTime) { + this.satelliteTime = satelliteTime; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getSatelliteType() { + return satelliteType; + } + + public void setSatelliteType(String satelliteType) { + this.satelliteType = satelliteType; + } + + public String getLandType() { + return landType; + } + + public void setLandType(String landType) { + this.landType = landType; + } + + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public String getFireImage() { + return fireImage; + } + + public void setFireImage(String fireImage) { + this.fireImage = fireImage; + } + + public String getSatelliteImage() { + return satelliteImage; + } + + public void setSatelliteImage(String satelliteImage) { + this.satelliteImage = satelliteImage; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public String getAddTime() { + return addTime; + } + + public void setAddTime(String addTime) { + this.addTime = addTime; + } + + public String getFirePointAddress() { + return firePointAddress; + } + + public void setFirePointAddress(String firePointAddress) { + this.firePointAddress = firePointAddress; + } + + @Override + public String toString() { + return "FirePointPreciseEntity{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", countyCode=" + countyCode + ", countyName='" + countyName + '\'' + ", satelliteTime='" + satelliteTime + '\'' + ", longitude=" + longitude + ", latitude=" + latitude + ", satelliteType='" + satelliteType + '\'' + ", landType='" + landType + '\'' + ", confidence='" + confidence + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", townCode='" + townCode + '\'' + ", townName='" + townName + '\'' + ", addTime='" + addTime + '\'' + ", firePointAddress='" + firePointAddress + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/straw/model/qo/AllFirePointQo.java b/src/main/java/com/xkrs/straw/model/qo/AllFirePointQo.java new file mode 100644 index 0000000..38aa407 --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/qo/AllFirePointQo.java @@ -0,0 +1,152 @@ +package com.xkrs.straw.model.qo; + +public class AllFirePointQo { + + /** + * 火点编码 + */ + private String fireCode; + /** + * 省市区的编码 + */ + private Long countyCode; + /** + * 省市区的名称 + */ + private String countyName; + /** + * 卫星监测的时间戳 + */ + private Long satelliteTimeTs; + /** + * 经度 + */ + private Double longitude; + /** + * 纬度 + */ + private Double latitude; + /** + * 卫星类型 + */ + private String satelliteType; + /** + * 植被类型 + */ + private String landType; + /** + * 置信度 + */ + private String confidence; + /** + * 当前火点的图片 + */ + private String fireImage; + /** + * 卫星影像图片 + */ + private String satelliteImage; + /** + * 乡镇街道的编码 + */ + private String townCode; + + public AllFirePointQo() { + } + + public String getFireCode() { + return fireCode; + } + + public void setFireCode(String fireCode) { + this.fireCode = fireCode; + } + + public Long getCountyCode() { + return countyCode; + } + + public void setCountyCode(Long countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public Long getSatelliteTimeTs() { + return satelliteTimeTs; + } + + public void setSatelliteTimeTs(Long satelliteTimeTs) { + this.satelliteTimeTs = satelliteTimeTs; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getSatelliteType() { + return satelliteType; + } + + public void setSatelliteType(String satelliteType) { + this.satelliteType = satelliteType; + } + + public String getLandType() { + return landType; + } + + public void setLandType(String landType) { + this.landType = landType; + } + + public String getConfidence() { + return confidence; + } + + public void setConfidence(String confidence) { + this.confidence = confidence; + } + + public String getFireImage() { + return fireImage; + } + + public void setFireImage(String fireImage) { + this.fireImage = fireImage; + } + + public String getSatelliteImage() { + return satelliteImage; + } + + public void setSatelliteImage(String satelliteImage) { + this.satelliteImage = satelliteImage; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } +} diff --git a/src/main/java/com/xkrs/straw/service/DispatchFirePointService.java b/src/main/java/com/xkrs/straw/service/DispatchFirePointService.java new file mode 100644 index 0000000..f9af330 --- /dev/null +++ b/src/main/java/com/xkrs/straw/service/DispatchFirePointService.java @@ -0,0 +1,11 @@ +package com.xkrs.straw.service; + +import com.xkrs.straw.model.qo.AllFirePointQo; + +public interface DispatchFirePointService { + + String insertFirePointChannelOrdinary(AllFirePointQo firePointQo); + + String insertFirePointChannelPrecise(AllFirePointQo firePointQo); + +} diff --git a/src/main/java/com/xkrs/straw/service/impl/DispatchFirePointServiceImpl.java b/src/main/java/com/xkrs/straw/service/impl/DispatchFirePointServiceImpl.java new file mode 100644 index 0000000..cfb7918 --- /dev/null +++ b/src/main/java/com/xkrs/straw/service/impl/DispatchFirePointServiceImpl.java @@ -0,0 +1,97 @@ +package com.xkrs.straw.service.impl; + +import com.xkrs.straw.dao.FirePointOrdinaryDao; +import com.xkrs.straw.dao.FirePointPreciseDao; +import com.xkrs.straw.model.qo.AllFirePointQo; +import com.xkrs.straw.service.DispatchFirePointService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class DispatchFirePointServiceImpl implements DispatchFirePointService { + + @Resource + private FirePointOrdinaryDao firePointOrdinaryDao; + private FirePointPreciseDao firePointPreciseDao; + + @Override + public String insertFirePointChannelOrdinary(AllFirePointQo firePointQo) { + + + firePointQo.getFireCode(); + firePointQo.getCountyCode(); + firePointQo.getCountyName(); + firePointQo.getSatelliteTimeTs(); + firePointQo.getLongitude(); + firePointQo.getLatitude(); + firePointQo.getSatelliteType(); + firePointQo.getLandType(); + firePointQo.getConfidence(); + firePointQo.getFireImage(); + firePointQo.getSatelliteImage(); + firePointQo.getTownCode(); + + +// FirePointOrdinaryEntity firePointOrdinaryEntity = new FirePointOrdinaryEntity(); +// firePointOrdinaryEntity.setFireCode(); +// firePointOrdinaryEntity.setCountyCode(); +// firePointOrdinaryEntity.setCountyName(); +// firePointOrdinaryEntity.setSatelliteTime(); +// firePointOrdinaryEntity.setLongitude(); +// firePointOrdinaryEntity.setLatitude(); +// firePointOrdinaryEntity.setSatelliteType(); +// firePointOrdinaryEntity.setLandType(); +// firePointOrdinaryEntity.setConfidence(); +// firePointOrdinaryEntity.setFireImage(); +// firePointOrdinaryEntity.setSatelliteImage(); +// firePointOrdinaryEntity.setTownCode(); +// firePointOrdinaryEntity.setTownName(); +// firePointOrdinaryEntity.setAddTime(); +// firePointOrdinaryEntity.setFirePointAddress(); +// firePointOrdinaryDao.save(firePointOrdinaryEntity); + + + return null; + } + + @Override + public String insertFirePointChannelPrecise(AllFirePointQo firePointQo) { + + firePointQo.getFireCode(); + firePointQo.getCountyCode(); + firePointQo.getCountyName(); + firePointQo.getSatelliteTimeTs(); + firePointQo.getLongitude(); + firePointQo.getLatitude(); + firePointQo.getSatelliteType(); + firePointQo.getLandType(); + firePointQo.getConfidence(); + firePointQo.getFireImage(); + firePointQo.getSatelliteImage(); + firePointQo.getTownCode(); + + +// FirePointPreciseEntity firePointPreciseEntity = new FirePointPreciseEntity(); +// firePointPreciseEntity.setFireCode(); +// firePointPreciseEntity.setCountyCode(); +// firePointPreciseEntity.setCountyName(); +// firePointPreciseEntity.setSatelliteTime(); +// firePointPreciseEntity.setLongitude(); +// firePointPreciseEntity.setLatitude(); +// firePointPreciseEntity.setSatelliteType(); +// firePointPreciseEntity.setLandType(); +// firePointPreciseEntity.setConfidence(); +// firePointPreciseEntity.setFireImage(); +// firePointPreciseEntity.setSatelliteImage(); +// firePointPreciseEntity.setTownCode(); +// firePointPreciseEntity.setTownName(); +// firePointPreciseEntity.setAddTime(); +// firePointPreciseEntity.setFirePointAddress(); +// firePointPreciseDao.save(firePointPreciseEntity); + + + return null; + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 987b328..bd9c2ff 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +1,9 @@ server.port = 6801 ## 数据源配置 -spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/fire_point -spring.datasource.userName = fire_manage -spring.datasource.password = fire456 +spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/straw_fire_point +spring.datasource.userName = straw_manager +spring.datasource.password = straw123 spring.datasource.driverClassName = org.postgresql.Driver server.tomcat.uri-encoding=UTF-8