重写用户获取火点数据的接口

This commit is contained in:
liuchengqian 2023-02-23 17:23:55 +08:00
parent 8f444954f1
commit 6d75affb2c
3 changed files with 343 additions and 0 deletions

View File

@ -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<AllFirePointVo> list;
public FirePointQueryResultBean() {
}
public FirePointQueryResultBean(boolean success, String errorMessage, List<AllFirePointVo> 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<AllFirePointVo> getList() {
return list;
}
public void setList(List<AllFirePointVo> list) {
this.list = list;
}
}

View File

@ -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;
}
}

View File

@ -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<VipTimeRangeBean.VipTimeRangeItemBean> vipTimeRangeItemList = vipTimeRangeBean.getList();
} catch (Exception e) {
e.printStackTrace();
return new FirePointQueryResultBean(false, e.getMessage(), null);
}
//FirePointQueryResultBean
return null;
}
}