| | |
| | | public void videoOnlineTask() { |
| | | //视频图像质量 |
| | | log.info("开始执行点位在线数据同步"); |
| | | VideoOnlineParam param = new VideoOnlineParam(); |
| | | param.setPageNum(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.PageSize); |
| | | param.setArealayerno(ApiConstants.AreaNo); |
| | | param.setStatus(ApiConstants.UY_OnlineStatus_All); |
| | | param.setIcmpStatus(ApiConstants.UY_OnlineStatus_All); |
| | | JSONObject jsonObject = uyClient.videoOnline(param); |
| | | if (jsonObject != null) { |
| | | Integer statusCode = jsonObject.getInteger("statusCode"); |
| | | if (ApiConstants.UYSuccessCode.equals(statusCode)) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | List<VideoOnlineResult> records = data.getList("records", VideoOnlineResult.class); |
| | | if (!CollectionUtils.isEmpty(records)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, VideoOnlineResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(records); |
| | | // 工单生成 |
| | | uyErrorTypeCheckService.videoOnlineCheck(records); |
| | | } else { |
| | | log.error("点位在线结果数据为空{}", data); |
| | | } |
| | | } else { |
| | | log.error("点位在线结果数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("点位在线结果请求失败{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("点位在线结果数据为空"); |
| | | } |
| | | // VideoOnlineParam param = new VideoOnlineParam(); |
| | | // param.setPageNum(ApiConstants.PageNo); |
| | | // param.setPageSize(ApiConstants.PageSize); |
| | | // param.setArealayerno(ApiConstants.AreaNo); |
| | | // param.setStatus(ApiConstants.UY_OnlineStatus_All); |
| | | // param.setIcmpStatus(ApiConstants.UY_OnlineStatus_All); |
| | | // JSONObject jsonObject = uyClient.videoOnline(param); |
| | | // if (jsonObject != null) { |
| | | // Integer statusCode = jsonObject.getInteger("statusCode"); |
| | | // if (ApiConstants.UYSuccessCode.equals(statusCode)) { |
| | | // JSONObject data = jsonObject.getJSONObject("data"); |
| | | // if (data != null) { |
| | | // List<VideoOnlineResult> records = data.getList("records", VideoOnlineResult.class); |
| | | // if (!CollectionUtils.isEmpty(records)) { |
| | | // //如果今天存在之前的数据先删除 |
| | | // Query query = new Query(Criteria |
| | | // .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, VideoOnlineResult.class); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(records); |
| | | // // 工单生成 |
| | | // uyErrorTypeCheckService.videoOnlineCheck(records); |
| | | // } else { |
| | | // log.error("点位在线结果数据为空{}", data); |
| | | // } |
| | | // } else { |
| | | // log.error("点位在线结果数据为空{}", jsonObject); |
| | | // } |
| | | // } else { |
| | | // log.error("点位在线结果请求失败{}", jsonObject); |
| | | // } |
| | | // } else { |
| | | // log.error("点位在线结果数据为空"); |
| | | // } |
| | | Query query = new Query(Criteria.where("mongoCreateTime").lt(DateUtils.getDayEnd(new Date()))); |
| | | uyErrorTypeCheckService.videoOnlineCheck(mongoTemplate.find(query, VideoOnlineResult.class)); |
| | | log.info("结束执行点位在线数据同步"); |