diff --git a/.gitignore b/.gitignore index 27e157b42..fea7419bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,12 @@ -# Compiled class file +# Existing ignores (preserve) +target/ *.class - -# Log file *.log -logs/* -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ -src/main/resources/application-*.yml -# Package Files # -#*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar +.idea/ *.iml -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/.idea/* -/target/* -/.idea/ -/target/ -/src/main/resources/static/ -certificates -/.vs -/docker/volumes -/docker/wvp/config/jwk.json - -# IDE与工具目录 -.claude/ -.trae/ - -# 临时脚本与文档 -QUICKSTART.md -启动.bat -编译.bat -启动指南-Java17.md -开始使用.md +# Diagnostic documents - DO NOT COMMIT +数据库/aiot/执行指南-*.md +数据库/aiot/*诊断*.md +数据库/aiot/*分析*.md +数据库/aiot/*报告*.md diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiRoiServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiRoiServiceImpl.java index 31909900d..5821a4f58 100644 --- a/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiRoiServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiRoiServiceImpl.java @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.aiot.dao.AiEdgeDeviceMapper; import com.genersoft.iot.vmp.aiot.dao.AiRoiAlgoBindMapper; import com.genersoft.iot.vmp.aiot.dao.AiRoiMapper; import com.genersoft.iot.vmp.aiot.service.IAiConfigLogService; +import com.genersoft.iot.vmp.aiot.service.IAiRedisConfigService; import com.genersoft.iot.vmp.aiot.service.IAiRoiService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -40,6 +41,9 @@ public class AiRoiServiceImpl implements IAiRoiService { @Autowired private IAiConfigLogService configLogService; + @Autowired + private IAiRedisConfigService redisConfigService; + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); @Override @@ -103,9 +107,19 @@ public class AiRoiServiceImpl implements IAiRoiService { public void delete(String roiId) { AiRoi old = roiMapper.queryByRoiId(roiId); if (old != null) { + String cameraId = old.getCameraId(); bindMapper.deleteByRoiId(roiId); roiMapper.deleteByRoiId(roiId); configLogService.addLog("ROI", roiId, toJson(old), null, null); + // 推送配置到 Edge(删除操作) + if (cameraId != null) { + try { + redisConfigService.writeDeviceAggregatedConfig(cameraId, "UPDATE"); + log.info("[AiRoi] 删除 ROI 后推送配置到 Edge,camera_id={}", cameraId); + } catch (Exception e) { + log.error("[AiRoi] 删除 ROI 后推送配置失败,camera_id={}", cameraId, e); + } + } } } @@ -171,8 +185,21 @@ public class AiRoiServiceImpl implements IAiRoiService { public void unbindAlgo(String bindId) { AiRoiAlgoBind old = bindMapper.queryByBindId(bindId); if (old != null) { + String roiId = old.getRoiId(); bindMapper.deleteByBindId(bindId); configLogService.addLog("BIND", bindId, toJson(old), null, null); + // 推送配置到 Edge(解绑算法) + if (roiId != null) { + AiRoi roi = roiMapper.queryByRoiId(roiId); + if (roi != null && roi.getCameraId() != null) { + try { + redisConfigService.writeDeviceAggregatedConfig(roi.getCameraId(), "UPDATE"); + log.info("[AiRoi] 解绑算法后推送配置到 Edge,camera_id={}", roi.getCameraId()); + } catch (Exception e) { + log.error("[AiRoi] 解绑算法后推送配置失败,camera_id={}", roi.getCameraId(), e); + } + } + } } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java index afc9b7b2b..e5f359e4b 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.streamProxy.service.impl; import com.alibaba.fastjson2.JSONObject; +import com.genersoft.iot.vmp.aiot.service.IAiRedisConfigService; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.conf.UserSetting; @@ -75,6 +76,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @Autowired TransactionDefinition transactionDefinition; + @Autowired + private IAiRedisConfigService redisConfigService; + /** * 生成唯一的 camera_code * 格式:cam_xxxxxxxxxxxx(12位随机字符) @@ -194,6 +198,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { private void delete(StreamProxy streamProxy) { Assert.notNull(streamProxy, "代理不可为NULL"); + String cameraCode = streamProxy.getCameraCode(); if (streamProxy.getPulling() != null && streamProxy.getPulling()) { playService.stopProxy(streamProxy); } @@ -201,6 +206,15 @@ public class StreamProxyServiceImpl implements IStreamProxyService { gbChannelService.delete(streamProxy.getGbId()); } streamProxyMapper.delete(streamProxy.getId()); + // 推送配置到 Edge(删除摄像头) + if (cameraCode != null) { + try { + redisConfigService.writeDeviceAggregatedConfig(cameraCode, "UPDATE"); + log.info("[StreamProxy] 删除摄像头后推送配置到 Edge,camera_code={}", cameraCode); + } catch (Exception e) { + log.error("[StreamProxy] 删除摄像头后推送配置失败,camera_code={}", cameraCode, e); + } + } } @Override