Browse Source

保存控制日志新增入参

lirong 2 years ago
parent
commit
0dde88e110

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

@@ -170,6 +170,7 @@ public class RestUtil {
             JSONObject paramObject = JSON.parseObject(param);
             String userId = (String) paramObject.get("userId");
             String userName = (String) paramObject.get("userName");
+            String ipAddress= (String) paramObject.get("ipAddress");
             JSONArray path = (JSONArray) paramObject.get("path");
             JSONObject infoValueSet = (JSONObject) paramObject.get("infoValueSet");
             String controlReason = (String) paramObject.get("controlReason");
@@ -198,7 +199,7 @@ public class RestUtil {
                 }
             }
 
-            JSONArray points = ControlUtil.set(userId, userName, Repository, path, infoValueSet, controlReason, request);
+            JSONArray points = ControlUtil.set(userId, userName,ipAddress, Repository, path, infoValueSet, controlReason, request);
             JSONArray success_points = new JSONArray();
             JSONArray failure_points = new JSONArray();
             for (int i = 0; i < points.size(); i++) {
@@ -260,6 +261,7 @@ public class RestUtil {
         JSONObject paramObject = JSON.parseObject(param);
         String userId = (String) paramObject.get("userId");
         String userName = (String) paramObject.get("userName");
+        String ipAddress=(String) paramObject.get("ipAddress");
         JSONArray subsystemStatusList = new JSONArray();
         try {
             subsystemStatusList = queryOcssiConfigsubsystemStatusList();
@@ -306,6 +308,7 @@ public class RestUtil {
         }
         JSONObject postParam = new JSONObject();
         postParam.put("logSource", "sys");
+        postParam.put("ipAddress", ipAddress);
         postParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
         postParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
         if (userId != null) {

+ 6 - 4
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -85,7 +85,7 @@ public class ControlUtil {
         return result;
     }
 
-    public static JSONArray set(String userId, String userName, RepositoryImpl Repository, JSONArray path, JSONObject infoValueSet,
+    public static JSONArray set(String userId, String userName,String ipAddress, RepositoryImpl Repository, JSONArray path, JSONObject infoValueSet,
                                 String controlReason, HttpServletRequest request) throws Exception {
         JSONArray result;
         Object valueObject = ComputeUtil.getValueObject(Repository, path);
@@ -105,17 +105,18 @@ public class ControlUtil {
             result = set(Repository, currData, infoValueSet, sdoList);
         }
 
-        ControlUtil.saveBatchOperationLog(userId, userName, sdoList, infoValueSet, result, controlReason, Repository, request);
+        ControlUtil.saveBatchOperationLog(userId, userName,ipAddress,sdoList, infoValueSet, result, controlReason, Repository, request);
         // ControlUtil.saveOperationLog(userId, userName, sdoList, infoValueSet, result);
 
         return result;
     }
 
-    public static void saveOperationLog(String userId, String userName, List<SceneDataObject> sdoList, JSONObject infoValueSet, JSONArray points) {
+    public static void saveOperationLog(String userId, String userName, List<SceneDataObject> sdoList, JSONObject infoValueSet, JSONArray points,String ipAddress) {
         try {
             JSONObject postParam = new JSONObject();
             postParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
             postParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+            postParam.put("ipAddress", ipAddress);
             if (userId == null || userId.length() == 0) {
                 postParam.put("userId", "systemId");
             } else {
@@ -191,7 +192,7 @@ public class ControlUtil {
         }
     }
 
-    public static void saveBatchOperationLog(String userId, String userName, List<SceneDataObject> sdoList, JSONObject infoValueSet, JSONArray points,
+    public static void saveBatchOperationLog(String userId, String userName,String ipAddress, List<SceneDataObject> sdoList, JSONObject infoValueSet, JSONArray points,
                                              String controlReason, RepositoryImpl Repository, HttpServletRequest request) {
         try {
             String authorization = request.getHeader("Authorization");
@@ -204,6 +205,7 @@ public class ControlUtil {
                 JSONObject postParam;
                 postParam = new JSONObject();
                 JSONObject postParam2 = new JSONObject();
+                postParam.put("ipAddress", ipAddress);
                 postParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
                 postParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
                 //控制中心保存指令