Browse Source

健康管理接口开发修正

shilin 3 years ago
parent
commit
a1ba382b19

+ 24 - 0
src/main/java/com/gyee/frame/controller/health/HealthSubController.java

@@ -366,6 +366,30 @@ public class HealthSubController {
     }
 
 
+    @PostMapping("/getWtMttrandMtbfByBj")
+    @ResponseBody
+    @ApiOperation(value = "获取风机部件MTTR和MTBF  数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量", notes = "获取风机部件MTTR和MTBF 数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult getWtMttrandMtbfByBj(String wtId) throws Exception {
+
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            map = healthSubService.getWtMttrandMtbfByBj(wtId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
 
 
     @PostMapping("/findPowerChar")

+ 39 - 0
src/main/java/com/gyee/frame/service/ShutdowneventService.java

@@ -341,4 +341,43 @@ public class ShutdowneventService implements BaseService<Shutdownevent, Shutdown
 		return vos;
 
 	}
+
+
+	public List<Shutdownevent> queryStopWtByPart(String wtId) {
+
+		List<Shutdownevent> list=new ArrayList<>();
+
+		ShutdowneventExample example=new ShutdowneventExample();
+		example.setOrderByClause(" StopTime ASC");
+
+		ShutdowneventExample.Criteria criteria =example.createCriteria();
+
+		if(StringUtils.isNotEmpty(wtId))
+		{
+			criteria.andWindturbineidEqualTo(wtId);
+			criteria.andStoptypeidIsNotNull();
+			criteria.andStarttimeIsNotNull();
+			criteria.andStoptypeidNotEqualTo("wh");
+			criteria.andStoptypeidNotEqualTo("gzbmq");
+			criteria.andStoptypeidNotEqualTo("other");
+			criteria.andStoptypeidNotEqualTo("其它");
+
+			Calendar cal = Calendar.getInstance();
+			cal.set(Calendar.MONTH,0);
+			cal.set(Calendar.DAY_OF_MONTH,1);
+			cal.set(Calendar.HOUR_OF_DAY, 0);
+			cal.set(Calendar.MINUTE, 0);
+			cal.set(Calendar.SECOND, 0);
+			cal.set(Calendar.MILLISECOND, 0);
+			Date beginDate=cal.getTime();
+			cal.add(Calendar.YEAR,1);
+			Date endDate=cal.getTime();
+			criteria.andStoptimeGreaterThanOrEqualTo(beginDate).andStoptimeLessThanOrEqualTo(endDate);
+
+			list= shutdowneventMapper.selectByExample(example);
+		}
+
+		return list;
+
+	}
 }

+ 1 - 1
src/main/java/com/gyee/frame/service/health/HealthMainService.java

@@ -376,7 +376,7 @@ public class HealthMainService {
                 {
                     if(weathermap.containsKey("tqtp"))
                     {
-                        wpmap.put("tqyb", weathermap.get("tqtp"));
+                        wpmap.put("tqyb", Double.valueOf(String.valueOf(weathermap.get("tqtp"))));
                     }
                     if(weathermap.containsKey("fs"))
                     {

+ 286 - 100
src/main/java/com/gyee/frame/service/health/HealthSubService.java

@@ -53,13 +53,14 @@ public class HealthSubService {
 
     /**
      * 获取故障类型和风机健康得分
+     *
      * @param wtId
      * @return
      * @throws Exception
      */
-    public Map<String,String> findWtInfo(String wtId) throws Exception {
+    public Map<String, String> findWtInfo(String wtId) throws Exception {
 
-        Map<String,String> map=new HashMap<String,String>();
+        Map<String, String> map = new HashMap<String, String>();
         Calendar cal = Calendar.getInstance();
         cal.set(Calendar.HOUR_OF_DAY, 0);
         cal.set(Calendar.MINUTE, 0);
@@ -72,24 +73,22 @@ public class HealthSubService {
 
         if (StringUtils.notEmp(wtId)) {
 
-            List<Statejudgmentrecord2>  sdls = statejudgmentrecord2Service.findStatejudgmentrecord2(wtId);
+            List<Statejudgmentrecord2> sdls = statejudgmentrecord2Service.findStatejudgmentrecord2(wtId);
 
-            if(!sdls.isEmpty())
-            {
-                Statejudgmentrecord2 stpo=sdls.get(0);
+            if (!sdls.isEmpty()) {
+                Statejudgmentrecord2 stpo = sdls.get(0);
 
-                map.put("top1type",stpo.getPart1());
-                map.put("top2type",stpo.getPart2());
-                map.put("top3type",stpo.getPart3());
-            }else
-            {
-                map.put("top1type","");
-                map.put("top2type","");
-                map.put("top3type","");
+                map.put("top1type", stpo.getPart1());
+                map.put("top2type", stpo.getPart2());
+                map.put("top3type", stpo.getPart3());
+            } else {
+                map.put("top1type", "");
+                map.put("top2type", "");
+                map.put("top3type", "");
             }
 
 
-            double score=getWtScore(wtId);
+            double score = getWtScore(wtId);
             map.put("wtscore", String.valueOf(StringUtils.round(score, 2)));
 
         }
@@ -101,16 +100,16 @@ public class HealthSubService {
 
     private double getWtScore(String wtId) throws Exception {
 
-        double score=0.0;
-        if(StringUtils.notEmp(wtId))
-        {
-            String pointid= windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FJJKZZ).getId();
-            PointData po=realApiUtil.getRealData(pointid);
-            score=po.getPointValueInDouble();
+        double score = 0.0;
+        if (StringUtils.notEmp(wtId)) {
+            String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FJJKZZ).getId();
+            PointData po = realApiUtil.getRealData(pointid);
+            score = po.getPointValueInDouble();
 
         }
         return score;
     }
+
     /**
      * 获取健康管理风机部件基础信息
      *
@@ -210,14 +209,14 @@ public class HealthSubService {
             smlv = 100;
         }
 
-        clxmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.98)));
-        fdjmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.95)));
-        bjmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.96)));
-        zkmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.97)));
-        zzmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.91)));
-        phmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.94)));
-        jcmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.93)));
-        bpqmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv*0.92)));
+        clxmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.98)));
+        fdjmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.95)));
+        bjmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.96)));
+        zkmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.97)));
+        zzmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.91)));
+        phmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.94)));
+        jcmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.93)));
+        bpqmap.put("smsyl", String.valueOf(MathUtil.twoBit(smlv * 0.92)));
 
         int fjsmlv = new BigDecimal(totalscore).divide(new BigDecimal(32), 0, RoundingMode.HALF_EVEN).intValue();
 
@@ -255,6 +254,7 @@ public class HealthSubService {
 
     /**
      * 故障数据统计
+     *
      * @param wtId
      * @param recodedate
      * @return
@@ -289,6 +289,7 @@ public class HealthSubService {
 
     /**
      * 预警数据统计
+     *
      * @param wtId
      * @param recodedate
      * @return
@@ -323,6 +324,7 @@ public class HealthSubService {
 
     /**
      * 部件运行数据
+     *
      * @param wtId
      * @param recodedate
      * @return
@@ -382,11 +384,12 @@ public class HealthSubService {
 
     /**
      * 获得日、月等级评估
+     *
      * @param cal
      * @param wtId
      * @return
      */
-    public List<XnfxVo> initalXnfx(String wtId,Calendar cal) {
+    public List<XnfxVo> initalXnfx(String wtId, Calendar cal) {
 
         List<XnfxVo> ls = new ArrayList<XnfxVo>();
 
@@ -430,6 +433,7 @@ public class HealthSubService {
 
     /**
      * 获得当日停机事件
+     *
      * @param wtId
      * @return
      */
@@ -455,6 +459,7 @@ public class HealthSubService {
 
     /**
      * 获得健康评价列表
+     *
      * @param wtId
      * @return
      * @throws Exception
@@ -504,20 +509,20 @@ public class HealthSubService {
     }
 
     private void setScoreValue(String str, ValueVo vo1) {
-        if(str.equals("1"))
-        {
+        if (str.equals("1")) {
             vo1.setValue("进行扣分处理!");
-        }else {
+        } else {
             vo1.setValue("未扣分!");
         }
     }
 
     /**
      * 各个区间曲线偏差率
+     *
      * @param wtId
      * @return
      */
-    public List<QxpcVo> findQxpcList(String wtId)  {
+    public List<QxpcVo> findQxpcList(String wtId) {
 
         List<QxpcVo> ls = new ArrayList<QxpcVo>();
         Map<String, List<Curvefittingsub>> cfmap = new HashMap<>();
@@ -525,14 +530,14 @@ public class HealthSubService {
         cal.add(Calendar.DAY_OF_MONTH, -1);
         if (StringUtils.notEmp(wtId)) {
 
-            Windturbine wt=InitialRunner.wtmap.get(wtId);
-            QxpcVo vo=new QxpcVo();
-            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId,3.0,5.0);
-            double qxpc1=curvefittingsubService.getNuberValue(cfmap, wt);
-            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId,5.0,11.0);
-            double qxpc2=curvefittingsubService.getNuberValue(cfmap, wt);
-            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId,11.0,25.0);
-            double qxpc3=curvefittingsubService.getNuberValue(cfmap, wt);
+            Windturbine wt = InitialRunner.wtmap.get(wtId);
+            QxpcVo vo = new QxpcVo();
+            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId, 3.0, 5.0);
+            double qxpc1 = curvefittingsubService.getNuberValue(cfmap, wt);
+            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId, 5.0, 11.0);
+            double qxpc2 = curvefittingsubService.getNuberValue(cfmap, wt);
+            cfmap = curvefittingsubService.findCurvefittingmapByDate(cal.getTime(), wtId, 11.0, 25.0);
+            double qxpc3 = curvefittingsubService.getNuberValue(cfmap, wt);
             vo.setQxpc1(qxpc1);
             vo.setQxpc2(qxpc2);
             vo.setQxpc3(qxpc3);
@@ -545,19 +550,20 @@ public class HealthSubService {
 
     /**
      * 温度范围
+     *
      * @param wtId
      * @return
      */
-    public List<YxfxVo> findWdList(String wtId)  {
+    public List<YxfxVo> findWdList(String wtId) {
 
         List<Parttemperaturesub> ls = new ArrayList<Parttemperaturesub>();
-        List<YxfxVo> vos=new ArrayList<>();
+        List<YxfxVo> vos = new ArrayList<>();
         Calendar cal = Calendar.getInstance();
         Date recodedate = DateUtils.truncate(cal.getTime());
         if (StringUtils.notEmp(wtId)) {
 
-            ls = parttemperaturesubService.getParttemperaturesubListBywtId( wtId,recodedate);
-            vos=parttemperaturesubService.getListValue(ls);
+            ls = parttemperaturesubService.getParttemperaturesubListBywtId(wtId, recodedate);
+            vos = parttemperaturesubService.getListValue(ls);
         }
 
 
@@ -567,11 +573,12 @@ public class HealthSubService {
     /**********************************************风机明细页面*****************************************************/
     /**
      * 获得等级评估前5数据
+     *
      * @param wtId
      * @return
      * @throws Exception
      */
-    public  Map<String, Object>  gadaytop5(String wtId) throws Exception {
+    public Map<String, Object> gadaytop5(String wtId) throws Exception {
 
 
         Calendar cal = Calendar.getInstance();
@@ -583,41 +590,37 @@ public class HealthSubService {
         Date beginDate = cal.getTime();
 
 
-        List<Daylygradeassessmentmain2> ls = daylygradeassessmentmain2Service.getDaylygradeassessmentmain2ListBywtId(wtId, beginDate,endDate);
+        List<Daylygradeassessmentmain2> ls = daylygradeassessmentmain2Service.getDaylygradeassessmentmain2ListBywtId(wtId, beginDate, endDate);
         Map<String, Object> map = new HashMap<String, Object>();
-        int num=1;
-        for(Daylygradeassessmentmain2 top:ls)
-        {
-            if(num<=5)
-            {
-                String[] str=new String[5];
-                str[0]=String.valueOf(top.getId());
-                str[1]=DateUtils.format(top.getRecorddate());
-                str[2]=String.valueOf(top.getModlevel());
-                str[3]=String.valueOf(top.getWpid());
-                str[4]=String.valueOf(top.getWtid());
+        int num = 1;
+        for (Daylygradeassessmentmain2 top : ls) {
+            if (num <= 5) {
+                String[] str = new String[5];
+                str[0] = String.valueOf(top.getId());
+                str[1] = DateUtils.format(top.getRecorddate());
+                str[2] = String.valueOf(top.getModlevel());
+                str[3] = String.valueOf(top.getWpid());
+                str[4] = String.valueOf(top.getWtid());
                 map.put(String.valueOf(num), str);
                 num++;
-            }else
-            {
+            } else {
                 break;
             }
         }
 
 
-
-
         return map;
     }
 
     /**
      * 获取最新的十次停机事件
+     *
      * @param wtId
      * @return
      */
-    public List<ShutdowneventVo> queryStopTop10(String wtId){
+    public List<ShutdowneventVo> queryStopTop10(String wtId) {
 
-        List<ShutdowneventVo> vos=shutdowneventService.queryStopTop10(wtId);
+        List<ShutdowneventVo> vos = shutdowneventService.queryStopTop10(wtId);
 
 
         return vos;
@@ -625,6 +628,7 @@ public class HealthSubService {
 
     /**
      * 获得实际功率和理论功率曲线
+     *
      * @param wtId
      * @return
      * @throws Exception
@@ -660,7 +664,7 @@ public class HealthSubService {
 
         WindTurbineTestingPointAi2 sjgl = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.TPOINT_WT_FJGL);
 
-        List<PointData> sjglls = realApiUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24*3600L);
+        List<PointData> sjglls = realApiUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24 * 3600L);
 
         if (!sjglls.isEmpty()) {
             for (int i = 0; i < sjglls.size() - 1; i++) {
@@ -669,7 +673,7 @@ public class HealthSubService {
         }
         WindTurbineTestingPointAi2 llgl = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.TPOINT_WT_LLGL);
 
-        List<PointData> llglls = realApiUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24*3600L);
+        List<PointData> llglls = realApiUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24 * 3600L);
 
         if (!llglls.isEmpty()) {
             for (int i = 0; i < llglls.size() - 1; i++) {
@@ -679,7 +683,7 @@ public class HealthSubService {
 
         WindTurbineTestingPointAi2 ssfs = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.TPOINT_WT_FJSSFS);
 
-        List<PointData> ssfsls = realApiUtil.getHistoryDatasSnap(ssfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24*3600L);
+        List<PointData> ssfsls = realApiUtil.getHistoryDatasSnap(ssfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24 * 3600L);
 
         if (!ssfsls.isEmpty()) {
             for (int i = 0; i < ssfsls.size() - 1; i++) {
@@ -697,37 +701,218 @@ public class HealthSubService {
         return resultmap;
     }
 
+    /**
+     * 数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量
+     * @param wtId
+     * @return获取风机部件MTTR和MTBF
+     * @throws Exception
+     */
+    public Map<String, Object> getWtMttrandMtbfByBj(String wtId) throws Exception {
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        String[] clxstrs = new String[8];
+        String[] fdjstrs = new String[8];
+        String[] bjstrs = new String[8];
+        String[] zkstrs = new String[8];
+
+        String[] zzstrs = new String[8];
+        String[] phstrs = new String[8];
+        String[] jcstrs = new String[8];
+        String[] bpqstrs = new String[8];
+
+        // 获得风机健康状态结果数组
+        String[] jkpoints = new String[4];
+
+        WindTurbineTestingPointAi2 clx = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.CLXJKZT);
+        WindTurbineTestingPointAi2 fdj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FDJJKZT);
+        WindTurbineTestingPointAi2 bj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.BJJKZT);
+        WindTurbineTestingPointAi2 zk = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.ZKJKZT);
+
+        jkpoints[0] = clx.getId();
+        jkpoints[1] = fdj.getId();
+        jkpoints[2] = bj.getId();
+        jkpoints[3] = zk.getId();
+
+        DNAVal[] ssjkvalues = realApiUtil.getRealtimeTagValues(jkpoints);
+
+        clxstrs[0] = String.valueOf(ssjkvalues[0].DValue);
+        fdjstrs[0] = String.valueOf(ssjkvalues[1].DValue);
+        bjstrs[0] = String.valueOf(ssjkvalues[2].DValue);
+        zkstrs[0] = String.valueOf(ssjkvalues[3].DValue);
+
+        zzstrs[0] = "1.0";
+        phstrs[0] = "1.0";
+        jcstrs[0] = "1.0";
+        bpqstrs[0] = "1.0";
+
+        StringBuilder clxsb = new StringBuilder();
+        StringBuilder fdjsb = new StringBuilder();
+        StringBuilder bjsb = new StringBuilder();
+        StringBuilder zksb = new StringBuilder();
+        Calendar cal = Calendar.getInstance();
+
+        cal.add(Calendar.DAY_OF_MONTH, -7);
+        for (int i = 0; i < 7; i++) {
+            int recodeDate = new BigDecimal(cal.getTime().getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).intValue();
+            DNAVal[] jkvalues = realApiUtil.getHistMatrix(jkpoints, recodeDate);
+            clxsb.append(jkvalues[0].DValue).append(",");
+            fdjsb.append(jkvalues[1].DValue).append(",");
+            bjsb.append(jkvalues[2].DValue).append(",");
+            zksb.append(jkvalues[3].DValue).append(",");
+            cal.add(Calendar.DAY_OF_MONTH, 1);
+        }
+        String clxchart = clxsb.substring(0, clxsb.length() - 1);
+        String fdjchart = fdjsb.substring(0, fdjsb.length() - 1);
+        String bjchart = bjsb.substring(0, bjsb.length() - 1);
+        String zkchart = zksb.substring(0, zksb.length() - 1);
+
+        clxstrs[2] = String.valueOf(clxchart);
+        fdjstrs[2] = String.valueOf(fdjchart);
+        bjstrs[2] = String.valueOf(bjchart);
+        zkstrs[2] = String.valueOf(zkchart);
+
+        zzstrs[2] = "4,4,4,4,4,4,4";
+        phstrs[2] = "4,4,4,4,4,4,4";
+        jcstrs[2] = "4,4,4,4,4,4,4";
+        bpqstrs[2] = "4,4,4,4,4,4,4";
+
+
+
+        clxstrs[1] = "齿轮箱";
+        fdjstrs[1] = "发电机";
+        bjstrs[1] = "变桨";
+        zkstrs[1] = "主控";
+
+        zzstrs[1] = "液压";
+        phstrs[1] = "偏航";
+        jcstrs[1] = "机舱";
+        bpqstrs[1] ="变桨";
+
+
+        if (StringUtils.notEmp(wtId)) {
+            List<Shutdownevent> selist = shutdowneventService.queryStopWtByPart(wtId);
+            Map<String, List<Shutdownevent>> semap = new HashMap<>();
+
+            if (!selist.isEmpty()) {
+                for (Shutdownevent se : selist) {
+                    if (semap.containsKey(se.getStoptypeid())) {
+                        List<Shutdownevent> sels = semap.get(se.getStoptypeid());
+                        sels.add(se);
+                        semap.put(se.getStoptypeid(), sels);
+                    } else {
+                        List<Shutdownevent> sels = new ArrayList<>();
+                        sels.add(se);
+                        semap.put(se.getStoptypeid(), sels);
+                    }
+                }
+
+                clxstrs =getPartInfo(semap,  "clx", clxstrs);
+                fdjstrs = getPartInfo(semap, "fdj",  fdjstrs);
+                bjstrs = getPartInfo(semap, "bj",  bjstrs);
+                zkstrs = getPartInfo(semap, "zz",  zkstrs);
+
+                zzstrs = getPartInfo(semap, "yy",  zzstrs);
+                phstrs = getPartInfo(semap, "ph",  phstrs);
+                jcstrs = getPartInfo(semap, "jc",  jcstrs);
+                bpqstrs = getPartInfo(semap, "bpq", bpqstrs);
+
+            }
+        }
+
+
+        map.put("clx", clxstrs);
+        map.put("fdj", fdjstrs);
+        map.put("bj", bjstrs);
+        map.put("zk", zkstrs);
+        map.put("zz", zzstrs);
+        map.put("ph", phstrs);
+        map.put("jc", jcstrs);
+        map.put("bpq", bpqstrs);
+        return map;
+    }
+
+    private String[] getPartInfo(Map<String, List<Shutdownevent>> semap, String type, String[] strs) {
+
+        Calendar c = Calendar.getInstance();
+        int days=c.get(Calendar.DAY_OF_YEAR);
+        double yearhours=24*days;
+
+        if(semap.containsKey(type))
+        {
+
+            List<Shutdownevent> sels =semap.get(type);
+            int num=sels.size();
+
+            double stophours=0.0;
+            double losspowers=0.0;
+            Date fristStopTime=null;
+            for(Shutdownevent se:sels)
+            {
+                fristStopTime=se.getStoptime();
+                stophours=stophours+se.getStophours();
+                losspowers=losspowers+se.getLosspower();
+            }
+            double runhours=yearhours-stophours;
+            double mtbf = new BigDecimal(runhours).divide(new BigDecimal(num), 2, RoundingMode.HALF_EVEN).doubleValue();
+            double mttr = new BigDecimal(stophours).divide(new BigDecimal(num), 2, RoundingMode.HALF_EVEN).doubleValue();
+            double loss = new BigDecimal(losspowers).divide(new BigDecimal(num), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+            if(null!=fristStopTime && mtbf!=0)
+            {
+                //最近一次故障距离当前时间
+                double jldqsj = DateUtils.hoursDiff(fristStopTime, new Date());//剩余时间
+
+                double gzjd = new BigDecimal(jldqsj).divide(new BigDecimal(mtbf), 2, RoundingMode.HALF_EVEN).doubleValue();
+                strs[3]=String.valueOf(gzjd);
+            }
+
+            strs[4]=String.valueOf(mtbf);
+            strs[5]=String.valueOf(mttr);
+            strs[6]=String.valueOf(loss);
+        }else
+        {
+            strs[3]=String.valueOf(0.0);
+            strs[4]=String.valueOf(yearhours);
+            strs[5]=String.valueOf(0.0);
+            strs[6]=String.valueOf(0.0);
+        }
+        return strs;
+    }
+
     /**********************************************风机明细页面*****************************************************/
+
+
     /**********************************************风机健康曲线*****************************************************/
     /**
      * 获取风机、部件健康状态图表
+     *
      * @param wtId
      * @param beginDate
      * @param endDate
      * @return
      * @throws Exception
      */
-    public ActivityVo hsFjValueIndex(String wtId,Date beginDate,Date endDate) throws Exception {
+    public ActivityVo hsFjValueIndex(String wtId, Date beginDate, Date endDate) throws Exception {
 
         ActivityVo vo = null;
-        long num=96;
-        long step=900;
-
-        int length=DateUtils.daysDiff(beginDate, endDate);
-
-        if(length>30)
-        {
-            num=length;
-            step=3600*24;
-        }else if(length>=15 && length<30){
-            num=length*2;
-            step=3600*12;
-        }else if(length>=7 && length<15){
-            num=length*4;
-            step=3600*6;
-        }else if(length>=3 && length<7){
-            num=length*8;
-            step=3600*3;
+        long num = 96;
+        long step = 900;
+
+        int length = DateUtils.daysDiff(beginDate, endDate);
+
+        if (length > 30) {
+            num = length;
+            step = 3600 * 24;
+        } else if (length >= 15 && length < 30) {
+            num = length * 2;
+            step = 3600 * 12;
+        } else if (length >= 7 && length < 15) {
+            num = length * 4;
+            step = 3600 * 6;
+        } else if (length >= 3 && length < 7) {
+            num = length * 8;
+            step = 3600 * 3;
         }
         vo = getWTChart(wtId, beginDate, endDate, num, step);
 
@@ -741,11 +926,11 @@ public class HealthSubService {
         List<DatasetsVo> datasets = new ArrayList<DatasetsVo>();
 
 
-        WindTurbineTestingPointAi2 fj =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FJJKZZ);
-        WindTurbineTestingPointAi2 clx =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.CLXJKJL);
-        WindTurbineTestingPointAi2 fdj =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FDJJKJL);
-        WindTurbineTestingPointAi2 kzys =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.BJJKJL);
-        WindTurbineTestingPointAi2 jcxt =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.ZKJKJL);
+        WindTurbineTestingPointAi2 fj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FJJKZZ);
+        WindTurbineTestingPointAi2 clx = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.CLXJKJL);
+        WindTurbineTestingPointAi2 fdj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FDJJKJL);
+        WindTurbineTestingPointAi2 kzys = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.BJJKJL);
+        WindTurbineTestingPointAi2 jcxt = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.ZKJKJL);
 
 
         if (null != fj) {
@@ -923,21 +1108,22 @@ public class HealthSubService {
 
     /**
      * 获取风机以及部件的健康历史
+     *
      * @param wtId
      * @return
      */
-    public Map<String,Object> findWtHisValueForBj(String wtId) {
-        Map<String,Object> mapstatus = new HashMap();
+    public Map<String, Object> findWtHisValueForBj(String wtId) {
+        Map<String, Object> mapstatus = new HashMap();
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         Map<String, Windturbine> wtmap = InitialRunner.wtmap;
         //String wtName = wtmap.get(wtId).getName();
 
-        WindTurbineTestingPointAi2 fj =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FJJKZT);
-        WindTurbineTestingPointAi2 clx =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.CLXJKZT);
-        WindTurbineTestingPointAi2 fdj =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FDJJKZT);
-        WindTurbineTestingPointAi2 bj =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.BJJKZT);
-        WindTurbineTestingPointAi2 zk =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.ZKJKZT);
+        WindTurbineTestingPointAi2 fj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FJJKZT);
+        WindTurbineTestingPointAi2 clx = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.CLXJKZT);
+        WindTurbineTestingPointAi2 fdj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.FDJJKZT);
+        WindTurbineTestingPointAi2 bj = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.BJJKZT);
+        WindTurbineTestingPointAi2 zk = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.ZKJKZT);
 
         // 时间 目前当天0点开始
         Calendar cl = Calendar.getInstance();
@@ -1041,6 +1227,6 @@ public class HealthSubService {
         mapstatus.put("name", namels);
         mapstatus.put("time", tList);
 
-      return mapstatus;
+        return mapstatus;
     }
 }

+ 2 - 2
src/main/java/com/gyee/frame/service/websocket/WtInfoPushService.java

@@ -872,8 +872,8 @@ public class WtInfoPushService {
                 if(InitialRunner.mlmap.containsKey(wt.getModelid()))
                 {
                     Equipmentmodel model=InitialRunner.mlmap.get(wt.getModelid());
-
-                    jcls.add(new String[]{"装机容量","","ai",String.valueOf(model.getPowerproduction())});
+                    jczbmap.put("zjrl",model.getPowerproduction());
+                  //  jczbmap.add(new String[]{"装机容量","","ai",String.valueOf(model.getPowerproduction())});
                 }
 
                 map.put("jczbmap", jczbmap);

+ 2 - 2
src/test/java/test/HealthTest.java

@@ -38,7 +38,7 @@ public class HealthTest {
 //        Map<String, Object> map =healthMainController.findAllMap();
 ////
 ////
-////        System.out.println(map);
+//        System.out.println(map);
 //
 //        Map<String, Object> map1 =healthMainController.findWpMap("MHS_FDC");
 
@@ -79,7 +79,7 @@ public class HealthTest {
 //        System.out.println(map1.size());
 
 
-        Map<String, Object> map1 =healthSubController.findWtHisValueForBj(wtid);
+        Map<String, Object> map1 =healthSubController.getWtMttrandMtbfByBj(wtid);
         System.out.println(map1.size());
         System.out.println("***************************************************************************************");