diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlertService.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlertService.java new file mode 100644 index 000000000..a8791340e --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlertService.java @@ -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 queryList(String cameraId, String alertType, String startTime, String endTime, int page, int count); + + void delete(String alertId); + + void deleteBatch(List alertIds); + + Map statistics(String startTime); +} diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlgoTemplateService.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlgoTemplateService.java new file mode 100644 index 000000000..00026fdd8 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiAlgoTemplateService.java @@ -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 queryList(String algoCode); + + /** + * 模板级联更新:更新模板后同步更新所有引用该模板的绑定 + */ + void cascadeUpdate(String templateId); +} diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiConfigSnapshotService.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiConfigSnapshotService.java new file mode 100644 index 000000000..e15926d59 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiConfigSnapshotService.java @@ -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 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 diff(String scopeType, String scopeId, Integer versionA, Integer versionB); + + /** + * 推送前预览 - 对比DB配置 vs Redis中的配置 + */ + Map preview(String cameraId); +} diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiEdgeDeviceService.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiEdgeDeviceService.java new file mode 100644 index 000000000..48aa405e8 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiEdgeDeviceService.java @@ -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 queryAll(); + + void checkOffline(); +} diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiRedisConfigService.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiRedisConfigService.java new file mode 100644 index 000000000..135f4db78 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/IAiRedisConfigService.java @@ -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 ids); + + /** + * 从Redis读取指定摄像头下所有ROI和绑定的当前配置 + */ + Map readConfigFromRedis(String cameraId); + + /** + * 全量同步摄像头配置到Redis + */ + void syncCameraConfigToRedis(String cameraId); +}