|
|
|
|
@ -2,6 +2,7 @@ package com.zhehekeji.web.service;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.zhehekeji.core.util.Assert;
|
|
|
|
|
@ -41,7 +42,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class CameraService {
|
|
|
|
|
public class CameraService extends ServiceImpl<CameraMapper,Camera> {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CameraMapper cameraMapper;
|
|
|
|
|
@ -103,7 +104,12 @@ public class CameraService {
|
|
|
|
|
}
|
|
|
|
|
camera.setPort(configProperties.getCameraConfig().getCameraPort());
|
|
|
|
|
camera.setUser(configProperties.getCameraConfig().getCameraUser());
|
|
|
|
|
camera.setRtsp("rtsp://"+configProperties.getCameraConfig().getCameraUser()+":"+configProperties.getCameraConfig().getCameraPassword()+"@"+camera.getIp()+":554/h264/ch1/sub/av_stream");
|
|
|
|
|
//老URL,小于64路的NVR或混合录像机的IP通道从33开始;大于等于64路的NVR的IP通道从1开始
|
|
|
|
|
int channel =1;
|
|
|
|
|
if(camera.getRecorderIp() !=null) {
|
|
|
|
|
channel = Integer.parseInt(camera.getChannel().substring(1)) + 32;
|
|
|
|
|
}
|
|
|
|
|
camera.setRtsp("rtsp://"+configProperties.getCameraConfig().getCameraUser()+":"+configProperties.getCameraConfig().getCameraPassword()+"@"+camera.getRecorderIp()+":554/h264/ch"+channel+"/sub/av_stream");
|
|
|
|
|
try {
|
|
|
|
|
cameraMapper.updateById(camera);
|
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
|
@ -358,11 +364,14 @@ public class CameraService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void cameraLogin(Camera camera){
|
|
|
|
|
public boolean cameraLogin(Camera camera){
|
|
|
|
|
NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword());
|
|
|
|
|
if(lLong != null){
|
|
|
|
|
log.info("camera login success,cameraId:{},ip:{}",camera.getId(),camera.getIp());
|
|
|
|
|
CameraConnMap.conn(camera.getId(),lLong);
|
|
|
|
|
return true;
|
|
|
|
|
}else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|