Browse Source

contrl设定值得是整数或者小数(可以用字符串抱起来),否则会报错

menglu 3 years ago
parent
commit
797ca11cf5

+ 14 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java

@@ -297,7 +297,20 @@ public class RestUtil {
 			for (String key : infoValueSet.keySet()) {
 				Object infoValue = infoValueSet.get(key);
 				if (infoValue == null) {
-					throw new Exception();
+					throw new Exception("control infoValueSet has null");
+				}
+				if (infoValue instanceof String) {
+					try {
+						int parseValue = Integer.parseInt((String) infoValue);
+						infoValueSet.put(key, parseValue);
+					} catch (Exception e) {
+						try {
+							double parseValue = Double.parseDouble((String) infoValue);
+							infoValueSet.put(key, parseValue);
+						} catch (Exception e1) {
+							throw new Exception("control infoValueSet has bad value: " + infoValue);
+						}
+					}
 				}
 			}