|  |  |  | 
|---|
|  |  |  | for (Map<String, Object> map : macAndOrganizationIdMap) { | 
|---|
|  |  |  | kv.put(map.get("mac").toString(), map.get("organizationId")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | for (int i = 0; i <= 358; i++) { | 
|---|
|  |  |  | LocalDateTime startTime = value.plusMinutes(i); | 
|---|
|  |  |  | LocalDateTime endTime = value.plusMinutes(i + 1); | 
|---|
|  |  |  | 
|---|
|  |  |  | devices.put("macs", macList); | 
|---|
|  |  |  | devices.put("yearAndMonth", yearAndMonth); | 
|---|
|  |  |  | List<Map<String, Object>> realtimeData = historyMinutelyService.getMinutelySensorData(devices); | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeMinutelyData:" + realtimeData.size()); | 
|---|
|  |  |  | count += realtimeData.size(); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(realtimeData)) { | 
|---|
|  |  |  | for (Map<String, Object> deviceData : realtimeData) { | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(deviceData)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | intersection.stream().forEach(parentId -> rabbitTemplate.convertAndSend(organization_data.getName(), parentId + "." + mac, JSON.toJSONString(deviceData))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ分钟实时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeMinutelyData:" + count); | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ分钟实时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeMinutelyException:" + e.getMessage()); | 
|---|
|  |  |  | logger.error(e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Map<String, Object> map : macAndOrganizationIdMap) { | 
|---|
|  |  |  | kv.put(map.get("mac").toString(), map.get("organizationId")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | for (int i = 0; i <= 350; i = i + 5) { | 
|---|
|  |  |  | LocalDateTime startTime = value.plusMinutes(i); | 
|---|
|  |  |  | LocalDateTime endTime = value.plusMinutes(i + 5); | 
|---|
|  |  |  | 
|---|
|  |  |  | devices.put("macs", macList); | 
|---|
|  |  |  | devices.put("yearAndMonth", yearAndMonth); | 
|---|
|  |  |  | List<Map<String, Object>> realtimeData = historyMinutelyService.getMinutelySensorData(devices); | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeEveryFiveMinutesData:" + realtimeData.size()); | 
|---|
|  |  |  | count += realtimeData.size(); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(realtimeData)) { | 
|---|
|  |  |  | for (Map<String, Object> deviceData : realtimeData) { | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(deviceData)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | intersection.stream().forEach(parentId -> rabbitTemplate.convertAndSend(organization_data.getName(), parentId + "." + mac, JSON.toJSONString(deviceData))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ每5分钟实时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeEveryFiveMinutesData:" + count); | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ每5分钟实时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQRealtimeEveryFiveMinutesException:" + e.getMessage()); | 
|---|
|  |  |  | logger.error(e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Map<String, Object> map : macAndOrganizationIdMap) { | 
|---|
|  |  |  | kv.put(map.get("mac").toString(), map.get("organizationId")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | for (int i = 0; i <= 340; i = i + 10) { | 
|---|
|  |  |  | LocalDateTime startTime = value.plusMinutes(i); | 
|---|
|  |  |  | LocalDateTime endTime = value.plusMinutes(i + 1); | 
|---|
|  |  |  | 
|---|
|  |  |  | devices.put("macs", macList); | 
|---|
|  |  |  | devices.put("yearAndMonth", yearAndMonth); | 
|---|
|  |  |  | List<Map<String, Object>> minutelyDataList = historyMinutelyService.getMinutelySensorData(devices); | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQMinutelyData:" + minutelyDataList.size()); | 
|---|
|  |  |  | count += minutelyDataList.size(); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(minutelyDataList)) { | 
|---|
|  |  |  | for (Map<String, Object> deviceData : minutelyDataList) { | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(deviceData)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | intersection.stream().forEach(parentId -> rabbitTemplate.convertAndSend(organization_data.getName(), parentId + "." + mac, JSON.toJSONString(minutelyData))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ分钟数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQMinutelyData:" + count); | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ分钟数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQMinutelyException:" + e.getMessage()); | 
|---|
|  |  |  | logger.error(e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Map<String, Object> map : macAndOrganizationIdMap) { | 
|---|
|  |  |  | kv.put(map.get("mac").toString(), map.get("organizationId")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | for (int i = 0; i <= 6; i++) { | 
|---|
|  |  |  | LocalDateTime startTime = value.plusHours(i); | 
|---|
|  |  |  | LocalDateTime endTime = value.plusHours(i + 1); | 
|---|
|  |  |  | 
|---|
|  |  |  | devices.put("end", endTime); | 
|---|
|  |  |  | devices.put("macs", macList); | 
|---|
|  |  |  | List<Map<String, Object>> hourlyDataList = historyHourlyService.getHourlySensorData(devices); | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQHourlyData:" + hourlyDataList.size()); | 
|---|
|  |  |  | count += hourlyDataList.size(); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(hourlyDataList)) { | 
|---|
|  |  |  | for (Map<String, Object> deviceData : hourlyDataList) { | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(deviceData)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | intersection.stream().forEach(parentId -> rabbitTemplate.convertAndSend(organization_data.getName(), parentId + "." + mac, JSON.toJSONString(hourlyData))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ小时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQHourlyData:" + count); | 
|---|
|  |  |  | ReturnT returnT = new ReturnT(200, "RabbitMQ小时数据存入成功"); | 
|---|
|  |  |  | return returnT; | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | XxlJobLogger.log("RabbitMQHourlyException:" + e.getMessage()); | 
|---|
|  |  |  | logger.error(e.getMessage()); | 
|---|