通过时间和mac集合查询数据接口,修改蜂窝图小时数据接口
| | |
| | | List<HistoryHourly> getValueByMacs(List<String> macs, String time); |
| | | |
| | | /** |
| | | * @param macs List<String> |
| | | * @param time String 例:2021-12-23 |
| | | * @description: 通过设备和时间获取小时数据 |
| | | */ |
| | | List<HistoryHourly> getHourlyDataByMacs(List<String> macs, String time); |
| | | |
| | | /** |
| | | * @param list 数据 |
| | | * @param sensorCode 因子code |
| | | * @param type 要计算的类型,最大值:max,最小值:min,平均值:sum,平均值:avg, |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HistoryHourly> getHourlyDataByMacs(List<String> macs, String time) { |
| | | QueryWrapper<HistoryHourly> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("mac","time", "value") |
| | | .likeRight("time", time) |
| | | .in("mac", macs); |
| | | Date date = DateUtils.getDate(time, DateUtils.yyyy_MM_dd_EN); |
| | | List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH); |
| | | return multiTableQuery(queryWrapper, tableNames); |
| | | } |
| | | |
| | | @Override |
| | | public Double calculatedValue(List<HistoryHourly> list, String sensorCode, String type, Double lower, Double upper) { |
| | | Supplier<Stream<HistoryHourly>> supplier = list::stream; |
| | | DoubleStream doubleStream = supplier.get() |
| | |
| | | @Autowired |
| | | private HistoryHourlyMapper historyHourlyMapper; |
| | | |
| | | @Autowired |
| | | private HistoryHourlyService historyHourlyService; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getDateByOrgIdAndCondition(Map map) { |
| | | int orgId = Integer.parseInt(map.get("organization_id").toString()); |
| | |
| | | } |
| | | } |
| | | if (type.equals("hourly")){ |
| | | Date houtly_time = DateUtils.getDate(time+":00:00",DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | Date hourly_time = DateUtils.getDate(time+":00:00",DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | QueryWrapper<HistoryHourly> wrapper = new QueryWrapper<>(); |
| | | wrapper.in("mac", deviceMacs); |
| | | wrapper.eq("time", houtly_time); |
| | | List<HistoryHourly> historyHourlies = historyHourlyMapper.selectList(wrapper); |
| | | wrapper.eq("time", hourly_time); |
| | | List<HistoryHourly> historyHourlies = historyHourlyService.getHourlyDataByMacs(deviceMacs,time); |
| | | for (HistoryHourly historyHourly : historyHourlies) { |
| | | historyDataMap.put(historyHourly.getMac(), JSON.parseObject(JSON.toJSONString(historyHourly), Map.class)); |
| | | } |