| | |
| | | import com.moral.api.service.HistoryHourlyService; |
| | | import com.moral.api.service.SensorService; |
| | | import com.moral.api.service.UnitConversionService; |
| | | import com.moral.api.utils.StringUtils; |
| | | import com.moral.api.vo.OnlineRateVo; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | |
| | | |
| | | @Autowired |
| | | SensorService sensorService; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | @Autowired |
| | | UnitConversionService unitConversionService; |
| | |
| | | ); |
| | | |
| | | //设备mac |
| | | List<String> macs = (List<String>) params.remove("macs"); |
| | | List<String> macList = (List<String>) params.remove("macs"); |
| | | List<Map<String, Object>> elementLists = new ArrayList<>(); |
| | | |
| | | List<String> idList = macList.stream().filter(it->it.contains(",avg")).collect(Collectors.toList()); |
| | | List<String> idListExcluding = macList.stream().filter(it->!it.contains(",avg")).collect(Collectors.toList()); |
| | | List<String> macs = new ArrayList<>(); |
| | | for(String s : idList){ |
| | | String mm = s.substring(0, s.indexOf(",avg")); |
| | | List<String> macResultList = deviceService.getMacMonitorPointId(Integer.parseInt(mm)); |
| | | macs.addAll(macResultList); |
| | | } |
| | | macs.addAll(idListExcluding); |
| | | macs = macs.stream().distinct().collect(Collectors.toList()); |
| | | for (String mac : macs) { |
| | | //从redis中获取设备因子信息 |
| | | Device device = (Device) redisTemplate.opsForHash().get(RedisConstants.DEVICE_INFO, mac); |
| | |
| | | QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("mac") |
| | | .eq("organization_id", organizationId) |
| | | .eq("is_delete", Constants.NOT_DELETE); |
| | | return deviceMapper.selectObjs(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List getMacMonitorPointId(Integer monitorPointId) { |
| | | QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("mac") |
| | | .eq("monitor_point_id", monitorPointId) |
| | | .eq("is_delete", Constants.NOT_DELETE); |
| | | return deviceMapper.selectObjs(queryWrapper); |
| | | } |
| | |
| | | } |
| | | return OrfList; |
| | | } |
| | | private boolean subStr(String mac){ |
| | | if(StringUtils.isNotEmpty(mac)&&mac.contains(",avg")){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |