From bbb5347967e96e2d42a540db7c6641d114953ded Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 27 Jun 2022 10:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E6=94=B6=E7=9A=84=E7=81=AB=E7=82=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BD=BF=E7=94=A8=E9=AB=98=E5=BE=B7api?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BD=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/model/entity/FirePointEntity.java | 186 ++++++++++-------- .../service/impl/FirePointServiceImpl.java | 10 +- .../java/com/xkrs/utils/GaoDeApiUtil.java | 11 ++ 3 files changed, 126 insertions(+), 81 deletions(-) diff --git a/src/main/java/com/xkrs/model/entity/FirePointEntity.java b/src/main/java/com/xkrs/model/entity/FirePointEntity.java index dd411b4..0c6f60d 100644 --- a/src/main/java/com/xkrs/model/entity/FirePointEntity.java +++ b/src/main/java/com/xkrs/model/entity/FirePointEntity.java @@ -3,9 +3,6 @@ package com.xkrs.model.entity; import javax.persistence.*; import java.io.Serializable; -/** - * @author XinYi Song - */ @Entity @Table(name = "fire_point") public class FirePointEntity implements Serializable { @@ -35,37 +32,57 @@ public class FirePointEntity implements Serializable { private double latitude; /** - * 省市区的编码 + * 详细地址 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String firePointAddress; + + /** + * 街道编码 + */ + @Column(length = 64, columnDefinition = "varchar(64)") + private String streetCode; + + /** + * 街道名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String streetName; + + /** + * 省市区编码 */ @Column(length = 32, columnDefinition = "varchar(32)") private String countyCode; /** - * 省市区的名称 + * 省市区名称 */ - @Column(columnDefinition = "varchar(64)") + @Column(length = 64, columnDefinition = "varchar(64)") private String countyName; /** * 卫星监测的时间 */ + @Column(length = 64, columnDefinition = "varchar(64)") private String satelliteTime; /** * 卫星的类型 */ - @Column(columnDefinition = "varchar(64)") + @Column(length = 64, columnDefinition = "varchar(64)") private String satelliteType; /** * 植被类型 */ - @Column(columnDefinition = "varchar(64)") + @Column(length = 64, columnDefinition = "varchar(64)") private String landType; /** * 添加的时间 */ + @Column(length = 64, columnDefinition = "varchar(64)") private String addTime; /** @@ -75,54 +92,48 @@ public class FirePointEntity implements Serializable { private String confidence; /** - * 详细地址 - */ - private String firePointAddress; - - /** - * 火点状态 0 发现 1预警 2核查 -1,3结案 + * 火点状态 + * 0:发现 + * 1:预警 + * 2:核查 + * -1,3:结案 */ @Column(length = 32, columnDefinition = "varchar(32)") private String fireType; - /** - * 当前火点的图片 - */ - private String fireImage; - - /** - * 卫星影像图片 - */ - private String satelliteImage; - - /** - * 火点前的图片 - */ - private String beforeFireImage; - - /** - * 火点后的图片 - */ - private String afterFireImage; - - /** - * 街道编码 - */ - @Column(length = 65, columnDefinition = "varchar(65)") - private String streetCode; - - @Column(length = 65, columnDefinition = "varchar(85)") - private String streetName; - /** * 审核火点状态 * 0:未审核 * 1:审核通过 * 2:审核未通过 */ - @Column(length = 65, columnDefinition = "varchar(85)") + @Column(length = 65, columnDefinition = "varchar(32)") private String auditFireType; + /** + * 当前火点的图片 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String fireImage; + + /** + * 卫星影像图片 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String satelliteImage; + + /** + * 火点前的图片 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String beforeFireImage; + + /** + * 火点后的图片 + */ + @Column(length = 255, columnDefinition = "varchar(255)") + private String afterFireImage; + public FirePointEntity() { } @@ -158,6 +169,30 @@ public class FirePointEntity implements Serializable { this.latitude = latitude; } + public String getFirePointAddress() { + return firePointAddress; + } + + public void setFirePointAddress(String firePointAddress) { + this.firePointAddress = firePointAddress; + } + + public String getStreetCode() { + return streetCode; + } + + public void setStreetCode(String streetCode) { + this.streetCode = streetCode; + } + + public String getStreetName() { + return streetName; + } + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + public String getCountyCode() { return countyCode; } @@ -214,14 +249,6 @@ public class FirePointEntity implements Serializable { this.confidence = confidence; } - public String getFirePointAddress() { - return firePointAddress; - } - - public void setFirePointAddress(String firePointAddress) { - this.firePointAddress = firePointAddress; - } - public String getFireType() { return fireType; } @@ -230,6 +257,14 @@ public class FirePointEntity implements Serializable { this.fireType = fireType; } + public String getAuditFireType() { + return auditFireType; + } + + public void setAuditFireType(String auditFireType) { + this.auditFireType = auditFireType; + } + public String getFireImage() { return fireImage; } @@ -262,32 +297,29 @@ public class FirePointEntity implements Serializable { this.afterFireImage = afterFireImage; } - public String getStreetCode() { - return streetCode; - } - - public void setStreetCode(String streetCode) { - this.streetCode = streetCode; - } - - public String getStreetName() { - return streetName; - } - - public void setStreetName(String streetName) { - this.streetName = streetName; - } - - public String getAuditFireType() { - return auditFireType; - } - - public void setAuditFireType(String auditFireType) { - this.auditFireType = auditFireType; - } - @Override public String toString() { - return "FirePointEntity{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", longitude=" + longitude + ", latitude=" + latitude + ", countyCode='" + countyCode + '\'' + ", countyName='" + countyName + '\'' + ", satelliteTime='" + satelliteTime + '\'' + ", satelliteType='" + satelliteType + '\'' + ", landType='" + landType + '\'' + ", addTime='" + addTime + '\'' + ", confidence='" + confidence + '\'' + ", firePointAddress='" + firePointAddress + '\'' + ", fireType='" + fireType + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", beforeFireImage='" + beforeFireImage + '\'' + ", afterFireImage='" + afterFireImage + '\'' + ", streetCode='" + streetCode + '\'' + ", streetName='" + streetName + '\'' + ", auditFireType='" + auditFireType + '\'' + '}'; + return "FirePointEntity{" + + "id=" + id + + ", fireCode='" + fireCode + '\'' + + ", longitude=" + longitude + + ", latitude=" + latitude + + ", firePointAddress='" + firePointAddress + '\'' + + ", streetCode='" + streetCode + '\'' + + ", streetName='" + streetName + '\'' + + ", countyCode='" + countyCode + '\'' + + ", countyName='" + countyName + '\'' + + ", satelliteTime='" + satelliteTime + '\'' + + ", satelliteType='" + satelliteType + '\'' + + ", landType='" + landType + '\'' + + ", addTime='" + addTime + '\'' + + ", confidence='" + confidence + '\'' + + ", fireType='" + fireType + '\'' + + ", auditFireType='" + auditFireType + '\'' + + ", fireImage='" + fireImage + '\'' + + ", satelliteImage='" + satelliteImage + '\'' + + ", beforeFireImage='" + beforeFireImage + '\'' + + ", afterFireImage='" + afterFireImage + '\'' + + '}'; } } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 7ca4fbd..3244123 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -270,11 +270,12 @@ public class FirePointServiceImpl implements FirePointService { String formattedAddress = reGeoCode.getFormatted_address(); firePointEntity.setFirePointAddress(formattedAddress); GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0); + firePointEntity.setCountyCode(addressComponent.getAdcode()); + firePointEntity.setCountyName(addressComponent.getDistrict()); String townCode = addressComponent.getTowncode(); String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode; firePointEntity.setStreetCode(fixedTownCode); - String townShip = addressComponent.getTownship(); - firePointEntity.setStreetName(townShip); + firePointEntity.setStreetName(addressComponent.getTownship()); } /** @@ -288,11 +289,12 @@ public class FirePointServiceImpl implements FirePointService { String formattedAddress = reGeoCode.getFormatted_address(); firePointEntity.setFirePointAddress(formattedAddress); GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0); + firePointEntity.setCountyCode(addressComponent.getAdcode()); + firePointEntity.setCountyName(addressComponent.getDistrict()); String townCode = addressComponent.getTowncode(); String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode; firePointEntity.setStreetCode(fixedTownCode); - String townShip = addressComponent.getTownship(); - firePointEntity.setStreetName(townShip); + firePointEntity.setStreetName(addressComponent.getTownship()); } /** diff --git a/src/main/java/com/xkrs/utils/GaoDeApiUtil.java b/src/main/java/com/xkrs/utils/GaoDeApiUtil.java index a8cd161..3b9e663 100644 --- a/src/main/java/com/xkrs/utils/GaoDeApiUtil.java +++ b/src/main/java/com/xkrs/utils/GaoDeApiUtil.java @@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.List; import static com.xkrs.utils.CommonConstant.INVERSEGEOGRAPHY_KEY; @@ -52,4 +53,14 @@ public class GaoDeApiUtil { }}; } + public static void main(String[] args) { + + List location = new ArrayList<>(); + location.add("120,36"); + GaoDeIgGeocodeVo geocode = geocode(location); + System.out.println("sdfghjm"); + + + } + }