隐患点
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.gis.xian.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* 异步配置类
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAsync // 开启异步支持
|
||||
public class AsyncConfig {
|
||||
|
||||
@Bean(name = "xianPool")
|
||||
public Executor taskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// 核心线程数
|
||||
executor.setCorePoolSize(5);
|
||||
// 最大线程数
|
||||
executor.setMaxPoolSize(10);
|
||||
// 队列容量
|
||||
executor.setQueueCapacity(100);
|
||||
// 线程名前缀
|
||||
executor.setThreadNamePrefix("async-xian-");
|
||||
// 拒绝策略:CallerRunsPolicy 表示由调用线程执行(不丢失任务)
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 等待所有任务结束再关闭
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(60);
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.utils.safety.SM2Utils;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -13,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/crypto")
|
||||
@Slf4j
|
||||
public class CryptoController extends BaseController {
|
||||
|
||||
@Resource
|
||||
@@ -30,7 +32,7 @@ public class CryptoController extends BaseController {
|
||||
if (sm2KeyPairObj == null) {
|
||||
Map<String, String> sm2KeyPair = SM2Utils.generateKeyPair();
|
||||
redisTemplate.opsForValue().set(sm2KeyPairRedisKey, sm2KeyPair);
|
||||
System.out.println("SM2密钥对已生成并存储到Redis");
|
||||
log.info("SM2密钥对已生成并存储到Redis");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsBasePoint;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsPointDetail;
|
||||
import com.gis.xian.service.XianHiddenDangerSpotsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hidden-danger-spots")
|
||||
public class XianHiddenDangerSpotsController extends BaseController{
|
||||
|
||||
@Resource
|
||||
private XianHiddenDangerSpotsService xianHiddenDangerSpotsService;
|
||||
|
||||
@GetMapping("/base-points")
|
||||
public ApiResponse<List<XianHiddenDangerSpotsBasePoint>> getBasePoints(@RequestParam String disasterType) {
|
||||
return ApiResponse.ok(xianHiddenDangerSpotsService.getBasePoints(disasterType));
|
||||
}
|
||||
|
||||
@GetMapping("point-detail/{id}")
|
||||
public ApiResponse<XianHiddenDangerSpotsPointDetail> getPointDetailById(@PathVariable String id) {
|
||||
return ApiResponse.ok(xianHiddenDangerSpotsService.getPointDetailById(Long.parseLong(id)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.gis.xian.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 地质灾害隐患点
|
||||
* @TableName xian_hidden_danger_spots
|
||||
*/
|
||||
@Data
|
||||
public class XianHiddenDangerSpots {
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 野外编号
|
||||
*/
|
||||
private String fieldCode;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 省编号
|
||||
*/
|
||||
private String provinceId;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 市编号
|
||||
*/
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
* 县
|
||||
*/
|
||||
private String county;
|
||||
|
||||
/**
|
||||
* 县编号
|
||||
*/
|
||||
private String countyId;
|
||||
|
||||
/**
|
||||
* 乡镇
|
||||
*/
|
||||
private String village;
|
||||
|
||||
/**
|
||||
* 灾害点名称
|
||||
*/
|
||||
private String disasterName;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Double lon;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private Double lat;
|
||||
|
||||
/**
|
||||
* 空间
|
||||
*/
|
||||
private Object geom;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 灾害类型
|
||||
*/
|
||||
private String disasterType;
|
||||
|
||||
/**
|
||||
* 规模等级
|
||||
*/
|
||||
private String scaleGrade;
|
||||
|
||||
/**
|
||||
* 险情等级
|
||||
*/
|
||||
private String riskGrade;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识,0未删除,1已删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
XianHiddenDangerSpots other = (XianHiddenDangerSpots) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getFieldCode() == null ? other.getFieldCode() == null : this.getFieldCode().equals(other.getFieldCode()))
|
||||
&& (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince()))
|
||||
&& (this.getProvinceId() == null ? other.getProvinceId() == null : this.getProvinceId().equals(other.getProvinceId()))
|
||||
&& (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity()))
|
||||
&& (this.getCityId() == null ? other.getCityId() == null : this.getCityId().equals(other.getCityId()))
|
||||
&& (this.getCounty() == null ? other.getCounty() == null : this.getCounty().equals(other.getCounty()))
|
||||
&& (this.getCountyId() == null ? other.getCountyId() == null : this.getCountyId().equals(other.getCountyId()))
|
||||
&& (this.getVillage() == null ? other.getVillage() == null : this.getVillage().equals(other.getVillage()))
|
||||
&& (this.getDisasterName() == null ? other.getDisasterName() == null : this.getDisasterName().equals(other.getDisasterName()))
|
||||
&& (this.getLon() == null ? other.getLon() == null : this.getLon().equals(other.getLon()))
|
||||
&& (this.getLat() == null ? other.getLat() == null : this.getLat().equals(other.getLat()))
|
||||
&& (this.getGeom() == null ? other.getGeom() == null : this.getGeom().equals(other.getGeom()))
|
||||
&& (this.getPosition() == null ? other.getPosition() == null : this.getPosition().equals(other.getPosition()))
|
||||
&& (this.getDisasterType() == null ? other.getDisasterType() == null : this.getDisasterType().equals(other.getDisasterType()))
|
||||
&& (this.getScaleGrade() == null ? other.getScaleGrade() == null : this.getScaleGrade().equals(other.getScaleGrade()))
|
||||
&& (this.getRiskGrade() == null ? other.getRiskGrade() == null : this.getRiskGrade().equals(other.getRiskGrade()))
|
||||
&& (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 + ((getFieldCode() == null) ? 0 : getFieldCode().hashCode());
|
||||
result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode());
|
||||
result = prime * result + ((getProvinceId() == null) ? 0 : getProvinceId().hashCode());
|
||||
result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode());
|
||||
result = prime * result + ((getCityId() == null) ? 0 : getCityId().hashCode());
|
||||
result = prime * result + ((getCounty() == null) ? 0 : getCounty().hashCode());
|
||||
result = prime * result + ((getCountyId() == null) ? 0 : getCountyId().hashCode());
|
||||
result = prime * result + ((getVillage() == null) ? 0 : getVillage().hashCode());
|
||||
result = prime * result + ((getDisasterName() == null) ? 0 : getDisasterName().hashCode());
|
||||
result = prime * result + ((getLon() == null) ? 0 : getLon().hashCode());
|
||||
result = prime * result + ((getLat() == null) ? 0 : getLat().hashCode());
|
||||
result = prime * result + ((getGeom() == null) ? 0 : getGeom().hashCode());
|
||||
result = prime * result + ((getPosition() == null) ? 0 : getPosition().hashCode());
|
||||
result = prime * result + ((getDisasterType() == null) ? 0 : getDisasterType().hashCode());
|
||||
result = prime * result + ((getScaleGrade() == null) ? 0 : getScaleGrade().hashCode());
|
||||
result = prime * result + ((getRiskGrade() == null) ? 0 : getRiskGrade().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(", fieldCode=").append(fieldCode);
|
||||
sb.append(", province=").append(province);
|
||||
sb.append(", provinceId=").append(provinceId);
|
||||
sb.append(", city=").append(city);
|
||||
sb.append(", cityId=").append(cityId);
|
||||
sb.append(", county=").append(county);
|
||||
sb.append(", countyId=").append(countyId);
|
||||
sb.append(", village=").append(village);
|
||||
sb.append(", disasterName=").append(disasterName);
|
||||
sb.append(", lon=").append(lon);
|
||||
sb.append(", lat=").append(lat);
|
||||
sb.append(", geom=").append(geom);
|
||||
sb.append(", position=").append(position);
|
||||
sb.append(", disasterType=").append(disasterType);
|
||||
sb.append(", scaleGrade=").append(scaleGrade);
|
||||
sb.append(", riskGrade=").append(riskGrade);
|
||||
sb.append(", isDelete=").append(isDelete);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gis.xian.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 地质灾害隐患点-基本点信息:滑坡、泥石流、内涝、山洪
|
||||
* @TableName xian_hidden_danger_spots
|
||||
*/
|
||||
@Data
|
||||
public class XianHiddenDangerSpotsBasePoint {
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Double lon;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private Double lat;
|
||||
|
||||
/**
|
||||
* 灾害类型
|
||||
*/
|
||||
private String disasterType;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
XianHiddenDangerSpotsBasePoint that = (XianHiddenDangerSpotsBasePoint) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(lon, that.lon) && Objects.equals(lat, that.lat) && Objects.equals(disasterType, that.disasterType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, lon, lat, disasterType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.gis.xian.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
public class XianHiddenDangerSpotsPointDetail {
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 野外编号
|
||||
*/
|
||||
private String fieldCode;
|
||||
|
||||
/**
|
||||
* 灾害点名称
|
||||
*/
|
||||
private String disasterName;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 灾害类型
|
||||
*/
|
||||
private String disasterType;
|
||||
|
||||
/**
|
||||
* 规模等级
|
||||
*/
|
||||
private String scaleGrade;
|
||||
|
||||
/**
|
||||
* 险情等级
|
||||
*/
|
||||
private String riskGrade;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
XianHiddenDangerSpotsPointDetail that = (XianHiddenDangerSpotsPointDetail) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(fieldCode, that.fieldCode) && Objects.equals(disasterName, that.disasterName) && Objects.equals(position, that.position) && Objects.equals(disasterType, that.disasterType) && Objects.equals(scaleGrade, that.scaleGrade) && Objects.equals(riskGrade, that.riskGrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, fieldCode, disasterName, position, disasterType, scaleGrade, riskGrade);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gis.xian.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DisasterTypeEnum {
|
||||
RAINSTORM("rainstorm"),
|
||||
EARTHQUAKE("earthquake");
|
||||
|
||||
private final String type;
|
||||
|
||||
DisasterTypeEnum(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.gis.xian.mapper;
|
||||
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsBasePoint;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsPointDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wzy
|
||||
* @description 针对表【xian_hidden_danger_spots(地质灾害隐患点)】的数据库操作Mapper
|
||||
* @createDate 2026-04-09 16:18:17
|
||||
* @Entity com.gis.xian.entity.XianHiddenDangerSpots
|
||||
*/
|
||||
public interface XianHiddenDangerSpotsMapper {
|
||||
/**
|
||||
* 获取所有基础点:滑坡、泥石流、山洪、内涝
|
||||
* @return 基础点列表
|
||||
*/
|
||||
List<XianHiddenDangerSpotsBasePoint> getBasePoints(String disasterType);
|
||||
|
||||
/**
|
||||
* 根据id获取隐患点详情
|
||||
* @param id 隐患点id
|
||||
* @return 隐患点详情
|
||||
*/
|
||||
XianHiddenDangerSpotsPointDetail getPointDetailById(Long id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.gis.xian.service;
|
||||
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsBasePoint;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsPointDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface XianHiddenDangerSpotsService {
|
||||
|
||||
/**
|
||||
* 获取所有基础点:滑坡、泥石流、山洪、内涝
|
||||
* @return 基础点列表
|
||||
*/
|
||||
List<XianHiddenDangerSpotsBasePoint> getBasePoints(String disasterType);
|
||||
|
||||
/**
|
||||
* 根据id获取隐患点详情
|
||||
* @param id 隐患点id
|
||||
* @return 隐患点详情
|
||||
*/
|
||||
XianHiddenDangerSpotsPointDetail getPointDetailById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gis.xian.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsBasePoint;
|
||||
import com.gis.xian.entity.XianHiddenDangerSpotsPointDetail;
|
||||
import com.gis.xian.enums.DisasterTypeEnum;
|
||||
import com.gis.xian.mapper.XianHiddenDangerSpotsMapper;
|
||||
import com.gis.xian.service.XianHiddenDangerSpotsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class IXianHiddenDangerSpotsServiceImpl implements XianHiddenDangerSpotsService {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Resource
|
||||
private XianHiddenDangerSpotsMapper xianHiddenDangerSpotsMapper;
|
||||
|
||||
@Value("${init.data.base-points.rainstorm}")
|
||||
private String rainstormBasePointsKey;
|
||||
|
||||
@Value("${init.data.base-points.earthquake}")
|
||||
private String earthquakeBasePointsKey;
|
||||
|
||||
@Override
|
||||
public List<XianHiddenDangerSpotsBasePoint> getBasePoints(String disasterType) {
|
||||
// 从redis中读取基础点信息
|
||||
Object data = null;
|
||||
|
||||
if(DisasterTypeEnum.RAINSTORM.getType().equals(disasterType)) {
|
||||
data = redisTemplate.opsForValue().get(rainstormBasePointsKey);
|
||||
}else {
|
||||
data = redisTemplate.opsForValue().get(earthquakeBasePointsKey);
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
List<XianHiddenDangerSpotsBasePoint> basePoints = xianHiddenDangerSpotsMapper.getBasePoints(disasterType);
|
||||
|
||||
if(DisasterTypeEnum.RAINSTORM.getType().equals(disasterType)) {
|
||||
redisTemplate.opsForValue().set(rainstormBasePointsKey, JSON.toJSONString(basePoints));
|
||||
}else {
|
||||
redisTemplate.opsForValue().set(earthquakeBasePointsKey, JSON.toJSONString(basePoints));
|
||||
}
|
||||
return basePoints;
|
||||
}
|
||||
|
||||
return JSON.parseArray(data.toString(), XianHiddenDangerSpotsBasePoint.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XianHiddenDangerSpotsPointDetail getPointDetailById(Long id) {
|
||||
return xianHiddenDangerSpotsMapper.getPointDetailById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gis.xian.task;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.gis.xian.enums.DisasterTypeEnum;
|
||||
import com.gis.xian.mapper.XianHiddenDangerSpotsMapper;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class InitializeData {
|
||||
|
||||
@Resource
|
||||
private XianHiddenDangerSpotsMapper xianHiddenDangerSpotsMapper;
|
||||
|
||||
@Resource
|
||||
RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Value("${init.data.base-points.rainstorm}")
|
||||
private String rainstormBasePointsKey;
|
||||
|
||||
@Value("${init.data.base-points.earthquake}")
|
||||
private String earthquakeBasePointsKey;
|
||||
|
||||
@PostConstruct
|
||||
@Async("xianPool")
|
||||
public void init() {
|
||||
log.info("开始初始化数据");
|
||||
|
||||
// 加载滑坡、泥石流、山洪、内涝隐患点信息并写入redis
|
||||
redisTemplate.opsForValue().set(rainstormBasePointsKey, JSON.toJSONString(xianHiddenDangerSpotsMapper.getBasePoints(DisasterTypeEnum.RAINSTORM.getType())));
|
||||
redisTemplate.opsForValue().set(earthquakeBasePointsKey, JSON.toJSONString(xianHiddenDangerSpotsMapper.getBasePoints(DisasterTypeEnum.EARTHQUAKE.getType())));
|
||||
|
||||
log.info("初始化数据完成");
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ server:
|
||||
# 开发环境配置
|
||||
spring:
|
||||
config:
|
||||
import: classpath:application-database-dev.yml
|
||||
import: classpath:config/database/application-database-dev.yml
|
||||
|
||||
# redis
|
||||
data:
|
||||
redis:
|
||||
|
||||
@@ -5,7 +5,8 @@ server:
|
||||
# 生产环境配置
|
||||
spring:
|
||||
config:
|
||||
import: classpath:application-database-prod.yml
|
||||
import: classpath:config/database/application-database-prod.yml
|
||||
|
||||
# redis
|
||||
data:
|
||||
redis:
|
||||
|
||||
@@ -2,16 +2,12 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
config:
|
||||
import: classpath:config/redis/redis-key.yml
|
||||
|
||||
# MyBatis 配置
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.gis.basic_template_not_login_back.entity
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
# 安全配置
|
||||
safety:
|
||||
sm2:
|
||||
# sm2公钥在redis存储名
|
||||
global: 'sm2:keypair:global'
|
||||
map-underscore-to-camel-case: true
|
||||
@@ -0,0 +1,67 @@
|
||||
<?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.XianHiddenDangerSpotsMapper">
|
||||
|
||||
<resultMap id="XianHiddenDangerSpotsResultMap" type="com.gis.xian.entity.XianHiddenDangerSpots">
|
||||
<id property="id" column="id" />
|
||||
<result property="fieldCode" column="field_code" />
|
||||
<result property="province" column="province" />
|
||||
<result property="provinceId" column="province_id" />
|
||||
<result property="city" column="city" />
|
||||
<result property="cityId" column="city_id" />
|
||||
<result property="county" column="county" />
|
||||
<result property="countyId" column="county_id" />
|
||||
<result property="village" column="village" />
|
||||
<result property="disasterName" column="disaster_name" />
|
||||
<result property="lon" column="lon" />
|
||||
<result property="lat" column="lat" />
|
||||
<result property="geom" column="geom" />
|
||||
<result property="position" column="position" />
|
||||
<result property="disasterType" column="disaster_type" />
|
||||
<result property="scaleGrade" column="scale_grade" />
|
||||
<result property="riskGrade" column="risk_grade" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="XianHiddenDangerSpotsBasePointResultMap" type="com.gis.xian.entity.XianHiddenDangerSpotsBasePoint">
|
||||
<id property="id" column="id" />
|
||||
<result property="lon" column="lon" />
|
||||
<result property="lat" column="lat" />
|
||||
<result property="disasterType" column="disaster_type" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="XianHiddenDangerSpotsPointDetailResultMap" type="com.gis.xian.entity.XianHiddenDangerSpotsPointDetail">
|
||||
<id property="id" column="id" />
|
||||
<result property="fieldCode" column="field_code" />
|
||||
<result property="disasterName" column="disaster_name" />
|
||||
<result property="position" column="position" />
|
||||
<result property="disasterType" column="disaster_type" />
|
||||
<result property="scaleGrade" column="scale_grade" />
|
||||
<result property="riskGrade" column="risk_grade" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 获取所有基础点:滑坡、泥石流、山洪、内涝 -->
|
||||
<select id="getBasePoints" resultMap="XianHiddenDangerSpotsBasePointResultMap">
|
||||
SELECT id, lon, lat, disaster_type FROM xian_hidden_danger_spots
|
||||
<where>
|
||||
<choose>
|
||||
<when test='disasterType == "rainstorm"'>
|
||||
disaster_type IN('滑坡', '泥石流', '山洪', '内涝')
|
||||
</when>
|
||||
<otherwise>
|
||||
disaster_type IN('滑坡', '泥石流')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取隐患点详情 -->
|
||||
<select id="getPointDetailById" resultMap="XianHiddenDangerSpotsPointDetailResultMap">
|
||||
SELECT id, field_code, disaster_name, position, disaster_type, scale_grade, risk_grade FROM xian_hidden_danger_spots
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
+1
-1
@@ -25,7 +25,7 @@ spring:
|
||||
|
||||
# 主库
|
||||
master:
|
||||
url: jdbc:postgresql://47.92.216.173:7654/xian?characterEncoding=utf8&TimeZone=Asia/Shanghai
|
||||
url: jdbc:postgresql://47.92.216.173:7654/xian_new?characterEncoding=utf8&TimeZone=Asia/Shanghai
|
||||
username: postgres
|
||||
password: zhangsan
|
||||
driver-class-name: org.postgresql.Driver
|
||||
@@ -0,0 +1,14 @@
|
||||
# 安全配置
|
||||
safety:
|
||||
sm2:
|
||||
# sm2公钥在redis存储名
|
||||
global: 'xian:sm2:keypair:global'
|
||||
|
||||
|
||||
# 初始化数据存储
|
||||
init:
|
||||
data:
|
||||
# 基础信息点数据:滑坡、泥石流、山洪、内涝
|
||||
base-points:
|
||||
rainstorm: 'xian:init:data:base-points:rainstorm'
|
||||
earthquake: 'xian:init:data:base-points:earthquake'
|
||||
Reference in New Issue
Block a user