Procházet zdrojové kódy

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

shilin před 2 roky
rodič
revize
626e6c441a

+ 4 - 4
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/PartstatisticsService.java

@@ -38,11 +38,11 @@ public class PartstatisticsService {
     private final String MONTH1NUM ="month1num";
     private final String SYNTHESISNUM ="synthesisnum";
 
-//	private final long STEP = 900*2;
-//	private final int DAYSTEP = 96/2;
+	private final long STEP = 60;
+	private final int DAYSTEP = 1440;
 
-    private final long STEP = 900;
-    private final int DAYSTEP = 96;
+//    private final long STEP = 900;
+//    private final int DAYSTEP = 96;
 
 
     SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");

+ 21 - 21
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java

@@ -48,7 +48,7 @@ public class ParttemperatureService {
     private String FDJLQFWD = "AI054";// 发电机冷却风温度
 
     private String BJDRQWD = "AI113";// 变浆电容器温度
-    private String BJDRDY = "AI236";// 变浆电容温度
+    private String BJDRDY = "AI116";// 变浆电容温度
     private String BJDLQWD = "AI239";// 变浆电流器温度
     private String BJDJWD = "AI242";// 电机温度
     private String BJKZGWD = "AI233";// 变浆控制柜温度
@@ -118,26 +118,26 @@ public class ParttemperatureService {
             Map<String, Double> wdmap = getWdValue(wt, Constant.TPOINT_WT_JCWD, endDate, beginDate, map);
 
 
-            Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map);
-            Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map);
-            Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map);
-            Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map);
+            Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map,63,0);
+            Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map,63,0);
+            Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map,63,0);
+            Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map,60,0);
 
-            Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map);
-            Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map);
-            Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map);
-            Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map);
-            Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map);
-            Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map);
+            Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map,45,0);
+            Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map,45,0);
+            Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map,110,0);
+            Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map,110,0);
+            Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map,110,0);
+            Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map,50,0);
 
-            Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map);
-            Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map);
-            Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map);
-            Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map);
-            Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map);
+            Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map,35,0);
+            Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map,70,0);
+            Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map,50,0);
+            Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map,50,0);
+            Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map,45,0);
 
-            Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map);
-            Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map);
+            Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map,35,0);
+            Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map,35,0);
 
 
             Map<String, Map<String, Integer>> pointmap =new HashMap<>();
@@ -351,15 +351,15 @@ public class ParttemperatureService {
     }
 
 
-    private Map<String, Double> getPartTargetValue(Windturbine wt, String code, Date endDate, Date beginDate, Map<String, Windturbinetestingpointnew> map) throws Exception {
+    private Map<String, Double> getPartTargetValue(Windturbine wt, String code, Date endDate, Date beginDate, Map<String, Windturbinetestingpointnew> map,double max,double min) throws Exception {
 
         Map<String, Double> resultmap = new TreeMap<String, Double>();
 
         if (map.containsKey(code)) {
             Windturbinetestingpointnew point = map.get(code);
 
-            double max=null!=point.getReasonablemaxval()?point.getReasonablemaxval():10000.0;
-            double min=null!=point.getReasonableminval()?point.getReasonableminval():0.0;
+//            double max=null!=point.getReasonablemaxval()?point.getReasonablemaxval():10000.0;
+//            double min=null!=point.getReasonableminval()?point.getReasonableminval():0.0;
             try {
                 List<PointData> pointls = ednaApiUtil.getHistoryDatasSnap(point, beginDate.getTime() / 1000, endDate.getTime() / 1000, DAYSTEP, STEP);
 

+ 161 - 134
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/util/realtimesource/EdosUtil.java

@@ -110,6 +110,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
             Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+            String pointid =tagName.get();
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             if (pried != null)
@@ -152,52 +153,58 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                         getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
                     }else
                     {
-                        resultList=snapList;
-//                        resultList=snapList;
-//                        for (PointData snapItem : snapList) {
-//
-//                            long subTime = snapItem.getPointTime() - pried;
-//                            //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
-//                            // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
-//                            // 则代表该时间节点快照有效,否则为0
-//                            String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
-//                            ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
-//                            JSONObject jsonObjectSection = sectionResp.getBody();
-//
-//                            if (jsonObjectSection != null) {
-//                                List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
-//                                if (sectionlist.size() > 0) {
-//                                    if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
-//                                        resultList.add(snapItem);
-//                                    }
-//                                    else{
-//                                        PointData data = new PointData();
-//                                        data.setEdnaId(point.getCode());
-//                                        data.setPointTime(0L);
-//                                        data.setPointValue("0");
-//                                        data.setPointName("1");
-//                                        data.setPointValueInDouble(0.0);
-//                                        resultList.add(data);
-//                                    }
-//                                } else {
-//                                    PointData data = new PointData();
-//                                    data.setEdnaId(point.getCode());
-//                                    data.setPointTime(0l);
-//                                    data.setPointValue("0");
-//                                    data.setPointName("1");
-//                                    data.setPointValueInDouble(0.0);
-//                                    resultList.add(data);
-//                                }
-//                            } else {
-//                                PointData data = new PointData();
-//                                data.setEdnaId(point.getCode());
-//                                data.setPointTime(0l);
-//                                data.setPointValue("0");
-//                                data.setPointName("1");
-//                                data.setPointValueInDouble(0.0);
-//                                resultList.add(data);
-//                            }
-//                        }
+                        if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+                        {
+                            resultList=snapList;
+                        }else
+                        {
+
+                            for (PointData snapItem : snapList) {
+
+                                long subTime = snapItem.getPointTime() - pried;
+                                //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+                                // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+                                // 则代表该时间节点快照有效,否则为0
+                                String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + snapItem.getPointTime() + "000";
+                                ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+                                JSONObject jsonObjectSection = sectionResp.getBody();
+
+                                if (jsonObjectSection != null) {
+                                    List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+                                    if (sectionlist.size() > 0) {
+                                        if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+                                            resultList.add(snapItem);
+                                        }
+                                        else{
+                                            PointData data = new PointData();
+                                            data.setEdnaId(pointid);
+                                            data.setPointTime(snapItem.getPointTime());
+                                            data.setPointValue("0");
+                                            data.setPointName("1");
+                                            data.setPointValueInDouble(0.0);
+                                            resultList.add(data);
+                                        }
+                                    } else {
+                                        PointData data = new PointData();
+                                        data.setEdnaId(pointid);
+                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointValue("0");
+                                        data.setPointName("1");
+                                        data.setPointValueInDouble(0.0);
+                                        resultList.add(data);
+                                    }
+                                } else {
+                                    PointData data = new PointData();
+                                    data.setEdnaId(pointid);
+                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointValue("0");
+                                    data.setPointName("1");
+                                    data.setPointValueInDouble(0.0);
+                                    resultList.add(data);
+                                }
+                            }
+
+                        }
                     }
 
 
@@ -424,6 +431,8 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
             Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
             Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+
+            String pointid =tagName.get();
             //通过时间区间和时间间隔获取点数
             Long finalInterval;
             if (pried != null)
@@ -467,50 +476,58 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                     }else
                     {
 
-                        resultList=snapList;
-//                        for (PointData snapItem : snapList) {
-//                            long subTime = snapItem.getPointTime() - pried;
-//                            //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
-//                            // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
-//                            // 则代表该时间节点快照有效,否则为0
-//                            String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
-//                            ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
-//                            JSONObject jsonObjectSection = sectionResp.getBody();
-//
-//                            if (jsonObjectSection != null) {
-//                                List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
-//                                if (sectionlist.size() > 0) {
-//                                    if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
-//                                        resultList.add(snapItem);
-//                                    }
-//                                    else{
-//                                        PointData data = new PointData();
-//                                        data.setEdnaId(point.getCode());
-//                                        data.setPointTime(0L);
-//                                        data.setPointValue("0");
-//                                        data.setPointName("1");
-//                                        data.setPointValueInDouble(0.0);
-//                                        resultList.add(data);
-//                                    }
-//                                } else {
-//                                    PointData data = new PointData();
-//                                    data.setEdnaId(point.getCode());
-//                                    data.setPointTime(0l);
-//                                    data.setPointValue("0");
-//                                    data.setPointName("1");
-//                                    data.setPointValueInDouble(0.0);
-//                                    resultList.add(data);
-//                                }
-//                            } else {
-//                                PointData data = new PointData();
-//                                data.setEdnaId(point.getCode());
-//                                data.setPointTime(0l);
-//                                data.setPointValue("0");
-//                                data.setPointName("1");
-//                                data.setPointValueInDouble(0.0);
-//                                resultList.add(data);
-//                            }
-//                        }
+                        if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+                        {
+                            resultList=snapList;
+                        }else
+                        {
+
+                            for (PointData snapItem : snapList) {
+
+                                long subTime = snapItem.getPointTime() - pried;
+                                //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+                                // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+                                // 则代表该时间节点快照有效,否则为0
+                                String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
+                                ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+                                JSONObject jsonObjectSection = sectionResp.getBody();
+
+                                if (jsonObjectSection != null) {
+                                    List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+                                    if (sectionlist.size() > 0) {
+                                        if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+                                            resultList.add(snapItem);
+                                        }
+                                        else{
+                                            PointData data = new PointData();
+                                            data.setEdnaId(point.getCode());
+                                            data.setPointTime(snapItem.getPointTime());
+                                            data.setPointValue("0");
+                                            data.setPointName("1");
+                                            data.setPointValueInDouble(0.0);
+                                            resultList.add(data);
+                                        }
+                                    } else {
+                                        PointData data = new PointData();
+                                        data.setEdnaId(point.getCode());
+                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointValue("0");
+                                        data.setPointName("1");
+                                        data.setPointValueInDouble(0.0);
+                                        resultList.add(data);
+                                    }
+                                } else {
+                                    PointData data = new PointData();
+                                    data.setEdnaId(point.getCode());
+                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointValue("0");
+                                    data.setPointName("1");
+                                    data.setPointValueInDouble(0.0);
+                                    resultList.add(data);
+                                }
+                            }
+
+                        }
                     }
 
 
@@ -840,6 +857,8 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                     }
 
                     ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+
+                    //  System.out.println("数据适配器"+url);
                     JSONObject jsonObject = resp.getBody();
                     if (jsonObject != null) {
 
@@ -1098,50 +1117,58 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                     }else
                     {
 
-                        resultList=list;
-//                        for (PointData snapItem : list) {
-//                            long subTime = snapItem.getPointTime() - pried;
-//                            //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
-//                            // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
-//                            // 则代表该时间节点快照有效,否则为0
-//                            String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
-//                            ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
-//                            JSONObject jsonObjectSection = sectionResp.getBody();
-//
-//                            if (jsonObjectSection != null) {
-//                                List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
-//                                if (sectionlist.size() > 0) {
-//                                    if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
-//                                        resultList.add(snapItem);
-//                                    }
-//                                    else{
-//                                        PointData data = new PointData();
-//                                        data.setEdnaId(pointid);
-//                                        data.setPointTime(0L);
-//                                        data.setPointValue("0");
-//                                        data.setPointName("1");
-//                                        data.setPointValueInDouble(0.0);
-//                                        resultList.add(data);
-//                                    }
-//                                } else {
-//                                    PointData data = new PointData();
-//                                    data.setEdnaId(pointid);
-//                                    data.setPointTime(0l);
-//                                    data.setPointValue("0");
-//                                    data.setPointName("1");
-//                                    data.setPointValueInDouble(0.0);
-//                                    resultList.add(data);
-//                                }
-//                            } else {
-//                                PointData data = new PointData();
-//                                data.setEdnaId(pointid);
-//                                data.setPointTime(0l);
-//                                data.setPointValue("0");
-//                                data.setPointName("1");
-//                                data.setPointValueInDouble(0.0);
-//                                resultList.add(data);
-//                            }
-//                        }
+                        if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
+                        {
+                            resultList=list;
+                        }else
+                        {
+
+                            for (PointData snapItem : list) {
+
+                                long subTime = snapItem.getPointTime() - pried;
+                                //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+                                // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+                                // 则代表该时间节点快照有效,否则为0
+                                String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + snapItem.getPointTime() + "000";
+                                ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+                                JSONObject jsonObjectSection = sectionResp.getBody();
+
+                                if (jsonObjectSection != null) {
+                                    List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+                                    if (sectionlist.size() > 0) {
+                                        if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+                                            resultList.add(snapItem);
+                                        }
+                                        else{
+                                            PointData data = new PointData();
+                                            data.setEdnaId(pointid);
+                                            data.setPointTime(snapItem.getPointTime());
+                                            data.setPointValue("0");
+                                            data.setPointName("1");
+                                            data.setPointValueInDouble(0.0);
+                                            resultList.add(data);
+                                        }
+                                    } else {
+                                        PointData data = new PointData();
+                                        data.setEdnaId(pointid);
+                                        data.setPointTime(snapItem.getPointTime());
+                                        data.setPointValue("0");
+                                        data.setPointName("1");
+                                        data.setPointValueInDouble(0.0);
+                                        resultList.add(data);
+                                    }
+                                } else {
+                                    PointData data = new PointData();
+                                    data.setEdnaId(pointid);
+                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointValue("0");
+                                    data.setPointName("1");
+                                    data.setPointValueInDouble(0.0);
+                                    resultList.add(data);
+                                }
+                            }
+
+                        }
                     }
 
                     return resultList;