From 85446b5b526ac53af9add7c83cfd72f39ec39611 Mon Sep 17 00:00:00 2001 From: ‘liusuyi’ <1951119284@qq.com> Date: 星期五, 07 七月 2023 10:51:13 +0800 Subject: [PATCH] 优化外联设备报警解析并上传mqtt --- src/main/java/com/ard/alarm/camera/service/impl/ArdCamerasServiceImpl.java | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ard/alarm/camera/service/impl/ArdCamerasServiceImpl.java b/src/main/java/com/ard/alarm/camera/service/impl/ArdCamerasServiceImpl.java index 914fd59..71d9b4b 100644 --- a/src/main/java/com/ard/alarm/camera/service/impl/ArdCamerasServiceImpl.java +++ b/src/main/java/com/ard/alarm/camera/service/impl/ArdCamerasServiceImpl.java @@ -4,8 +4,13 @@ import com.ard.alarm.camera.domain.ArdCameras; import com.ard.alarm.camera.mapper.ArdCamerasMapper; import com.ard.alarm.camera.service.IArdCamerasService; +import com.ard.alarm.external.domain.ArdEquipExternal; +import com.ard.alarm.external.mapper.ArdEquipExternalMapper; import com.ard.utils.hiksdk.service.impl.HikClientUtil; import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.core.annotation.Order; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @@ -19,17 +24,25 @@ */ @Service @Slf4j(topic = "camera") -public class ArdCamerasServiceImpl implements IArdCamerasService { +@Order(4) +public class ArdCamerasServiceImpl implements IArdCamerasService, ApplicationRunner { @Resource private ArdCamerasMapper ardCamerasMapper; + @Resource + private ArdEquipExternalMapper ardEquipExternalMapper; + @Override + public void run(ApplicationArguments args) throws Exception { - - @PostConstruct - public void init() - { - List<ArdCameras> ardCameras = ardCamerasMapper.selectArdCamerasList(new ArdCameras()); HikClientUtil.loadHCNetSDKLib(); - HikClientUtil.loginAll(ardCameras); + //鑾峰彇鍏ㄩ儴娴峰悍鍏夌數 + List<ArdCameras> ardCameras = ardCamerasMapper.selectArdCamerasList(new ArdCameras()); + HikClientUtil.loginAllCamera(ardCameras); + //鑾峰彇鍏ㄩ儴娴峰悍鎶ヨ涓绘満 + ArdEquipExternal ardEquipExternal= new ArdEquipExternal(); + ardEquipExternal.setFactory("1"); + ardEquipExternal.setType("1"); + List<ArdEquipExternal> ardEquipExternals = ardEquipExternalMapper.selectArdEquipExternalList(ardEquipExternal); + HikClientUtil.loginAllAlarmHost(ardEquipExternals); } /** * 鏌ヨ鐩告満璁惧 @@ -53,4 +66,5 @@ return ardCamerasMapper.selectArdCamerasList(ardCameras); } + } -- Gitblit v1.9.3