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 class SisApplication {
public static void main(String[] args) { public static void main(String[] args) {
// 加载hik sdk // 加载hik sdk
SdkBaseServer.initSdk(); // SdkBaseServer.initSdk();
SpringApplication application = new SpringApplication(SisApplication.class); SpringApplication application = new SpringApplication(SisApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048)); application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args); application.run(args);

View File

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