修改bug

main
刘政 3 weeks ago
parent 727202d135
commit 35d6b29dda

@ -228,7 +228,7 @@ public class IpChannelServiceImpl extends ServiceImpl<CameraMapper, Camera> impl
}
// 开启和关闭云台守望
// 开启和关闭云台守望 0表示关闭1表示开启
@Override
@Transactional
public boolean ControlSentinel(Long id, int openOrNo, int watchTime, Integer presetIndex) {
@ -237,15 +237,19 @@ public class IpChannelServiceImpl extends ServiceImpl<CameraMapper, Camera> impl
{
flag = manageNVR.watchful(id.intValue(), openOrNo, watchTime, -1);
}else {
if(presetIndex==null)
{
throw new BusinessException(AdminResponseEnum.OPERATION_FAIL, null, "预置点不能为空");
}
flag = manageNVR.watchful(id.intValue(), openOrNo, watchTime, presetIndex);
}
if (flag) {
// 获取当前预置点的ptz坐标并且保存
PTZVO ptzLocation = manageNVR.getPTZLocation(id);
ptzLocation.setCameraId(id);
// PTZVO ptzLocation = manageNVR.getPTZLocation(id);
// ptzLocation.setCameraId(id);
// 将ptz保存到redis中
stringRedisTemplate.opsForValue().set("camera:sentinel", JSON.toJSONString(ptzLocation));
log.info("ptz 坐标:{}", ptzLocation);
// stringRedisTemplate.opsForValue().set("camera:sentinel", JSON.toJSONString(ptzLocation));
// log.info("ptz 坐标:{}", ptzLocation);
Camera camera = this.getById(id);
// 保存守望信息
camera.setWatchfulTime(watchTime);

@ -1,6 +1,7 @@
package com.sz.admin.monitor.service.impl;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.sz.admin.monitor.mapper.CameraMapper;
import com.sz.admin.monitor.mapper.PresetMapper;
@ -84,13 +85,12 @@ public class PresetServiceImpl extends ServiceImpl<PresetMapper, Preset> impleme
throw new BusinessException(AdminResponseEnum.CHANNEL_PRESET_FAIL, null, "当前预置位被设置为守望位,请先关闭或者修改守望位");
}
if (watchful.getWatchfulState() == 0 && isCurrentWatchful) {
Camera updateEntity = new Camera();
updateEntity.setWatchfulIndex(null);
QueryWrapper updateWrapper = QueryWrapper.create()
.from(CameraTableDef.CAMERA)
// update Camera set watchfulIndex = null where id = 132 and watchfulIndex = 1
UpdateChain.of(Camera.class)
.set(CameraTableDef.CAMERA.WATCHFUL_INDEX, null)
.where(CameraTableDef.CAMERA.ID.eq(dto.getCameraId()))
.and(CameraTableDef.CAMERA.WATCHFUL_INDEX.eq(dto.getCurrentPresetIndex()));
int updateCount = cameraMapper.updateByQuery(updateEntity, updateWrapper);
.and(CameraTableDef.CAMERA.WATCHFUL_INDEX.eq(dto.getCurrentPresetIndex()))
.update();
}
}
// 3. 删除预置位表中的数据

Loading…
Cancel
Save