feat(aiot): 新增方案B Service接口
- IAiAlertService: AI告警服务接口 - IAiAlgoTemplateService: 算法模板服务接口 - IAiConfigSnapshotService: 配置快照服务接口 - IAiEdgeDeviceService: 边缘设备服务接口 - IAiRedisConfigService: Redis配置同步服务接口 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package com.genersoft.iot.vmp.aiot.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiAlert;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IAiAlertService {
|
||||||
|
|
||||||
|
void save(AiAlert alert);
|
||||||
|
|
||||||
|
AiAlert queryByAlertId(String alertId);
|
||||||
|
|
||||||
|
PageInfo<AiAlert> queryList(String cameraId, String alertType, String startTime, String endTime, int page, int count);
|
||||||
|
|
||||||
|
void delete(String alertId);
|
||||||
|
|
||||||
|
void deleteBatch(List<String> alertIds);
|
||||||
|
|
||||||
|
Map<String, Object> statistics(String startTime);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.genersoft.iot.vmp.aiot.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiAlgoTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IAiAlgoTemplateService {
|
||||||
|
|
||||||
|
void save(AiAlgoTemplate template);
|
||||||
|
|
||||||
|
void delete(String templateId);
|
||||||
|
|
||||||
|
AiAlgoTemplate queryByTemplateId(String templateId);
|
||||||
|
|
||||||
|
List<AiAlgoTemplate> queryList(String algoCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板级联更新:更新模板后同步更新所有引用该模板的绑定
|
||||||
|
*/
|
||||||
|
void cascadeUpdate(String templateId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.genersoft.iot.vmp.aiot.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiConfigSnapshot;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IAiConfigSnapshotService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成快照
|
||||||
|
*/
|
||||||
|
AiConfigSnapshot createSnapshot(String scopeType, String scopeId, String cameraId,
|
||||||
|
String snapshot, String changeType, String changeDesc, String createdBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询版本列表
|
||||||
|
*/
|
||||||
|
PageInfo<AiConfigSnapshot> queryVersions(String scopeType, String scopeId, String cameraId, int page, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看快照详情
|
||||||
|
*/
|
||||||
|
AiConfigSnapshot queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头级别回滚
|
||||||
|
*/
|
||||||
|
void rollbackCamera(String cameraId, Integer targetVersion, String operator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ROI级别回滚
|
||||||
|
*/
|
||||||
|
void rollbackRoi(String roiId, Integer targetVersion, String operator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定级别回滚
|
||||||
|
*/
|
||||||
|
void rollbackBind(String bindId, Integer targetVersion, String operator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本间比对
|
||||||
|
*/
|
||||||
|
Map<String, Object> diff(String scopeType, String scopeId, Integer versionA, Integer versionB);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送前预览 - 对比DB配置 vs Redis中的配置
|
||||||
|
*/
|
||||||
|
Map<String, Object> preview(String cameraId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.genersoft.iot.vmp.aiot.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiEdgeDevice;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IAiEdgeDeviceService {
|
||||||
|
|
||||||
|
void saveOrUpdateHeartbeat(String deviceId, String payload);
|
||||||
|
|
||||||
|
AiEdgeDevice queryByDeviceId(String deviceId);
|
||||||
|
|
||||||
|
List<AiEdgeDevice> queryAll();
|
||||||
|
|
||||||
|
void checkOffline();
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.genersoft.iot.vmp.aiot.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiRoi;
|
||||||
|
import com.genersoft.iot.vmp.aiot.bean.AiRoiAlgoBind;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI配置Redis同步服务 - 负责将平台配置写入Redis(对齐ai_edge的key格式)
|
||||||
|
*/
|
||||||
|
public interface IAiRedisConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将ROI配置写入Redis Hash (config:roi:{roi_id})
|
||||||
|
*/
|
||||||
|
void writeRoiToRedis(AiRoi roi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将算法绑定配置写入Redis Hash (config:bind:{bind_id})
|
||||||
|
*/
|
||||||
|
void writeBindToRedis(AiRoiAlgoBind bind, String algoName, String targetClass, String effectiveParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将摄像头配置写入Redis Hash (config:camera:{camera_id})
|
||||||
|
*/
|
||||||
|
void writeCameraToRedis(String cameraId, String rtspUrl, String cameraName, String location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Redis中的ROI配置
|
||||||
|
*/
|
||||||
|
void deleteRoiFromRedis(String roiId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Redis中的绑定配置
|
||||||
|
*/
|
||||||
|
void deleteBindFromRedis(String bindId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布config_update通知到Redis Pub/Sub
|
||||||
|
*/
|
||||||
|
void publishConfigUpdate(String type, List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从Redis读取指定摄像头下所有ROI和绑定的当前配置
|
||||||
|
*/
|
||||||
|
Map<String, Object> readConfigFromRedis(String cameraId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全量同步摄像头配置到Redis
|
||||||
|
*/
|
||||||
|
void syncCameraConfigToRedis(String cameraId);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user