| | |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.MonitorParam; |
| | | import com.sandu.ximon.dao.domain.Monitor; |
| | | import com.sandu.ximon.dao.domain.YSY_AccessTokenDto; |
| | | import com.sandu.ximon.dao.domain.YSY_MonitorDto; |
| | | import com.sandu.ximon.admin.dto.YSY_AccessTokenDto; |
| | | import com.sandu.ximon.admin.dto.YSY_MonitorDto; |
| | | import com.sandu.ximon.dao.mapper.MonitorMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private static final String DELETE_DEVICE_URL = "/device/delete"; |
| | | //获取萤石云单个设备信息 |
| | | private static final String GET_DEVICE_URL = "/device/info"; |
| | | //获取萤石云摄像头播放地址URL |
| | | private static final String GET_VEDIO_URL = "/v2/live/address/get"; |
| | | |
| | | |
| | | private final PoleBindingService poleBindingService; |
| | | |
| | | /** |
| | | * 查询全部摄像头 |
| | |
| | | bindingState1 = monitorParam.getBindingState(); |
| | | bindingState2 = monitorParam.getBindingState(); |
| | | } |
| | | return monitorMapper.listMonitorByKeyword(monitorParam.getKeyword(), equipmentState1, equipmentState2, bindingState1, bindingState2); |
| | | // return monitorMapper.listMonitorByKeyword(monitorParam.getKeyword(), equipmentState1, equipmentState2, bindingState1, bindingState2); |
| | | return monitorMapper.listMonitorByKeyword1(monitorParam.getKeyword(), bindingState1, bindingState2); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (monitor == null) { |
| | | throw new BusinessException("找不到摄像头"); |
| | | } |
| | | |
| | | //删除摄像头设备前需要先解绑 |
| | | poleBindingService.unBindPole(monitor.getDeviceSerial()); |
| | | return removeById(Id); |
| | | } |
| | | |
| | |
| | | if (one == null) { |
| | | return save(monitor); |
| | | } else { |
| | | monitor.setId(one.getId()); |
| | | return updateById(monitor); |
| | | } |
| | | } |
| | |
| | | return updateById(monitor); |
| | | } |
| | | |
| | | /** |
| | | * 返回摄像头实时画面播放地址 |
| | | * |
| | | * @param accessToken |
| | | * @param deviceSerial |
| | | * @return |
| | | */ |
| | | public String getMonitorVideoUrl(String accessToken, String deviceSerial, int protocol) { |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("accessToken", accessToken); |
| | | paramMap.put("deviceSerial", deviceSerial); |
| | | paramMap.put("protocol", protocol); |
| | | String s = HttpUtil.post(YSY_URL + GET_VEDIO_URL, paramMap); |
| | | System.out.println(s); |
| | | YSY_MonitorDto monitor = JSON.parseObject(s, YSY_MonitorDto.class); |
| | | if ("200".equals(monitor.getCode())) { |
| | | return monitor.getData().getUrl(); |
| | | } else { |
| | | throw new BusinessException(monitor.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |