Quellcode durchsuchen

修改控制日志

menglu vor 3 Jahren
Ursprung
Commit
af9b335b92

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

@@ -100,9 +100,10 @@ public class ControlUtil {
 				Object objType = sdo.get("objType").value_prim.value;
 				Object objName = sdo.get("ibmsxianshimingcheng").value_prim.value;
 				Object systemCode = null;
-				Object classCode = sdo.get("classCode").value_prim.value;
+				String classCode = (String) sdo.get("classCode").value_prim.value;
 				Object belongSystem = sdo.get("所属场景").value_prim.value;
 
+				List<SceneDataObject> infoList = RepositoryContainer.instance.infoArrayDic.get(classCode).set;
 				postParam.put("objType", objType);
 				postParam.put("objName", objName);
 				postParam.put("systemCode", systemCode);
@@ -111,7 +112,20 @@ public class ControlUtil {
 				StringBuffer sb = new StringBuffer();
 				for (String key : infoValueSet.keySet()) {
 					Object infoValue = infoValueSet.get(key);
-					sb.append(key + "设为:" + infoValue);
+					SceneDataObject infoDef = null;
+					for (SceneDataObject infoDefInner : infoList) {
+						String code = (String) infoDefInner.get("code").value_prim.value;
+						if (code.equals(key)) {
+							infoDef = infoDefInner;
+							break;
+						}
+					}
+					String infoName = key;
+					if (infoDef != null) {
+						infoName = (String) infoDef.get("name").value_prim.value;
+						infoValue = ControlUtil.value2CanRead(infoDef, infoValue);
+					}
+					sb.append(" " + infoName + " " + "设为:" + " " + infoValue + " ");
 					sb.append(";");
 				}
 				JSONArray success_points = new JSONArray();
@@ -135,6 +149,25 @@ public class ControlUtil {
 		}
 	}
 
+	public static Object value2CanRead(SceneDataObject infoDef, Object infoValue) {
+		if (infoDef.containsKey("dataSource")) {
+			JSONArray dataSource = (JSONArray) infoDef.get("dataSource").value_prim.value;
+			for (int i = 0; i < dataSource.size(); i++) {
+				JSONObject item = (JSONObject) dataSource.get(i);
+				String code = item.getString("code");
+				double value1 = Double.parseDouble(infoValue.toString());
+				double value2 = Double.parseDouble(code);
+				if (value1 == value2) {
+					String name = item.getString("name");
+					return name;
+				}
+			}
+			return infoValue;
+		} else {
+			return infoValue;
+		}
+	}
+
 	private static void saveOperationLog(JSONObject postParam) throws Exception {
 		String post_url = Constant.zkt_control_url + "/operationLog/saveOperationLog";
 		String post_result = HttpClientUtil.instance("zkt_control").post(post_url, postParam.toJSONString());