| | |
| | | * 模糊查询 |
| | | */ |
| | | public List<MonitorBo> listMonitorByKeyword(BaseConditionVO baseConditionVO, MonitorParam monitorParam) { |
| | | List<String> list; |
| | | list = monitorMapper.listMonitorDeviceSerial(); |
| | | |
| | | MonitorParam monitorParam1; |
| | | for (String devices_serial : list) { |
| | | monitorParam1 = new MonitorParam(); |
| | | monitorParam1.setAccessToken(getAccessToken()); |
| | | monitorParam1.setDeviceSerial(devices_serial); |
| | | getYSYMonitorInfoAndaddMonitorToTable(monitorParam1); |
| | | } |
| | | |
| | | |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (baseConditionVO != null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | } |
| | | List<MonitorBo> monitorList; |
| | | //绑定状态:已绑定/未绑定/全部 |
| | | if (monitorParam.getBindingState() == null) { |
| | |
| | | monitorParam.setEquipmentState(2); |
| | | } |
| | | |
| | | monitorList = monitorMapper.listMonitorByIds(monitorParam.getKeyword(), clientId, monitorParam.getBindingState(), monitorParam.getEquipmentState()); |
| | | monitorList = monitorMapper.listMonitorByIds(list, monitorParam.getKeyword(), monitorParam.getBindingState(), monitorParam.getEquipmentState(), clientId); |
| | | |
| | | return monitorList; |
| | | } |
| | | |
| | | public Monitor getYSYMonitorInfoAndaddMonitorToTable(MonitorParam monitorParam) { |
| | | YSY_MonitorDto getMonitorDto = getYSYMonitorInfo(getAccessToken(), monitorParam.getDeviceSerial()); |
| | | |
| | | if ("200".equals(getMonitorDto.getCode())) { |
| | | Monitor monitor = new Monitor(); |
| | | monitor.setDeviceSerial(getMonitorDto.getData().getDeviceSerial()); |
| | | if (monitorParam.getValidateCode() != null) { |
| | | monitor.setDevicesCode(monitorParam.getValidateCode()); |
| | | } |
| | | monitor.setDeviceName(getMonitorDto.getData().getDeviceName()); |
| | | monitor.setDeviceType(getMonitorDto.getData().getModel()); |
| | | monitor.setEquipmentState(getMonitorDto.getData().getStatus()); |
| | | monitor.setIsEncrypt(getMonitorDto.getData().getIsEncrypt()); |
| | | monitor.setAddTime(getMonitorDto.getData().getUpdateTime()); |
| | | monitor.setNetAddress(getMonitorDto.getData().getNetAddress()); |
| | | |
| | | return monitor; |
| | | } else { |
| | | throw new BusinessException(getMonitorDto.getMsg()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return accessTokenDto.getData().getAccessToken(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取萤石云摄像头信息 无需验证accessToken |
| | | * |
| | | * @return |
| | | */ |
| | | public YSY_MonitorDto.MonitorDto getMonitorInfo(String deviceSerial) { |
| | | String token = getAccessToken(); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("accessToken", token); |
| | | paramMap.put("deviceSerial", deviceSerial); |
| | | String s = HttpUtil.post(YSY_URL + GET_DEVICE_URL, paramMap); |
| | | YSY_MonitorDto monitorDto = JSON.parseObject(s, YSY_MonitorDto.class); |
| | | return monitorDto.getData(); |
| | | } |
| | | |
| | | /** |
| | | * 添加萤石云摄像头 |
| | | * |
| | |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("accessToken", accessToken); |
| | | paramMap.put("deviceSerial", deviceSerial); |
| | | if(validateCode != null ){ |
| | | if (validateCode != null && validateCode.trim().length() != 0) { |
| | | paramMap.put("validateCode", validateCode); |
| | | } |
| | | String s = HttpUtil.post(YSY_URL + ADD_DEVICE_URL, paramMap); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改note |
| | | * |
| | | * @param deviceSerial |
| | | * @param notes |
| | | * @return |
| | | */ |
| | | public boolean updateNotes(String deviceSerial, String notes) { |
| | | if (deviceSerial == null || deviceSerial.trim().length() == 0 || notes == null) { |
| | | throw new BusinessException("修改备注参数有误!"); |
| | | } |
| | | Monitor one = getOne(Wrappers.lambdaQuery(Monitor.class).eq(Monitor::getDeviceSerial, deviceSerial)); |
| | | if (one != null) { |
| | | one.setNote(notes); |
| | | return updateById(one); |
| | | } else { |
| | | throw new BusinessException("摄像头设备不存在!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |