shilin пре 1 година
родитељ
комит
a7b0e499f4

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -131,7 +131,7 @@ public class EquipmentInfo2Service {
         List<ProEconEquipmentInfoDay2> templs=new ArrayList<>();
         for(ProEconEquipmentInfoDay2 vo:dayls)
         {
-            if(StringUtils.notEmp(vo.getWindturbineId()))
+            if(StringUtils.notEmp(vo) && StringUtils.notEmp(vo.getWindturbineId()))
             {
                 templs.add(vo);
                 if(templs.size()==100)

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -135,7 +135,7 @@ public class EquipmentInfo3Service {
         List<ProEconEquipmentInfoDay3> templs=new ArrayList<>();
         for(ProEconEquipmentInfoDay3 vo:dayls)
         {
-            if(StringUtils.notEmp(vo.getWindturbineId()))
+            if(StringUtils.notEmp(vo) && StringUtils.notEmp(vo.getWindturbineId()))
             {
                 templs.add(vo);
                 if(templs.size()==100)

+ 17 - 18
realtime/generationXK-service/src/main/java/com/gyee/generation/service/initalcache/CacheService.java

@@ -7,8 +7,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
-import com.gyee.generation.model.auto.ProBasicPowerstationPoint;
-import com.gyee.generation.model.auto.ProBasicSubStation;
 import com.gyee.generation.service.auto.*;
 import com.gyee.generation.util.redis.RedisService;
 import lombok.extern.slf4j.Slf4j;
@@ -62,7 +60,7 @@ public class CacheService {
     public void initRedisCache(){
         redisService.select(9);
         log.info("--------------------------redisWT");
-        List<ProBasicEquipment> windturbineList = windturbineService.list().stream().filter(i->i.getWindpowerstationId().equals("SXJ_KGDL_YG_GDC_STA") && i.getIsable().equals(1)).collect(Collectors.toList());
+        List<ProBasicEquipment> windturbineList = windturbineService.list().stream().filter(i-> i.getIsable().equals(1)).collect(Collectors.toList());
         log.info("--------------------------windturbineList"+windturbineList.size());
         windturbineList.stream().forEach(i->{
             Map<String, ProBasicEquipmentPoint> codeaimap = new HashMap<>();
@@ -77,8 +75,8 @@ public class CacheService {
             String s = JSONObject.toJSONString(codeaimap);
             redisService.set(i.getId(),s);
         });
-
-        log.info("--------------------------redisZL");
+//
+//        log.info("--------------------------redisZL");
 //        List<ProBasicBranch> branchList = proBasicBranchService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
 //        if (StringUtils.isNotEmpty(branchList)){
 //            branchList.stream().forEach(i->{
@@ -139,18 +137,18 @@ public class CacheService {
 //        });
 //
 //        log.info("--------------------------redisSubWP");
-        List<ProBasicSubStation> subStationList = subStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        subStationList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
+//        List<ProBasicSubStation> subStationList = subStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        subStationList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
 //
 //        log.info("--------------------------redisWeatherWP");
 //        List<ProBasicWeatherStation> weatherStationList = proBasicWeatherStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
@@ -242,8 +240,9 @@ public class CacheService {
 //            String s = JSONObject.toJSONString(codeaimap);
 //            redisService.set(i,s);
 //        });
+//        redisService.select(9);
 //        log.info("--------------------------redis理论保证功率");
-//        Map<String, Map<Double,ProBasicModelPowerRd>> powerrdMap = new HashMap<>();
+//        Map<String, Map<Double, ProBasicModelPowerRd>> powerrdMap = new HashMap<>();
 //
 //        List<ProBasicModelPowerRd> proBasicModelPowerRds = proBasicModelPowerRdService.list();
 //        proBasicModelPowerRds.stream().forEach(powerrd->{

+ 45 - 6
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/StatusService.java

@@ -283,6 +283,7 @@ public class StatusService {
             if (wt.getEquipmentCategory()==-1){
                 interruption = ContantXk.INTERRUPTION.split(",");
             }else if (wt.getEquipmentCategory()==-2){
+
                 interruption = ContantXk.INTERRUPTIONGF.split(",");
             }
 
@@ -310,10 +311,47 @@ public class StatusService {
                     status = 6.0;
                 }
                 else {
+
+
                     List<PointData> interruptionRealData = edosUtil.getRealData(interruptionList);
+                    Calendar c=Calendar.getInstance();
+                    c.setTime(currentDate);
+                    c.add(Calendar.MINUTE,-3);
+                    long oldtime =c.getTime().getTime()/1000 ;
+//                    if(wt.getId().equals("SXJ_KGDL_XWT_F_WT_0019_EQ"))
+//                    {
+//                        System.out.println("");
+//                    }
+                    int state=0;
+                    for(int i=0;i<interruptionList.size();i++)
+                    {
+                        String str=interruptionList.get(i);
+                        List<PointData> oldValueLs = edosUtil.getHistoryDatasSnap(str,c.getTime().getTime()/1000,currentDate.getTime()/1000,null,30l);
+                        if(!oldValueLs.isEmpty())
+                        {
+                            for(PointData oldValue:oldValueLs)
+                            {
+                                if(oldValue.getPointValueInDouble()!=interruptionRealData.get(i).getPointValueInDouble())
+                                {
+                                    state++;
+                                }
+                            }
+                        }
+                    }
+
+
+                    if(state==0)
+                    {
+                        //离线
+                        mxstatus = 12.0;
+                    }
+
                     long time = currentDate.getTime();
+
                     List<PointData> collect = interruptionRealData.stream().filter(i -> (currentDate.getTime() - i.getPointTime()) / 1000 > Integer.parseInt(second)).collect(Collectors.toList());
-                    if (collect.size()!=interruptionRealData.size()){
+
+                    if (collect.size()==interruptionRealData.size()){
+
                         double ssgl = edosUtil.getSectionData(ssglPoint,currentDate.getTime()).getPointValueInDouble();
                         double gpzt = edosUtil.getSectionData(gpztPoint,currentDate.getTime()).getPointValueInDouble();
                         double xdzt = edosUtil.getSectionData(xdztPoint,currentDate.getTime()).getPointValueInDouble();
@@ -335,10 +373,6 @@ public class StatusService {
                                 mxstatus = 3.0;
                             }
                         }
-
-                    }else{
-                        //离线
-                        mxstatus = 12.0;
                     }
                     if (mxstatus == 0 || mxstatus == 1){
                         status = 0.0;
@@ -855,7 +889,12 @@ public class StatusService {
             if (first.isPresent()){
                 ProBasicStatusPoint windturbinestatusdi = first.get();
                 int pointValueInDouble = (int) edosUtil.getRealData(windturbinestatusdi.getNemCode()).getPointValueInDouble();
-                mxstatus = (double)stateMap.get(pointValueInDouble);
+
+                if(stateMap.containsKey(pointValueInDouble))
+                {
+                    mxstatus = (double)stateMap.get(pointValueInDouble);
+                }
+
             }
         }else {
             //每个状态一个状态点