| | |
| | | initReginCameralList(allList,req );//获取全部监控点数据 |
| | | }else if(Constants.equalsInteger(req.getWithCameras(),Constants.TWO)){ |
| | | initReginCameralList(allList,req );//获取全部监控点数据 |
| | | initReginFireDeviveList(allList, req);//获取全部监控点数据 |
| | | initReginSensorList(allList,req);//获取全部监控点数据 |
| | | initReginFireDeviveList(allList);//获取全部监控点数据 |
| | | initReginSensorList(allList);//获取全部监控点数据 |
| | | } |
| | | List<PageRegionInfoResponse> data = new RegionTreeVO(allList).buildTree(); |
| | | //加入缓存 |
| | |
| | | return allList; |
| | | } |
| | | |
| | | private void initReginFireDeviveList(List<PageRegionInfoResponse> allList,CarmeraListVO req) { |
| | | String name =req.getName(); |
| | | private void initReginFireDeviveList(List<PageRegionInfoResponse> allList ) { |
| | | List<CarmeraListVO> carmeraListVOList = fireDeviceList(); |
| | | if(carmeraListVOList!=null && carmeraListVOList.size()>0){ |
| | | for(PageRegionInfoResponse p : allList){ |
| | |
| | | } |
| | | } |
| | | } |
| | | private void initReginSensorList(List<PageRegionInfoResponse> allList,CarmeraListVO req) { |
| | | String name =req.getName(); |
| | | private void initReginSensorList(List<PageRegionInfoResponse> allList) { |
| | | List<CarmeraListVO> carmeraListVOList = sensorList(); |
| | | if(carmeraListVOList!=null && carmeraListVOList.size()>0){ |
| | | for(PageRegionInfoResponse p : allList){ |
| | |
| | | } |
| | | } |
| | | } |
| | | @PostConstruct |
| | | // @PostConstruct |
| | | public void cacheRegionAndDeviceData(){ |
| | | log.error("===============缓存海康平台区域设备信息======开始============"); |
| | | try { |
| | | CarmeraListVO param =new CarmeraListVO(); |
| | | param.setWithCameras(2); |
| | | param.setRefresh(1); |
| | | List<PageRegionInfoResponse> resultTree = getRegionTree(param); |
| | | List<PageRegionInfoResponse> result = getAllRegionList(); |
| | | List<CarmeraListVO> carmeraListVOList = initAllReginCameralList(result); |
| | |
| | | stringRedisTemplate.opsForValue().set(Constants.RedisKeys.HK_SENSOR,sensorList);//所有传感器 |
| | | log.error("===============缓存海康平台区域设备信息======成功============"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.error("===============缓存海康平台区域设备信息失败=================="); |
| | | } |
| | | } |
| | |
| | | for(PageRegionInfoResponse p : allList){ |
| | | for(CarmeraListVO c : carmeraListVOList){ |
| | | if(StringUtils.equals(p.getIndexCode(),c.getReginCode()) |
| | | && (StringUtils.contains(c.getName(),name) ||StringUtils.isBlank(name))){ |
| | | && (StringUtils.isBlank(name) || StringUtils.contains(c.getName(),name))){ |
| | | if(p.getCarmeraList()==null){ |
| | | p.setCarmeraList(new ArrayList<>()); |
| | | } |
| | |
| | | @Override |
| | | public YearDeviceDataVO yearFightingAdminDeviceData(){ |
| | | YearDeviceDataVO data = new YearDeviceDataVO(); |
| | | FireStatisticRequest param = new FireStatisticRequest(); |
| | | param.setIndexCode("api_fire_statistic"); |
| | | BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param); |
| | | if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) { |
| | | data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum())); |
| | | data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum())); |
| | | // FireStatisticRequest param = new FireStatisticRequest(); |
| | | // param.setIndexCode("api_fire_statistic"); |
| | | // BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param); |
| | | // if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) { |
| | | // data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum())); |
| | | // data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum())); |
| | | // } |
| | | // param = new FireStatisticRequest(); |
| | | // param.setIndexCode("api_fire_statistic_month"); |
| | | // BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param); |
| | | // if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE) |
| | | // && response1.getData()!=null ) { |
| | | // data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth())); |
| | | // data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum())); |
| | | // } |
| | | |
| | | data.setProtectNum(Constants.ZERO); |
| | | data.setPlanProtectTotal(Constants.ZERO); |
| | | data.setMonthAddNum(Constants.ZERO); |
| | | data.setMonthTotalNum(Constants.ZERO); |
| | | BaseResponse<SensorStatusStatisticResponse> response = HKService.sensorStatusStatistic(); |
| | | if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) |
| | | && response.getData()!=null ) { |
| | | data.setProtectNum(Constants.formatIntegerNum(response.getData().getSensorMainNum())); |
| | | data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getSensorNum())); |
| | | data.setMonthAddNum(Constants.formatIntegerNum(response.getData().getSensorMainMonthNum())); |
| | | data.setMonthTotalNum(Constants.formatIntegerNum(response.getData().getSensorNum())); |
| | | } |
| | | param = new FireStatisticRequest(); |
| | | param.setIndexCode("api_fire_statistic_month"); |
| | | BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param); |
| | | if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE) |
| | | && response1.getData()!=null ) { |
| | | data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth())); |
| | | data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum())); |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 【消防管控】看板-分类和汇总的各状态设备数量 |
| | |
| | | .selectAs(Platform::getName,PlatformWarnEvent::getPlatformName) |
| | | .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) |
| | | .eq(PlatformWarnEvent::getIsdeleted,Constants.ZERO) |
| | | .apply("to_days(t.create_date) = to_days(now())") |
| | | //.apply(" to_days(t.create_date) = to_days(now()) ") |
| | | .apply(" ( t.create_date > now() - INTERVAL 10 MINUTE ) ") |
| | | .orderByDesc(PlatformWarnEvent::getCreateDate) |
| | | .last(" limit "+limit) |
| | | ); |