From fa525b45b0a3f4e524462dceb409c30909c5be72 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 30 Oct 2017 13:51:49 +0800
Subject: [PATCH] 增加 参数空值校验

---
 src/main/java/com/moral/monitor/listener/TaskListener.java |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/moral/monitor/listener/TaskListener.java b/src/main/java/com/moral/monitor/listener/TaskListener.java
index 1460079..69c101c 100644
--- a/src/main/java/com/moral/monitor/listener/TaskListener.java
+++ b/src/main/java/com/moral/monitor/listener/TaskListener.java
@@ -16,6 +16,7 @@
 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;
@@ -53,6 +54,10 @@
         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>>() {});

--
Gitblit v1.8.0