Explorar el Código

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis-background

chenminghua hace 2 años
padre
commit
7b195706e4

+ 105 - 105
cache/src/main/java/com/gyee/cache/init/CacheContext.java

@@ -75,111 +75,111 @@ public class CacheContext implements CommandLineRunner {
 
         logger.info("----------------------数据中心点开始");
         //缓存golden 所有点
-//        List<Datacenter> datacenterList = datacenterService.list();
-//
-//        datacenterList.stream().forEach(i->{
-//            if (!redisService.hasKey(i.getTableid())){
-//                QueryWrapper<Datacenterpoint> queryWrapper = new QueryWrapper<>();
-//                queryWrapper.eq("tid",i.getTableid());
-//                List<Datacenterpoint> realtimedataList = datacenterpointService.list(queryWrapper);
-//                String s = null;
-//                try {
-//                    s = JSONUtil.objectToJson(realtimedataList);
-//                } catch (IOException e) {
-//                    e.printStackTrace();
-//                }
-//                redisService.set(i.getTableid(),s);
-//            }
-//        });
-//        logger.info("----------------------数据中心点结束");
-//        logger.info("----------------------设备点开始");
-//        //缓存设备点
-//        if (!redisService.hasKey("WT")){
-//            Map<String,Map<String,Windturbinetestingpointai2>> wtaimap = new HashMap<>();
-//            List<Windturbine> windturbineList = windturbineService.list();
-//            windturbineList.stream().forEach(i->{
-//                Map<String,Windturbinetestingpointai2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windturbinetestingpointai2> qw = new QueryWrapper<>();
-//                qw.eq("windturbineid",i.getId());
-//                List<Windturbinetestingpointai2> windturbinetestingpointai2List = windturbinetestingpointai2Service.list(qw);
-//                windturbinetestingpointai2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                wtaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(wtaimap);
-//            redisService.set("WT",s);
-//        };
-//        logger.info("----------------------设备点结束");
-//        logger.info("----------------------线路点开始");
-//        //缓存线路点
-//        if (!redisService.hasKey("LN")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> lnaimap = new HashMap<>();
-//            List<Line> lineList = lineService.list();
-//            lineList.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i.getId());
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                lnaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(lnaimap);
-//            redisService.set("LN",s);
-//        };
-//        logger.info("----------------------线路点结束");
-//        logger.info("----------------------工程点开始");
-//        //缓存工程点
-//        if (!redisService.hasKey("PJ")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> pjaimap = new HashMap<>();
-//            List<Project> projectList = projectService.list();
-//            projectList.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i.getId());
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                pjaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(pjaimap);
-//            redisService.set("PJ",s);
-//        };
-//        logger.info("----------------------工程点结束");
-//        logger.info("----------------------场站点开始");
-//        //缓存场站点
-//        if (!redisService.hasKey("WP")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> wpaimap = new HashMap<>();
-//            List<Windpowerstation> wpList = windpowerstationService.list();
-//            List<String> wpids = wpList.stream().map(i -> i.getId()).collect(Collectors.toList());
-//            wpids.add("0");
-//            wpids.add("-1");
-//            wpids.add("-2");
-//            wpids.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i);
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                wpaimap.put(i,codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(wpaimap);
-//
-//            redisService.set("WP",s);
-//        };
-//        logger.info("----------------------场站点结束");
-//        logger.info("----------------------MODELPOWERRD表开始");
-//        if (!redisService.hasKey("MPRD")){
-//            List<Modelpowerrd> mordlist = modelpowerrdService.list();
-//            String s = JSONObject.toJSONString(mordlist);
-//            redisService.set("MPRD",s);
-//        }
-//        logger.info("----------------------MODELPOWERRD表结束");
+        List<Datacenter> datacenterList = datacenterService.list();
+
+        datacenterList.stream().forEach(i->{
+            if (!redisService.hasKey(i.getTableid())){
+                QueryWrapper<Datacenterpoint> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("tid",i.getTableid());
+                List<Datacenterpoint> realtimedataList = datacenterpointService.list(queryWrapper);
+                String s = null;
+                try {
+                    s = JSONUtil.objectToJson(realtimedataList);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                redisService.set(i.getTableid(),s);
+            }
+        });
+        logger.info("----------------------数据中心点结束");
+        logger.info("----------------------设备点开始");
+        //缓存设备点
+        if (!redisService.hasKey("WT")){
+            Map<String,Map<String,Windturbinetestingpointai2>> wtaimap = new HashMap<>();
+            List<Windturbine> windturbineList = windturbineService.list();
+            windturbineList.stream().forEach(i->{
+                Map<String,Windturbinetestingpointai2> codeaimap = new HashMap<>();
+                QueryWrapper<Windturbinetestingpointai2> qw = new QueryWrapper<>();
+                qw.eq("windturbineid",i.getId());
+                List<Windturbinetestingpointai2> windturbinetestingpointai2List = windturbinetestingpointai2Service.list(qw);
+                windturbinetestingpointai2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                wtaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(wtaimap);
+            redisService.set("WT",s);
+        };
+        logger.info("----------------------设备点结束");
+        logger.info("----------------------线路点开始");
+        //缓存线路点
+        if (!redisService.hasKey("LN")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> lnaimap = new HashMap<>();
+            List<Line> lineList = lineService.list();
+            lineList.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i.getId());
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                lnaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(lnaimap);
+            redisService.set("LN",s);
+        };
+        logger.info("----------------------线路点结束");
+        logger.info("----------------------工程点开始");
+        //缓存工程点
+        if (!redisService.hasKey("PJ")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> pjaimap = new HashMap<>();
+            List<Project> projectList = projectService.list();
+            projectList.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i.getId());
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                pjaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(pjaimap);
+            redisService.set("PJ",s);
+        };
+        logger.info("----------------------工程点结束");
+        logger.info("----------------------场站点开始");
+        //缓存场站点
+        if (!redisService.hasKey("WP")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> wpaimap = new HashMap<>();
+            List<Windpowerstation> wpList = windpowerstationService.list();
+            List<String> wpids = wpList.stream().map(i -> i.getId()).collect(Collectors.toList());
+            wpids.add("0");
+            wpids.add("-1");
+            wpids.add("-2");
+            wpids.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i);
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                wpaimap.put(i,codeaimap);
+            });
+            String s = JSONObject.toJSONString(wpaimap);
+
+            redisService.set("WP",s);
+        };
+        logger.info("----------------------场站点结束");
+        logger.info("----------------------MODELPOWERRD表开始");
+        if (!redisService.hasKey("MPRD")){
+            List<Modelpowerrd> mordlist = modelpowerrdService.list();
+            String s = JSONObject.toJSONString(mordlist);
+            redisService.set("MPRD",s);
+        }
+        logger.info("----------------------MODELPOWERRD表结束");
 
 
     }

+ 1 - 1
datacenter/src/main/java/com/gyee/datacenter/init/CacheContext.java

@@ -31,7 +31,7 @@ import java.util.Map;
 @Component
 public class CacheContext implements CommandLineRunner {
 
-    private static final Logger log = LoggerFactory.getLogger(ParameterComparisonService.class);
+    private static final Logger log = LoggerFactory.getLogger(CacheContext.class);
     @Autowired
     private RedisService redisService;
     @Autowired

+ 1 - 0
datacenter/src/main/java/com/gyee/datacenter/util/PageDTO.java

@@ -13,6 +13,7 @@ import lombok.Data;
 public class PageDTO {
     /**
      * 每页显示的条数
+     *
      */
     private int limit = 100;
 

+ 5 - 7
gradeevaluation/src/main/java/com/gyee/gradeevaluation/init/CacheContext.java

@@ -104,13 +104,11 @@ public class CacheContext implements CommandLineRunner {
         });
         lineList = lineService.list();
 
-
-
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","MHS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","NSS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","QS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","SBQ_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","XS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","MHS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","NSS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","QS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","SBQ_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","XS_FDC");
         log.info("-------------------------------缓存结束--------------------------------------");
     }
 }

+ 150 - 192
gradeevaluation/src/main/java/com/gyee/gradeevaluation/service/health/HealthReportService.java

@@ -1,5 +1,6 @@
 package com.gyee.gradeevaluation.service.health;
 
+import com.alibaba.druid.sql.visitor.functions.Concat;
 import com.alibaba.druid.support.json.JSONUtils;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.Query;
@@ -37,27 +38,14 @@ public class HealthReportService {
     @Resource
     private IWttragetreportmain3Service wttragetreportmain3Service;
     @Resource
-    private ICurvefittingmonthsubService curvefittingmonthsubService;
-    @Resource
     private ICurvefittingsubService curvefittingsubService;
     @Resource
-    private IWtreportsubService wtreportsubService;
-
-    @Resource
-    private IWindturbinecurvefittingService windturbinecurvefittingService;
-    @Resource
-    private IWindturbinecurvefittingmonthService windturbinecurvefittingmonthService;
-    @Resource
     private IWindturbinewindyawService windturbinewindyawService;
     @Resource
     private IWindturbinepoweryawService windturbinepoweryawService;
     @Resource
     private IInputoroutputspeedtotalService inputoroutputspeedtotalService;
     @Resource
-    private IJkbgbjyhService jkbgbjyhService;
-    @Resource
-    private IBjgltjbService bjgltjbService;
-    @Resource
     private IWttragetreportchartService wttragetreportchartService;
     @Resource
     private IEquipmentdayinfoService equipmentdayinfoService;
@@ -280,22 +268,22 @@ public class HealthReportService {
             healthReportVo.setGlfw("1500");
         }
         //对风偏差第三段
-        QueryWrapper<Windturbinepoweryaw> windturbinepoweryawQueryWrapper = new QueryWrapper<>();
-        windturbinepoweryawQueryWrapper.eq("windturbineid",wt.getId());
-        windturbinepoweryawQueryWrapper.ge("recorddate",monthFirst).le("recorddate",date);
-        List<Windturbinepoweryaw> windturbinepoweryaws = windturbinepoweryawService.list(windturbinepoweryawQueryWrapper);
-        if (windturbinepoweryaws!=null && windturbinepoweryaws.size()>0){
-            List<Double> collect = windturbinepoweryaws.stream().map(i -> i.getPower()).distinct().collect(Collectors.toList());
-            Collections.sort(collect);
-            String descriptiondfpcl="";
-            for (Double aDouble : collect) {
-                int hg = windturbinepoweryaws.stream().filter(i->i.getPower()==aDouble).mapToInt(Windturbinepoweryaw::getQualified).sum();
-                int bhg= windturbinepoweryaws.stream().filter(i->i.getPower()==aDouble).mapToInt(Windturbinepoweryaw::getUnqualified).sum();
-                int sum = hg + bhg;
-                descriptiondfpcl += ((sum!=0?bhg/sum*100:0)+"%,");
-            }
-            healthReportVo.setDescriptiondfpcl(descriptiondfpcl);
-        }
+//        QueryWrapper<Windturbinepoweryaw> windturbinepoweryawQueryWrapper = new QueryWrapper<>();
+//        windturbinepoweryawQueryWrapper.eq("windturbineid",wt.getId());
+//        windturbinepoweryawQueryWrapper.ge("recorddate",monthFirst).le("recorddate",date);
+//        List<Windturbinepoweryaw> windturbinepoweryaws = windturbinepoweryawService.list(windturbinepoweryawQueryWrapper);
+//        if (windturbinepoweryaws!=null && windturbinepoweryaws.size()>0){
+//            List<Double> collect = windturbinepoweryaws.stream().map(i -> i.getPower()).distinct().collect(Collectors.toList());
+//            Collections.sort(collect);
+//            String descriptiondfpcl="";
+//            for (Double aDouble : collect) {
+//                int hg = windturbinepoweryaws.stream().filter(i->i.getPower()==aDouble).mapToInt(Windturbinepoweryaw::getQualified).sum();
+//                int bhg= windturbinepoweryaws.stream().filter(i->i.getPower()==aDouble).mapToInt(Windturbinepoweryaw::getUnqualified).sum();
+//                int sum = hg + bhg;
+//                descriptiondfpcl += ((sum!=0?bhg/sum*100:0)+"%,");
+//            }
+//            healthReportVo.setDescriptiondfpcl(descriptiondfpcl);
+//        }
 
         //对风偏差图
         QueryWrapper<Windpowerdeviationrate> windpowerdeviationrateQueryWrapper = new QueryWrapper<>();
@@ -321,6 +309,22 @@ public class HealthReportService {
             });
             SortUtils.sort(dfpclpowers,"power",SortUtils.ASC);
             healthReportVo.setDfpclpowers(dfpclpowers);
+            String descriptiondfpcl="";
+            List<Double> collect = dfpclpowers.stream().map(i -> i.getDfpcl()).collect(Collectors.toList());
+
+
+            for(int i=0;i<collect.size();i++){
+                if (!wt.getModelid().contains("2000")){
+                    if (i==15){
+                        break;
+                    }
+                }
+                descriptiondfpcl+=(collect.get(i)+",");
+            }
+
+            descriptiondfpcl= descriptiondfpcl.substring(0,descriptiondfpcl.length()-1);
+
+            healthReportVo.setDescriptiondfpcl(descriptiondfpcl);
         }
         List<Windpowerdeviationrate> fsqxts = windpowerdeviationrates.stream().filter(deviationrate-> deviationrate.getType() == 1).collect(Collectors.toList());
 //        List<Windturbinewindyaw> fsqxts =windturbinewindyawService.getPowerDraw(wt.getId(),day);
@@ -343,6 +347,11 @@ public class HealthReportService {
             });
             SortUtils.sort(dfpclSpeeds,"speed",SortUtils.ASC);
             healthReportVo.setDfpclSpeeds(dfpclSpeeds);
+
+            healthReportVo.setDfpcl(dfpclSpeeds.stream().mapToDouble(DfpclSpeedVo::getDfpcl).average().getAsDouble());
+            healthReportVo.setThreedfpcl(dfpclSpeeds.stream().filter(i -> i.getSpeed() >= 3 && i.getSpeed() < 5).mapToDouble(DfpclSpeedVo::getDfpcl).average().getAsDouble());
+            healthReportVo.setFivedfpcl(dfpclSpeeds.stream().filter(i -> i.getSpeed() >= 5 && i.getSpeed() < 11).mapToDouble(DfpclSpeedVo::getDfpcl).average().getAsDouble());
+            healthReportVo.setElevendfpcl(dfpclSpeeds.stream().filter(i -> i.getSpeed() >= 11 && i.getSpeed() < 25).mapToDouble(DfpclSpeedVo::getDfpcl).average().getAsDouble());
         }
         QueryWrapper<Winddeviationrate> winddeviationrateQueryWrapper = new QueryWrapper<>();
         winddeviationrateQueryWrapper.eq("wtid",wt.getId());
@@ -424,91 +433,65 @@ public class HealthReportService {
             List<String> types = jkbgbjyhs.stream().map(i -> i.getPart()).collect(Collectors.toList());
             BjyhdbVo sj = new BjyhdbVo();
             sj.setForeignkeyid(wt.getId());
-            if (types.contains("传动链")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("传动链")).findFirst().get();
-                sj.setCdlcount(cdl.getCount());
-                sj.setCdltimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setCdlcount(0);
-                sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("测风系统")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("测风系统")).findFirst().get();
-                sj.setCfxtcount(cdl.getCount());
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setCfxtcount(0);
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("齿轮箱")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("齿轮箱")).findFirst().get();
-                sj.setClxcount(cdl.getCount());
-                sj.setClxtimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setClxcount(0);
-                sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("发电机")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("发电机")).findFirst().get();
-                sj.setFdjcount(cdl.getCount());
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setFdjcount(0);
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("变桨")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("变桨")).findFirst().get();
-                sj.setBjcount(cdl.getCount());
-                sj.setBjtimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setBjcount(0);
-                sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("机舱")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("机舱")).findFirst().get();
-                sj.setJccount(cdl.getCount());
-                sj.setJctimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setJccount(0);
-                sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("偏航")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("偏航")).findFirst().get();
-                sj.setPhcount(cdl.getCount());
-                sj.setPhtimes(DoubleUtils.getRoundingNum(cdl.getTimes(),0));
-            }else {
-                sj.setPhcount(0);
-                sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("塔底柜")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("塔底柜")).findFirst().get();
-                sj.setTdgcount(cdl.getCount());
-                sj.setTdgtimes(cdl.getTimes());
-            }else {
-                sj.setTdgcount(0);
-                sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
+            for (Reportdanger reportdanger: jkbgbjyhs){
+                String part = reportdanger.getPart();
+                if (part == null){
+                    continue;
+                }
+                if (part.contains("传动链")){
+                    sj.setCdlcount(reportdanger.getCount());
+                    sj.setCdltimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("测风系统")){
+                    sj.setCfxtcount(reportdanger.getCount());
+                    sj.setCfxttimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("齿轮箱")){
+                    sj.setClxcount(reportdanger.getCount());
+                    sj.setClxtimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("发电机")){
+                    sj.setFdjcount(reportdanger.getCount());
+                    sj.setFdjtimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("变桨")){
+                    sj.setBjcount(reportdanger.getCount());
+                    sj.setBjtimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("机舱")){
+                    sj.setJccount(reportdanger.getCount());
+                    sj.setJctimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("偏航")){
+                    sj.setPhcount(reportdanger.getCount());
+                    sj.setPhtimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
+                if (part.contains("塔底柜")){
+                    sj.setTdgcount(reportdanger.getCount());
+                    sj.setTdgtimes(DoubleUtils.getRoundingNum(reportdanger.getTimes(),0));
+                }
             }
             bjyhdbs.add(sj);
         }else{
             BjyhdbVo sj = new BjyhdbVo();
             sj.setForeignkeyid(wt.getId());
-                sj.setCdlcount(0);
-                sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setCfxtcount(0);
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
-
-                sj.setClxcount(0);
-                sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setFdjcount(0);
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setBjcount(0);
-                sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setJccount(0);
-                sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setPhcount(0);
-                sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setTdgcount(0);
-                sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setCdlcount(0);
+            sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setCfxtcount(0);
+            sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
+
+            sj.setClxcount(0);
+            sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setFdjcount(0);
+            sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setBjcount(0);
+            sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setJccount(0);
+            sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setPhcount(0);
+            sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setTdgcount(0);
+            sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
             bjyhdbs.add(sj);
         }
 //        List<Jkbgbjyh> jkbgbjyhsjz = jkbgbjyhService.getBjyhdbjz(wt.getWindpowerstationid(),day);
@@ -516,93 +499,67 @@ public class HealthReportService {
             List<String> types = jkbgbjyhs.stream().map(i -> i.getPart()).collect(Collectors.toList());
             BjyhdbVo sj = new BjyhdbVo();
             sj.setForeignkeyid("平均值");
-            if (types.contains("传动链")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("传动链")).findFirst().get();
-                sj.setCdlcount(cdl.getCountavg());
-                sj.setCdltimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setCdlcount(0);
-                sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("测风系统")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("测风系统")).findFirst().get();
-                sj.setCfxtcount(cdl.getCountavg());
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setCfxtcount(0);
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("齿轮箱")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("齿轮箱")).findFirst().get();
-                sj.setClxcount(cdl.getCountavg());
-                sj.setClxtimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setClxcount(0);
-                sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("发电机")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("发电机")).findFirst().get();
-                sj.setFdjcount(cdl.getCountavg());
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setFdjcount(0);
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("变桨")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("变桨")).findFirst().get();
-                sj.setBjcount(cdl.getCountavg());
-                sj.setBjtimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setBjcount(0);
-                sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("机舱")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("机舱")).findFirst().get();
-                sj.setJccount(cdl.getCountavg());
-                sj.setJctimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setJccount(0);
-                sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("偏航")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("偏航")).findFirst().get();
-                sj.setPhcount(cdl.getCountavg());
-                sj.setPhtimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setPhcount(0);
-                sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
-            }
-            if (types.contains("塔底柜")){
-                Reportdanger cdl = jkbgbjyhs.stream().filter(i -> i.getPart().contains("塔底柜")).findFirst().get();
-                sj.setTdgcount(cdl.getCountavg());
-                sj.setTdgtimes(DoubleUtils.getRoundingNum(cdl.getTimesavg(),0));
-            }else {
-                sj.setTdgcount(0);
-                sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
+            for (Reportdanger reportdanger: jkbgbjyhs){
+                String part = reportdanger.getPart();
+                if (part == null){
+                    continue;
+                }
+                if (part.contains("传动链")){
+                    sj.setCdlcount(reportdanger.getCountavg());
+                    sj.setCdltimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("测风系统")){
+                    sj.setCfxtcount(reportdanger.getCountavg());
+                    sj.setCfxttimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("齿轮箱")){
+                    sj.setClxcount(reportdanger.getCountavg());
+                    sj.setClxtimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("发电机")){
+                    sj.setFdjcount(reportdanger.getCountavg());
+                    sj.setFdjtimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("变桨")){
+                    sj.setBjcount(reportdanger.getCountavg());
+                    sj.setBjtimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("机舱")){
+                    sj.setJccount(reportdanger.getCountavg());
+                    sj.setJctimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("偏航")){
+                    sj.setPhcount(reportdanger.getCountavg());
+                    sj.setPhtimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
+                if (part.contains("塔底柜")){
+                    sj.setTdgcount(reportdanger.getCountavg());
+                    sj.setTdgtimes(DoubleUtils.getRoundingNum(reportdanger.getTimesavg(),0));
+                }
             }
             bjyhdbs.add(sj);
         }else{
             BjyhdbVo sj = new BjyhdbVo();
             sj.setForeignkeyid("平均值");
-                sj.setCdlcount(0);
-                sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setCfxtcount(0);
-                sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setClxcount(0);
-                sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setFdjcount(0);
-                sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
-                sj.setBjcount(0);
-                sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
-
-                sj.setJccount(0);
-                sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
-
-                sj.setPhcount(0);
-                sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
-
-                sj.setTdgcount(0);
-                sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setCdlcount(0);
+            sj.setCdltimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setCfxtcount(0);
+            sj.setCfxttimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setClxcount(0);
+            sj.setClxtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setFdjcount(0);
+            sj.setFdjtimes(DoubleUtils.getRoundingNum(0.0,0));
+            sj.setBjcount(0);
+            sj.setBjtimes(DoubleUtils.getRoundingNum(0.0,0));
+
+            sj.setJccount(0);
+            sj.setJctimes(DoubleUtils.getRoundingNum(0.0,0));
+
+            sj.setPhcount(0);
+            sj.setPhtimes(DoubleUtils.getRoundingNum(0.0,0));
+
+            sj.setTdgcount(0);
+            sj.setTdgtimes(DoubleUtils.getRoundingNum(0.0,0));
             bjyhdbs.add(sj);
         }
         healthReportVo.setBjyhdbs(bjyhdbs);
@@ -625,7 +582,8 @@ public class HealthReportService {
 //                i.setMeancount(yht2jz.stream().filter(j->j.getAlerttext().equals(i.getYhmx())).findFirst().get().getCount());
 //                i.setMeantimes(DoubleUtils.getRoundingNum(yht2jz.stream().filter(j->j.getAlerttext().equals(i.getYhmx())).findFirst().get().getTime(),2));
 //            });
-            SortUtils.sort(yhmxdbs,"part",SortUtils.ASC);
+            List<YhmxdbVo> yhmxdbVos = yhmxdbs.stream().filter(i -> StringUtils.isNotEmpty(i.getPart())).collect(Collectors.toList());
+            SortUtils.sort(yhmxdbVos,"part",SortUtils.ASC);
 
         }
         healthReportVo.setYhmxdbs(yhmxdbs);