From 6d75affb2cb3c665584a2d01677686066d40181f Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 23 Feb 2023 17:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E7=94=A8=E6=88=B7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=81=AB=E7=82=B9=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/bean/FirePointQueryResultBean.java | 47 ++++ .../xkrs/straw/model/vo/AllFirePointVo.java | 228 ++++++++++++++++++ .../straw/utils/FirePointQueryManager.java | 68 ++++++ 3 files changed, 343 insertions(+) create mode 100644 src/main/java/com/xkrs/straw/model/bean/FirePointQueryResultBean.java create mode 100644 src/main/java/com/xkrs/straw/model/vo/AllFirePointVo.java create mode 100644 src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java diff --git a/src/main/java/com/xkrs/straw/model/bean/FirePointQueryResultBean.java b/src/main/java/com/xkrs/straw/model/bean/FirePointQueryResultBean.java new file mode 100644 index 0000000..908bca5 --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/bean/FirePointQueryResultBean.java @@ -0,0 +1,47 @@ +package com.xkrs.straw.model.bean; + +import com.xkrs.straw.model.vo.AllFirePointVo; + +import java.util.List; + +public class FirePointQueryResultBean { + + private boolean success; + + private String errorMessage; + + private List list; + + public FirePointQueryResultBean() { + } + + public FirePointQueryResultBean(boolean success, String errorMessage, List list) { + this.success = success; + this.errorMessage = errorMessage; + this.list = list; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/src/main/java/com/xkrs/straw/model/vo/AllFirePointVo.java b/src/main/java/com/xkrs/straw/model/vo/AllFirePointVo.java new file mode 100644 index 0000000..827fa2c --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/vo/AllFirePointVo.java @@ -0,0 +1,228 @@ +package com.xkrs.straw.model.vo; + +public class AllFirePointVo { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + private Long id; + + /** + * 火点编码 + */ + private String fireCode; + + /** + * 省市区的编码 + */ + private String countyCode; + + /** + * 省市区的名称 + */ + private String countyName; + + /** + * 卫星监测的时间 + */ + private String satelliteTime; + + /** + * 经度 + */ + private Double longitude; + + /** + * 纬度 + */ + private Double latitude; + + /** + * 卫星类型 + */ + private String satelliteType; + + /** + * 植被类型 + */ + private String landType; + + /** + * 置信度 + */ + private String confidence; + + /** + * 当前火点的图片 + */ + private String fireImage; + + /** + * 卫星影像图片 + */ + private String satelliteImage; + + /** + * 乡镇街道的编码 + */ + private String townCode; + + /** + * 乡镇街道的名字 + */ + private String townName; + + /** + * 添加的时间 + */ + private String addTime; + + /** + * 详细地址 + */ + private String firePointAddress; + + /** + * 备注 + */ + private String remark; + + public AllFirePointVo() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFireCode() { + return fireCode; + } + + public void setFireCode(String fireCode) { + this.fireCode = fireCode; + } + + public String getCountyCode() { + return countyCode; + } + + public void setCountyCode(String 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; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java new file mode 100644 index 0000000..e9503d1 --- /dev/null +++ b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java @@ -0,0 +1,68 @@ +package com.xkrs.straw.utils; + +import com.xkrs.straw.dao.FirePointOrdinaryDao; +import com.xkrs.straw.dao.FirePointPreciseDao; +import com.xkrs.straw.model.bean.FirePointQueryResultBean; +import com.xkrs.straw.model.bean.VipTimeRangeBean; +import com.xkrs.straw.model.entity.SysUserEntity; +import com.xkrs.utils.FirePointCodeUtils; +import org.apache.hc.core5.util.TextUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +@Component +public class FirePointQueryManager { + + @Resource + private FirePointOrdinaryDao firePointOrdinaryDao; + + @Resource + private FirePointPreciseDao firePointPreciseDao; + + public FirePointQueryResultBean queryFirePointBelongToUser(SysUserEntity sysUserEntity, String startTime, String endTime, String satelliteType, String landType) { + + try { + //获取用户注册的区划编码 + String userCode = sysUserEntity.getCountyCode(); + //如果用户注册的区划编码是空,就返回失败 + if (TextUtils.isEmpty(userCode)) { + return new FirePointQueryResultBean(false, "User CountyCode Error 1, userCode = " + userCode, null); + } + //对用户区划编码进行格式化,获得没有冗余数据的区划编码 + String noRedundantUserCode = FirePointCodeUtils.getFormatCutCode(userCode); + //如果格式化后的用户区划编码是空,就返回失败 + if (TextUtils.isEmpty(noRedundantUserCode)) { + return new FirePointQueryResultBean(false, "User CountyCode Error 2, userCode = " + userCode + ", noRedundantUserCode = " + noRedundantUserCode, null); + } + + //获取用户的VIP时间范围 + String vipTimeRangeJson = sysUserEntity.getVipTimeRangeJson(); + //如果用户的VIP时间范围数据是空,就返回失败 + if (TextUtils.isEmpty(vipTimeRangeJson)) { + return new FirePointQueryResultBean(false, "User VipTimeRangeJson Error 1, vipTimeRangeJson = " + vipTimeRangeJson, null); + } + //反序列化用户的VIP时间范围,得到对象 + VipTimeRangeBean vipTimeRangeBean = JsonUtils.deserialize(vipTimeRangeJson, VipTimeRangeBean.class); + //用户注册时有初始VIP时间范围,反序列化失败或无数据,说明该用户的数据发生了异常,返回失败 + if (vipTimeRangeBean == null || vipTimeRangeBean.getList() == null || vipTimeRangeBean.getList().size() == 0) { + return new FirePointQueryResultBean(false, "User VipTimeRangeJson Error 2, 已保存的VIP时间范围反序列化失败, vipTimeRangeJson = " + vipTimeRangeJson, null); + } + + //得到由<开始时间 + 结束时间>组成的集合 + List vipTimeRangeItemList = vipTimeRangeBean.getList(); + + + } catch (Exception e) { + e.printStackTrace(); + return new FirePointQueryResultBean(false, e.getMessage(), null); + } + + + //FirePointQueryResultBean + + return null; + } + +}