6 Commits

Author SHA1 Message Date
zxyroy d37d9c2361 修改后端readme 2026-06-17 22:10:41 +08:00
wzy-warehouse d4f892fad6 水库不显示的问题 2026-06-17 16:02:12 +08:00
wzy-warehouse bfd80887b2 调整返回前端的数据顺序 2026-06-17 15:42:10 +08:00
wzy-warehouse e33105a467 添加预测概率 2026-06-17 14:22:53 +08:00
wzy-warehouse f4af9975d6 添加崩塌隐患点 2026-06-16 10:19:22 +08:00
wzy-warehouse 3c6b716007 统一数据库映射 2026-06-12 10:08:20 +08:00
24 changed files with 378 additions and 50 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
# basic_template_not_login_back
开发基本模版——后端
# xian_api_new
新版西安项目——后端
# basic_template_not_login_back
@@ -22,8 +22,8 @@ public class XianHiddenDangerSpotsController extends BaseController{
return ApiResponse.ok(xianHiddenDangerSpotsService.getBasePoints(disasterType));
}
@GetMapping("point-detail/{id}")
public ApiResponse<XianHiddenDangerSpotsPointDetailVo> getPointDetailById(@PathVariable String id) {
return ApiResponse.ok(xianHiddenDangerSpotsService.getPointDetailById(Long.parseLong(id)));
@GetMapping("point-detail/{id}/{simulationId}")
public ApiResponse<XianHiddenDangerSpotsPointDetailVo> getPointDetailById(@PathVariable String id, @PathVariable String simulationId) {
return ApiResponse.ok(xianHiddenDangerSpotsService.getPointDetailById(Long.parseLong(id), Long.parseLong(simulationId)));
}
}
@@ -24,8 +24,8 @@ public class XianRiskSpotsController {
return ApiResponse.ok(xianRiskSpotsService.getBasePoints());
}
@GetMapping("point-detail/{id}")
public ApiResponse<XianRiskSpotsPointDetailVo> getPointDetailById(@PathVariable String id) {
return ApiResponse.ok(xianRiskSpotsService.getPointDetailById(Long.parseLong(id)));
@GetMapping("point-detail/{id}/{simulationId}")
public ApiResponse<XianRiskSpotsPointDetailVo> getPointDetailById(@PathVariable String id, @PathVariable String simulationId) {
return ApiResponse.ok(xianRiskSpotsService.getPointDetailById(Long.parseLong(id), Long.parseLong(simulationId)));
}
}
@@ -86,7 +86,7 @@ public class XianBridge {
/**
* 位置
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -120,7 +120,7 @@ public class XianBridge {
&& (this.getMaster() == null ? other.getMaster() == null : this.getMaster().equals(other.getMaster()))
&& (this.getMaint() == null ? other.getMaint() == null : this.getMaint().equals(other.getMaint()))
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -143,7 +143,7 @@ public class XianBridge {
result = prime * result + ((getMaster() == null) ? 0 : getMaster().hashCode());
result = prime * result + ((getMaint() == null) ? 0 : getMaint().hashCode());
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -169,7 +169,7 @@ public class XianBridge {
sb.append(", master=").append(master);
sb.append(", maint=").append(maint);
sb.append(", note=").append(note);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -201,7 +201,7 @@ public class XianDangerousSource {
/**
*
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -258,7 +258,7 @@ public class XianDangerousSource {
&& (this.getWriteTime() == null ? other.getWriteTime() == null : this.getWriteTime().equals(other.getWriteTime()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -304,7 +304,7 @@ public class XianDangerousSource {
result = prime * result + ((getWriteTime() == null) ? 0 : getWriteTime().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -353,7 +353,7 @@ public class XianDangerousSource {
sb.append(", writeTime=").append(writeTime);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -71,7 +71,7 @@ public class XianEmergencyShelter {
/**
* 位置
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -102,7 +102,7 @@ public class XianEmergencyShelter {
&& (this.getEffectiveNumberOfRefugees() == null ? other.getEffectiveNumberOfRefugees() == null : this.getEffectiveNumberOfRefugees().equals(other.getEffectiveNumberOfRefugees()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -122,7 +122,7 @@ public class XianEmergencyShelter {
result = prime * result + ((getEffectiveNumberOfRefugees() == null) ? 0 : getEffectiveNumberOfRefugees().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -145,7 +145,7 @@ public class XianEmergencyShelter {
sb.append(", effectiveNumberOfRefugees=").append(effectiveNumberOfRefugees);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -281,7 +281,7 @@ public class XianFirefighter {
/**
*
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -354,7 +354,7 @@ public class XianFirefighter {
&& (this.getWriteTime() == null ? other.getWriteTime() == null : this.getWriteTime().equals(other.getWriteTime()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -416,7 +416,7 @@ public class XianFirefighter {
result = prime * result + ((getWriteTime() == null) ? 0 : getWriteTime().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -481,7 +481,7 @@ public class XianFirefighter {
sb.append(", writeTime=").append(writeTime);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -316,7 +316,7 @@ public class XianHospitals {
/**
*
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -396,7 +396,7 @@ public class XianHospitals {
&& (this.getWriteTime() == null ? other.getWriteTime() == null : this.getWriteTime().equals(other.getWriteTime()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -465,7 +465,7 @@ public class XianHospitals {
result = prime * result + ((getWriteTime() == null) ? 0 : getWriteTime().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -537,7 +537,7 @@ public class XianHospitals {
sb.append(", writeTime=").append(writeTime);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -0,0 +1,221 @@
package com.gis.xian.entity;
import java.util.Date;
/**
* 推理结果表
* @TableName xian_inference_result
*/
public class XianInferenceResult {
/**
* 主键ID
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 事件类型
*/
private String eventType;
/**
* 发生时间
*/
private Date occurredTime;
/**
* 操作类型
*/
private String operationType;
/**
* 推理结果(JSONB
*/
private Object result;
/**
* 条件(JSONB
*/
private Object condition;
/**
* 文件路径(JSONB
*/
private Object filePath;
/**
* 创建时间
*/
private Date createTime;
/**
* 是否删除(0: 未删除, 1: 已删除)
*/
private Integer isDelete;
// 构造方法
public XianInferenceResult() {
}
public XianInferenceResult(Long id, String name, String eventType, Date occurredTime,
String operationType, Object result, Object condition,
Object filePath, Date createTime, Integer isDelete) {
this.id = id;
this.name = name;
this.eventType = eventType;
this.occurredTime = occurredTime;
this.operationType = operationType;
this.result = result;
this.condition = condition;
this.filePath = filePath;
this.createTime = createTime;
this.isDelete = isDelete;
}
// Getter 和 Setter 方法
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public Date getOccurredTime() {
return occurredTime;
}
public void setOccurredTime(Date occurredTime) {
this.occurredTime = occurredTime;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public Object getCondition() {
return condition;
}
public void setCondition(Object condition) {
this.condition = condition;
}
public Object getFilePath() {
return filePath;
}
public void setFilePath(Object filePath) {
this.filePath = filePath;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
XianInferenceResult other = (XianInferenceResult) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getEventType() == null ? other.getEventType() == null : this.getEventType().equals(other.getEventType()))
&& (this.getOccurredTime() == null ? other.getOccurredTime() == null : this.getOccurredTime().equals(other.getOccurredTime()))
&& (this.getOperationType() == null ? other.getOperationType() == null : this.getOperationType().equals(other.getOperationType()))
&& (this.getResult() == null ? other.getResult() == null : this.getResult().equals(other.getResult()))
&& (this.getCondition() == null ? other.getCondition() == null : this.getCondition().equals(other.getCondition()))
&& (this.getFilePath() == null ? other.getFilePath() == null : this.getFilePath().equals(other.getFilePath()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getEventType() == null) ? 0 : getEventType().hashCode());
result = prime * result + ((getOccurredTime() == null) ? 0 : getOccurredTime().hashCode());
result = prime * result + ((getOperationType() == null) ? 0 : getOperationType().hashCode());
result = prime * result + ((getResult() == null) ? 0 : getResult().hashCode());
result = prime * result + ((getCondition() == null) ? 0 : getCondition().hashCode());
result = prime * result + ((getFilePath() == null) ? 0 : getFilePath().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", eventType=").append(eventType);
sb.append(", occurredTime=").append(occurredTime);
sb.append(", operationType=").append(operationType);
sb.append(", result=").append(result);
sb.append(", condition=").append(condition);
sb.append(", filePath=").append(filePath);
sb.append(", createTime=").append(createTime);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
}
}
@@ -251,7 +251,7 @@ public class XianStorePoints {
/**
*
*/
private Object point;
private Object geom;
/**
*
@@ -318,7 +318,7 @@ public class XianStorePoints {
&& (this.getOverwriteTime() == null ? other.getOverwriteTime() == null : this.getOverwriteTime().equals(other.getOverwriteTime()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -374,7 +374,7 @@ public class XianStorePoints {
result = prime * result + ((getOverwriteTime() == null) ? 0 : getOverwriteTime().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -433,7 +433,7 @@ public class XianStorePoints {
sb.append(", overwriteTime=").append(overwriteTime);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", point=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -61,7 +61,7 @@ public class XianSubwayStations {
/**
* 站点经纬度
*/
private Object point;
private Object geom;
/**
* 逻辑删除标识,0未删除,1已删除
@@ -90,7 +90,7 @@ public class XianSubwayStations {
&& (this.getPointOtherDefenses() == null ? other.getPointOtherDefenses() == null : this.getPointOtherDefenses().equals(other.getPointOtherDefenses()))
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
&& (this.getPoint() == null ? other.getPoint() == null : this.getPoint().equals(other.getPoint()))
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
}
@@ -108,7 +108,7 @@ public class XianSubwayStations {
result = prime * result + ((getPointOtherDefenses() == null) ? 0 : getPointOtherDefenses().hashCode());
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
result = prime * result + ((getPoint() == null) ? 0 : getPoint().hashCode());
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
return result;
}
@@ -129,7 +129,7 @@ public class XianSubwayStations {
sb.append(", pointOtherDefenses=").append(pointOtherDefenses);
sb.append(", lon=").append(lon);
sb.append(", lat=").append(lat);
sb.append(", point=").append(point);
sb.append(", geom=").append(geom);
sb.append(", isDelete=").append(isDelete);
sb.append("]");
return sb.toString();
@@ -6,6 +6,7 @@ import lombok.Getter;
public enum DisasterTypeEnum {
// 具体灾害类型
LANDSLIDE("landslide", "滑坡"),
COLLAPSE("collapse", "崩塌"),
DEBRIS_FLOW("debris_flow", "泥石流"),
FLASH_FLOOD("flash_flood", "山洪"),
WATER_LOGGING("water_logging", "内涝");
@@ -0,0 +1,21 @@
package com.gis.xian.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author wzy
* @description 针对表【xian_inference_result(预测结果表)】的数据库操作Mapper
* @createDate 2026-06-17 11:58:32
* @Entity com.gis.xian.entity.XianInferenceResult
*/
@Mapper
public interface XianInferenceResultMapper {
/**
* 根据id和pointId获取概率
* @param id 预测结果id
* @param pointId 隐患点/风险点id和类型
* @return 预测概率
*/
String getProbabilityByIdAndPointId(@Param("id") Long id, @Param("pointId") String pointId);
}
@@ -17,7 +17,8 @@ public interface XianHiddenDangerSpotsService {
/**
* 根据id获取隐患点详情
* @param id 隐患点id
* @param simulationId 模拟id
* @return 隐患点详情
*/
XianHiddenDangerSpotsPointDetailVo getPointDetailById(Long id);
XianHiddenDangerSpotsPointDetailVo getPointDetailById(Long id, Long simulationId);
}
@@ -15,7 +15,8 @@ public interface XianRiskSpotsService {
/**
* 根据id获取风险点详情
* @param id 风险点id
* @param simulationId 模拟id
* @return 风险点详情
*/
XianRiskSpotsPointDetailVo getPointDetailById(Long id);
XianRiskSpotsPointDetailVo getPointDetailById(Long id, Long simulationId);
}
@@ -2,6 +2,7 @@ package com.gis.xian.service.impl;
import com.alibaba.fastjson2.JSON;
import com.gis.xian.entity.XianHiddenDangerSpots;
import com.gis.xian.mapper.XianInferenceResultMapper;
import com.gis.xian.vo.XianHiddenDangerSpotsBasePointVo;
import com.gis.xian.vo.XianHiddenDangerSpotsPointDetailVo;
import com.gis.xian.mapper.XianHiddenDangerSpotsMapper;
@@ -22,12 +23,18 @@ public class IXianHiddenDangerSpotsServiceImpl implements XianHiddenDangerSpotsS
@Resource
private XianHiddenDangerSpotsMapper xianHiddenDangerSpotsMapper;
@Resource
private XianInferenceResultMapper xianInferenceResultMapper;
@Value("${init.data.base-points.hidden-danger.all}")
private String allBasePointsKey;
@Value("${init.data.base-points.hidden-danger.landslide}")
private String landslideKey;
@Value("${init.data.base-points.hidden-danger.collapse}")
private String collapseKey;
@Value("${init.data.base-points.hidden-danger.debris-flow}")
private String debrisFlowKey;
@@ -68,6 +75,8 @@ public class IXianHiddenDangerSpotsServiceImpl implements XianHiddenDangerSpotsS
switch (disasterType) {
case "landslide":
return landslideKey;
case "collapse":
return collapseKey;
case "debris_flow":
return debrisFlowKey;
case "flash_flood":
@@ -80,7 +89,14 @@ public class IXianHiddenDangerSpotsServiceImpl implements XianHiddenDangerSpotsS
}
@Override
public XianHiddenDangerSpotsPointDetailVo getPointDetailById(Long id) {
return XianHiddenDangerSpotsPointDetailVo.entity2Vo(xianHiddenDangerSpotsMapper.getPointDetailById(id));
public XianHiddenDangerSpotsPointDetailVo getPointDetailById(Long id, Long simulationId) {
XianHiddenDangerSpotsPointDetailVo pointDetail = XianHiddenDangerSpotsPointDetailVo.entity2Vo(xianHiddenDangerSpotsMapper.getPointDetailById(id));
// 根据模拟id和id获取预测结果
if(simulationId != null && simulationId != -1L) {
pointDetail.setProbability(xianInferenceResultMapper.getProbabilityByIdAndPointId(simulationId, id + "_1") + "%");
}
return pointDetail;
}
}
@@ -1,6 +1,8 @@
package com.gis.xian.service.impl;
import com.alibaba.fastjson2.JSON;
import com.gis.xian.mapper.XianInferenceResultMapper;
import com.gis.xian.vo.XianHiddenDangerSpotsPointDetailVo;
import com.gis.xian.vo.XianRiskSpotsBasePointVo;
import com.gis.xian.vo.XianRiskSpotsPointDetailVo;
import com.gis.xian.mapper.XianRiskSpotsMapper;
@@ -21,6 +23,9 @@ public class IXianRiskSpotsServiceImpl implements XianRiskSpotsService {
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Resource
private XianInferenceResultMapper xianInferenceResultMapper;
@Value("${init.data.base-points.risk}")
private String riskPointKey;
@@ -39,7 +44,14 @@ public class IXianRiskSpotsServiceImpl implements XianRiskSpotsService {
}
@Override
public XianRiskSpotsPointDetailVo getPointDetailById(Long id) {
return XianRiskSpotsPointDetailVo.entity2Vo(xianRiskSpotsMapper.getPointDetailById(id));
public XianRiskSpotsPointDetailVo getPointDetailById(Long id, Long simulationId) {
XianRiskSpotsPointDetailVo pointDetail = XianRiskSpotsPointDetailVo.entity2Vo(xianRiskSpotsMapper.getPointDetailById(id));
// 根据模拟id和id获取预测结果
if(simulationId != null && simulationId != -1L) {
pointDetail.setProbability(xianInferenceResultMapper.getProbabilityByIdAndPointId(simulationId, id + "_2") + "%");
}
return pointDetail;
}
}
@@ -63,6 +63,9 @@ public class InitializeData {
@Value("${init.data.base-points.hidden-danger.landslide}")
private String landslideKey;
@Value("${init.data.base-points.hidden-danger.collapse}")
private String collapseKey;
@Value("${init.data.base-points.hidden-danger.debris-flow}")
private String debrisFlowKey;
@@ -127,7 +130,17 @@ public class InitializeData {
);
log.info("加载隐患点信息(滑坡)并写入redis完成");
});
// 隐患点 - 崩塌
CompletableFuture<Void> collapseFuture = CompletableFuture.runAsync(() -> {
redisTemplate.opsForValue().set(collapseKey, JSON.toJSONString(
XianHiddenDangerSpotsBasePointVo.entity2Vo(
xianHiddenDangerSpotsMapper.getBasePoints("collapse"))
)
);
log.info("加载隐患点信息(崩塌)并写入redis完成");
});
// 隐患点 - 泥石流
CompletableFuture<Void> debrisFlowFuture = CompletableFuture.runAsync(() -> {
redisTemplate.opsForValue().set(debrisFlowKey, JSON.toJSONString(
@@ -250,7 +263,7 @@ public class InitializeData {
// 等待所有任务完成
CompletableFuture.allOf(
allFuture, landslideFuture, debrisFlowFuture,
allFuture, landslideFuture, collapseFuture, debrisFlowFuture,
flashFloodFuture, waterLoggingFuture,
riskFuture, hospitalsFuture,
dangerousSourceFuture, emergencyShelterFuture, firefighterFuture, storePointsFuture, schoolFuture,
@@ -9,6 +9,11 @@ import java.util.Objects;
@Data
public class XianHiddenDangerSpotsPointDetailVo {
/**
* 概率
*/
private String probability;
/**
* 序号
*/
@@ -9,6 +9,11 @@ import java.util.Objects;
@Data
public class XianRiskSpotsPointDetailVo {
/**
* 概率
*/
private String probability;
/**
* 序号
*/
@@ -25,17 +25,20 @@
<result property="isDelete" column="is_delete" />
</resultMap>
<!-- 获取所有基础点:滑坡、泥石流、山洪、内涝 -->
<!-- 获取所有基础点:滑坡、崩塌、泥石流、山洪、内涝 -->
<select id="getBasePoints" resultMap="XianHiddenDangerSpotsResultMap">
SELECT id, disaster_name, lon, lat, disaster_type FROM xian_hidden_danger_spots
<where>
is_delete = 0
AND disaster_type IN('滑坡', '泥石流', '山洪', '内涝')
AND disaster_type IN('滑坡', '崩塌', '泥石流', '山洪', '内涝')
<if test="disasterType != null and disasterType != ''">
<choose>
<when test="disasterType == 'landslide'">
AND disaster_type = '滑坡'
</when>
<when test="disasterType == 'collapse'">
AND disaster_type = '崩塌'
</when>
<when test="disasterType == 'debris_flow'">
AND disaster_type = '泥石流'
</when>
@@ -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.gis.xian.mapper.XianInferenceResultMapper">
<resultMap id="XianInferenceResultResultMap" type="com.gis.xian.entity.XianInferenceResult">
<id property="id" column="id" />
<result property="name" column="name" />
<result property="eventType" column="event_type" />
<result property="occurredTime" column="occurred_time" />
<result property="operationType" column="operation_type" />
<result property="result" column="result" />
<result property="condition" column="condition" />
<result property="filePath" column="file_path" />
<result property="createTime" column="create_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<!-- 根据id和pointId获取概率 -->
<select id="getProbabilityByIdAndPointId" resultType="java.lang.String">
SELECT result->>#{pointId} FROM xian_inference_result
<where>
id = #{id}
</where>
</select>
</mapper>
@@ -17,15 +17,15 @@
<result property="projectScale" column="project_scale" />
<result property="hasHiddenDanger" column="has_hidden_danger" />
<result property="note1" column="note1" />
<result property="lon" column="longitude" />
<result property="lat" column="latitude" />
<result property="lon" column="lon" />
<result property="lat" column="lat" />
<result property="geom" column="geom" />
<result property="isDelete" column="is_delete" />
</resultMap>
<!-- 获取所有水库基础点 -->
<select id="getBasePoints" resultMap="BaseResultMap">
SELECT id, reservoir_name, longitude, latitude FROM xian_reservoir_list
SELECT id, reservoir_name, lon, lat FROM xian_reservoir_list
<where>
is_delete = 0
</where>
@@ -33,7 +33,7 @@
<!-- 根据id获取水库详情 -->
<select id="getPointDetailById" resultMap="BaseResultMap">
SELECT id, reservoir_name, location, safety_assess_result, longitude, latitude FROM xian_reservoir_list
SELECT id, reservoir_name, location, safety_assess_result, lon, lat FROM xian_reservoir_list
<where>
id = #{id} AND is_delete = 0
</where>
@@ -22,6 +22,7 @@ init:
hidden-danger:
all: 'xian:init:data:base-points:hidden-danger:all'
landslide: 'xian:init:data:base-points:hidden-danger:landslide'
collapse: 'xian:init:data:base-points:hidden-danger:collapse'
debris-flow: 'xian:init:data:base-points:hidden-danger:debris_flow'
flash-flood: 'xian:init:data:base-points:hidden-danger:flash_flood'
water-logging: 'xian:init:data:base-points:hidden-danger:water_logging'