| | |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerListResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.admin.vo.NovaPushResultVO; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedPlayerInfoEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | |
| | | * @param screenStatus |
| | | * @return |
| | | */ |
| | | public VnnoxResult screenStatusChange(List<LedPlayerEntity> playerList, Integer screenStatus) { |
| | | public Map<String, Object> screenStatusChange(List<LedPlayerEntity> playerList, Integer screenStatus) { |
| | | playerList.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | }); |
| | | VnnoxScreenStatusType type; |
| | | if (screenStatus.equals(0)) { |
| | | type = VnnoxScreenStatusType.CLOSE; |
| | |
| | | } |
| | | |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenStatus(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), type); |
| | | |
| | | |
| | | List<String> success = vnnoxResult.getSuccess(); |
| | | List<String> fail = vnnoxResult.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | playerList.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | successList.add(vo); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | faileList.add(vo); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | |
| | | // 根据屏幕状态调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + playerId, screenStatus, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | return result; |
| | | } |
| | | |
| | | public VnnoxResult volChange(List<LedPlayerEntity> playerList, Integer vol) { |
| | | public Map<String, Object> volChange(List<LedPlayerEntity> playerList, Integer vol) { |
| | | playerList.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | }); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), vol); |
| | | // 根据音量调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_VOL + playerId, vol, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | List<String> success = vnnoxResult.getSuccess(); |
| | | List<String> fail = vnnoxResult.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | playerList.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | successList.add(vo); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | faileList.add(vo); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | return result; |
| | | } |
| | | |
| | | public VnnoxResult brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) { |
| | | public Map<String, Object> brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) { |
| | | playerList.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | }); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.brightnessChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), brightness); |
| | | // 根据亮度调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_BRIGHTNESS + playerId, brightness, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | List<String> success = vnnoxResult.getSuccess(); |
| | | List<String> fail = vnnoxResult.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | playerList.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | successList.add(vo); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | NovaPushResultVO vo = new NovaPushResultVO(); |
| | | vo.setName(n.getName()); |
| | | vo.setPlayerId(n.getPlayerId()); |
| | | faileList.add(vo); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | return result; |
| | | |
| | | } |
| | | |
| | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | // 批量截屏 |
| | | public Map<String, String> getScreenShotUrl(List<String> playerIds) { |
| | | Map<String, String> map = new HashMap(); |
| | | |
| | | playerIds.forEach( |
| | | playId->{ |
| | | try { |
| | | redisUtils.delete(VnnoxConstant.REDIS_SCREEN_SHOT + playId); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | ); |
| | | |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenShot(playerIds); |
| | | |
| | | if (null == vnnoxResult) { |
| | | map.put("code", "500"); |
| | | map.put("msg", "设备已下线"); |
| | | return map; |
| | | } |
| | | |
| | | if (vnnoxResult.getSuccess().size() == 0) { |
| | | map.put("code", "500"); |
| | | map.put("msg", "获取缩略图失败!"); |
| | | return map; |
| | | } |
| | | String url = null; |
| | | Integer checkCount = 0; |
| | | while (checkCount < 10) { |
| | | url = redisUtils.get(VnnoxConstant.REDIS_SCREEN_SHOT + playerIds.get(0)); |
| | | if (null != url) { |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(2000); |
| | | checkCount = checkCount + 1; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | map.put("url", url); |
| | | map.put("code", "200"); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | // //重启 |
| | | // public VnnoxResult reboot(List<LedPlayerEntity> playerList) { |
| | | // return vnnoxAPIUtil.reboot( |
| | |
| | | // } |
| | | |
| | | //重启 |
| | | public VnnoxResult reboot(List<String> playerList) { |
| | | return vnnoxAPIUtil.reboot(playerList); |
| | | public Map<String, Object> reboot(List<NovaPushResultVO> nova) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | nova.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | playerIds.add(item.getPlayerId()); |
| | | }); |
| | | |
| | | VnnoxResult reboot = vnnoxAPIUtil.reboot(playerIds); |
| | | |
| | | |
| | | List<String> success = reboot.getSuccess(); |
| | | List<String> fail = reboot.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | nova.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | successList.add(n); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | faileList.add(n); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | public VnnoxResult syncPlay(List<String> playerList, Integer option) { |
| | | return vnnoxAPIUtil.syncPlay(playerList, option); |
| | | public Map<String, Object> syncPlay(List<NovaPushResultVO> nova, Integer option) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | nova.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | playerIds.add(item.getPlayerId()); |
| | | }); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.syncPlay(playerIds, option); |
| | | |
| | | List<String> success = vnnoxResult.getSuccess(); |
| | | List<String> fail = vnnoxResult.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | nova.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | successList.add(n); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | faileList.add(n); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | public VnnoxResult ntpSync(List<String> playerList, boolean enable) { |
| | | return vnnoxAPIUtil.ntpSync(playerList, enable); |
| | | public Map<String, Object> ntpSync(List<NovaPushResultVO> nova, boolean enable) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | nova.forEach(item -> { |
| | | if (item.getName() == null || item.getPlayerId() == null) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) { |
| | | throw new BusinessException("playerId或playerName为空"); |
| | | } |
| | | playerIds.add(item.getPlayerId()); |
| | | }); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.ntpSync(playerIds, enable); |
| | | |
| | | List<String> success = vnnoxResult.getSuccess(); |
| | | List<String> fail = vnnoxResult.getFail(); |
| | | //拼接成功失败的结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<NovaPushResultVO> successList = new ArrayList<>(); |
| | | List<NovaPushResultVO> faileList = new ArrayList<>(); |
| | | List<String> finalSuccess = success; |
| | | List<String> finalFail = fail; |
| | | nova.forEach(n -> { |
| | | if (finalSuccess.contains(n.getPlayerId())) { |
| | | successList.add(n); |
| | | } else if (finalFail.contains(n.getPlayerId())) { |
| | | faileList.add(n); |
| | | } |
| | | }); |
| | | |
| | | result.put("success", successList); |
| | | result.put("fail", faileList); |
| | | return result; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | private List<PlayerWidget> generateWaterAndSensorWidget(A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage poleSensorEntity) { |
| | | |
| | | List widgetList = new ArrayList<>(); |
| | | List<String> list = new ArrayList<>(); |
| | | if (Objects.nonNull(poleSensorEntity)) { |