| | |
| | | import org.springblade.jfpt.animalheat.service.AnimalHeatService; |
| | | import org.springblade.jfpt.catalog.service.catalogService; |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.message.entity.Message; |
| | | import org.springblade.jfpt.message.service.IMessageService; |
| | | import org.springblade.jfpt.operation.service.IOperationService; |
| | | import org.springblade.jfpt.operation.vo.OperationVO; |
| | | import org.springblade.jfpt.webscoket.service.IPushMsgService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private org.springblade.jfpt.Netty.service.nettyService nettyService; |
| | | @Autowired |
| | | private IMessageService messageService; |
| | | |
| | | @Autowired |
| | | private IEquipmentService equipmentService; |
| | |
| | | |
| | | @Autowired |
| | | private IAlarmService alarmService; |
| | | |
| | | @Autowired |
| | | private IPushMsgService pushMsgService; |
| | | |
| | | @Autowired |
| | | private IOperationService operationService; |
| | |
| | | @Override |
| | | public void channelRead(ChannelHandlerContext channelHandlerContext, Object info) throws Exception { |
| | | long startTime1 = System.currentTimeMillis(); |
| | | Date day = new Date(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | System.out.println("接收到了:" + info); |
| | | ByteBuf buf = (ByteBuf) info; |
| | | byte[] req = new byte[buf.readableBytes()]; |
| | |
| | | } |
| | | } else { |
| | | String ChannelName = content.substring(10, 22);//设备编码 |
| | | //报文内容保存 |
| | | Message message = new Message(); |
| | | message.setEnumber(ChannelName); |
| | | message.setContent(body); |
| | | message.setTime(df.format(day)); |
| | | serverHandler.messageService.save(message); |
| | | String sub = content.substring(23, 27); |
| | | ConcurrentHashMap<String, Channel> channelHashMap = ChannelMap.getChannelHashMap(); |
| | | if (channelHashMap == null) { |
| | |
| | | Alarm alarm = new Alarm(); |
| | | alarm.setAlarmType("一键报警"); |
| | | alarm.setGalarmPeople("报警主机"); |
| | | Date day = new Date(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | alarm.setAlarmTime(df.format(day)); |
| | | alarm.setPlace((String) list.get(0).get("streeName"));//事发地址 |
| | | alarm.setDeviceNumber((String) list.get(0).get("deviceNumber"));//设备编号 |
| | |
| | | operation.setZc("接警"); |
| | | operation.setZctime(alarm.getJjTime()); |
| | | serverHandler.operationService.save(operation); |
| | | |
| | | //通过websocket给前端接警员发送信息 |
| | | serverHandler.pushMsgService.pushMsg(alarm.getAlarmId(), alarm.getId().toString()); |
| | | } |
| | | |
| | | outData.add("LEOK#@"); |