ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -76,12 +76,15 @@ return ResponseUtil.fail("缺少对应用户权限"); } CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param); List<Pole> listCommonPage = (List<Pole>) commonPage.getList(); List<PoleBindVO> listResult = new ArrayList<>(); for (Pole pole : (List<Pole>) commonPage.getList()) { for (Pole pole : listCommonPage) { PoleBindVO bindByPoleId = poleService.getBindByPoleId(pole.getId()); bindByPoleId.setPole(pole); listResult.add(bindByPoleId); } commonPage.setList(listResult); return ResponseUtil.success(commonPage); } ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -74,6 +74,9 @@ } LedPlayerEntity one = getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn)); if (one == null) { return equipmentInfo; } List<LedPlayerEntity> list = new ArrayList<>(); list.add(one); List<LedPlayerEntity> ledPlayerEntities = vnnoxAPIUtil.syncCurrentInfo(list); @@ -81,11 +84,11 @@ if (one != null) { equipmentInfo.setEquipmentMac(one.getSn()); equipmentInfo.setEquipmentName(one.getName()); if (onlineStatus == 0) { if (onlineStatus == 0) { equipmentInfo.setEquipmentState("在线"); }else { equipmentInfo.setEquipmentName("离线"); } } else { equipmentInfo.setEquipmentName("离线"); } } return equipmentInfo; ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -276,6 +276,7 @@ } List<Pole> PoleResult = isOnLine(poleList, param); setCount(PoleResult); CommonPage commonPage = ListPagingUtils.pages(PoleResult, pageNo, pageSize); ximon-admin/src/main/java/com/sandu/ximon/admin/service/WaterQualityEquipmentService.java
@@ -109,8 +109,11 @@ try { String s = HttpUtil.get(WATER_QUALITY_DATA_URL + waterQualityEquipmentCode + ".json"); System.out.println(s); System.out.println(waterQualityEquipmentCode+"-------------------------------"+s); if(!s.startsWith("{")){ equipmentInfo.setEquipmentState("未知"); return equipmentInfo; } WaterQualityDataDto waterQualityDataDto = JSON.parseObject(s, WaterQualityDataDto.class); //设置水质设备状态 if (waterQualityDataDto != null) { ximon-admin/src/main/java/com/sandu/ximon/admin/utils/VnnoxAPIUtil.java
@@ -31,39 +31,40 @@ /** * 获取token */ public void getToken () { public void getToken() { String result = VnnoxRequestUtil.PostWithHeader( VnnoxUrl.getUrl(VnnoxUrl.GET_TOKEN), new VnnoxGetTokenRequest().toJson(), new CommonHeader(CommonHeader.FORM, false) ); CommonResponse commonResponse = JSON.parseObject(result,CommonResponse.class); CommonResponse commonResponse = JSON.parseObject(result, CommonResponse.class); VnnoxGetTokenResponse response = new VnnoxGetTokenResponse().parse(commonResponse); // 将token保存到redis缓存中 redisUtils.set(VnnoxConstant.REDIS_TOKEN_NAME,response.getToken(),(long)(response.getExpire()-30)); redisUtils.set(VnnoxConstant.REDIS_TOKEN_NAME, response.getToken(), (long) (response.getExpire() - 30)); } /** * 获取播放器列表 * * @param count 每次读取数量,默认20,取值范围:1~100 * @param start 从第几条记录开始读取,默认0 * @return */ public VnnoxPlayerListResponse getPlayerList(Integer count, Integer start,String name) throws URISyntaxException { public VnnoxPlayerListResponse getPlayerList(Integer count, Integer start, String name) throws URISyntaxException { List<NameValuePair> urlParameters = new ArrayList<>(); urlParameters.add(new BasicNameValuePair("count",count.toString())); urlParameters.add(new BasicNameValuePair("start",start.toString())); urlParameters.add(new BasicNameValuePair("name",name)); urlParameters.add(new BasicNameValuePair("count", count.toString())); urlParameters.add(new BasicNameValuePair("start", start.toString())); urlParameters.add(new BasicNameValuePair("name", name)); String result = VnnoxRequestUtil.GetWithHeader( VnnoxUrl.getUrl(VnnoxUrl.GET_PLAYER_LIST), urlParameters, new CommonHeader(CommonHeader.JSON, true) ); return new VnnoxPlayerListResponse().parse(JSON.parseObject(result,CommonResponse.class)); return new VnnoxPlayerListResponse().parse(JSON.parseObject(result, CommonResponse.class)); } /** @@ -74,6 +75,9 @@ */ public List<LedPlayerEntity> syncCurrentInfo(List<LedPlayerEntity> list) { List<String> playerIds = new ArrayList<>(); if (list.isEmpty()) { return list; } for (LedPlayerEntity playerEntity : list) { playerIds.add(playerEntity.getPlayerId()); @@ -224,7 +228,6 @@ /** * 同步播放 * */ public VnnoxResult syncPlay(List<String> playerId, Integer option) { VnnoxBaseRequest request = new VnnoxBaseRequest();