Browse Source

控制日志格式

menglu 3 năm trước cách đây
mục cha
commit
05eb420724

+ 3 - 2
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -125,7 +125,7 @@ public class ControlUtil {
 						infoName = (String) infoDef.get("name").value_prim.value;
 						infoValue = ControlUtil.value2CanRead(infoDef, infoValue);
 					}
-					sb.append(" " + infoName + " " + "设为:" + " " + infoValue + " ");
+					sb.append("[" + infoName + "]" + "设为:" + "[" + infoValue + "]");
 					sb.append(";");
 				}
 				JSONArray success_points = new JSONArray();
@@ -139,7 +139,8 @@ public class ControlUtil {
 						failure_points.add(point);
 					}
 				}
-				sb.append("控制结果:" + points.size() + "个控制指令," + success_points.size() + "个成功," + failure_points.size() + "个失败");
+				sb.append("控制结果:" + points.size() + "个控制指令" + (success_points.size() > 0 ? ("," + success_points.size() + "个成功") : "")
+						+ (failure_points.size() > 0 ? ("," + failure_points.size() + "个失败") : ""));
 				postParam.put("operateDetail", "【" + belongSystem + "】:" + objName + "-" + sb.toString());
 				postParam.put("sourceType", 1);
 			}