Browse Source

2203版本火车内容
1、转发工作台、待办事项接口
2、对接对比分析接口
3、保存控制中心指令面板
4、重新对接报警定义接口

lirong 2 years ago
parent
commit
f9f8d3ee25

+ 55 - 8
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -1,5 +1,7 @@
 package com.persagy.ibms.data.sdk.util;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -10,6 +12,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.ibms.core.data.SceneDataObject;
 import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataSet;
 import com.persagy.ibms.core.data.SceneDataValue;
 import com.persagy.ibms.core.util.ComputeUtil;
 
@@ -83,7 +86,7 @@ public class ControlUtil {
     }
 
     public static JSONArray set(String userId, String userName, RepositoryImpl Repository, JSONArray path, JSONObject infoValueSet,
-                                String controlReason,HttpServletRequest request) throws Exception {
+                                String controlReason, HttpServletRequest request) throws Exception {
         JSONArray result;
         Object valueObject = ComputeUtil.getValueObject(Repository, path);
         List<SceneDataObject> sdoList = new CopyOnWriteArrayList<SceneDataObject>();
@@ -191,22 +194,32 @@ public class ControlUtil {
     public static void saveBatchOperationLog(String userId, String userName, List<SceneDataObject> sdoList, JSONObject infoValueSet, JSONArray points,
                                              String controlReason, RepositoryImpl Repository, HttpServletRequest request) {
         try {
-            String authorization=request.getHeader("Authorization");
+            String authorization = request.getHeader("Authorization");
             JSONArray postParamArray = new JSONArray();
+            JSONObject commandRecordParam=new JSONObject();
+            Date date = new Date();
+            SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String currentTime=dateFormat.format(date);
             for (int i = 0; i < sdoList.size(); i++) {
                 JSONObject postParam;
                 postParam = new JSONObject();
                 JSONObject postParam2 = new JSONObject();
                 postParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
                 postParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+                //控制中心保存指令
+                commandRecordParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
+                commandRecordParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+                commandRecordParam.put("executeTime",currentTime);
+                commandRecordParam.put("commandType",2);
                 if (userId != null) {
                     postParam.put("userId", userId);
+                    commandRecordParam.put("userId", userId);
                 }
                 if (userName != null) {
                     postParam.put("userName", userName);
+                    commandRecordParam.put("creator", userName);
                 }
-                if(authorization!=null)
-                {
+                if (authorization != null) {
                     postParam.put("token", authorization);
                 }
                 SceneDataObject sdo = sdoList.get(i);
@@ -228,7 +241,13 @@ public class ControlUtil {
                 postParam.put("classCode", classCode);
                 postParam.put("systemType", "control");
 //                postParam.put("token", "");
+                //控制中心保存指令
+                Object objectId = sdo.get("id").value_prim.value;
+                commandRecordParam.put("objectId",objectId);
+                commandRecordParam.put("ibmsSceneCode",ibmsSceneCode);
+                commandRecordParam.put("ibmsClassCode",ibmsClassCode);
                 StringBuffer sb = new StringBuffer();
+                StringBuffer sb2 = new StringBuffer();
                 for (String key : infoValueSet.keySet()) {
                     Object infoValue = infoValueSet.get(key);
                     SceneDataObject infoDef = null;
@@ -240,11 +259,25 @@ public class ControlUtil {
                         }
                     }
                     String infoName = key;
+                    String infoCode;
+                    String unit;
+                    Object ctrlFbCode;
                     if (infoDef != null) {
                         infoName = (String) infoDef.get("name").value_prim.value;
+                        infoCode = (String) infoDef.get("code").value_prim.value;
+                        commandRecordParam.put("infoCode",infoCode);
+                        commandRecordParam.put("infoValue",infoValue);
+                        sb2.append("" + infoName + ":" + "" + infoValue + "");
+                        commandRecordParam.put("commandContent",sb2.toString());
                         infoValue = ControlUtil.value2CanRead(infoDef, infoValue);
+                        SceneDataSet infoPointRelationArray =Repository.InfoPointRelationArray;
+                        SceneDataObject infoPointRelation=infoPointRelationArray.set.stream().filter(x -> JSONObject.parseObject(x.toString()).get("ibmsSceneCode").equals(ibmsSceneCode)
+                                        && JSONObject.parseObject(x.toString()).get("ibmsClassCode").equals(ibmsClassCode)&& JSONObject.parseObject(x.toString()).get("控制点").equals(infoCode))
+                                .findFirst().get();
+                        ctrlFbCode = infoPointRelation.get("控制反馈点").value_prim.value;
+                        commandRecordParam.put("ctrlFbCode",ctrlFbCode);
                     }
-                    sb.append("" + infoName + "设为:" +  "" + infoValue + "");
+                    sb.append("" + infoName + "设为:" + "" + infoValue + "");
                     if (controlReason != null && !controlReason.isEmpty()) {
                         if (infoDef.get("code").value_prim.value.equals("manualAutoSet")) {
                             sb.append(",切换原因:" + controlReason + "");
@@ -262,14 +295,17 @@ public class ControlUtil {
                                         && JSONObject.parseObject(x.toString()).get("funcid").equals(funcid))
                                 .findFirst().get();
                         String status = (String) point.get("status");
+                        boolean virtual = (boolean) point.get("virtual");
+                        commandRecordParam.put("isVirtual",virtual);
                         if (status.equals("finish:success")) {
                             sb.append("*成功;");
+                            commandRecordParam.put("executeStatus",1);
                         } else {
                             sb.append("*失败;");
+                            commandRecordParam.put("executeStatus",2);
                         }
                     }
-                    if(i < sdoList.size()-1)
-                    {
+                    if (i < sdoList.size() - 1) {
                         sb.append(",");
                     }
                 }
@@ -279,12 +315,13 @@ public class ControlUtil {
                         postParam2.put("details", "控制:" + ibmsxianshimingcheng + "," + sb.toString());
                         postParam2.put("logSource", "user");
                     } else {
-                        postParam2.put("details", "用户控制日志."+userName+":" + ibmsxianshimingcheng + "," + sb.toString());
+                        postParam2.put("details", "用户控制日志." + userName + ":" + ibmsxianshimingcheng + "," + sb.toString());
                         postParam2.put("logSource", "sys");
                     }
                     postParamArray.add(postParam2);
                 }
             }
+            createCommandRecord(commandRecordParam);
             saveBatchOperationLog(postParamArray);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -329,6 +366,16 @@ public class ControlUtil {
         log.debug(result.toJSONString());
     }
 
+    //控制中心保存控制命令
+    private static void createCommandRecord(JSONObject postParam) throws Exception {
+        String post_url = Constant.zkt_control_url + "/commandRecord/createCommandRecord";
+        System.out.println("保存控制指令url:" + post_url);
+        System.out.println("控制指令boby:" + postParam.toJSONString());
+        String post_result = HttpClientUtil.instance("zkt_control").post(post_url, postParam.toJSONString());
+        JSONObject result = JSON.parseObject(post_result);
+        log.debug(result.toJSONString());
+    }
+
     private static JSONArray set(RepositoryImpl Repository, SceneDataObject object, JSONObject infoValueSet, List<SceneDataObject> sdoList)
             throws Exception {
         JSONArray result;

File diff suppressed because it is too large
+ 946 - 932
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java


+ 39 - 0
ibms-data-sdk/src/main/resources/config.xml

@@ -359,6 +359,45 @@
               url="http://ibmsdev.persagy.com/ibms-config/sysGraphCtrl/querySysGraphCtrlList">
         <header key="Content-Type" value="application/json"/>
     </Redirect>
+    <!--2203版本火车-->
+    <!--工作台升级-->
+    <Redirect code="创建待办事项" http_request_type="post"
+              url="http://ibmsdev.persagy.com/ibms-alarm/todolist/createByUser">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="执行待办事项" http_request_type="get"
+              url="http://ibmsdev.persagy.com/ibms-alarm/todolist/handle">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="小面板查询待办事项" http_request_type="get"
+              url="http://ibmsdev.persagy.com/ibms-alarm/todolist/now">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="大面板查询待办事项" http_request_type="post"
+              url="http://ibmsdev.persagy.com/ibms-alarm//todolist/list">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="导出待办事项" http_request_type="post"
+              url="http://ibmsdev.persagy.com/ibms-alarm//todolist/export">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <!--对比分析-->
+    <Redirect code="查询常用模板" http_request_type="post"
+              url="http://ibmsdev.persagy.com/zkt-monitor/pointcompare/list/templates">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="历史查询记录" http_request_type="post"
+              url="http://ibmsdev.persagy.com/zkt-monitor/pointcompare/list/history">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="删除常用模板" http_request_type="get"
+              url="http://ibmsdev.persagy.com/zkt-monitor/pointcompare/delete">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
+    <Redirect code="保存为常用模板" http_request_type="post"
+              url="http://ibmsdev.persagy.com/zkt-monitor/pointcompare/saveAsTemplate">
+        <header key="Content-Type" value="application/json"/>
+    </Redirect>
     <Redirect code="test-get1" http_request_type="get" url="http://183.230.202.111:30000/ibms-alarm/alarm-record/list"/>
     <Redirect code="test-post1" http_request_type="post" url="http://192.168.4.69:8806/zkt-sdk/post"/>
     <Redirect code="test-get2" http_request_type="get"