| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.moral.util.AlarmUtils_2; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.amqp.core.TopicExchange; |
| | |
| | | LocalDateTime time = LocalDateTime.now(); |
| | | int year = time.getYear(); |
| | | int month = time.getMonthValue(); |
| | | int day = time.getDayOfMonth(); |
| | | int hour = time.getHour(); |
| | | int minute = time.getMinute(); |
| | | if (day == 1) { |
| | | if (hour == 0 && minute == 0) { |
| | | if (month == 1) { |
| | | month = 12; |
| | | year = year - 1; |
| | | } else { |
| | | month = month - 1; |
| | | } |
| | | } |
| | | } |
| | | String monthStr = month < 10 ? ("0" + month) : month + ""; |
| | | String yearAndMonth = year + monthStr; |
| | | Map organizationIdMap = JSON.parseObject(params); |
| | |
| | | LocalDateTime endTime = time.truncatedTo(ChronoUnit.MINUTES); |
| | | LocalDateTime startTime = endTime.minusMinutes(1); |
| | | List<Object> organizationIdList = organizationRelationService.getChildIdByParentId(parentIdList); |
| | | AlarmUtils_2.sendMail("276999030@qq.com","小时警报","小时警报"); |
| | | try { |
| | | List<String> macList = deviceService.getMacByOrganizationid(organizationIdList); |
| | | List<String> sensorKeys = sensorService.getSensorKeyByMac(macList); |
| | |
| | | LocalDateTime time = LocalDateTime.now(); |
| | | int year = time.getYear(); |
| | | int month = time.getMonthValue(); |
| | | int day = time.getDayOfMonth(); |
| | | int hour = time.getHour(); |
| | | int minute = time.getMinute(); |
| | | if (day == 1) { |
| | | if (hour == 0 && minute == 0) { |
| | | if (month == 1) { |
| | | month = 12; |
| | | year = year - 1; |
| | | } else { |
| | | month = month - 1; |
| | | } |
| | | } |
| | | } |
| | | String monthStr = month < 10 ? ("0" + month) : month + ""; |
| | | String yearAndMonth = year + monthStr; |
| | | Map organizationIdMap = JSON.parseObject(params); |
| | |
| | | LocalDateTime time = LocalDateTime.now(); |
| | | int year = time.getYear(); |
| | | int month = time.getMonthValue(); |
| | | int day = time.getDayOfMonth(); |
| | | int hour = time.getHour(); |
| | | int minute = time.getMinute(); |
| | | if (day == 1) { |
| | | if (hour == 0 && minute == 0) { |
| | | if (month == 1) { |
| | | month = 12; |
| | | year = year - 1; |
| | | } else { |
| | | month = month - 1; |
| | | } |
| | | } |
| | | } |
| | | String monthStr = month < 10 ? ("0" + month) : month + ""; |
| | | String yearAndMonth = year + monthStr; |
| | | Map organizationIdMap = JSON.parseObject(params); |
| | |
| | | devices.put("macs", macList); |
| | | List<Map<String, Object>> hourlyDataList = historyHourlyService.getHourlySensorData(devices); |
| | | XxlJobLogger.log("RabbitMQHourlyData:" + hourlyDataList.size()); |
| | | AlarmUtils_2.sendMail("357328213@qq.com","小时警报","小时警报"); |
| | | if (!CollectionUtils.isEmpty(hourlyDataList)) { |
| | | if(!(hourlyDataList.size()==macList.size())){ |
| | | List<String> macList_copy = macList; |
| | | String mac_Splicing = null; |
| | | if (hourlyDataList.size()<macList.size()){ |
| | | int i = 0; |
| | | for (Map hourData: hourlyDataList) { |
| | | if (!hourData.get("mac").toString().equals(macList_copy.get(i))){ |
| | | mac_Splicing = mac_Splicing+hourData.get("mac")+","; |
| | | i=i-1; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | AlarmUtils_2.sendMail("276999030@qq.com","离线警报",mac_Splicing+"设备或许离线!"); |
| | | } |
| | | for (Map<String, Object> deviceData : hourlyDataList) { |
| | | if (!ObjectUtils.isEmpty(deviceData)) { |
| | | Map<String, Object> hourlyData = new LinkedHashMap<>(); |
| | |
| | | ReturnT returnT = new ReturnT(500, "RabbitMQ天数据存入失败"); |
| | | return returnT; |
| | | } |
| | | |
| | | } |
| | | |
| | | |