| | |
| | | import org.springframework.amqp.rabbit.connection.Connection; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | String mac = msgData.get("mac"); |
| | | String ver = msgData.get("ver"); |
| | | |
| | | if(StringUtils.isEmpty(ver) || StringUtils.isEmpty(mac)) { |
| | | return; |
| | | } |
| | | |
| | | Map<String, Float> adjustMap; |
| | | if(RedisUtil.hasKey(redisTemplate, mac)) { |
| | | adjustMap = JSON.parseObject(RedisUtil.get(redisTemplate, mac), new TypeReference<Map<String, Float>>() {}); |
| | |
| | | // System.out.println(message); |
| | | // System.out.println(JSON.toJSONString(msgData)); |
| | | |
| | | // rabbitTemplate.convertAndSend("monitors_data", "", JSON.toJSONString(msgData).getBytes()); |
| | | rabbitTemplate.convertAndSend("monitors_data2", "", JSON.toJSONString(msgData).getBytes()); |
| | | // rabbitTemplate.send("monitors_data_3", "", new Message(JSON.toJSONString(msgData).getBytes(), new MessageProperties())); |
| | | |
| | | int state = (new Random()).nextInt(4) % 5; //TODO |