Procházet zdrojové kódy

修改风机故障损失电量修改

shilin před 1 rokem
rodič
revize
774e02238c

+ 13 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java

@@ -54,6 +54,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,Windpowerstation> wpmap = new HashMap<>();
 
     public static Map<String,List<Windturbine>> wpwtlsmap = new HashMap<>();
+    public static Map<String,List<Windturbine>> pjwtlsmap = new HashMap<>();
     public static List<Windpowerstation> wpls = new ArrayList<>();
     public static Map<String,String> stopmap = new HashMap<>();
 
@@ -86,6 +87,18 @@ public class CacheContext implements CommandLineRunner {
                 ls.add(wt);
                 wpwtlsmap.put(wt.getWindpowerstationid(),ls);
             }
+            if(pjwtlsmap.containsKey(wt.getProjectid()))
+            {
+                List<Windturbine> ls=pjwtlsmap.get(wt.getProjectid());
+                ls.add(wt);
+
+            }else
+            {
+                List<Windturbine> ls=new ArrayList<>();
+                ls.add(wt);
+                pjwtlsmap.put(wt.getProjectid(),ls);
+            }
+
             wtnamemap.put(wt.getName(),wt);
             Double powerproduction = equipmentmodelList.stream().filter(e -> e.getId().equals(wt.getModelid())).findFirst().get().getPowerproduction();
             wtcap.put(wt.getId(),powerproduction);

+ 54 - 10
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/GhostService.java

@@ -82,13 +82,57 @@ public class GhostService {
 
 
 
+//        for(Faultrecord fr:resultList)
+//        {
+//            if(StringUtils.notEmp(fr.getFaultduration()))
+//            {
+//                QueryWrapper<Windpowerinfoday> windturbineinfodayQueryWrapper = new QueryWrapper<>();
+//                windturbineinfodayQueryWrapper.eq("recorddate",DateUtils.truncate(fr.getBegindate()));
+//                windturbineinfodayQueryWrapper.eq("foreignkeyid",fr.getWpid());
+//                List<Windpowerinfoday> windturbineinfodayList = windpowerinfodayService.list(windturbineinfodayQueryWrapper);
+//
+//                Map<String,Windpowerinfoday> wtdaymap=new HashMap<>();
+//                if(!windturbineinfodayList.isEmpty())
+//                {
+//                    for ( Windpowerinfoday wtday:windturbineinfodayList)
+//                    {
+//                        wtdaymap.put(wtday.getWindpowerstationid(),wtday);
+//                    }
+//                }
+//
+//                double gzsc=DateUtils.hoursDiff1(fr.getBegindate(),fr.getEnddate());
+//
+//                if(wtdaymap.containsKey(fr.getWpid()))
+//                {
+//                    Windpowerinfoday wpday=wtdaymap.get(fr.getWpid());
+//
+//                    if(CacheContext.wpwtlsmap.containsKey(wpday.getWindpowerstationid()))
+//                    {
+//                        List<Windturbine> wtls=CacheContext.wpwtlsmap.get(wpday.getWindpowerstationid());
+//                        double rfdl= wpday.getGeneratingcapacity2();
+//                        double ssdl = new BigDecimal(rfdl).divide(new BigDecimal(wtls.size()), 2, RoundingMode.HALF_EVEN).divide(new BigDecimal(24), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(gzsc)).doubleValue();
+//
+//
+//                        fr.setPowerloss(StringUtils.round(ssdl,2));
+//                        if(StringUtils.round(ssdl,2)==0)
+//                        {
+//                            ssdl=0.01;
+//                            fr.setPowerloss(ssdl);
+//                        }
+//                        faultrecordService.saveOrUpdate(fr);
+//                    }
+//
+//                }
+//            }
+//        }
+
         for(Faultrecord fr:resultList)
         {
             if(StringUtils.notEmp(fr.getFaultduration()))
             {
                 QueryWrapper<Windpowerinfoday> windturbineinfodayQueryWrapper = new QueryWrapper<>();
                 windturbineinfodayQueryWrapper.eq("recorddate",DateUtils.truncate(fr.getBegindate()));
-                windturbineinfodayQueryWrapper.eq("foreignkeyid",fr.getWpid());
+                windturbineinfodayQueryWrapper.eq("foreignkeyid",fr.getProjectid());
                 List<Windpowerinfoday> windturbineinfodayList = windpowerinfodayService.list(windturbineinfodayQueryWrapper);
 
                 Map<String,Windpowerinfoday> wtdaymap=new HashMap<>();
@@ -96,23 +140,23 @@ public class GhostService {
                 {
                     for ( Windpowerinfoday wtday:windturbineinfodayList)
                     {
-                        wtdaymap.put(wtday.getWindpowerstationid(),wtday);
+                        wtdaymap.put(wtday.getForeignkeyid(),wtday);
                     }
                 }
 
                 double gzsc=DateUtils.hoursDiff1(fr.getBegindate(),fr.getEnddate());
 
-                if(wtdaymap.containsKey(fr.getWpid()))
+                if(wtdaymap.containsKey(fr.getProjectid()))
                 {
-                    Windpowerinfoday wpday=wtdaymap.get(fr.getWpid());
+                    Windpowerinfoday wpday=wtdaymap.get(fr.getProjectid());
 
-                    if(CacheContext.wpwtlsmap.containsKey(wpday.getWindpowerstationid()))
+                    if(CacheContext.pjwtlsmap.containsKey(wpday.getProjectid()))
                     {
-                        List<Windturbine> wtls=CacheContext.wpwtlsmap.get(wpday.getWindpowerstationid());
+                        List<Windturbine> wtls=CacheContext.pjwtlsmap.get(wpday.getProjectid());
+                        wtls = wtls.stream().filter(a -> fr.getProjectid().equals(a.getProjectid())).collect(Collectors.toList());
                         double rfdl= wpday.getGeneratingcapacity2();
                         double ssdl = new BigDecimal(rfdl).divide(new BigDecimal(wtls.size()), 2, RoundingMode.HALF_EVEN).divide(new BigDecimal(24), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(gzsc)).doubleValue();
-
-
+                        if("内报".equals(fr.getType())) ssdl = ssdl * 0.6;
                         fr.setPowerloss(StringUtils.round(ssdl,2));
                         if(StringUtils.round(ssdl,2)==0)
                         {
@@ -170,9 +214,9 @@ public class GhostService {
                 {
                     Windpowerinfoday wpday=wtdaymap.get(fr.getProjectid());
 
-                    if(CacheContext.wpwtlsmap.containsKey(wpday.getWindpowerstationid()))
+                    if(CacheContext.pjwtlsmap.containsKey(wpday.getProjectid()))
                     {
-                        List<Windturbine> wtls=CacheContext.wpwtlsmap.get(wpday.getWindpowerstationid());
+                        List<Windturbine> wtls=CacheContext.pjwtlsmap.get(wpday.getProjectid());
                         wtls = wtls.stream().filter(a -> fr.getProjectid().equals(a.getProjectid())).collect(Collectors.toList());
                         double rfdl= wpday.getGeneratingcapacity2();
                         double ssdl = new BigDecimal(rfdl).divide(new BigDecimal(wtls.size()), 2, RoundingMode.HALF_EVEN).divide(new BigDecimal(24), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(gzsc)).doubleValue();