| | |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | private static NettyServerHandler nettyServerHandler; |
| | | |
| | | /** |
| | | * 客户端连接会触发 |
| | | */ |
| | |
| | | // comPropertyAlarm.setType(ComPropertyAlarm.type.one); |
| | | // nettyServerHandler.comPropertyAlarmDao.insert(comPropertyAlarm); |
| | | if(msg.toString().startsWith("4A18031")){ |
| | | delayAlarm(serial); |
| | | //正式处理 |
| | | // delayAlarm(serial); |
| | | //展会处理 |
| | | ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm(); |
| | | comPropertyAlarm.setCreateTime(DateUtil.date()); |
| | | comPropertyAlarm.setSerialNo(serial); |
| | | comPropertyAlarm.setType(ComPropertyAlarm.type.one); |
| | | nettyServerHandler.comPropertyAlarmDao.insert(comPropertyAlarm); |
| | | } |
| | | |
| | | } |
| | |
| | | nettyServerHandler.stringRedisTemplate=this.stringRedisTemplate; |
| | | nettyServerHandler.rabbitTemplate=this.rabbitTemplate; |
| | | } |
| | | |
| | | //报警事件包延迟处理方法 |
| | | private void delayAlarm(String serial){ |
| | | int duration=0; |
| | |
| | | comPropertyEquipment= JSONObject.parseObject(nettyServerHandler.stringRedisTemplate.boundValueOps(serial).get(),ComPropertyEquipment.class); |
| | | duration = getDuration(Objects.requireNonNull(comPropertyEquipment)); |
| | | nettyServerHandler.stringRedisTemplate.boundValueOps(serial).set(JSONObject.toJSONString(comPropertyEquipment), Duration.ofHours(duration)); |
| | | } |
| | | else { |
| | | } else { |
| | | comPropertyEquipment=nettyServerHandler.comPropertyEquipmentDao.selectOne(new QueryWrapper<ComPropertyEquipment>().eq("serial_no",serial)); |
| | | duration = getDuration(comPropertyEquipment); |
| | | nettyServerHandler.stringRedisTemplate.boundValueOps(serial).set(JSONObject.toJSONString(comPropertyEquipment)); |