Compare commits

..

2 Commits

Author SHA1 Message Date
15683799673
d5d8b80f49 Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 6m41s
2025-08-20 13:06:13 +08:00
15683799673
9e346ba882 屏蔽海康sdk 2025-08-20 13:06:06 +08:00
2 changed files with 94 additions and 94 deletions

View File

@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class SisApplication {
public static void main(String[] args) {
// 加载hik sdk
SdkBaseServer.initSdk();
// SdkBaseServer.initSdk();
SpringApplication application = new SpringApplication(SisApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);

View File

@ -1,93 +1,93 @@
package org.dromara.sis.runner;
import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.property.api.RemoteFloorService;
import org.dromara.property.api.domain.vo.RemoteFloorVo;
import org.dromara.sis.domain.SisDeviceManage;
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
import org.dromara.sis.sdk.hik.HikApiService;
import org.dromara.sis.sdk.hik.calback.HikAlarmCallBack;
import org.dromara.sis.service.ISisDeviceManageService;
import org.dromara.sis.service.ISisElevatorInfoService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@Slf4j
@Component
@RequiredArgsConstructor
public class HikDeviceApplicationRunner implements ApplicationRunner {
private final HikAlarmCallBack hikAlarmCallBack;
private final ISisDeviceManageService deviceManageService;
private final ISisElevatorInfoService elevatorInfoService;
@DubboReference
private RemoteFloorService remoteFloorService;
@Override
public void run(ApplicationArguments args) throws Exception {
// 先布放在登录
HikApiService.getInstance().setAlarmCallBack(0, hikAlarmCallBack);
// 现在查询全部后面要更具需要查询指定厂商的设备
HikDeviceApplicationRunner runner = SpringUtils.getAopProxy(this);
// 梯控登录
// runner.hikElevatorInfoLogin();
// 网络摄像头登录
runner.hikNetCameraLogin();
}
@Async
public void hikElevatorInfoLogin() {
List<SisElevatorInfoVo> sisElevatorInfoVos = elevatorInfoService.queryAll();
if (CollUtil.isNotEmpty(sisElevatorInfoVos)) {
sisElevatorInfoVos.forEach(item -> {
// 执行设备登录操作
HikApiService.getInstance().login(item.getControlIp(), item.getControlPort().shortValue(), item.getControlAccount(), item.getControlPwd());
AtomicReference<List<RemoteFloorVo>> floorInfoRef = new AtomicReference<>();
// 模拟上下文
SaTokenContextMockUtil.setMockContext(() -> {
// 模拟登录
StpUtil.login(-8);
floorInfoRef.set(remoteFloorService.queryByBuildingId(item.getBuildingId()));
});
// 根据单元ID获取楼层信息
List<RemoteFloorVo> floorInfo = floorInfoRef.get();
// 下发权限
for (int i = 0; i < floorInfo.size(); i++) {
// 初始权限默认禁用状态
HikApiService.getInstance().controlGateway(item.getControlIp(), (i + 1), 3);
}
});
}
}
@Async
public void hikNetCameraLogin() {
List<SisDeviceManage> deviceList = deviceManageService.queryHikDevices();
if (CollUtil.isEmpty(deviceList)) {
log.info("没有查询到摄像设备信息,不执行登录");
return;
}
deviceList.forEach(item -> {
boolean isLogin = HikApiService.getInstance().login(item.getDeviceIp(), item.getDevicePort().shortValue(), item.getDeviceAccount(), item.getDevicePwd());
log.info("设备[{}]执行登录完成result={}", item.getDeviceIp(), isLogin);
if (isLogin) {
HikApiService.getInstance().setAlarmChan(item.getDeviceIp());
}
});
}
}
//package org.dromara.sis.runner;
//
//import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
//import cn.dev33.satoken.stp.StpUtil;
//import cn.hutool.core.collection.CollUtil;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.DubboReference;
//import org.dromara.common.core.utils.SpringUtils;
//import org.dromara.property.api.RemoteFloorService;
//import org.dromara.property.api.domain.vo.RemoteFloorVo;
//import org.dromara.sis.domain.SisDeviceManage;
//import org.dromara.sis.domain.vo.SisElevatorInfoVo;
//import org.dromara.sis.sdk.hik.HikApiService;
//import org.dromara.sis.sdk.hik.calback.HikAlarmCallBack;
//import org.dromara.sis.service.ISisDeviceManageService;
//import org.dromara.sis.service.ISisElevatorInfoService;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.concurrent.atomic.AtomicReference;
//
//@Slf4j
//@Component
//@RequiredArgsConstructor
//public class HikDeviceApplicationRunner implements ApplicationRunner {
//
// private final HikAlarmCallBack hikAlarmCallBack;
// private final ISisDeviceManageService deviceManageService;
// private final ISisElevatorInfoService elevatorInfoService;
//
// @DubboReference
// private RemoteFloorService remoteFloorService;
//
// @Override
// public void run(ApplicationArguments args) throws Exception {
// // 先布放在登录
// HikApiService.getInstance().setAlarmCallBack(0, hikAlarmCallBack);
// // 现在查询全部后面要更具需要查询指定厂商的设备
// HikDeviceApplicationRunner runner = SpringUtils.getAopProxy(this);
// // 梯控登录
//// runner.hikElevatorInfoLogin();
// // 网络摄像头登录
// runner.hikNetCameraLogin();
// }
//
// @Async
// public void hikElevatorInfoLogin() {
// List<SisElevatorInfoVo> sisElevatorInfoVos = elevatorInfoService.queryAll();
// if (CollUtil.isNotEmpty(sisElevatorInfoVos)) {
// sisElevatorInfoVos.forEach(item -> {
// // 执行设备登录操作
// HikApiService.getInstance().login(item.getControlIp(), item.getControlPort().shortValue(), item.getControlAccount(), item.getControlPwd());
//
// AtomicReference<List<RemoteFloorVo>> floorInfoRef = new AtomicReference<>();
// // 模拟上下文
// SaTokenContextMockUtil.setMockContext(() -> {
// // 模拟登录
// StpUtil.login(-8);
// floorInfoRef.set(remoteFloorService.queryByBuildingId(item.getBuildingId()));
// });
//
// // 根据单元ID获取楼层信息
// List<RemoteFloorVo> floorInfo = floorInfoRef.get();
//
// // 下发权限
// for (int i = 0; i < floorInfo.size(); i++) {
// // 初始权限默认禁用状态
// HikApiService.getInstance().controlGateway(item.getControlIp(), (i + 1), 3);
// }
// });
// }
// }
//
// @Async
// public void hikNetCameraLogin() {
// List<SisDeviceManage> deviceList = deviceManageService.queryHikDevices();
// if (CollUtil.isEmpty(deviceList)) {
// log.info("没有查询到摄像设备信息,不执行登录");
// return;
// }
// deviceList.forEach(item -> {
// boolean isLogin = HikApiService.getInstance().login(item.getDeviceIp(), item.getDevicePort().shortValue(), item.getDeviceAccount(), item.getDevicePwd());
// log.info("设备[{}]执行登录完成result={}", item.getDeviceIp(), isLogin);
// if (isLogin) {
// HikApiService.getInstance().setAlarmChan(item.getDeviceIp());
// }
// });
// }
//}