liupeng преди 5 години
родител
ревизия
c10a19e8d7
променени са 1 файла, в които са добавени 13 реда и са изтрити 4 реда
  1. 13 4
      code/sapparent/sapservice/src/main/java/org/fouram/core/util/JsonNodeUtil.java

+ 13 - 4
code/sapparent/sapservice/src/main/java/org/fouram/core/util/JsonNodeUtil.java

@@ -1,25 +1,34 @@
 package org.fouram.core.util;
 
+import java.util.Date;
+
 import com.fasterxml.jackson.databind.JsonNode;
 
 public class JsonNodeUtil {
-	
+
 	public static String getValue(JsonNode userNode, String key) {
 		String value = userNode.get(key).asText().trim();
-		if(Tools.isEmpty(value)) {
+		if (Tools.isEmpty(value)) {
 			return "";
 		}
+		if (value.contains("/Date(")) {
+			return DateUtil.getDay(new Date(Long.valueOf(value.replace("/Date(", "").replace(")/", ""))));
+		}
 		return value;
 	}
-	
+
 	public static String getValue(JsonNode userNode, String key1, String key2) {
 		String value = null;
 		if (userNode.get(key1) != null && userNode.get(key1).get(key2) != null) {
 			value = userNode.get(key1).get(key2).asText().trim();
 		}
-		if(Tools.isEmpty(value)) {
+		if (Tools.isEmpty(value)) {
 			return "";
 		}
 		return value;
 	}
+
+	public static void main(String[] args) {
+		System.out.println(DateUtil.getDay(new Date(1577923200000L)));
+	}
 }