فهرست منبع

修改配置信息和多适配器切换

shilin 2 سال پیش
والد
کامیت
30b80fa396

+ 10 - 0
web/monitor-hb/src/main/java/com/gyee/frame/common/conf/V2Config.java

@@ -55,6 +55,16 @@ public class V2Config
 
     /**测点初始码**/
     private  static  String initialcode;
+    /**健康管理数据适配器网址 **/
+    private static String healthurl;
+
+    public static String getHealthurl() {
+        return healthurl;
+    }
+
+    public  void setHealthurl(String healthurl) {
+        V2Config.healthurl = healthurl;
+    }
 
     public static String getInitialcode() {
         return initialcode;

+ 8 - 8
web/monitor-hb/src/main/java/com/gyee/frame/service/websocket/MatrixDetialPushService.java

@@ -317,14 +317,14 @@ public class MatrixDetialPushService {
                 //功率
                 fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.TPOINT_WT_FJGL).getCode());
 
-                //风机转数
-                if (wt.getWindpowerstationid().equals("QS_FDC")) {
-                    fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.QSTPOINT_WT_FDJZS).getCode());
-                } else {
-                    fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.TPOINT_WT_FDJZS).getCode());
-                }
-
-
+//                //风机转数
+//                if (wt.getWindpowerstationid().equals("QS_FDC")) {
+//                    fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.QSTPOINT_WT_FDJZS).getCode());
+//                } else {
+//                    fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.TPOINT_WT_FDJZS).getCode());
+//                }
+
+                fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.QSTPOINT_WT_FDJZS).getCode());
             }
 
             List<PointData> fjzblist = realApiUtil.getRealData(fjzbls);

+ 230 - 72
web/monitor-hb/src/main/java/com/gyee/frame/util/golden/EdosUtil.java

@@ -22,18 +22,28 @@ import java.util.*;
 
 /**
  */
-public class EdosUtil implements IRealTimeDataBaseUtil {
 
+public class EdosUtil implements IRealTimeDataBaseUtil {
 
 
 
+    private final String JKFC="JKFC.";
+    private final String JKFJ="JKFJ.";
     private RestTemplate restTemplate =new RestTemplate();
 
-    static String baseURL = V2Config.getBaseurl();
+    private String baseURL = V2Config.getBaseurl();
 
     @Override
     public PointData getRealData(Windpowerstationpointnew point) throws Exception {
 
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
+
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             try {
@@ -86,6 +96,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -218,7 +235,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     private void getHistsnapSameTiem(String pointid, Long beginDate, Long pried,
                                      List<PointData> resultList) {
 
-
+        if(!pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         long subTime =beginDate - pried;
         String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate + "000";
         ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
@@ -261,7 +284,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
-
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -321,7 +350,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
-
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> keys = Optional.ofNullable(point.getCode());
@@ -375,7 +410,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
-
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -502,6 +543,15 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
+
+        if(StringUtils.notEmp(point) &&  StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
+
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -560,6 +610,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public PointData getRealData(String pointid) throws Exception {
 
+
+        if(StringUtils.notEmp(pointid) &&  !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> keys = Optional.ofNullable(pointid);
@@ -607,6 +665,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
         if(StringUtils.notEmp(pointids) )
         {
+            if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
+
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
@@ -743,8 +809,16 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     public List<PointData> getRealData(List<String> pointids) throws Exception {
 
 
-        if(StringUtils.notEmp(pointids) )
+        if(StringUtils.notEmp(pointids) && !pointids.isEmpty() )
         {
+
+            if(!pointids.get(0).startsWith(JKFC) && !pointids.get(0).startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
@@ -882,6 +956,15 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
         if(StringUtils.notEmp(pointids) )
         {
+
+            if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
+
             List<String> idls=new ArrayList<>();
             for(String str:pointids)
             {
@@ -966,6 +1049,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
+
+        if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
@@ -1085,7 +1176,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
 
-
+        if(StringUtils.notEmp(pointid) && StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
@@ -1134,6 +1231,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) &&   !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -1209,7 +1313,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
-
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
         {
             Optional<String> tagName = Optional.ofNullable(point.getCode());
@@ -1279,7 +1389,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
-
+        if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(pointid) &&  !V2Config.getInitialcode().equals(pointid))
         {
             Optional<String> tagName = Optional.ofNullable(pointid);
@@ -1338,7 +1454,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
     @Override
     public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
 
-
+        if(StringUtils.notEmp(point) && !point.startsWith(JKFC) && !point.startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
         if(StringUtils.notEmp(point) &&  !V2Config.getInitialcode().equals(point))
         {
             Optional<String> tagName = Optional.ofNullable(point);
@@ -1435,16 +1557,28 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public void updatePoint(PointData point) throws Exception {
-        String url = baseURL + "/history";
-        try {
-            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
-        } catch (HttpClientErrorException exception) {
-            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                return;
-            } else {
-                throw exception;
+
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()) &&!point.getEdnaId().startsWith(JKFC) && !point.getEdnaId().startsWith(JKFJ))
+        {
+            baseURL = V2Config.getBaseurl();
+        }else
+        {
+            baseURL = V2Config.getHealthurl();
+        }
+        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()))
+        {
+            String url = baseURL + "/history";
+            try {
+                String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+            } catch (HttpClientErrorException exception) {
+                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                    return;
+                } else {
+                    throw exception;
+                }
             }
         }
+
     }
 
     @Override
@@ -1454,6 +1588,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
         if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
 
 
+            if(!tagNames[0].startsWith(JKFC) && !tagNames[0].startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
             DNAVal[] result = new DNAVal[tagNames.length];
             for (int i = 0; i < tagNames.length; i++) {
                 if (StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
@@ -1493,76 +1634,84 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 
     @Override
     public void updatePoint(List<PointData> pointls) throws Exception {
-        String url = baseURL + "/history/batch";
-        List<JSONObject> writeList = new ArrayList<>();
 
-        for (PointData entity : pointls) {
-            writeList.add(convertPointData(entity));
-        }
-        try {
-            String result = restTemplate.postForObject(url, writeList, String.class);
-        } catch (HttpClientErrorException exception) {
-            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                return;
-            } else {
-                throw exception;
+        if(null!=pointls && !pointls.isEmpty())
+        {
+            if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
+
+            String url = baseURL + "/history/batch";
+            List<JSONObject> writeList = new ArrayList<>();
+
+            for (PointData entity : pointls) {
+                writeList.add(convertPointData(entity));
+            }
+            try {
+                String result = restTemplate.postForObject(url, writeList, String.class);
+            } catch (HttpClientErrorException exception) {
+                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                    return;
+                } else {
+                    throw exception;
+                }
             }
         }
+
     }
 
 //    @Override
 //    public void sendSinglePoint(PointData point) throws Exception {
-//        String url = baseURL + "/latest";
 //
-//
-//        try {
-//            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
-//        } catch (HttpClientErrorException exception) {
-//            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-//                return;
-//            } else {
-//                throw exception;
+//        if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()))
+//        {
+//            if(!point.getEdnaId().startsWith(JKFC) && !point.getEdnaId().startsWith(JKFJ))
+//            {
+//                baseURL = V2Config.getBaseurl();
+//            }else
+//            {
+//                baseURL = V2Config.getHealthurl();
 //            }
-//        }
-//    }
-//
-//    @Override
-//    public void sendMultiPoint(List<PointData> pointls) throws Exception {
+//            String url = baseURL + "/latest";
 //
-//        String url = baseURL + "/latest/batch";
-//        List<JSONObject> writeList = new ArrayList<>();
 //
-//        for (PointData entity : pointls) {
-//            writeList.add(convertPointData(entity));
-//        }
-//        try {
-//            String result = restTemplate.postForObject(url, writeList, String.class);
-//        } catch (HttpClientErrorException exception) {
-//            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-//                //System.out.println("404请求错误");
-//            } else {
-//                throw exception;
+//            try {
+//                String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+//            } catch (HttpClientErrorException exception) {
+//                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+//                    return;
+//                } else {
+//                    throw exception;
+//                }
 //            }
 //        }
+//
 //    }
 //
 //    @Override
-//    public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
-//        String url = baseURL + "/latest/batch";
+//    public void sendMultiPoint(List<PointData> pointls) throws Exception {
 //
-//        List<JSONObject> writeDataList = new ArrayList<>();
-//        if (realvalue != null && pointls != null & realvalue.length == pointls.length) {
-//            for (int i = 0; i < realvalue.length; i++) {
-//                PointData writeData = new PointData();
-//                writeData.setEdnaId(realvalue[i]);
-//                writeData.setPointValueInDouble(pointls[i].DValue);
-//                writeData.setPointTime((long)pointls[i].Time);
-//                JSONObject jsonObject=convertPointData(writeData);
-//                writeDataList.add(jsonObject);
+//        if(null !=pointls && !pointls.isEmpty())
+//        {
+//            if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
+//            {
+//                baseURL = V2Config.getBaseurl();
+//            }else
+//            {
+//                baseURL = V2Config.getHealthurl();
 //            }
+//            String url = baseURL + "/latest/batch";
+//            List<JSONObject> writeList = new ArrayList<>();
 //
+//            for (PointData entity : pointls) {
+//                writeList.add(convertPointData(entity));
+//            }
 //            try {
-//                String result = restTemplate.postForObject(url, writeDataList, String.class);
+//                String result = restTemplate.postForObject(url, writeList, String.class);
 //            } catch (HttpClientErrorException exception) {
 //                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
 //                    //System.out.println("404请求错误");
@@ -1570,17 +1719,26 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
 //                    throw exception;
 //                }
 //            }
-//        } else
-//            return;
+//        }
+//
 //    }
 
+
+
     //多点切面数据
     @Override
     public DNAVal[] getHistMatrix(String[] nameList, long tTime) throws Exception {
 
 
-        if(StringUtils.notEmp(nameList) )
+        if(StringUtils.notEmp(nameList) && nameList.length>0 && StringUtils.notEmp(tTime))
         {
+            if(!nameList[0].startsWith(JKFC) && !nameList[0].startsWith(JKFJ))
+            {
+                baseURL = V2Config.getBaseurl();
+            }else
+            {
+                baseURL = V2Config.getHealthurl();
+            }
             List<String> idls=new ArrayList<>();
             for(String str:nameList)
             {

+ 2 - 2
web/monitor-hb/src/main/resources/application-hb.yml

@@ -27,7 +27,7 @@ gyee:
   rollVerification: true
   #实时数据库Url
   baseurl: http://192.168.2.198:8011/ts
-
+  healthurl: http://192.168.2.198:8012/ts
   #API访问ip
   #swaggerip: 49.4.50.80:8082
   swaggerip: 192.168.2.198:8082
@@ -90,7 +90,7 @@ spring :
 
   redis:
     database: 19
-    host: 192.168.2.194
+    host: 192.168.2.202
     password:
     pool:
       maxTotal: 20