修改QGIS项目结构
This commit is contained in:
+1
-3
@@ -1,12 +1,10 @@
|
||||
package com.gis.xian.core.config;
|
||||
package com.gis.xian.config;
|
||||
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.amqp.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package com.gis.xian.core.config;
|
||||
package com.gis.xian.config;
|
||||
|
||||
import com.gis.xian.utils.http.HttpRestClient;
|
||||
import com.gis.xian.utils.HttpRequestClientUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -19,8 +19,8 @@ public class RestClientConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpRestClient httpRestClient(RestTemplate restTemplate) {
|
||||
HttpRestClient client = new HttpRestClient(restTemplate);
|
||||
public HttpRequestClientUtils httpRestClient(RestTemplate restTemplate) {
|
||||
HttpRequestClientUtils client = new HttpRequestClientUtils(restTemplate);
|
||||
// 添加全局默认请求头
|
||||
// client.addDefaultHeader("X-App-Id", "my-app-id");
|
||||
return client;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.handler;
|
||||
package com.gis.xian.config.typehandler;
|
||||
|
||||
import net.postgis.jdbc.PGgeometry;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
@@ -10,9 +10,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class BaseConstants {
|
||||
|
||||
// 暴雨专题图模板路径
|
||||
public static final String RAIN_MAPS_OUTPUT_PATH = "F:/files/xian/dzxx/output/rain/map/"; // 暴雨专题图文件输出路径
|
||||
|
||||
// 提示语
|
||||
public static final String PARAMS_ERROR = "参数有误,请重新传入!";
|
||||
public static final String RESULT_ERROR = "结果空值!";
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.dto.pub.EqTriggerDTO;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import com.gis.xian.service.pub.IDZEqEventService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeTriggerDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeEventService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.geolatte.geom.V;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -22,17 +19,17 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequestMapping("/open")
|
||||
public class DZEqEventController {
|
||||
@Resource
|
||||
private IDZEqEventService idzEqEventService;
|
||||
private IEarthquakeEventService IEarthquakeEventService;
|
||||
|
||||
@PostMapping("/eq/trigger")
|
||||
public ApiResponse<EqQuery> trigger(@RequestBody @Validated EqTriggerDTO trigger) {
|
||||
EqQuery query = idzEqEventService.trigger(trigger);
|
||||
public ApiResponse<EarthquakeQuery> trigger(@RequestBody @Validated EarthquakeTriggerDTO trigger) {
|
||||
EarthquakeQuery query = IEarthquakeEventService.trigger(trigger);
|
||||
return ApiResponse.ok(query);
|
||||
}
|
||||
|
||||
@PostMapping("/eq/delete/{Id}")
|
||||
public ApiResponse<Boolean> delete(@PathVariable Long Id) {
|
||||
Boolean deleted = idzEqEventService.deletedById(Id);
|
||||
Boolean deleted = IEarthquakeEventService.deletedById(Id);
|
||||
return ApiResponse.ok(deleted);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import com.gis.xian.service.dzxx.IDZXXInfluenceService;
|
||||
import com.gis.xian.service.pub.IDZInfluenceService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationInfluenceService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInfluenceService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -27,19 +26,19 @@ import java.util.Map;
|
||||
public class DZInfluenceController {
|
||||
|
||||
@Resource
|
||||
private IDZInfluenceService idzInfluenceService;
|
||||
private IEarthquakeInfluenceService IEarthquakeInfluenceService;
|
||||
@Resource
|
||||
private IDZXXInfluenceService idzxxInfluenceService;
|
||||
private IEarthquakeInformationInfluenceService IEarthquakeInformationInfluenceService;
|
||||
|
||||
@PostMapping("/influence")
|
||||
public ApiResponse<Map<String, String>> getInfluence(@RequestBody @Validated EqQuery query) {
|
||||
Map<String, String> influence = idzInfluenceService.getInfluence(query);
|
||||
public ApiResponse<Map<String, String>> getInfluence(@RequestBody @Validated EarthquakeQuery query) {
|
||||
Map<String, String> influence = IEarthquakeInfluenceService.getInfluence(query);
|
||||
return ApiResponse.ok(influence);
|
||||
}
|
||||
|
||||
@PostMapping("/generate/influence")
|
||||
public ApiResponse<String> generateInfluence(@RequestBody @Validated EqAssessmentDTO assess) {
|
||||
idzxxInfluenceService.handle(assess);
|
||||
public ApiResponse<String> generateInfluence(@RequestBody @Validated EarthquakeAssessmentDTO assess) {
|
||||
IEarthquakeInformationInfluenceService.handle(assess);
|
||||
return ApiResponse.ok("地震影响场已生成!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.dto.pub.DZProductDTO;
|
||||
import com.gis.xian.query.ProductQuery;
|
||||
import com.gis.xian.service.pub.IDZProductService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeProductDTO;
|
||||
import com.gis.xian.dto.qgis.base.ProductQuery;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeProductService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,14 +18,17 @@ import java.util.List;
|
||||
* @description: 产出结果控制类
|
||||
* @date 2026/6/4 下午3:38
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/open")
|
||||
public class DZProductController {
|
||||
|
||||
@Resource
|
||||
private IDZProductService idzProductService;
|
||||
private IEarthquakeProductService IEarthquakeProductService;
|
||||
|
||||
@PostMapping("/product")
|
||||
public ApiResponse<List<DZProductDTO>> getProducts(@RequestBody ProductQuery query) {
|
||||
List<DZProductDTO> products = idzProductService.getProducts(query);
|
||||
public ApiResponse<List<EarthquakeProductDTO>> getProducts(@RequestBody ProductQuery query) {
|
||||
List<EarthquakeProductDTO> products = IEarthquakeProductService.getProducts(query);
|
||||
return ApiResponse.ok(products);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.domain.ApiResponse;
|
||||
import com.gis.xian.dto.pub.RTriggerDTO;
|
||||
import com.gis.xian.query.RQuery;
|
||||
import com.gis.xian.service.pub.IREventService;
|
||||
import com.gis.xian.dto.qgis.rain.RainTriggerDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainQuery;
|
||||
import com.gis.xian.service.qgis.rain.IREventService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -23,8 +23,8 @@ public class REventController {
|
||||
private IREventService irEventService;
|
||||
|
||||
@PostMapping("/rs/trigger")
|
||||
public ApiResponse<RQuery> trigger(@RequestBody @Validated RTriggerDTO trigger) {
|
||||
RQuery query = irEventService.trigger(trigger);
|
||||
public ApiResponse<RainQuery> trigger(@RequestBody @Validated RainTriggerDTO trigger) {
|
||||
RainQuery query = irEventService.trigger(trigger);
|
||||
return ApiResponse.ok(query);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.gis.xian.domain;
|
||||
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,9 +11,9 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class DlqMessage {
|
||||
public class DeadLetterMessageDomain {
|
||||
|
||||
private QgisArgs qgisArgs; // 原始参数
|
||||
private QgisArgsParams qgisArgsParams; // 原始参数
|
||||
private String failReason; // 失败原因
|
||||
private Long failTime; // 失败时间戳
|
||||
private Integer retryCount; // 已重试次数
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.base;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.query;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.params;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
* @date 2026/5/26 上午11:32
|
||||
*/
|
||||
@Data
|
||||
public class QgisArgs implements Serializable {
|
||||
public class QgisArgsParams implements Serializable {
|
||||
|
||||
private Integer Id; // 记录进度
|
||||
private double centerX;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.base;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.base;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.base;
|
||||
package com.gis.xian.dto.qgis.base;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/5/25 下午6:04
|
||||
*/
|
||||
@Data
|
||||
public class EqAssessmentDTO {
|
||||
public class EarthquakeAssessmentDTO {
|
||||
|
||||
private String event; // 地震编码
|
||||
private String eqQueueId; // 评估编码
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.dzxx;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/5/25 下午5:19
|
||||
*/
|
||||
@Data
|
||||
public class DZXXCenterDTO {
|
||||
public class EarthquakeCenterDTO {
|
||||
|
||||
private String event;
|
||||
private LocalDateTime eqTime;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.dzxx;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
@@ -9,7 +9,7 @@ import org.locationtech.jts.geom.Geometry;
|
||||
* @date 2026/5/26 上午10:03
|
||||
*/
|
||||
@Data
|
||||
public class DZXXDistanceDTO {
|
||||
public class EarthquakeDistanceDTO {
|
||||
|
||||
private Geometry geom;
|
||||
private String eqQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
* @date 2026/5/26 上午10:46
|
||||
*/
|
||||
@Data
|
||||
public class DZInfluenceDTO {
|
||||
public class EarthquakeInfluenceDTO {
|
||||
|
||||
private String eqQueueId;
|
||||
private String event;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
* @date 2026/5/26 上午10:43
|
||||
*/
|
||||
@Data
|
||||
public class IntyGeoJsonDTO {
|
||||
public class EarthquakeInfluenceGeoJsonDTO {
|
||||
|
||||
private final String type = "FeatureCollection";
|
||||
private List<GeoJsonFeature> features = new ArrayList<>();
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.dzxx;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
@@ -9,7 +9,7 @@ import org.locationtech.jts.geom.Geometry;
|
||||
* @date 2026/5/26 上午10:11
|
||||
*/
|
||||
@Data
|
||||
public class DZXXInfluenceDTO {
|
||||
public class EarthquakeInformationInfluenceDTO {
|
||||
|
||||
private Geometry geom;
|
||||
private String eqQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.query;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
* @date 2026/5/26 上午10:33
|
||||
*/
|
||||
@Data
|
||||
public class IntensityQuery {
|
||||
public class EarthquakeIntensityQuery {
|
||||
|
||||
private double centerLon; // 中心点经度
|
||||
private double centerLat; // 中心点纬度
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/5/26 上午10:59
|
||||
*/
|
||||
@Data
|
||||
public class DZProductDTO {
|
||||
public class EarthquakeProductDTO {
|
||||
|
||||
|
||||
private String eqQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.query;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EqQuery {
|
||||
public class EarthquakeQuery {
|
||||
|
||||
private String event;
|
||||
private String eqQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -9,7 +9,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/5/25 下午4:52
|
||||
*/
|
||||
@Data
|
||||
public class EqTriggerDTO {
|
||||
public class EarthquakeTriggerDTO {
|
||||
|
||||
private String eqName; // 地震名称
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.rain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/5/26 下午5:51
|
||||
*/
|
||||
@Data
|
||||
public class RAssessmentDTO implements Serializable {
|
||||
public class RainAssessmentDTO implements Serializable {
|
||||
|
||||
private String rainId;
|
||||
private String rainQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.rain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
@@ -11,7 +11,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/6/8 下午4:49
|
||||
*/
|
||||
@Data
|
||||
public class REventDTO {
|
||||
public class RainEventDTO {
|
||||
|
||||
private String rainId;
|
||||
private String rainQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.query;
|
||||
package com.gis.xian.dto.qgis.rain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RQuery {
|
||||
public class RainQuery {
|
||||
|
||||
private String rainId;
|
||||
private String rainQueueId;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.dto.pub;
|
||||
package com.gis.xian.dto.qgis.rain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2026/6/8 下午4:44
|
||||
*/
|
||||
@Data
|
||||
public class RTriggerDTO {
|
||||
public class RainTriggerDTO {
|
||||
|
||||
private String position; // 区县
|
||||
private double longitude; // 经度
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
package com.gis.xian.entity.base;
|
||||
package com.gis.xian.entity.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gis.xian.config.typehandler.GeometryTypeHandler;
|
||||
import lombok.Data;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
@@ -197,7 +198,7 @@ public class ActiveFault {
|
||||
@TableField("\"DateSource\"")
|
||||
private String DateSource;
|
||||
|
||||
@TableField(value = "\"Geometry\"", typeHandler = com.gis.xian.handler.GeometryTypeHandler.class)
|
||||
@TableField(value = "\"Geometry\"", typeHandler = GeometryTypeHandler.class)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Geometry geometry;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.base;
|
||||
package com.gis.xian.entity.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.base;
|
||||
package com.gis.xian.entity.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.base;
|
||||
package com.gis.xian.entity.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.gis.xian.entity.dzxx;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.gis.xian.config.typehandler.GeometryTypeHandler;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -14,12 +14,12 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("dzxx.dz_gis_center")
|
||||
public class DZXXCenter {
|
||||
public class EarthquakeCenter {
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
|
||||
@TableField(value = "geom", typeHandler = com.gis.xian.handler.GeometryTypeHandler.class)
|
||||
@TableField(value = "geom", typeHandler = GeometryTypeHandler.class)
|
||||
private Geometry geom;
|
||||
|
||||
@TableField("event")
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.dzxx;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("dzxx.dz_gis_distance")
|
||||
public class DZXXDistance {
|
||||
public class EarthquakeDistance {
|
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.pub;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("public.dz_eqevent")
|
||||
public class DZEqEvent {
|
||||
public class EarthquakeEvent {
|
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.dzxx;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("dzxx.dz_gis_influence")
|
||||
public class DZXXInfluence {
|
||||
public class EarthquakeGisInfluence {
|
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.pub;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("public.dz_influence")
|
||||
public class DZInfluence {
|
||||
public class EarthquakeInfluence {
|
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.pub;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("public.dz_product")
|
||||
public class DZProduct {
|
||||
public class EarthquakeProduct {
|
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID)
|
||||
private Long Id;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.entity.pub;
|
||||
package com.gis.xian.entity.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -13,7 +13,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("public.dz_eqqueue")
|
||||
public class DZEqQueue {
|
||||
public class EarthquakeQueue {
|
||||
|
||||
@TableField(value = "id")
|
||||
private String id; // eqqueueid
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package com.gis.xian.entity.pub;
|
||||
package com.gis.xian.entity.qgis.rain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gis.xian.handler.GeometryTypeHandler;
|
||||
import com.gis.xian.config.typehandler.GeometryTypeHandler;
|
||||
import lombok.Data;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@TableName("public.r_event")
|
||||
public class REvent {
|
||||
public class RainEvent {
|
||||
|
||||
@TableId
|
||||
@TableField("id")
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.enums;
|
||||
package com.gis.xian.enums.qgis;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.enums;
|
||||
package com.gis.xian.enums.qgis;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EqMapsEnums {
|
||||
public enum EarthquakeMapsEnums {
|
||||
|
||||
// 制图枚举
|
||||
EARTHQUAKE_DISTRIBUTION(1, "地震影响估计范围分布图"),
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.enums;
|
||||
package com.gis.xian.enums.qgis;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
+23
-24
@@ -1,19 +1,18 @@
|
||||
package com.gis.xian.core.rabbitmq;
|
||||
package com.gis.xian.listener;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.domain.DlqMessage;
|
||||
import com.gis.xian.domain.DeadLetterMessageDomain;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.enums.BaseEnums;
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.service.pub.IDZEqQueueService;
|
||||
import com.gis.xian.enums.qgis.BaseEnums;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeQueueService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import com.gis.xian.utils.http.HttpRestClient;
|
||||
import com.gis.xian.utils.HttpRequestClientUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -24,14 +23,14 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DlqConsumer {
|
||||
public class DeadLetterMessageListener {
|
||||
|
||||
@Resource
|
||||
private HttpRestClient restclient;
|
||||
private HttpRequestClientUtils restclient;
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
@Resource
|
||||
private IDZEqQueueService idzEqQueueService;
|
||||
private IEarthquakeQueueService IEarthquakeQueueService;
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
|
||||
@@ -40,19 +39,19 @@ public class DlqConsumer {
|
||||
|
||||
// 死信队列消费者
|
||||
@RabbitListener(queues = BaseConstants.DLQ_QUEUE)
|
||||
public void handleDlqMessage(DlqMessage dlqMessage) {
|
||||
QgisArgs arg = dlqMessage.getQgisArgs();
|
||||
int currentRetryCount = dlqMessage.getRetryCount();
|
||||
public void handleDlqMessage(DeadLetterMessageDomain deadLetterMessageDomain) {
|
||||
QgisArgsParams arg = deadLetterMessageDomain.getQgisArgsParams();
|
||||
int currentRetryCount = deadLetterMessageDomain.getRetryCount();
|
||||
|
||||
try {
|
||||
log.info("处理死信队列消息! 参数ID:{} 重试次数:{}", arg.getId(), currentRetryCount);
|
||||
|
||||
// 判断是否超过最大重试次数
|
||||
if (currentRetryCount >= maxRetry) {
|
||||
log.error("消息重试次数已达上限! 参数ID:{} 失败原因:{}", arg.getId(), dlqMessage.getFailReason());
|
||||
log.error("消息重试次数已达上限! 参数ID:{} 失败原因:{}", arg.getId(), deadLetterMessageDomain.getFailReason());
|
||||
// 处理:告警+记录到失败表+人工介入
|
||||
sendAlarm(arg, dlqMessage);
|
||||
saveToFailTable(dlqMessage);
|
||||
sendAlarm(arg, deadLetterMessageDomain);
|
||||
saveToFailTable(deadLetterMessageDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,20 +74,20 @@ public class DlqConsumer {
|
||||
if (arg.getDisaster() == BaseConstants.RAIN_DISASTER_MAP) {
|
||||
p = BaseUtils.compute(arg.getId() + 1, 1);
|
||||
}
|
||||
idzEqQueueService.updated(arg.getEvent(), arg.getQueueId(), p, BaseEnums.CALCULATING.getCode());
|
||||
IEarthquakeQueueService.updated(arg.getEvent(), arg.getQueueId(), p, BaseEnums.CALCULATING.getCode());
|
||||
// 推送原业务消息
|
||||
rabbitTemplate.convertAndSend(BaseConstants.ASSESS_EXCHANGE, BaseConstants.MAPS_QUEUE, arg);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("死信消息重试失败! 参数ID:{} 重试次数:{}", arg.getId(), currentRetryCount, e);
|
||||
// 重试失败:更新重试次数,重新发送到死信队列(设置延迟)
|
||||
dlqMessage.setRetryCount(currentRetryCount + 1);
|
||||
dlqMessage.setFailReason(dlqMessage.getFailReason() + " | 重试失败:" + e.getMessage());
|
||||
deadLetterMessageDomain.setRetryCount(currentRetryCount + 1);
|
||||
deadLetterMessageDomain.setFailReason(deadLetterMessageDomain.getFailReason() + " | 重试失败:" + e.getMessage());
|
||||
// 延迟发送(需要安装rabbitmq_delayed_message_exchange插件)
|
||||
rabbitTemplate.convertAndSend(
|
||||
BaseConstants.DLX_EXCHANGE,
|
||||
BaseConstants.DLQ_QUEUE,
|
||||
dlqMessage,
|
||||
deadLetterMessageDomain,
|
||||
message -> {
|
||||
// 设置延迟时间(指数退避:10s, 30s, 60s)
|
||||
long delay = 10000 * (long) Math.pow(3, currentRetryCount);
|
||||
@@ -103,15 +102,15 @@ public class DlqConsumer {
|
||||
}
|
||||
|
||||
// 发送告警(邮件/短信/钉钉等)
|
||||
private void sendAlarm(QgisArgs arg, DlqMessage dlqMessage) {
|
||||
private void sendAlarm(QgisArgsParams arg, DeadLetterMessageDomain deadLetterMessageDomain) {
|
||||
// 实现告警逻辑:调用钉钉机器人/邮件接口等
|
||||
log.error("【告警】图件处理失败需要人工介入! 参数ID:{} 失败原因:{}", arg.getId(), dlqMessage.getFailReason());
|
||||
log.error("【告警】图件处理失败需要人工介入! 参数ID:{} 失败原因:{}", arg.getId(), deadLetterMessageDomain.getFailReason());
|
||||
}
|
||||
|
||||
// 保存失败记录到数据库
|
||||
private void saveToFailTable(DlqMessage dlqMessage) {
|
||||
private void saveToFailTable(DeadLetterMessageDomain deadLetterMessageDomain) {
|
||||
// 实现数据库存储逻辑,便于人工排查和处理
|
||||
log.info("失败记录已保存到数据库! 参数ID:{}", dlqMessage.getQgisArgs().getId());
|
||||
log.info("失败记录已保存到数据库! 参数ID:{}", deadLetterMessageDomain.getQgisArgsParams().getId());
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,11 +1,11 @@
|
||||
package com.gis.xian.listener;
|
||||
package com.gis.xian.listener.qgis;
|
||||
|
||||
import com.gis.xian.config.DataSourceContextHolder;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.entity.pub.DZProduct;
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeProduct;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import com.gis.xian.service.ex.ServeException;
|
||||
import com.gis.xian.service.pub.IDZProductService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeProductService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -31,7 +31,7 @@ import java.time.LocalDateTime;
|
||||
public class MapReceiveListener {
|
||||
|
||||
@Resource
|
||||
private IDZProductService idzProductService;
|
||||
private IEarthquakeProductService IEarthquakeProductService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
@@ -45,7 +45,7 @@ public class MapReceiveListener {
|
||||
|
||||
// rabbitmq 监听专题图队列
|
||||
@RabbitListener(queues = "maps", ackMode = "MANUAL")
|
||||
public void receive(QgisArgs args, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, Message message) throws IOException {
|
||||
public void receive(QgisArgsParams args, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, Message message) throws IOException {
|
||||
log.info("接收通知:{} 已生成!", args.getName());
|
||||
try {
|
||||
// 获取路径
|
||||
@@ -80,12 +80,12 @@ public class MapReceiveListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleData(QgisArgs args, String filePath) {
|
||||
private void handleData(QgisArgsParams args, String filePath) {
|
||||
try {
|
||||
DataSourceContextHolder.setDataSource("slave1");
|
||||
log.debug("切换数据源到: slave1");
|
||||
|
||||
DZProduct product = new DZProduct();
|
||||
EarthquakeProduct product = new EarthquakeProduct();
|
||||
product.setEqQueueId(args.getQueueId());
|
||||
product.setProTime(LocalDateTime.now());
|
||||
product.setCode(args.getMapLayout());
|
||||
@@ -100,7 +100,7 @@ public class MapReceiveListener {
|
||||
product.setSourceFile(filePath);
|
||||
|
||||
// 将图件信息插入到结果表中
|
||||
idzProductService.save(product);
|
||||
IEarthquakeProductService.save(product);
|
||||
log.info("{} 已保存到数据库!", args.getName());
|
||||
} finally {
|
||||
DataSourceContextHolder.clearDataSource();
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.gis.xian.mapper.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.pub.DZInfluence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: DZInfluenceMapper
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZInfluenceMapper extends BaseMapper<DZInfluence> {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.gis.xian.mapper.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.pub.DZProduct;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: DZInfluenceMapper
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZProductMapper extends BaseMapper<DZProduct> {
|
||||
}
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.base;
|
||||
package com.gis.xian.mapper.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.base.ActiveFault;
|
||||
import com.gis.xian.entity.qgis.base.ActiveFault;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.base;
|
||||
package com.gis.xian.mapper.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.base.SXCities;
|
||||
import com.gis.xian.entity.qgis.base.SXCities;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.base;
|
||||
package com.gis.xian.mapper.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.base.SXCounty;
|
||||
import com.gis.xian.entity.qgis.base.SXCounty;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.base;
|
||||
package com.gis.xian.mapper.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.base.SXTowns;
|
||||
import com.gis.xian.entity.qgis.base.SXTowns;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.dzxx;
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.dzxx.DZXXCenter;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeCenter;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -11,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/5/25 下午5:21
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZXXCenterMapper extends BaseMapper<DZXXCenter> {
|
||||
public interface EarthquakeCenterMapper extends BaseMapper<EarthquakeCenter> {
|
||||
}
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.dzxx;
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.dzxx.DZXXDistance;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeDistance;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -11,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/5/25 下午6:20
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZXXDistanceMapper extends BaseMapper<DZXXDistance> {
|
||||
public interface EarthquakeDistanceMapper extends BaseMapper<EarthquakeDistance> {
|
||||
}
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.pub;
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.pub.DZEqEvent;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeEvent;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -11,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/5/25 下午5:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZEqEventMapper extends BaseMapper<DZEqEvent> {
|
||||
public interface EarthquakeEventMapper extends BaseMapper<EarthquakeEvent> {
|
||||
}
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.dzxx;
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.dzxx.DZXXInfluence;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeGisInfluence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -11,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/5/25 下午6:20
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZXXInfluenceMapper extends BaseMapper<DZXXInfluence> {
|
||||
public interface EarthquakeGISInfluenceMapper extends BaseMapper<EarthquakeGisInfluence> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeInfluence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: EarthquakeInfluenceMapper
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface EarthquakeInfluenceMapper extends BaseMapper<EarthquakeInfluence> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeProduct;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: EarthquakeProductMapper
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface EarthquakeProductMapper extends BaseMapper<EarthquakeProduct> {
|
||||
}
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.mapper.pub;
|
||||
package com.gis.xian.mapper.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.pub.DZEqQueue;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeQueue;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -11,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface DZEqQueueMapper extends BaseMapper<DZEqQueue> {
|
||||
public interface EarthquakeQueueMapper extends BaseMapper<EarthquakeQueue> {
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.gis.xian.mapper.pub;
|
||||
package com.gis.xian.mapper.qgis.rain;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gis.xian.entity.pub.REvent;
|
||||
import com.gis.xian.entity.qgis.rain.RainEvent;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -10,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2026/6/8 下午6:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface REventMapper extends BaseMapper<REvent> {
|
||||
public interface RainEventMapper extends BaseMapper<RainEvent> {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.gis.xian.service.dzxx;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.dzxx.DZXXCenterDTO;
|
||||
import com.gis.xian.entity.dzxx.DZXXCenter;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震信息
|
||||
* @date 2026/5/25 下午5:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZXXCenterService extends IService<DZXXCenter> {
|
||||
|
||||
// 地震触发
|
||||
public void handle(DZXXCenterDTO trigger);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.gis.xian.service.dzxx;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.dzxx.DZXXInfluenceDTO;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.entity.dzxx.DZXXInfluence;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震影响场接口
|
||||
* @date 2026/5/25 下午6:09
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZXXInfluenceService extends IService<DZXXInfluence> {
|
||||
|
||||
// 处理地震影响场数据
|
||||
public void handle(EqAssessmentDTO trigger);
|
||||
|
||||
// 根据地震编码查询影响场范围
|
||||
public List<DZXXInfluenceDTO> findInfluenceById(EqQuery query);
|
||||
|
||||
// 获取最大烈度影响场
|
||||
public DZXXInfluenceDTO findInfluenceMaxIntyById(EqQuery query);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.gis.xian.service.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.pub.EqTriggerDTO;
|
||||
import com.gis.xian.entity.pub.DZEqEvent;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: QGIS地震事件触发
|
||||
* @date 2026/5/25 下午3:23
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZEqEventService extends IService<DZEqEvent> {
|
||||
|
||||
// 地震触发
|
||||
public EqQuery trigger(EqTriggerDTO trigger);
|
||||
|
||||
// 删除地震事件
|
||||
public Boolean deletedById(Long Id);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.gis.xian.service.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.RAssessmentDTO;
|
||||
import com.gis.xian.entity.pub.DZEqQueue;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震评估
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZEqQueueService extends IService<DZEqQueue> {
|
||||
|
||||
// 地震评估
|
||||
public void assess(EqAssessmentDTO assess);
|
||||
|
||||
// 暴雨评估
|
||||
public void assess(RAssessmentDTO assess);
|
||||
|
||||
// 更新评估进度、状态
|
||||
public void updated(String event, String queueId, double progress, int state);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.gis.xian.service.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.dzxx.DZXXInfluenceDTO;
|
||||
import com.gis.xian.entity.pub.DZInfluence;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震影响场
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZInfluenceService extends IService<DZInfluence> {
|
||||
|
||||
// 以文件形式 保存影响场
|
||||
public void handle(List<DZXXInfluenceDTO> dzxx);
|
||||
|
||||
// 获取影响场文件
|
||||
public Map<String, String> getInfluence(EqQuery query);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.gis.xian.service.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.pub.DZProductDTO;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.RAssessmentDTO;
|
||||
import com.gis.xian.entity.pub.DZProduct;
|
||||
import com.gis.xian.query.ProductQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: IDZProductService
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZProductService extends IService<DZProduct> {
|
||||
|
||||
// qgis 地震制图服务
|
||||
public void makeEarthquakeMaps(EqAssessmentDTO assess);
|
||||
|
||||
// qgis 暴雨制图服务
|
||||
public void makeRainstormMaps(RAssessmentDTO assess);
|
||||
|
||||
// 获取产品
|
||||
public List<DZProductDTO> getProducts(ProductQuery query);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.gis.xian.service.pub;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.pub.RTriggerDTO;
|
||||
import com.gis.xian.entity.pub.REvent;
|
||||
import com.gis.xian.query.RQuery;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: IREventService
|
||||
* @date 2026/6/8 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IREventService extends IService<REvent> {
|
||||
// 暴雨触发
|
||||
public RQuery trigger(RTriggerDTO trigger);
|
||||
|
||||
// 删除暴雨事件
|
||||
public Boolean deletedById(Long Id);
|
||||
}
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
package com.gis.xian.core.rabbitmq;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.gis.xian.domain.DlqMessage;
|
||||
import com.gis.xian.domain.DeadLetterMessageDomain;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DlqOperate {
|
||||
public class DeadLetterMessageService {
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
@@ -27,11 +27,11 @@ public class DlqOperate {
|
||||
* @param reason 失败原因
|
||||
* @param e 异常信息
|
||||
*/
|
||||
public void sendToDlq(QgisArgs arg, String reason, Exception e) {
|
||||
public void sendToDlq(QgisArgsParams arg, String reason, Exception e) {
|
||||
try {
|
||||
// 封装死信消息体,包含原始参数、失败原因、异常信息、重试次数等
|
||||
DlqMessage dlqMessage = DlqMessage.builder()
|
||||
.qgisArgs(arg)
|
||||
DeadLetterMessageDomain deadLetterMessageDomain = DeadLetterMessageDomain.builder()
|
||||
.qgisArgsParams(arg)
|
||||
.failReason(reason + (e != null ? " | " + e.getMessage() : ""))
|
||||
.failTime(System.currentTimeMillis())
|
||||
.retryCount(0) // 初始重试次数为0
|
||||
@@ -40,7 +40,7 @@ public class DlqOperate {
|
||||
rabbitTemplate.convertAndSend(
|
||||
BaseConstants.DLX_EXCHANGE,
|
||||
BaseConstants.DLQ_QUEUE,
|
||||
dlqMessage
|
||||
deadLetterMessageDomain
|
||||
);
|
||||
log.info("消息已发送到死信队列! 参数ID:{}", arg.getId());
|
||||
} catch (Exception ex) {
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.gis.xian.service.base;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.base.ActiveFaultDTO;
|
||||
import com.gis.xian.entity.base.ActiveFault;
|
||||
import com.gis.xian.dto.qgis.base.ActiveFaultDTO;
|
||||
import com.gis.xian.entity.qgis.base.ActiveFault;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.gis.xian.service.pub;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,5 +14,5 @@ import java.util.List;
|
||||
public interface IFeignService {
|
||||
|
||||
// 调用专题图
|
||||
public void invoke(List<QgisArgs> args);
|
||||
public void invoke(List<QgisArgsParams> args);
|
||||
}
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.gis.xian.service.base;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.entity.base.SXCities;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXCities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.gis.xian.service.base;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.entity.base.SXCounty;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXCounty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.gis.xian.service.base;
|
||||
package com.gis.xian.service.qgis.base;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.entity.base.SXTowns;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXTowns;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
package com.gis.xian.service.base.impl;
|
||||
package com.gis.xian.service.qgis.base.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ActiveFaultDTO;
|
||||
import com.gis.xian.entity.base.ActiveFault;
|
||||
import com.gis.xian.handler.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.base.ActiveFaultMapper;
|
||||
import com.gis.xian.service.base.IActiveFaultService;
|
||||
import com.gis.xian.dto.qgis.base.ActiveFaultDTO;
|
||||
import com.gis.xian.entity.qgis.base.ActiveFault;
|
||||
import com.gis.xian.service.qgis.base.IActiveFaultService;
|
||||
import com.gis.xian.utils.qgis.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.qgis.base.ActiveFaultMapper;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
+14
-15
@@ -1,22 +1,21 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.base.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.core.rabbitmq.DlqOperate;
|
||||
import com.gis.xian.enums.BaseEnums;
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import com.gis.xian.service.qgis.base.DeadLetterMessageService;
|
||||
import com.gis.xian.enums.qgis.BaseEnums;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.pub.IDZEqQueueService;
|
||||
import com.gis.xian.service.pub.IFeignService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeQueueService;
|
||||
import com.gis.xian.service.qgis.base.IFeignService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import com.gis.xian.utils.http.HttpRestClient;
|
||||
import com.gis.xian.utils.HttpRequestClientUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -34,20 +33,20 @@ public class FeignServiceImpl implements IFeignService {
|
||||
|
||||
|
||||
@Resource
|
||||
private HttpRestClient restclient;
|
||||
private HttpRequestClientUtils restclient;
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
@Resource
|
||||
@Lazy
|
||||
private IDZEqQueueService idzEqQueueService;
|
||||
private IEarthquakeQueueService IEarthquakeQueueService;
|
||||
@Resource
|
||||
private DlqOperate dlqOperate;
|
||||
private DeadLetterMessageService dlqOperate;
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
|
||||
// 调用制图服务
|
||||
@Override
|
||||
public void invoke(List<QgisArgs> args) {
|
||||
public void invoke(List<QgisArgsParams> args) {
|
||||
// 进度
|
||||
double p = 0;
|
||||
// 异常参数
|
||||
@@ -57,7 +56,7 @@ public class FeignServiceImpl implements IFeignService {
|
||||
// 保证尽可能的多产, 这里不要进行任何异常抛出, 只能记录失败的图层
|
||||
try {
|
||||
log.info("开始调用pyqgis服务");
|
||||
for (QgisArgs arg : args) {
|
||||
for (QgisArgsParams arg : args) {
|
||||
try { // 处理单个图件
|
||||
// 返回数据格式
|
||||
ParameterizedTypeReference<String> res = new ParameterizedTypeReference<String>() {
|
||||
@@ -79,7 +78,7 @@ public class FeignServiceImpl implements IFeignService {
|
||||
if (arg.getDisaster() == BaseConstants.RAIN_DISASTER_MAP) {
|
||||
p = BaseUtils.compute(arg.getId() + 1, 1);
|
||||
}
|
||||
idzEqQueueService.updated(arg.getEvent(), arg.getQueueId(), p, BaseEnums.CALCULATING.getCode());
|
||||
IEarthquakeQueueService.updated(arg.getEvent(), arg.getQueueId(), p, BaseEnums.CALCULATING.getCode());
|
||||
// 推送消息
|
||||
rabbitTemplate.convertAndSend(BaseConstants.ASSESS_EXCHANGE, BaseConstants.MAPS_QUEUE, arg);
|
||||
} catch (Exception ex) {
|
||||
@@ -91,7 +90,7 @@ public class FeignServiceImpl implements IFeignService {
|
||||
} catch (Exception e) {
|
||||
log.error("制图服务出现错误,请检查服务问题! {}", e.getMessage(), e);
|
||||
// 批量失败时,将所有未处理的参数投递到死信
|
||||
for (QgisArgs arg : args) {
|
||||
for (QgisArgsParams arg : args) {
|
||||
// 进入死信队列
|
||||
dlqOperate.sendToDlq(arg, "制图服务整体异常", e);
|
||||
}
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
package com.gis.xian.service.base.impl;
|
||||
package com.gis.xian.service.qgis.base.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.entity.base.SXCities;
|
||||
import com.gis.xian.handler.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.base.ShanXiCitiesMapper;
|
||||
import com.gis.xian.service.base.IShanXiCitiesService;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXCities;
|
||||
import com.gis.xian.service.qgis.base.IShanXiCitiesService;
|
||||
import com.gis.xian.utils.qgis.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.qgis.base.ShanXiCitiesMapper;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
package com.gis.xian.service.base.impl;
|
||||
package com.gis.xian.service.qgis.base.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.entity.base.SXCounty;
|
||||
import com.gis.xian.handler.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.base.ShanXiCountyMapper;
|
||||
import com.gis.xian.service.base.IShanXiCountyService;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXCounty;
|
||||
import com.gis.xian.service.qgis.base.IShanXiCountyService;
|
||||
import com.gis.xian.utils.qgis.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.qgis.base.ShanXiCountyMapper;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
package com.gis.xian.service.base.impl;
|
||||
package com.gis.xian.service.qgis.base.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.entity.base.SXTowns;
|
||||
import com.gis.xian.handler.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.base.ShanXiTownsMapper;
|
||||
import com.gis.xian.service.base.IShanXiTownsService;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.entity.qgis.base.SXTowns;
|
||||
import com.gis.xian.service.qgis.base.IShanXiTownsService;
|
||||
import com.gis.xian.utils.qgis.GeoDistanceHandler;
|
||||
import com.gis.xian.mapper.qgis.base.ShanXiTownsMapper;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeTriggerDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeEvent;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: QGIS地震事件触发
|
||||
* @date 2026/5/25 下午3:23
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeEventService extends IService<EarthquakeEvent> {
|
||||
|
||||
// 地震触发
|
||||
public EarthquakeQuery trigger(EarthquakeTriggerDTO trigger);
|
||||
|
||||
// 删除地震事件
|
||||
public Boolean deletedById(Long Id);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInformationInfluenceDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeInfluence;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震影响场
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeInfluenceService extends IService<EarthquakeInfluence> {
|
||||
|
||||
// 以文件形式 保存影响场
|
||||
public void handle(List<EarthquakeInformationInfluenceDTO> dzxx);
|
||||
|
||||
// 获取影响场文件
|
||||
public Map<String, String> getInfluence(EarthquakeQuery query);
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeCenterDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeCenter;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震信息
|
||||
* @date 2026/5/25 下午5:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeInformationCenterService extends IService<EarthquakeCenter> {
|
||||
|
||||
// 地震触发
|
||||
public void handle(EarthquakeCenterDTO trigger);
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.gis.xian.service.dzxx;
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.entity.dzxx.DZXXDistance;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeDistance;
|
||||
|
||||
/**
|
||||
* @ClassName IDZXXDistanceService
|
||||
@@ -11,7 +11,7 @@ import com.gis.xian.entity.dzxx.DZXXDistance;
|
||||
* @Date 2026/5/25 12:06
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IDZXXDistanceService extends IService<DZXXDistance> {
|
||||
public interface IEarthquakeInformationDistanceService extends IService<EarthquakeDistance> {
|
||||
|
||||
// 处理震中到省市区镇
|
||||
public void handle(double lon, double lat, String eqQueueId);
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInformationInfluenceDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeGisInfluence;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震影响场接口
|
||||
* @date 2026/5/25 下午6:09
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeInformationInfluenceService extends IService<EarthquakeGisInfluence> {
|
||||
|
||||
// 处理地震影响场数据
|
||||
public void handle(EarthquakeAssessmentDTO trigger);
|
||||
|
||||
// 根据地震编码查询影响场范围
|
||||
public List<EarthquakeInformationInfluenceDTO> findInfluenceById(EarthquakeQuery query);
|
||||
|
||||
// 获取最大烈度影响场
|
||||
public EarthquakeInformationInfluenceDTO findInfluenceMaxIntyById(EarthquakeQuery query);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeProductDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeProduct;
|
||||
import com.gis.xian.dto.qgis.base.ProductQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: IDZProductService
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeProductService extends IService<EarthquakeProduct> {
|
||||
|
||||
// qgis 地震制图服务
|
||||
public void makeEarthquakeMaps(EarthquakeAssessmentDTO assess);
|
||||
|
||||
// qgis 暴雨制图服务
|
||||
public void makeRainstormMaps(RainAssessmentDTO assess);
|
||||
|
||||
// 获取产品
|
||||
public List<EarthquakeProductDTO> getProducts(ProductQuery query);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gis.xian.service.qgis.earthquake;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeQueue;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: 地震评估
|
||||
* @date 2026/5/25 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IEarthquakeQueueService extends IService<EarthquakeQueue> {
|
||||
|
||||
// 地震评估
|
||||
public void assess(EarthquakeAssessmentDTO assess);
|
||||
|
||||
// 暴雨评估
|
||||
public void assess(RainAssessmentDTO assess);
|
||||
|
||||
// 更新评估进度、状态
|
||||
public void updated(String event, String queueId, double progress, int state);
|
||||
}
|
||||
+22
-23
@@ -1,26 +1,25 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.dzxx.DZXXCenterDTO;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.EqTriggerDTO;
|
||||
import com.gis.xian.entity.pub.DZEqEvent;
|
||||
import com.gis.xian.mapper.pub.DZEqEventMapper;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import com.gis.xian.service.dzxx.IDZXXCenterService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeCenterDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeTriggerDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeEvent;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeEventMapper;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationCenterService;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServeException;
|
||||
import com.gis.xian.service.pub.IDZEqEventService;
|
||||
import com.gis.xian.service.pub.IDZEqQueueService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeEventService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeQueueService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -32,17 +31,17 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZEqEventServiceImpl extends ServiceImpl<DZEqEventMapper, DZEqEvent> implements IDZEqEventService {
|
||||
public class EarthquakeEventServiceImpl extends ServiceImpl<EarthquakeEventMapper, EarthquakeEvent> implements IEarthquakeEventService {
|
||||
|
||||
@Resource
|
||||
private IDZXXCenterService idzxxCenterService;
|
||||
private IEarthquakeInformationCenterService IEarthquakeInformationCenterService;
|
||||
@Resource
|
||||
private IDZEqQueueService idzEqQueueService;
|
||||
private IEarthquakeQueueService IEarthquakeQueueService;
|
||||
|
||||
// 地震业务触发
|
||||
@Transactional
|
||||
@Override
|
||||
public EqQuery trigger(EqTriggerDTO trigger) {
|
||||
public EarthquakeQuery trigger(EarthquakeTriggerDTO trigger) {
|
||||
log.info("地震参数:{}", trigger);
|
||||
// 异常值
|
||||
if (trigger == null) {
|
||||
@@ -52,14 +51,14 @@ public class DZEqEventServiceImpl extends ServiceImpl<DZEqEventMapper, DZEqEvent
|
||||
String code = BaseUtils.generationCode(trigger.getEqTime());
|
||||
// 地震业务
|
||||
try {
|
||||
DZXXCenterDTO dzxx = new DZXXCenterDTO();
|
||||
EarthquakeCenterDTO dzxx = new EarthquakeCenterDTO();
|
||||
BeanUtils.copyProperties(trigger, dzxx);
|
||||
dzxx.setEvent(code);
|
||||
log.info("地震专题图编码:{}", code);
|
||||
// 震中位置存储
|
||||
idzxxCenterService.handle(dzxx);
|
||||
IEarthquakeInformationCenterService.handle(dzxx);
|
||||
// 地震基本信息存储
|
||||
DZEqEvent dzeq = new DZEqEvent();
|
||||
EarthquakeEvent dzeq = new EarthquakeEvent();
|
||||
BeanUtils.copyProperties(dzxx, dzeq);
|
||||
save(dzeq);
|
||||
log.info("地震基本信息已存库...");
|
||||
@@ -72,20 +71,20 @@ public class DZEqEventServiceImpl extends ServiceImpl<DZEqEventMapper, DZEqEvent
|
||||
String batch = BaseUtils.generationBatchCode(code);
|
||||
// 评估业务
|
||||
try {
|
||||
EqAssessmentDTO assess = new EqAssessmentDTO();
|
||||
EarthquakeAssessmentDTO assess = new EarthquakeAssessmentDTO();
|
||||
BeanUtils.copyProperties(trigger, assess);
|
||||
assess.setEvent(code);
|
||||
assess.setEqQueueId(batch);
|
||||
|
||||
// 开始评估
|
||||
idzEqQueueService.assess(assess);
|
||||
IEarthquakeQueueService.assess(assess);
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
throw new ServeException(BaseConstants.ASSESS_SERVER_ERROR);
|
||||
}
|
||||
// 地震编码
|
||||
return new EqQuery(code, batch);
|
||||
return new EarthquakeQuery(code, batch);
|
||||
}
|
||||
|
||||
// 删除地震
|
||||
@@ -96,8 +95,8 @@ public class DZEqEventServiceImpl extends ServiceImpl<DZEqEventMapper, DZEqEvent
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
}
|
||||
// 条件构造
|
||||
LambdaQueryWrapper<DZEqEvent> lambdaQuery = Wrappers.lambdaQuery(DZEqEvent.class);
|
||||
lambdaQuery.eq(DZEqEvent::getId, Id);
|
||||
LambdaQueryWrapper<EarthquakeEvent> lambdaQuery = Wrappers.lambdaQuery(EarthquakeEvent.class);
|
||||
lambdaQuery.eq(EarthquakeEvent::getId, Id);
|
||||
int flag = this.baseMapper.delete(lambdaQuery);
|
||||
return flag > 0 ? true : false;
|
||||
}
|
||||
+25
-28
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -6,21 +6,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.dzxx.DZXXInfluenceDTO;
|
||||
import com.gis.xian.dto.pub.DZInfluenceDTO;
|
||||
import com.gis.xian.dto.pub.IntyGeoJsonDTO;
|
||||
import com.gis.xian.entity.pub.DZInfluence;
|
||||
import com.gis.xian.handler.GeoFilesHandler;
|
||||
import com.gis.xian.mapper.pub.DZInfluenceMapper;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInformationInfluenceDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInfluenceDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInfluenceGeoJsonDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeInfluence;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInfluenceService;
|
||||
import com.gis.xian.utils.qgis.GeoFilesHandler;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeInfluenceMapper;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServiceException;
|
||||
import com.gis.xian.service.pub.IDZInfluenceService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -36,10 +35,8 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInfluence> implements IDZInfluenceService {
|
||||
public class EarthquakeInfluenceServiceImpl extends ServiceImpl<EarthquakeInfluenceMapper, EarthquakeInfluence> implements IEarthquakeInfluenceService {
|
||||
|
||||
@Resource
|
||||
private GeoFilesHandler handler;
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
|
||||
@@ -47,7 +44,7 @@ public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInf
|
||||
// 将影响场以文件形式保存
|
||||
@Async("xianPool")
|
||||
@Override
|
||||
public void handle(List<DZXXInfluenceDTO> dzxxs) {
|
||||
public void handle(List<EarthquakeInformationInfluenceDTO> dzxxs) {
|
||||
// 异常
|
||||
if (dzxxs == null || dzxxs.isEmpty()) {
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
@@ -55,14 +52,14 @@ public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInf
|
||||
try {
|
||||
// 影响场名称
|
||||
String fineName = "";
|
||||
IntyGeoJsonDTO features = new IntyGeoJsonDTO();
|
||||
DZInfluenceDTO influence = new DZInfluenceDTO();
|
||||
EarthquakeInfluenceGeoJsonDTO features = new EarthquakeInfluenceGeoJsonDTO();
|
||||
EarthquakeInfluenceDTO influence = new EarthquakeInfluenceDTO();
|
||||
// 处理影响场数据
|
||||
for (DZXXInfluenceDTO dzxx : dzxxs) {
|
||||
for (EarthquakeInformationInfluenceDTO dzxx : dzxxs) {
|
||||
// 接收面数据
|
||||
Polygon polygon = (Polygon) dzxx.getGeom();
|
||||
// 转换Polygon为GeoJSON Geometry结构
|
||||
IntyGeoJsonDTO.GeoJsonFeature feature = handler.convertPolygonToGeoJsonFeature(polygon, dzxx);
|
||||
EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature feature = GeoFilesHandler.convertPolygonToGeoJsonFeature(polygon, dzxx);
|
||||
features.getFeatures().add(feature);
|
||||
// 根据批次编码拼接目录和文件名
|
||||
fineName = dzxx.getEqQueueId() + "/" + dzxx.getEqName();
|
||||
@@ -77,7 +74,7 @@ public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInf
|
||||
}
|
||||
|
||||
// 保存GeoJSON文件
|
||||
handler.writeGeoJsonToFile(features, fineName);
|
||||
GeoFilesHandler.writeGeoJsonToFile(features, fineName, qgisProperties);
|
||||
log.info("地震影响场GeoJson文件已生成成功!");
|
||||
|
||||
influence.setPath(qgisProperties.getBasePath() + qgisProperties.getIntensityGeojsonPath() + fineName + ".geojson");
|
||||
@@ -91,20 +88,20 @@ public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInf
|
||||
|
||||
// 获取影响场文件
|
||||
@Override
|
||||
public Map<String, String> getInfluence(EqQuery query) {
|
||||
public Map<String, String> getInfluence(EarthquakeQuery query) {
|
||||
// 异常
|
||||
if (query == null) {
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
}
|
||||
// 条件
|
||||
LambdaQueryWrapper<DZInfluence> lambdaQuery = Wrappers.lambdaQuery(DZInfluence.class);
|
||||
lambdaQuery.select(DZInfluence::getPath);
|
||||
lambdaQuery.eq(DZInfluence::getEvent, query.getEvent());
|
||||
lambdaQuery.eq(DZInfluence::getEqQueueId, query.getEqQueueId());
|
||||
lambdaQuery.orderByDesc(DZInfluence::getCreateTime); // 防止多条记录
|
||||
LambdaQueryWrapper<EarthquakeInfluence> lambdaQuery = Wrappers.lambdaQuery(EarthquakeInfluence.class);
|
||||
lambdaQuery.select(EarthquakeInfluence::getPath);
|
||||
lambdaQuery.eq(EarthquakeInfluence::getEvent, query.getEvent());
|
||||
lambdaQuery.eq(EarthquakeInfluence::getEqQueueId, query.getEqQueueId());
|
||||
lambdaQuery.orderByDesc(EarthquakeInfluence::getCreateTime); // 防止多条记录
|
||||
lambdaQuery.last("limit 1");
|
||||
// 查询
|
||||
DZInfluence influence = (DZInfluence) this.baseMapper.selectList(lambdaQuery);
|
||||
EarthquakeInfluence influence = (EarthquakeInfluence) this.baseMapper.selectList(lambdaQuery);
|
||||
if (influence == null) {
|
||||
throw new ParmaException(BaseConstants.RESULT_ERROR);
|
||||
}
|
||||
@@ -115,8 +112,8 @@ public class DZInfluenceServiceImpl extends ServiceImpl<DZInfluenceMapper, DZInf
|
||||
|
||||
|
||||
// 处理地震信息数据
|
||||
private void handleDzxxData(DZInfluenceDTO dto) {
|
||||
DZInfluence influence = new DZInfluence();
|
||||
private void handleDzxxData(EarthquakeInfluenceDTO dto) {
|
||||
EarthquakeInfluence influence = new EarthquakeInfluence();
|
||||
BeanUtils.copyProperties(dto, influence);
|
||||
// 存库
|
||||
save(influence);
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package com.gis.xian.service.dzxx.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.dzxx.DZXXCenterDTO;
|
||||
import com.gis.xian.entity.dzxx.DZXXCenter;
|
||||
import com.gis.xian.mapper.dzxx.DZXXCenterMapper;
|
||||
import com.gis.xian.service.dzxx.IDZXXCenterService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeCenterDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeCenter;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeCenterMapper;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationCenterService;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServiceException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -24,18 +24,18 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZXXCenterServiceImpl extends ServiceImpl<DZXXCenterMapper, DZXXCenter> implements IDZXXCenterService {
|
||||
public class EarthquakeInformationCenterServiceImpl extends ServiceImpl<EarthquakeCenterMapper, EarthquakeCenter> implements IEarthquakeInformationCenterService {
|
||||
|
||||
// 地震触发
|
||||
@Override
|
||||
public void handle(DZXXCenterDTO dzxxdto) {
|
||||
public void handle(EarthquakeCenterDTO dzxxdto) {
|
||||
// 抛出异常
|
||||
if (dzxxdto == null) {
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
try {
|
||||
DZXXCenter dzxx = new DZXXCenter();
|
||||
EarthquakeCenter dzxx = new EarthquakeCenter();
|
||||
BeanUtils.copyProperties(dzxxdto, dzxx);
|
||||
// 处理空间数据
|
||||
GeometryFactory geometryFactory = new GeometryFactory();
|
||||
+22
-23
@@ -1,24 +1,23 @@
|
||||
package com.gis.xian.service.dzxx.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.dto.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.dto.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.dto.dzxx.DZXXDistanceDTO;
|
||||
import com.gis.xian.entity.dzxx.DZXXDistance;
|
||||
import com.gis.xian.mapper.dzxx.DZXXDistanceMapper;
|
||||
import com.gis.xian.service.base.IShanXiCitiesService;
|
||||
import com.gis.xian.service.base.IShanXiCountyService;
|
||||
import com.gis.xian.service.base.IShanXiTownsService;
|
||||
import com.gis.xian.service.dzxx.IDZXXDistanceService;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCitiesDTO;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiCountyDTO;
|
||||
import com.gis.xian.dto.qgis.base.ShanXiTownsDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeDistanceDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeDistance;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeDistanceMapper;
|
||||
import com.gis.xian.service.qgis.base.IShanXiCitiesService;
|
||||
import com.gis.xian.service.qgis.base.IShanXiCountyService;
|
||||
import com.gis.xian.service.qgis.base.IShanXiTownsService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationDistanceService;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.locationtech.jts.geom.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -33,7 +32,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZXXDistanceServiceImpl extends ServiceImpl<DZXXDistanceMapper, DZXXDistance> implements IDZXXDistanceService {
|
||||
public class EarthquakeInformationDistanceServiceImpl extends ServiceImpl<EarthquakeDistanceMapper, EarthquakeDistance> implements IEarthquakeInformationDistanceService {
|
||||
private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326);
|
||||
|
||||
@Resource
|
||||
@@ -54,22 +53,22 @@ public class DZXXDistanceServiceImpl extends ServiceImpl<DZXXDistanceMapper, DZX
|
||||
// 查询距震中20km乡镇
|
||||
List<ShanXiTownsDTO> towns20km = iShanXiTownsService.getMostIntensityAreaTowns(20, lon, lat);
|
||||
// 所有行政区划数
|
||||
List<DZXXDistanceDTO> combined = combine(cities, counties50km, towns20km, eqQueueId, lon, lat);
|
||||
List<EarthquakeDistanceDTO> combined = combine(cities, counties50km, towns20km, eqQueueId, lon, lat);
|
||||
// 存库
|
||||
asyncSave(combined);
|
||||
}
|
||||
|
||||
// 将行政区划组合
|
||||
private List<DZXXDistanceDTO> combine(List<ShanXiCitiesDTO> cities,
|
||||
private List<EarthquakeDistanceDTO> combine(List<ShanXiCitiesDTO> cities,
|
||||
List<ShanXiCountyDTO> counties20km,
|
||||
List<ShanXiTownsDTO> towns10km,
|
||||
String eqQueueId, double lon, double lat) {
|
||||
// 震中到行政区划距离
|
||||
List<DZXXDistanceDTO> distancedtos = new ArrayList<>();
|
||||
List<EarthquakeDistanceDTO> distancedtos = new ArrayList<>();
|
||||
|
||||
// 处理市州
|
||||
for (ShanXiCitiesDTO city : cities) {
|
||||
DZXXDistanceDTO dzxx = new DZXXDistanceDTO();
|
||||
EarthquakeDistanceDTO dzxx = new EarthquakeDistanceDTO();
|
||||
// 处理震中到市州的线段
|
||||
dzxx.setGeom(p2pLines(lon, lat, city.getX(), city.getY()));
|
||||
|
||||
@@ -85,7 +84,7 @@ public class DZXXDistanceServiceImpl extends ServiceImpl<DZXXDistanceMapper, DZX
|
||||
|
||||
// 处理县区
|
||||
for (ShanXiCountyDTO county : counties20km) {
|
||||
DZXXDistanceDTO dzxx = new DZXXDistanceDTO();
|
||||
EarthquakeDistanceDTO dzxx = new EarthquakeDistanceDTO();
|
||||
// 处理震中到县区的线段
|
||||
dzxx.setGeom(p2pLines(lon, lat, county.getX(), county.getY()));
|
||||
|
||||
@@ -101,7 +100,7 @@ public class DZXXDistanceServiceImpl extends ServiceImpl<DZXXDistanceMapper, DZX
|
||||
|
||||
// 处理乡镇
|
||||
for (ShanXiTownsDTO town : towns10km) {
|
||||
DZXXDistanceDTO dzxx = new DZXXDistanceDTO();
|
||||
EarthquakeDistanceDTO dzxx = new EarthquakeDistanceDTO();
|
||||
// 处理震中到乡镇的线段
|
||||
dzxx.setGeom(p2pLines(lon, lat, town.getX(), town.getY()));
|
||||
|
||||
@@ -141,12 +140,12 @@ public class DZXXDistanceServiceImpl extends ServiceImpl<DZXXDistanceMapper, DZX
|
||||
}
|
||||
|
||||
@Async("xianPool")
|
||||
protected void asyncSave(List<DZXXDistanceDTO> data) {
|
||||
protected void asyncSave(List<EarthquakeDistanceDTO> data) {
|
||||
// 批量存储
|
||||
List<DZXXDistance> dzxxs = new ArrayList<>();
|
||||
List<EarthquakeDistance> dzxxs = new ArrayList<>();
|
||||
//处理数据
|
||||
for (DZXXDistanceDTO datum : data) {
|
||||
DZXXDistance dzxx = new DZXXDistance();
|
||||
for (EarthquakeDistanceDTO datum : data) {
|
||||
EarthquakeDistance dzxx = new EarthquakeDistance();
|
||||
BeanUtils.copyProperties(datum, dzxx);
|
||||
dzxx.getGeom().setSRID(4490);
|
||||
dzxxs.add(dzxx);
|
||||
+47
-52
@@ -1,29 +1,28 @@
|
||||
package com.gis.xian.service.dzxx.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.base.ActiveFaultDTO;
|
||||
import com.gis.xian.dto.dzxx.DZXXInfluenceDTO;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.entity.dzxx.DZXXInfluence;
|
||||
import com.gis.xian.handler.EarthquakeHandler;
|
||||
import com.gis.xian.handler.EllipseToWktHandler;
|
||||
import com.gis.xian.mapper.dzxx.DZXXInfluenceMapper;
|
||||
import com.gis.xian.query.EqQuery;
|
||||
import com.gis.xian.query.IntensityQuery;
|
||||
import com.gis.xian.service.base.IActiveFaultService;
|
||||
import com.gis.xian.service.dzxx.IDZXXInfluenceService;
|
||||
import com.gis.xian.dto.qgis.base.ActiveFaultDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInformationInfluenceDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeGisInfluence;
|
||||
import com.gis.xian.utils.qgis.EarthquakeHandler;
|
||||
import com.gis.xian.utils.qgis.EllipseToWktHandler;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeGISInfluenceMapper;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeQuery;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeIntensityQuery;
|
||||
import com.gis.xian.service.qgis.base.IActiveFaultService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationInfluenceService;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServiceException;
|
||||
import com.gis.xian.service.pub.IDZInfluenceService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInfluenceService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,21 +36,17 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, DZXXInfluence> implements IDZXXInfluenceService {
|
||||
public class EarthquakeInformationInfluenceServiceImpl extends ServiceImpl<EarthquakeGISInfluenceMapper, EarthquakeGisInfluence> implements IEarthquakeInformationInfluenceService {
|
||||
|
||||
|
||||
@Resource
|
||||
private IActiveFaultService faultService;
|
||||
@Resource
|
||||
private EllipseToWktHandler ellipseToWktHandler;
|
||||
@Resource
|
||||
private IDZInfluenceService idzInfluenceService;
|
||||
@Resource
|
||||
private EarthquakeHandler earthquakeHandler;
|
||||
private IEarthquakeInfluenceService IEarthquakeInfluenceService;
|
||||
|
||||
// 处理地震影响场数据
|
||||
@Override
|
||||
public void handle(EqAssessmentDTO assess) {
|
||||
public void handle(EarthquakeAssessmentDTO assess) {
|
||||
// 异常处理
|
||||
if (assess == null) {
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
@@ -63,18 +58,18 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
// 根据烈度值和震级生成影响场
|
||||
for (int intensity : intensities) {
|
||||
// 根据烈度和震级计算长轴
|
||||
double longUranium = earthquakeHandler.calculateRa(assess.getEqMagnitude(), intensity);
|
||||
double longUranium = EarthquakeHandler.calculateRa(assess.getEqMagnitude(), intensity);
|
||||
// 根据烈度和震级计算短轴
|
||||
double shortUranium = earthquakeHandler.calculateRb(assess.getEqMagnitude(), intensity);
|
||||
double shortUranium = EarthquakeHandler.calculateRb(assess.getEqMagnitude(), intensity);
|
||||
// 根据长短轴计算面积
|
||||
double area = earthquakeHandler.calculateArea(longUranium, shortUranium);
|
||||
double area = EarthquakeHandler.calculateArea(longUranium, shortUranium);
|
||||
|
||||
// 获取断层走向 角度
|
||||
ActiveFaultDTO shortlyFault = faultService.getShortlyFault(assess.getLongitude(), assess.getLatitude());
|
||||
// 根据烈度长短轴、走向、面积计算生成影响场
|
||||
IntensityQuery query = compute(longUranium, shortUranium, shortlyFault, assess);
|
||||
EarthquakeIntensityQuery query = compute(longUranium, shortUranium, shortlyFault, assess);
|
||||
// 影响场范围
|
||||
Polygon polygon = ellipseToWktHandler.ellipseToPolygonWkt(query);
|
||||
Polygon polygon = EllipseToWktHandler.ellipseToPolygonWkt(query);
|
||||
|
||||
// 转换存库
|
||||
convert(longUranium, shortUranium, area, intensity, polygon, shortlyFault, assess);
|
||||
@@ -88,31 +83,31 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
}
|
||||
|
||||
// 获取地震影响场数据
|
||||
List<DZXXInfluenceDTO> influences = findInfluenceById(new EqQuery(assess.getEvent(), assess.getEqQueueId()));
|
||||
List<EarthquakeInformationInfluenceDTO> influences = findInfluenceById(new EarthquakeQuery(assess.getEvent(), assess.getEqQueueId()));
|
||||
// 输出geojson文件
|
||||
idzInfluenceService.handle(influences);
|
||||
IEarthquakeInfluenceService.handle(influences);
|
||||
|
||||
}
|
||||
|
||||
// 查询地震影响场
|
||||
@Override
|
||||
public List<DZXXInfluenceDTO> findInfluenceById(EqQuery query) {
|
||||
public List<EarthquakeInformationInfluenceDTO> findInfluenceById(EarthquakeQuery query) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<DZXXInfluence> lambdaQuery = Wrappers.lambdaQuery(DZXXInfluence.class);
|
||||
lambdaQuery.eq(DZXXInfluence::getEvent, query.getEvent());
|
||||
lambdaQuery.eq(DZXXInfluence::getEqQueueId, query.getEqQueueId());
|
||||
LambdaQueryWrapper<EarthquakeGisInfluence> lambdaQuery = Wrappers.lambdaQuery(EarthquakeGisInfluence.class);
|
||||
lambdaQuery.eq(EarthquakeGisInfluence::getEvent, query.getEvent());
|
||||
lambdaQuery.eq(EarthquakeGisInfluence::getEqQueueId, query.getEqQueueId());
|
||||
|
||||
// 该场地震影响场
|
||||
List<DZXXInfluence> influences = this.baseMapper.selectList(lambdaQuery);
|
||||
List<EarthquakeGisInfluence> influences = this.baseMapper.selectList(lambdaQuery);
|
||||
|
||||
if (influences == null || influences.size() == 0) {
|
||||
log.error("查询地震影响场结果为空!");
|
||||
throw new ParmaException(BaseConstants.RESULT_ERROR);
|
||||
}
|
||||
// 处理
|
||||
List<DZXXInfluenceDTO> dzxxs = new ArrayList<>();
|
||||
for (DZXXInfluence influence : influences) {
|
||||
DZXXInfluenceDTO dzxx = new DZXXInfluenceDTO();
|
||||
List<EarthquakeInformationInfluenceDTO> dzxxs = new ArrayList<>();
|
||||
for (EarthquakeGisInfluence influence : influences) {
|
||||
EarthquakeInformationInfluenceDTO dzxx = new EarthquakeInformationInfluenceDTO();
|
||||
BeanUtils.copyProperties(influence, dzxx);
|
||||
dzxxs.add(dzxx);
|
||||
}
|
||||
@@ -123,23 +118,23 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
|
||||
// 获取最大烈度影响场
|
||||
@Override
|
||||
public DZXXInfluenceDTO findInfluenceMaxIntyById(EqQuery query) {
|
||||
public EarthquakeInformationInfluenceDTO findInfluenceMaxIntyById(EarthquakeQuery query) {
|
||||
|
||||
LambdaQueryWrapper<DZXXInfluence> lambdaQuery = Wrappers.lambdaQuery(DZXXInfluence.class);
|
||||
LambdaQueryWrapper<EarthquakeGisInfluence> lambdaQuery = Wrappers.lambdaQuery(EarthquakeGisInfluence.class);
|
||||
lambdaQuery
|
||||
.eq(DZXXInfluence::getEvent, query.getEvent())
|
||||
.eq(DZXXInfluence::getEqQueueId, query.getEqQueueId())
|
||||
.orderByDesc(DZXXInfluence::getInty)
|
||||
.eq(EarthquakeGisInfluence::getEvent, query.getEvent())
|
||||
.eq(EarthquakeGisInfluence::getEqQueueId, query.getEqQueueId())
|
||||
.orderByDesc(EarthquakeGisInfluence::getInty)
|
||||
.last("limit 1"); // 最大烈度
|
||||
|
||||
// 获取单条数据
|
||||
DZXXInfluence influence = this.baseMapper.selectOne(lambdaQuery);
|
||||
EarthquakeGisInfluence influence = this.baseMapper.selectOne(lambdaQuery);
|
||||
|
||||
if (influence == null) {
|
||||
log.error("查询地震影响场结果为空!");
|
||||
throw new ParmaException(BaseConstants.RESULT_ERROR);
|
||||
}
|
||||
DZXXInfluenceDTO dzxx = new DZXXInfluenceDTO();
|
||||
EarthquakeInformationInfluenceDTO dzxx = new EarthquakeInformationInfluenceDTO();
|
||||
BeanUtils.copyProperties(influence, dzxx);
|
||||
|
||||
return dzxx;
|
||||
@@ -167,10 +162,10 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
}
|
||||
|
||||
// 根据烈度长短轴、走向、面积计算生成影响场
|
||||
private IntensityQuery compute(double longUranium, double shortUranium,
|
||||
ActiveFaultDTO shortlyFault, EqAssessmentDTO assess) {
|
||||
private EarthquakeIntensityQuery compute(double longUranium, double shortUranium,
|
||||
ActiveFaultDTO shortlyFault, EarthquakeAssessmentDTO assess) {
|
||||
|
||||
IntensityQuery query = new IntensityQuery();
|
||||
EarthquakeIntensityQuery query = new EarthquakeIntensityQuery();
|
||||
query.setCenterLon(assess.getLongitude());
|
||||
query.setCenterLat(assess.getLatitude());
|
||||
query.setSemiMajor(longUranium);
|
||||
@@ -183,8 +178,8 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
|
||||
// 转换存库
|
||||
private void convert(double longUranium, double shortUranium, double area, int intensity,
|
||||
Polygon polygon, ActiveFaultDTO shortlyFault, EqAssessmentDTO assess) {
|
||||
DZXXInfluenceDTO dzxxDto = new DZXXInfluenceDTO();
|
||||
Polygon polygon, ActiveFaultDTO shortlyFault, EarthquakeAssessmentDTO assess) {
|
||||
EarthquakeInformationInfluenceDTO dzxxDto = new EarthquakeInformationInfluenceDTO();
|
||||
dzxxDto.setArea(area);
|
||||
dzxxDto.setGeom(polygon);
|
||||
dzxxDto.setDirection(Double.valueOf(shortlyFault.getDirection()));
|
||||
@@ -199,10 +194,10 @@ public class DZXXInfluenceServiceImpl extends ServiceImpl<DZXXInfluenceMapper, D
|
||||
dzxxDto.setShortUranium(shortUranium);
|
||||
|
||||
// 存库
|
||||
DZXXInfluence dzxxInfluence = new DZXXInfluence();
|
||||
BeanUtils.copyProperties(dzxxDto, dzxxInfluence);
|
||||
dzxxInfluence.getGeom().setSRID(4490);
|
||||
save(dzxxInfluence);
|
||||
EarthquakeGisInfluence earthquakeGisInfluence = new EarthquakeGisInfluence();
|
||||
BeanUtils.copyProperties(dzxxDto, earthquakeGisInfluence);
|
||||
earthquakeGisInfluence.getGeom().setSRID(4490);
|
||||
save(earthquakeGisInfluence);
|
||||
log.info("地震影响场已保存!");
|
||||
}
|
||||
|
||||
+54
-59
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -6,27 +6,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.pub.DZProductDTO;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.RAssessmentDTO;
|
||||
import com.gis.xian.entity.pub.DZProduct;
|
||||
import com.gis.xian.enums.BaseEnums;
|
||||
import com.gis.xian.enums.EqMapsEnums;
|
||||
import com.gis.xian.enums.RainMapsEnums;
|
||||
import com.gis.xian.handler.EarthquakeHandler;
|
||||
import com.gis.xian.mapper.pub.DZProductMapper;
|
||||
import com.gis.xian.query.ProductQuery;
|
||||
import com.gis.xian.service.base.IActiveFaultService;
|
||||
import com.gis.xian.service.dzxx.IDZXXInfluenceService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeProductDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeProduct;
|
||||
import com.gis.xian.enums.qgis.BaseEnums;
|
||||
import com.gis.xian.enums.qgis.EarthquakeMapsEnums;
|
||||
import com.gis.xian.enums.qgis.RainMapsEnums;
|
||||
import com.gis.xian.dto.qgis.base.QgisArgsParams;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeProductService;
|
||||
import com.gis.xian.utils.qgis.EarthquakeHandler;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeProductMapper;
|
||||
import com.gis.xian.dto.qgis.base.ProductQuery;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServeException;
|
||||
import com.gis.xian.service.pub.IDZProductService;
|
||||
import com.gis.xian.service.pub.IFeignService;
|
||||
import com.gis.xian.service.qgis.base.IFeignService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -34,7 +32,6 @@ import java.security.SecureRandom;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import com.gis.xian.params.QgisArgs;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -45,7 +42,7 @@ import org.springframework.util.StringUtils;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct> implements IDZProductService {
|
||||
public class EarthquakeProductServiceImpl extends ServiceImpl<EarthquakeProductMapper, EarthquakeProduct> implements IEarthquakeProductService {
|
||||
|
||||
private static final SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
@@ -53,35 +50,33 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
private IFeignService iFeignService;
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
@Resource
|
||||
private EarthquakeHandler earthquakeHandler;
|
||||
|
||||
// qgis 地震制图服务
|
||||
@Override
|
||||
@Async("xianPool")
|
||||
public void makeEarthquakeMaps(EqAssessmentDTO assess) {
|
||||
public void makeEarthquakeMaps(EarthquakeAssessmentDTO assess) {
|
||||
// 待产专题图集
|
||||
List<EqMapsEnums> maps = Arrays.asList(EqMapsEnums.values());
|
||||
List<EarthquakeMapsEnums> maps = Arrays.asList(EarthquakeMapsEnums.values());
|
||||
// 设置制图参数
|
||||
List<QgisArgs> args = setMakeEqMapsArgs(assess, maps);
|
||||
List<QgisArgsParams> args = setMakeEqMapsArgs(assess, maps);
|
||||
// 调用出图服务
|
||||
iFeignService.invoke(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("xianPool")
|
||||
public void makeRainstormMaps(RAssessmentDTO assess) {
|
||||
public void makeRainstormMaps(RainAssessmentDTO assess) {
|
||||
// 待产专题图集
|
||||
List<RainMapsEnums> maps = Arrays.asList(RainMapsEnums.values());
|
||||
// 设置制图参数
|
||||
List<QgisArgs> args = setMakeRainstormMapsArgs(assess, maps);
|
||||
List<QgisArgsParams> args = setMakeRainstormMapsArgs(assess, maps);
|
||||
// 调用出图服务
|
||||
iFeignService.invoke(args);
|
||||
}
|
||||
|
||||
// 获取产品
|
||||
@Override
|
||||
public List<DZProductDTO> getProducts(ProductQuery query) {
|
||||
public List<EarthquakeProductDTO> getProducts(ProductQuery query) {
|
||||
try {
|
||||
log.info("查询产品参数:{}", query);
|
||||
// 空值
|
||||
@@ -89,19 +84,19 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
throw new ParmaException(BaseConstants.QUEUE_ID_ERROR);
|
||||
}
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<DZProduct> lambdaQuery = Wrappers.lambdaQuery(DZProduct.class);
|
||||
LambdaQueryWrapper<EarthquakeProduct> lambdaQuery = Wrappers.lambdaQuery(EarthquakeProduct.class);
|
||||
// 必填项
|
||||
lambdaQuery.eq(DZProduct::getEqQueueId, query.getQueueId());
|
||||
lambdaQuery.eq(EarthquakeProduct::getEqQueueId, query.getQueueId());
|
||||
// 选填项
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getCode()), DZProduct::getCode, query.getCode());
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getFileType()), DZProduct::getFileType, query.getFileType());
|
||||
lambdaQuery.or().like(StringUtils.hasText(query.getFileName()), DZProduct::getFileName, query.getFileName());
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getProType()), DZProduct::getProType, query.getProType());
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getCode()), EarthquakeProduct::getCode, query.getCode());
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getFileType()), EarthquakeProduct::getFileType, query.getFileType());
|
||||
lambdaQuery.or().like(StringUtils.hasText(query.getFileName()), EarthquakeProduct::getFileName, query.getFileName());
|
||||
lambdaQuery.or().eq(StringUtils.hasText(query.getProType()), EarthquakeProduct::getProType, query.getProType());
|
||||
// 获取产品服务
|
||||
List<DZProduct> productList = this.baseMapper.selectList(lambdaQuery);
|
||||
List<DZProductDTO> dtos = new ArrayList<>();
|
||||
for (DZProduct product : productList) {
|
||||
DZProductDTO dto = new DZProductDTO();
|
||||
List<EarthquakeProduct> productList = this.baseMapper.selectList(lambdaQuery);
|
||||
List<EarthquakeProductDTO> dtos = new ArrayList<>();
|
||||
for (EarthquakeProduct product : productList) {
|
||||
EarthquakeProductDTO dto = new EarthquakeProductDTO();
|
||||
BeanUtils.copyProperties(product, dto);
|
||||
dto.setTempletId(null);
|
||||
|
||||
@@ -115,27 +110,27 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
}
|
||||
|
||||
// 地震 制图参数
|
||||
private List<QgisArgs> setMakeEqMapsArgs(EqAssessmentDTO assess, List<EqMapsEnums> maps) {
|
||||
private List<QgisArgsParams> setMakeEqMapsArgs(EarthquakeAssessmentDTO assess, List<EarthquakeMapsEnums> maps) {
|
||||
// 专题图集参数
|
||||
List<QgisArgs> args = new ArrayList<>();
|
||||
List<QgisArgsParams> args = new ArrayList<>();
|
||||
|
||||
// A4 画幅
|
||||
for (EqMapsEnums map : maps) {
|
||||
for (EarthquakeMapsEnums map : maps) {
|
||||
// qgis参数
|
||||
QgisArgs arg = new QgisArgs();
|
||||
QgisArgsParams arg = new QgisArgsParams();
|
||||
arg.setId(map.getNum());
|
||||
arg.setEvent(assess.getEvent());
|
||||
arg.setQueueId(assess.getEqQueueId());
|
||||
arg.setCenterX(assess.getLongitude());
|
||||
arg.setCenterY(assess.getLatitude());
|
||||
arg.setInfo(earthquakeHandler.parseInfo(assess.getEqTime(), assess.getEqMagnitude(), assess.getEqAddr()));
|
||||
arg.setMapTitle(earthquakeHandler.combine(assess.getEqName(), assess.getEqType(), map));
|
||||
arg.setInfo(EarthquakeHandler.parseInfo(assess.getEqTime(), assess.getEqMagnitude(), assess.getEqAddr()));
|
||||
arg.setMapTitle(EarthquakeHandler.combine(assess.getEqName(), assess.getEqType(), map));
|
||||
arg.setMapTime(BaseUtils.formatTime(LocalDateTime.now(), false));
|
||||
arg.setMapLayout(BaseConstants.MAP_LAYOUT_A4); // A4
|
||||
arg.setMapUint(BaseConstants.MAP_UNIT); // 单位
|
||||
// 死信队列中获取单张图片
|
||||
arg.setName(map.getName());
|
||||
arg.setOutFile(earthquakeHandler.getPath(assess.getEvent(), assess.getEqQueueId(), BaseConstants.MAP_LAYOUT_A4, map));
|
||||
arg.setOutFile(EarthquakeHandler.getPath(assess.getEvent(), assess.getEqQueueId(), BaseConstants.MAP_LAYOUT_A4, map, qgisProperties));
|
||||
arg.setPath(qgisProperties.getEqMapsTemplatePath() + map.getName() + ".qgz");
|
||||
arg.setDisaster(BaseConstants.EQ_DISASTER_MAP); // 地震灾害
|
||||
|
||||
@@ -148,22 +143,22 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
}
|
||||
|
||||
// 增加 A3 画幅
|
||||
for (EqMapsEnums map : maps) {
|
||||
for (EarthquakeMapsEnums map : maps) {
|
||||
// qgis参数
|
||||
QgisArgs arg = new QgisArgs();
|
||||
QgisArgsParams arg = new QgisArgsParams();
|
||||
arg.setId(map.getNum());
|
||||
arg.setEvent(assess.getEvent());
|
||||
arg.setQueueId(assess.getEqQueueId());
|
||||
arg.setCenterX(assess.getLongitude());
|
||||
arg.setCenterY(assess.getLatitude());
|
||||
arg.setInfo(earthquakeHandler.parseInfo(assess.getEqTime(), assess.getEqMagnitude(), assess.getEqAddr()));
|
||||
arg.setMapTitle(earthquakeHandler.combine(assess.getEqName(), assess.getEqType(), map));
|
||||
arg.setInfo(EarthquakeHandler.parseInfo(assess.getEqTime(), assess.getEqMagnitude(), assess.getEqAddr()));
|
||||
arg.setMapTitle(EarthquakeHandler.combine(assess.getEqName(), assess.getEqType(), map));
|
||||
arg.setMapTime(BaseUtils.formatTime(LocalDateTime.now(), false));
|
||||
arg.setMapLayout(BaseConstants.MAP_LAYOUT_A3); // A3
|
||||
arg.setMapUint(BaseConstants.MAP_UNIT); // 单位
|
||||
// 死信队列中获取单张图片
|
||||
arg.setName(map.getName());
|
||||
arg.setOutFile(earthquakeHandler.getPath(assess.getEvent(), assess.getEqQueueId(), BaseConstants.MAP_LAYOUT_A3, map));
|
||||
arg.setOutFile(EarthquakeHandler.getPath(assess.getEvent(), assess.getEqQueueId(), BaseConstants.MAP_LAYOUT_A3, map, qgisProperties));
|
||||
arg.setPath(qgisProperties.getEqMapsTemplatePath() + map.getName() + ".qgz");
|
||||
arg.setDisaster(BaseConstants.EQ_DISASTER_MAP); // 地震灾害
|
||||
|
||||
@@ -180,27 +175,27 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
}
|
||||
|
||||
// 暴雨 制图参数
|
||||
private List<QgisArgs> setMakeRainstormMapsArgs(RAssessmentDTO assess, List<RainMapsEnums> maps) {
|
||||
private List<QgisArgsParams> setMakeRainstormMapsArgs(RainAssessmentDTO assess, List<RainMapsEnums> maps) {
|
||||
// 专题图集参数
|
||||
List<QgisArgs> args = new ArrayList<>();
|
||||
List<QgisArgsParams> args = new ArrayList<>();
|
||||
|
||||
// A4 画幅
|
||||
for (RainMapsEnums map : maps) {
|
||||
// qgis参数
|
||||
QgisArgs arg = new QgisArgs();
|
||||
QgisArgsParams arg = new QgisArgsParams();
|
||||
arg.setId(map.getNum());
|
||||
arg.setEvent(assess.getRainId());
|
||||
arg.setQueueId(assess.getRainQueueId());
|
||||
arg.setCenterX(assess.getLongitude());
|
||||
arg.setCenterY(assess.getLatitude());
|
||||
arg.setInfo(earthquakeHandler.parseRInfo(assess.getOccurrenceTime(), assess.getRainfall(), assess.getDuration()));
|
||||
arg.setMapTitle(earthquakeHandler.combineR(assess.getPosition(), assess.getRainType(), map));
|
||||
arg.setInfo(EarthquakeHandler.parseRInfo(assess.getOccurrenceTime(), assess.getRainfall(), assess.getDuration()));
|
||||
arg.setMapTitle(EarthquakeHandler.combineR(assess.getPosition(), assess.getRainType(), map));
|
||||
arg.setMapTime(BaseUtils.formatTime(LocalDateTime.now(), false));
|
||||
arg.setMapLayout(BaseConstants.MAP_LAYOUT_A3); // A4
|
||||
arg.setMapUint(BaseConstants.MAP_UNIT); // 单位
|
||||
// 死信队列中获取单张图片
|
||||
arg.setName(map.getName());
|
||||
arg.setOutFile(earthquakeHandler.getRPath(assess.getRainId(), assess.getRainQueueId(), BaseConstants.MAP_LAYOUT_A4, map));
|
||||
arg.setOutFile(EarthquakeHandler.getRPath(assess.getRainId(), assess.getRainQueueId(), BaseConstants.MAP_LAYOUT_A4, map, qgisProperties));
|
||||
arg.setPath(qgisProperties.getRainMapsTemplatePath() + map.getName() + ".qgz");
|
||||
arg.setDisaster(BaseConstants.RAIN_DISASTER_MAP); // 暴雨灾害
|
||||
// 按规则缩放
|
||||
@@ -213,20 +208,20 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
// 增加 A3 画幅
|
||||
for (RainMapsEnums map : maps) {
|
||||
// qgis参数
|
||||
QgisArgs arg = new QgisArgs();
|
||||
QgisArgsParams arg = new QgisArgsParams();
|
||||
arg.setId(map.getNum());
|
||||
arg.setEvent(assess.getRainId());
|
||||
arg.setQueueId(assess.getRainQueueId());
|
||||
arg.setCenterX(assess.getLongitude());
|
||||
arg.setCenterY(assess.getLatitude());
|
||||
arg.setInfo(earthquakeHandler.parseRInfo(assess.getOccurrenceTime(), assess.getRainfall(), assess.getDuration()));
|
||||
arg.setMapTitle(earthquakeHandler.combineR(assess.getPosition(), assess.getRainType(), map));
|
||||
arg.setInfo(EarthquakeHandler.parseRInfo(assess.getOccurrenceTime(), assess.getRainfall(), assess.getDuration()));
|
||||
arg.setMapTitle(EarthquakeHandler.combineR(assess.getPosition(), assess.getRainType(), map));
|
||||
arg.setMapTime(BaseUtils.formatTime(LocalDateTime.now(), false));
|
||||
arg.setMapLayout(BaseConstants.MAP_LAYOUT_A4); // A4
|
||||
arg.setMapUint(BaseConstants.MAP_UNIT); // 单位
|
||||
// 死信队列中获取单张图片
|
||||
arg.setName(map.getName());
|
||||
arg.setOutFile(earthquakeHandler.getRPath(assess.getRainId(), assess.getRainQueueId(), BaseConstants.MAP_LAYOUT_A3, map));
|
||||
arg.setOutFile(EarthquakeHandler.getRPath(assess.getRainId(), assess.getRainQueueId(), BaseConstants.MAP_LAYOUT_A3, map, qgisProperties));
|
||||
arg.setPath(qgisProperties.getRainMapsTemplatePath() + map.getName() + ".qgz");
|
||||
arg.setDisaster(BaseConstants.RAIN_DISASTER_MAP); // 暴雨灾害
|
||||
arg.setZoomRule(BaseEnums.NO.getCode().toString()); // 默认不缩放
|
||||
@@ -251,7 +246,7 @@ public class DZProductServiceImpl extends ServiceImpl<DZProductMapper, DZProduct
|
||||
* A4:
|
||||
* 所有都不变
|
||||
*/
|
||||
public Map<String, String> change(EqAssessmentDTO assess, String size, String name) {
|
||||
public Map<String, String> change(EarthquakeAssessmentDTO assess, String size, String name) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
if (size.equals("A3")) {
|
||||
+28
-29
@@ -1,26 +1,25 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.earthquake.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.pub.EqAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.RAssessmentDTO;
|
||||
import com.gis.xian.entity.pub.DZEqQueue;
|
||||
import com.gis.xian.enums.BaseEnums;
|
||||
import com.gis.xian.mapper.pub.DZEqQueueMapper;
|
||||
import com.gis.xian.service.dzxx.IDZXXDistanceService;
|
||||
import com.gis.xian.service.dzxx.IDZXXInfluenceService;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainAssessmentDTO;
|
||||
import com.gis.xian.entity.qgis.earthquake.EarthquakeQueue;
|
||||
import com.gis.xian.enums.qgis.BaseEnums;
|
||||
import com.gis.xian.mapper.qgis.earthquake.EarthquakeQueueMapper;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationDistanceService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeInformationInfluenceService;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServeException;
|
||||
import com.gis.xian.service.pub.IDZEqQueueService;
|
||||
import com.gis.xian.service.pub.IDZProductService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeProductService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeQueueService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -34,19 +33,19 @@ import java.time.LocalDateTime;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue> implements IDZEqQueueService {
|
||||
public class EarthquakeQueueServiceImpl extends ServiceImpl<EarthquakeQueueMapper, EarthquakeQueue> implements IEarthquakeQueueService {
|
||||
|
||||
@Resource
|
||||
private IDZXXDistanceService idzxxDistanceService;
|
||||
private IEarthquakeInformationDistanceService IEarthquakeInformationDistanceService;
|
||||
@Resource
|
||||
private IDZXXInfluenceService idzxxInfluenceService;
|
||||
private IEarthquakeInformationInfluenceService IEarthquakeInformationInfluenceService;
|
||||
@Resource
|
||||
private IDZProductService idzProductService;
|
||||
private IEarthquakeProductService IEarthquakeProductService;
|
||||
|
||||
// 地震评估
|
||||
@Transactional
|
||||
@Override
|
||||
public void assess(EqAssessmentDTO assess) {
|
||||
public void assess(EarthquakeAssessmentDTO assess) {
|
||||
log.info("开始评估,评估参数:{}", assess);
|
||||
// 异常值
|
||||
if (assess == null) {
|
||||
@@ -57,12 +56,12 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
// 初始化评估
|
||||
initial(assess, BaseConstants.MANUAL);
|
||||
// 地震影响场评估 5s
|
||||
idzxxInfluenceService.handle(assess);
|
||||
IEarthquakeInformationInfluenceService.handle(assess);
|
||||
updated(assess.getEvent(), assess.getEqQueueId(), BaseUtils.compute(1, 0), BaseEnums.CALCULATING.getCode());
|
||||
// 震中距评估
|
||||
idzxxDistanceService.handle(assess.getLongitude(), assess.getLatitude(), assess.getEqQueueId());
|
||||
IEarthquakeInformationDistanceService.handle(assess.getLongitude(), assess.getLatitude(), assess.getEqQueueId());
|
||||
// 专题图产出
|
||||
idzProductService.makeEarthquakeMaps(assess);
|
||||
IEarthquakeProductService.makeEarthquakeMaps(assess);
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
throw new ServeException(BaseConstants.ASSESS_SERVER_ERROR);
|
||||
@@ -71,7 +70,7 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void assess(RAssessmentDTO assess) {
|
||||
public void assess(RainAssessmentDTO assess) {
|
||||
log.info("开始评估,评估参数:{}", assess);
|
||||
// 异常值
|
||||
if (assess == null) {
|
||||
@@ -82,7 +81,7 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
// 初始化评估
|
||||
initial(assess, BaseConstants.MANUAL);
|
||||
// 专题图产出
|
||||
idzProductService.makeRainstormMaps(assess);
|
||||
IEarthquakeProductService.makeRainstormMaps(assess);
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
throw new ServeException(BaseConstants.ASSESS_SERVER_ERROR);
|
||||
@@ -90,9 +89,9 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
}
|
||||
|
||||
// 地震初始化评估进度和评估状态
|
||||
private void initial(EqAssessmentDTO assess, int type) {
|
||||
private void initial(EarthquakeAssessmentDTO assess, int type) {
|
||||
|
||||
DZEqQueue dzqueue = new DZEqQueue();
|
||||
EarthquakeQueue dzqueue = new EarthquakeQueue();
|
||||
BeanUtils.copyProperties(assess, dzqueue);
|
||||
dzqueue.setId(assess.getEqQueueId());
|
||||
dzqueue.setBatch(1);
|
||||
@@ -108,9 +107,9 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
}
|
||||
|
||||
// 暴雨初始化评估进度和评估状态
|
||||
private void initial(RAssessmentDTO assess, int type) {
|
||||
private void initial(RainAssessmentDTO assess, int type) {
|
||||
|
||||
DZEqQueue dzqueue = new DZEqQueue();
|
||||
EarthquakeQueue dzqueue = new EarthquakeQueue();
|
||||
BeanUtils.copyProperties(assess, dzqueue);
|
||||
dzqueue.setId(assess.getRainQueueId());
|
||||
dzqueue.setBatch(1);
|
||||
@@ -129,11 +128,11 @@ public class DZEqQueueServiceImpl extends ServiceImpl<DZEqQueueMapper, DZEqQueue
|
||||
// 更新评估进度和评估状态
|
||||
public void updated(String event, String queueId, double progress, int state) {
|
||||
|
||||
DZEqQueue dzqueue = new DZEqQueue();
|
||||
EarthquakeQueue dzqueue = new EarthquakeQueue();
|
||||
// 条件
|
||||
LambdaQueryWrapper<DZEqQueue> lambdaQuery = Wrappers.lambdaQuery(DZEqQueue.class)
|
||||
.eq(DZEqQueue::getEvent, event)
|
||||
.eq(DZEqQueue::getId, queueId);
|
||||
LambdaQueryWrapper<EarthquakeQueue> lambdaQuery = Wrappers.lambdaQuery(EarthquakeQueue.class)
|
||||
.eq(EarthquakeQueue::getEvent, event)
|
||||
.eq(EarthquakeQueue::getId, queueId);
|
||||
|
||||
// 评估异常终止
|
||||
if (state == BaseEnums.TIMEOUT_OR_EXCEPTION.getCode()) {
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.gis.xian.service.qgis.rain;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.dto.qgis.rain.RainTriggerDTO;
|
||||
import com.gis.xian.entity.qgis.rain.RainEvent;
|
||||
import com.gis.xian.dto.qgis.rain.RainQuery;
|
||||
|
||||
/**
|
||||
* @author zzw
|
||||
* @description: IREventService
|
||||
* @date 2026/6/8 下午6:01
|
||||
*/
|
||||
@DataSource("slave1")
|
||||
public interface IREventService extends IService<RainEvent> {
|
||||
// 暴雨触发
|
||||
public RainQuery trigger(RainTriggerDTO trigger);
|
||||
|
||||
// 删除暴雨事件
|
||||
public Boolean deletedById(Long Id);
|
||||
}
|
||||
+20
-20
@@ -1,21 +1,21 @@
|
||||
package com.gis.xian.service.pub.impl;
|
||||
package com.gis.xian.service.qgis.rain.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gis.xian.config.DataSource;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.pub.RAssessmentDTO;
|
||||
import com.gis.xian.dto.pub.REventDTO;
|
||||
import com.gis.xian.dto.pub.RTriggerDTO;
|
||||
import com.gis.xian.entity.pub.REvent;
|
||||
import com.gis.xian.mapper.pub.REventMapper;
|
||||
import com.gis.xian.query.RQuery;
|
||||
import com.gis.xian.dto.qgis.rain.RainAssessmentDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainEventDTO;
|
||||
import com.gis.xian.dto.qgis.rain.RainTriggerDTO;
|
||||
import com.gis.xian.entity.qgis.rain.RainEvent;
|
||||
import com.gis.xian.mapper.qgis.rain.RainEventMapper;
|
||||
import com.gis.xian.dto.qgis.rain.RainQuery;
|
||||
import com.gis.xian.service.ex.ParmaException;
|
||||
import com.gis.xian.service.ex.ServeException;
|
||||
import com.gis.xian.service.ex.ServiceException;
|
||||
import com.gis.xian.service.pub.IDZEqQueueService;
|
||||
import com.gis.xian.service.pub.IREventService;
|
||||
import com.gis.xian.service.qgis.earthquake.IEarthquakeQueueService;
|
||||
import com.gis.xian.service.qgis.rain.IREventService;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,14 +34,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
@Service
|
||||
@DataSource("slave1")
|
||||
public class REventServiceImpl extends ServiceImpl<REventMapper, REvent> implements IREventService {
|
||||
public class RainEventServiceImpl extends ServiceImpl<RainEventMapper, RainEvent> implements IREventService {
|
||||
@Resource
|
||||
private IDZEqQueueService idzEqQueueService;
|
||||
private IEarthquakeQueueService IEarthquakeQueueService;
|
||||
|
||||
// 暴雨触发
|
||||
@Transactional
|
||||
@Override
|
||||
public RQuery trigger(RTriggerDTO trigger) {
|
||||
public RainQuery trigger(RainTriggerDTO trigger) {
|
||||
log.info("暴雨参数:{}", trigger);
|
||||
// 异常值
|
||||
if (trigger == null) {
|
||||
@@ -52,7 +52,7 @@ public class REventServiceImpl extends ServiceImpl<REventMapper, REvent> impleme
|
||||
// 暴雨业务
|
||||
try {
|
||||
// 暴雨信息存储
|
||||
REventDTO eventdto = new REventDTO();
|
||||
RainEventDTO eventdto = new RainEventDTO();
|
||||
BeanUtils.copyProperties(trigger, eventdto);
|
||||
eventdto.setRainId(code);
|
||||
log.info("暴雨专题图编码:{}", code);
|
||||
@@ -65,19 +65,19 @@ public class REventServiceImpl extends ServiceImpl<REventMapper, REvent> impleme
|
||||
String batch = BaseUtils.generationBatchCode(code);
|
||||
// 评估业务
|
||||
try {
|
||||
RAssessmentDTO assess = new RAssessmentDTO();
|
||||
RainAssessmentDTO assess = new RainAssessmentDTO();
|
||||
BeanUtils.copyProperties(trigger, assess);
|
||||
assess.setRainId(code);
|
||||
assess.setRainQueueId(batch);
|
||||
// 开始评估
|
||||
idzEqQueueService.assess(assess);
|
||||
IEarthquakeQueueService.assess(assess);
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
throw new ServeException(BaseConstants.ASSESS_SERVER_ERROR);
|
||||
}
|
||||
// 地震编码
|
||||
return new RQuery(code, batch);
|
||||
return new RainQuery(code, batch);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,22 +89,22 @@ public class REventServiceImpl extends ServiceImpl<REventMapper, REvent> impleme
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
}
|
||||
// 条件构造
|
||||
LambdaQueryWrapper<REvent> lambdaQuery = Wrappers.lambdaQuery(REvent.class);
|
||||
lambdaQuery.eq(REvent::getId, Id);
|
||||
LambdaQueryWrapper<RainEvent> lambdaQuery = Wrappers.lambdaQuery(RainEvent.class);
|
||||
lambdaQuery.eq(RainEvent::getId, Id);
|
||||
int flag = this.baseMapper.delete(lambdaQuery);
|
||||
return flag > 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
// 处理暴雨数据
|
||||
private void handle(REventDTO eventdto) {
|
||||
private void handle(RainEventDTO eventdto) {
|
||||
// 抛出异常
|
||||
if (eventdto == null) {
|
||||
throw new ParmaException(BaseConstants.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
try {
|
||||
REvent revent = new REvent();
|
||||
RainEvent revent = new RainEvent();
|
||||
BeanUtils.copyProperties(eventdto, revent);
|
||||
// 处理空间数据
|
||||
GeometryFactory geometryFactory = new GeometryFactory();
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.gis.xian.utils.http;
|
||||
package com.gis.xian.utils;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -12,7 +11,7 @@ import java.util.Map;
|
||||
* @description: 第三方请求工具类
|
||||
* @date 2026/5/26 下午4:27
|
||||
*/
|
||||
public class HttpRestClient {
|
||||
public class HttpRequestClientUtils {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
@@ -29,7 +28,7 @@ public class HttpRestClient {
|
||||
* 构造方法,注入RestTemplate
|
||||
* @param restTemplate RestTemplate实例
|
||||
*/
|
||||
public HttpRestClient(RestTemplate restTemplate) {
|
||||
public HttpRequestClientUtils(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
+16
-20
@@ -1,12 +1,10 @@
|
||||
package com.gis.xian.handler;
|
||||
package com.gis.xian.utils.qgis;
|
||||
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.enums.EqMapsEnums;
|
||||
import com.gis.xian.enums.RainMapsEnums;
|
||||
import com.gis.xian.enums.qgis.EarthquakeMapsEnums;
|
||||
import com.gis.xian.enums.qgis.RainMapsEnums;
|
||||
import com.gis.xian.utils.BaseUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -16,12 +14,8 @@ import java.time.format.DateTimeFormatter;
|
||||
* @description: 地震烈度核心服务
|
||||
* @date 2026/5/26 上午10:47
|
||||
*/
|
||||
@Component
|
||||
public class EarthquakeHandler {
|
||||
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
|
||||
/**
|
||||
* 获取不同烈度下的面积
|
||||
*
|
||||
@@ -29,7 +23,7 @@ public class EarthquakeHandler {
|
||||
* @param b 短轴
|
||||
* @return 返回椭圆的面积
|
||||
*/
|
||||
public double calculateArea(double a, double b) {
|
||||
public static double calculateArea(double a, double b) {
|
||||
return Math.PI * a * b;
|
||||
}
|
||||
|
||||
@@ -41,7 +35,7 @@ public class EarthquakeHandler {
|
||||
* @description: 计算椭圆的长轴
|
||||
* @return: 返回长轴
|
||||
*/
|
||||
public double calculateRa(double M, double Ia) {
|
||||
public static double calculateRa(double M, double Ia) {
|
||||
return (Math.pow(10, (4.0293 + 1.3003 * M - Ia) / 3.6404) - 10) * 1000;
|
||||
}
|
||||
|
||||
@@ -53,25 +47,25 @@ public class EarthquakeHandler {
|
||||
* @description: 计算椭圆的短轴
|
||||
* @return: 返回短轴
|
||||
*/
|
||||
public double calculateRb(double M, double Ib) {
|
||||
public static double calculateRb(double M, double Ib) {
|
||||
return (Math.pow(10, (2.3816 + 1.3003 * M - Ib) / 2.8573) - 5) * 1000;
|
||||
}
|
||||
|
||||
|
||||
// 格式化地震三要素信息
|
||||
public String parseInfo(LocalDateTime eqTime, double magnitude, String addr) {
|
||||
public static String parseInfo(LocalDateTime eqTime, double magnitude, String addr) {
|
||||
String time = BaseUtils.formatTime(eqTime, true);
|
||||
return String.format("时间:%s\r\n震级:%s级\r\n位置:%s", time, magnitude, addr);
|
||||
}
|
||||
|
||||
// 格式化暴雨三要素信息
|
||||
public String parseRInfo(LocalDateTime eqTime, String magnitude, String addr) {
|
||||
public static String parseRInfo(LocalDateTime eqTime, String magnitude, String addr) {
|
||||
String time = BaseUtils.formatTime(eqTime, true);
|
||||
return String.format("时间:%s\r\n累计降雨量:%s毫米\r\n已持续:%s小时", time, magnitude, addr);
|
||||
}
|
||||
|
||||
// 拼接地震图件标题
|
||||
public String combine(String eqName, String eqType, EqMapsEnums map) {
|
||||
public static String combine(String eqName, String eqType, EarthquakeMapsEnums map) {
|
||||
// 地点 + 震级
|
||||
String name = eqName;
|
||||
// 图名称 + 地震类型
|
||||
@@ -80,7 +74,7 @@ public class EarthquakeHandler {
|
||||
}
|
||||
|
||||
// 拼接暴雨图件标题
|
||||
public String combineR(String rainName, String rainType, RainMapsEnums map) {
|
||||
public static String combineR(String rainName, String rainType, RainMapsEnums map) {
|
||||
// 地点 + 暴雨名称
|
||||
String name = rainName;
|
||||
// 图名称 + 暴雨类型
|
||||
@@ -89,7 +83,9 @@ public class EarthquakeHandler {
|
||||
}
|
||||
|
||||
// 拼接导出路径
|
||||
public String getPath(String event, String queueId, String size, EqMapsEnums map) {
|
||||
|
||||
// 拼接导出路径
|
||||
public static String getPath(String event, String queueId, String size, EarthquakeMapsEnums map, QgisProperties qgisProperties) {
|
||||
// 地震事件 + 批次
|
||||
String batch = queueId.substring(event.length());
|
||||
String path = event + "/" + batch + "/" + size + "/" + map.getName();
|
||||
@@ -97,20 +93,20 @@ public class EarthquakeHandler {
|
||||
}
|
||||
|
||||
// 拼接导出路径
|
||||
public String getRPath(String rainId, String queueId, String size, RainMapsEnums map) {
|
||||
public static String getRPath(String rainId, String queueId, String size, RainMapsEnums map, QgisProperties qgisProperties) {
|
||||
// 地震事件 + 批次
|
||||
String batch = queueId.substring(rainId.length());
|
||||
String path = rainId + "/" + batch + "/" + size + "/" + map.getName();
|
||||
return String.format("%s", qgisProperties.getBasePath() + qgisProperties.getRainMapsOutputPath() + path + ".jpg");
|
||||
}
|
||||
|
||||
public String format(LocalDateTime time) {
|
||||
public static String format(LocalDateTime time) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM月dd日HH时mm分");
|
||||
String timestamp = time.format(formatter);
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public String formatTime(LocalDateTime time) {
|
||||
public static String formatTime(LocalDateTime time) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分");
|
||||
String timestamp = time.format(formatter);
|
||||
return timestamp;
|
||||
+9
-11
@@ -1,12 +1,11 @@
|
||||
package com.gis.xian.handler;
|
||||
package com.gis.xian.utils.qgis;
|
||||
|
||||
import com.gis.xian.query.IntensityQuery;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeIntensityQuery;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
import org.locationtech.proj4j.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -18,19 +17,18 @@ import java.util.List;
|
||||
* @description: 椭圆烈度衰减圈转换为WKT格式
|
||||
* @date 2026/5/26 上午10:25
|
||||
*/
|
||||
@Component
|
||||
public class EllipseToWktHandler {
|
||||
// 投影转换工厂
|
||||
private final CRSFactory crsFactory = new CRSFactory();
|
||||
private final CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
|
||||
GeometryFactory geometryFactory = new GeometryFactory();
|
||||
private static final CRSFactory crsFactory = new CRSFactory();
|
||||
private static final CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
|
||||
private static final GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
||||
/**
|
||||
* 将椭圆参数转换为 POLYGON 格式的 WKT 字符串
|
||||
* @param query 椭圆烈度参数
|
||||
* @return POLYGON格式的WKT字符串
|
||||
*/
|
||||
public Polygon ellipseToPolygonWkt(IntensityQuery query) {
|
||||
public static Polygon ellipseToPolygonWkt(EarthquakeIntensityQuery query) {
|
||||
try {
|
||||
// 确定UTM投影带并创建转换器
|
||||
int utmZone = (int) Math.floor((query.getCenterLon() + 180) / 6) + 1;
|
||||
@@ -108,7 +106,7 @@ public class EllipseToWktHandler {
|
||||
/**
|
||||
* 解析WKT获取经纬度范围
|
||||
*/
|
||||
public void printLatLonRange(String wkt) {
|
||||
public static void printLatLonRange(String wkt) {
|
||||
// 提取顶点坐标
|
||||
String coordsPart = wkt.replace("POLYGON ((", "").replace("))", "");
|
||||
String[] coordStrs = coordsPart.split(", ");
|
||||
@@ -137,12 +135,12 @@ public class EllipseToWktHandler {
|
||||
/**
|
||||
* 保留6位小数
|
||||
*/
|
||||
private double roundTo6Decimals(double value) {
|
||||
private static double roundTo6Decimals(double value) {
|
||||
return new BigDecimal(value).setScale(6, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
// 构建 Polygon 对象
|
||||
public Polygon buildPolygonFromWKTString(String wktPolygon) {
|
||||
public static Polygon buildPolygonFromWKTString(String wktPolygon) {
|
||||
try {
|
||||
// WKT解析器
|
||||
WKTReader wktReader = new WKTReader(geometryFactory);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.gis.xian.handler;
|
||||
package com.gis.xian.utils.qgis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
+9
-19
@@ -1,18 +1,13 @@
|
||||
package com.gis.xian.handler;
|
||||
package com.gis.xian.utils.qgis;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.gis.xian.config.QgisProperties;
|
||||
import com.gis.xian.constant.BaseConstants;
|
||||
import com.gis.xian.dto.dzxx.DZXXInfluenceDTO;
|
||||
import com.gis.xian.dto.pub.IntyGeoJsonDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInformationInfluenceDTO;
|
||||
import com.gis.xian.dto.qgis.earthquake.EarthquakeInfluenceGeoJsonDTO;
|
||||
import org.locationtech.jts.geom.CoordinateSequence;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.LinearRing;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@@ -27,18 +22,13 @@ import java.util.List;
|
||||
* @description: 处理空间数据文件形式
|
||||
* @date 2026/5/26 上午10:41
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GeoFilesHandler {
|
||||
|
||||
@Resource
|
||||
private QgisProperties qgisProperties;
|
||||
|
||||
private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory();
|
||||
private static final WKTReader WKT_READER = new WKTReader(GEOMETRY_FACTORY);
|
||||
// Deleted:private static final WKTReader WKT_READER = new WKTReader(GEOMETRY_FACTORY);
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
public void writeGeoJsonToFile(IntyGeoJsonDTO featureCollection, String fileName) throws IOException {
|
||||
public static void writeGeoJsonToFile(EarthquakeInfluenceGeoJsonDTO featureCollection, String fileName, QgisProperties qgisProperties) throws IOException {
|
||||
// 序列化
|
||||
String geoJsonStr = OBJECT_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(featureCollection);
|
||||
// geojson文件路径
|
||||
@@ -60,7 +50,7 @@ public class GeoFilesHandler {
|
||||
}
|
||||
|
||||
// 将JTS转换为GeoJSON坐标
|
||||
private List<List<Double>> convertCoordinateSequenceToGeoJson(CoordinateSequence cs) {
|
||||
private static List<List<Double>> convertCoordinateSequenceToGeoJson(CoordinateSequence cs) {
|
||||
List<List<Double>> coordinates = new ArrayList<>();
|
||||
for (int i = 0; i < cs.size(); i++) {
|
||||
double lon = cs.getX(i); // 经度
|
||||
@@ -74,9 +64,9 @@ public class GeoFilesHandler {
|
||||
}
|
||||
|
||||
// 将JTS Polygon转换为GeoJSON Feature对象
|
||||
public IntyGeoJsonDTO.GeoJsonFeature convertPolygonToGeoJsonFeature(Polygon polygon, DZXXInfluenceDTO dzxx) {
|
||||
IntyGeoJsonDTO.GeoJsonFeature feature = new IntyGeoJsonDTO.GeoJsonFeature();
|
||||
IntyGeoJsonDTO.GeoJsonFeature.GeoJsonGeometry geometry = new IntyGeoJsonDTO.GeoJsonFeature.GeoJsonGeometry();
|
||||
public static EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature convertPolygonToGeoJsonFeature(Polygon polygon, EarthquakeInformationInfluenceDTO dzxx) {
|
||||
EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature feature = new EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature();
|
||||
EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature.GeoJsonGeometry geometry = new EarthquakeInfluenceGeoJsonDTO.GeoJsonFeature.GeoJsonGeometry();
|
||||
|
||||
// 设置几何类型
|
||||
geometry.setType("Polygon");
|
||||
@@ -23,10 +23,14 @@ spring:
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
# username: xiaodemo
|
||||
# password: 1234
|
||||
username: zzw
|
||||
password: zzw0401
|
||||
# host: 47.92.216.173
|
||||
# port: 4018
|
||||
# username: xiaodemo
|
||||
# password: 1234
|
||||
# username: gis
|
||||
# password: gis502
|
||||
#虚拟host 可以不设置,使用server默认host
|
||||
# virtual-host: /xiaodemos
|
||||
#消息确认配置项
|
||||
@@ -42,7 +46,7 @@ spring:
|
||||
retry:
|
||||
enabled: true # 开启消费者重试(建议结合业务幂等性使用)
|
||||
max-attempts: 3 # 最大重试次数
|
||||
initial-interval: 1000ms # 第一次重试间隔
|
||||
initial-interval: 10000ms # 第一次重试间隔
|
||||
multiplier: 2 # 重试间隔倍数(第二次2s,第三次4s)
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
Reference in New Issue
Block a user