refactor: 只传simulationId给Python,删除模板文件
This commit is contained in:
@@ -4,7 +4,7 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一专题图触发请求
|
||||
* 只传递 simulationId 和类型,Python 端负责所有计算和产图
|
||||
* 只传递 simulationId,Python 端根据 ID 自行查库决定模板和类型
|
||||
*/
|
||||
@Data
|
||||
public class QgisTriggerDTO {
|
||||
@@ -13,9 +13,4 @@ public class QgisTriggerDTO {
|
||||
* 模拟ID(事件唯一标识)
|
||||
*/
|
||||
private String simulationId;
|
||||
|
||||
/**
|
||||
* 类型:earthquake(地震)/ rainstorm(暴雨)
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.gis.xian.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DisasterTypeEnum {
|
||||
// 具体灾害类型
|
||||
LANDSLIDE("landslide", "滑坡"),
|
||||
DEBRIS_FLOW("debris_flow", "泥石流"),
|
||||
FLASH_FLOOD("flash_flood", "山洪"),
|
||||
WATER_LOGGING("water_logging", "内涝");
|
||||
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
DisasterTypeEnum(String type, String description) {
|
||||
this.type = type;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据type获取枚举
|
||||
*/
|
||||
public static DisasterTypeEnum getByType(String type) {
|
||||
for (DisasterTypeEnum e : values()) {
|
||||
if (e.getType().equals(type)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,13 @@ import com.gis.xian.entity.qgis.earthquake.EarthquakeQueue;
|
||||
|
||||
/**
|
||||
* 地震评估队列服务
|
||||
* 简化为只负责触发 Python 端
|
||||
* 只负责触发 Python 端生成专题图
|
||||
*/
|
||||
public interface IEarthquakeQueueService extends IService<EarthquakeQueue> {
|
||||
|
||||
/**
|
||||
* 触发专题图生成
|
||||
* @param simulationId 模拟ID
|
||||
* @param type 类型:earthquake / rainstorm
|
||||
*/
|
||||
void trigger(String simulationId, String type);
|
||||
void trigger(String simulationId);
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class EarthquakeEventServiceImpl extends ServiceImpl<EarthquakeEventMappe
|
||||
}
|
||||
|
||||
String batch = BaseUtils.generationBatchCode(code);
|
||||
queueService.trigger(code, "earthquake");
|
||||
queueService.trigger(code);
|
||||
return new EarthquakeQuery(code, batch);
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 地震评估队列服务
|
||||
* 简化为只负责触发 Python 端生成专题图
|
||||
* 只负责触发 Python 端生成专题图
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -25,11 +25,10 @@ public class EarthquakeQueueServiceImpl extends ServiceImpl<EarthquakeQueueMappe
|
||||
private IFeignService feignService;
|
||||
|
||||
@Override
|
||||
public void trigger(String simulationId, String type) {
|
||||
log.info("触发专题图生成: simulationId={}, type={}", simulationId, type);
|
||||
public void trigger(String simulationId) {
|
||||
log.info("触发专题图生成: simulationId={}", simulationId);
|
||||
QgisTriggerDTO triggerDTO = new QgisTriggerDTO();
|
||||
triggerDTO.setSimulationId(simulationId);
|
||||
triggerDTO.setType(type);
|
||||
feignService.trigger(triggerDTO);
|
||||
log.info("专题图触发完成: simulationId={}", simulationId);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class RainEventServiceImpl extends ServiceImpl<RainEventMapper, RainEvent
|
||||
}
|
||||
|
||||
String batch = BaseUtils.generationBatchCode(code);
|
||||
queueService.trigger(code, "rainstorm");
|
||||
queueService.trigger(code);
|
||||
return new RainQuery(code, batch);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user