Kaynağa Gözat

风机绩效表明细风能利用率修改

shilin 3 yıl önce
ebeveyn
işleme
3fd0221700

+ 1 - 1
src/main/java/com/gyee/frame/common/websocket/WebsocketMessageService.java

@@ -17,7 +17,7 @@ public class WebsocketMessageService
     public void SendAlertToAll(String destination, Object sendData)
     {
         String s = JSON.toJSONString(sendData);
-        System.out.println(s);
+//        System.out.println(s);
         simpMessagingTemplate.convertAndSend(destination, s);
     }
 }

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

@@ -139,7 +139,7 @@ public class RecommenmainMsSqlService implements BaseService<RecommenmainMsSql,
 
 		List<WoBugEqVo> list=new ArrayList<>();
 
-		if (StringUtils.notEmp(wpId) && StringUtils.notEmp(wtId) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+		if ( StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
 
 
 			list= recommenmainMsSqlMapper.unfinishedList(wpId,wtId, beginDate, endDate);
@@ -154,7 +154,7 @@ public class RecommenmainMsSqlService implements BaseService<RecommenmainMsSql,
 
 		List<WoBugEqVo> list=new ArrayList<>();
 
-		if (StringUtils.notEmp(wpId) && StringUtils.notEmp(wtId) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+		if (StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
 
 
 			list= recommenmainMsSqlMapper.finishedList(wpId,wtId, beginDate, endDate);

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

@@ -143,7 +143,7 @@ public class WarningInfoDayService implements BaseService<WarningInfoDay, Warnin
 			order=" frequencyday desc";
 		}
 		PageHelper.startPage(0, 10);
-		list =warningInfoDayMapper.getWarningInfoDayByWarningid(beginDate, endDate,order);
+		list =warningInfoDayMapper.getWarningInfoDayByWarningClassify(beginDate, endDate,order);
 		PageInfo<SawVo> pageInfo = new PageInfo<SawVo>(list);
 		return list;
 

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

@@ -0,0 +1,112 @@
+package com.gyee.frame.service.health;
+
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.WindTurbineTestingPointAi2;
+import com.gyee.frame.model.auto.Windpowerstation;
+import com.gyee.frame.model.auto.Windturbine;
+import com.gyee.frame.model.custom.PointData;
+import com.gyee.frame.service.WindTurbineTestingPointAiService;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.golden.EdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+@Service
+public class HealthMainService {
+
+    @Resource
+    private WindTurbineTestingPointAiService windTurbineTestingPointAiService;
+
+    IRealTimeDataBaseUtil realApiUtil = new EdosUtil();
+    private final int digit = 2;
+    public Map<String, Object> findHealthMatrix() throws Exception {
+
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        for (Windpowerstation wp:InitialRunner.wpls) {
+
+
+
+                int ysl = 0;// 优数量
+                int lsl = 0;// 良数量
+                int csl = 0;// 差数量
+
+                List<String[]> wtIdls = new ArrayList<String[]>();// 风机编号集合
+
+                List<Windturbine> wtls = InitialRunner.wp_wtmap.get(wp.getId());
+
+
+                String[] jkpoints = new String[wtls.size()];
+                String[] ztpoints = new String[wtls.size()];
+
+                // 获得训练参数对象
+                for (int x = 0; x < wtls.size(); x++) {
+
+                    Windturbine wt=wtls.get(x);
+
+                    WindTurbineTestingPointAi2 jkztpoint =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(),Constant.FJJKZZ);
+                    jkpoints[x] = jkztpoint.getId();
+                    WindTurbineTestingPointAi2 fjztpoint =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(),Constant.FJZT);
+                    ztpoints[x] = fjztpoint.getId();
+
+                }
+
+                // 获得风机健康状态结果数组
+                List<PointData> jkvalues = realApiUtil.getRealData(jkpoints);
+                // 获得风机实时状态结果数组
+                List<PointData> ztvalues = realApiUtil.getRealData(ztpoints);
+
+
+                Calendar cal2 = Calendar.getInstance();
+                Date end = cal2.getTime();
+                cal2.add(Calendar.DAY_OF_MONTH, -1);
+                Date begin = cal2.getTime();
+                for (int x = 0; x < wtls.size(); x++) {
+                    String wtId = wtls.get(x).getId();
+                    double jk = jkvalues.get(x).getPointValueInDouble();
+                    double zt = ztvalues.get(x).getPointValueInDouble();
+
+
+                    if (zt == 2.0) {
+
+                        String[] str = new String[2];
+                        str[0] = wtId;
+                        str[1] = "3";
+                        wtIdls.add(str);
+                        csl++;
+                    } else {
+                        String[] str = new String[2];
+                        if (jk >= 60) {
+                            str[0] = wtId;
+                            str[1] = "1";
+                            wtIdls.add(str);
+                            ysl++;
+                        } else if (jk < 60  && jk >= 30) {
+                            str[0] = wtId;
+                            str[1] = "2";
+                            wtIdls.add(str);
+                            lsl++;
+                        } else {
+                            str[0] = wtId;
+                            str[1] = "3";
+                            wtIdls.add(str);
+                            csl++;
+                        }
+
+                    }
+
+                }
+
+                map.put(wp.getId() + "_csl", csl);
+                map.put(wp.getId() + "_lsl", lsl);
+                map.put(wp.getId() + "_ysl", ysl);
+                map.put(wp.getId() + "_wtIdls", wtIdls);
+
+        }
+
+        return map;
+    }
+}

+ 13 - 4
src/main/resources/mybatis/auto/RecommenmainMsSqlMapper.xml

@@ -463,16 +463,25 @@
     SELECT c.WFSHORTNAME,c.WFNAME,a.WTID,b.PRODTDEPTTIME,b.DEPARTURETIME,a.REASON,b.STATUS,a.RID,a.OPERATIONDATE,a.ISMAIN
     FROM  RECOMMENMAIN a left join WOBUGEQ b on a.wobugid=b.bugnum left join  WINDFARM c on a.wpnum=c.wfnum  where a.OPERATIONDATE IS NOT null
     AND (b.STATUS!='流程关闭' OR b.STATUS IS NULL)
-    and c.WFSHORTNAME=#{wpId}
-    and a.WTID=#{wtId}
+    <if test="wpId!=null &amp;&amp; wpId.trim()!=''">
+      and c.WFSHORTNAME=#{wpId}
+    </if>
+    <if test="wtId!=null &amp;&amp; wtId.trim()!=''">
+      and a.WTID=#{wtId}
+    </if>
     and a.OPERATIONDATE >= #{beginDate} and a.OPERATIONDATE &lt; #{endDate}
   </select>
 
   <select id="finishedList"  resultType="com.gyee.frame.model.custom.WoBugEqVo">
     SELECT  c.WFSHORTNAME,c.WFNAME,a.WTID,b.PRODTDEPTTIME,b.DEPARTURETIME,a.REASON,b.REPAIREDCOMMENT,a.RID,a.OPERATIONDATE,a.ISMAIN
     FROM  RECOMMENMAIN a left join WOBUGEQ b on a.wobugid=b.bugnum left join  WINDFARM c on a.wpnum=c.wfnum  where  a.ISMAIN='是' AND b.STATUS='流程关闭'
-    and c.WFSHORTNAME=#{wpId}
-    and a.WTID=#{wtId}
+    <if test="wpId!=null &amp;&amp; wpId.trim()!=''">
+      and c.WFSHORTNAME=#{wpId}
+    </if>
+    <if test="wtId!=null &amp;&amp; wtId.trim()!=''">
+      and a.WTID=#{wtId}
+    </if>
+
     and a.OPERATIONDATE >= #{beginDate} and a.OPERATIONDATE &lt; #{endDate}
   </select>
 </mapper>

+ 2 - 2
src/main/resources/mybatis/auto/WarningInfoDayMapper.xml

@@ -414,8 +414,8 @@
 
     SELECT    SUM(WarningInfoDay.frequencyDay) AS frequencyday, SUM(WarningInfoDay.totalhoursDay) AS totalhoursday, WarningClassify.name
     FROM (SELECT  * FROM WarningInfoDay WHERE
-    WarningInfoDay.recordDate>= #{beginDate} AND WarningInfoDay.recordDate &lt; #{endDate}
-    WarningInfoDay LEFT JOIN Warning2 ON WarningInfoDay.warningId = Warning2.id RIGHT JOIN WarningClassify ON Warning2.warningClassifyId = WarningClassify.id
+    WarningInfoDay.recordDate>= #{beginDate} AND WarningInfoDay.recordDate &lt; #{endDate} )
+    WarningInfoDay LEFT JOIN Warning2 ON WarningInfoDay.warningId = Warning2.id LEFT JOIN WarningClassify ON Warning2.warningClassifyId = WarningClassify.id
     GROUP BY WarningClassify.name  order by  ${order}
 
   </select>

+ 59 - 0
src/test/java/test/HealthTest.java

@@ -0,0 +1,59 @@
+package test;
+
+import com.gyee.SpringbootStart;
+import com.gyee.frame.common.spring.SpringUtils;
+import com.gyee.frame.service.health.HealthMainService;
+import lombok.SneakyThrows;
+import org.springframework.boot.SpringApplication;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class HealthTest {
+
+    @SneakyThrows
+    public static void main(String[] args) {
+
+        SpringApplication.run(SpringbootStart.class, args);
+
+
+        Calendar c = Calendar.getInstance();
+
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        c.set(Calendar.MILLISECOND, 0);
+        c.set(Calendar.DAY_OF_MONTH,24);
+        c.set(Calendar.MONTH,2);
+        c.set(Calendar.YEAR,2021);
+
+        Date date = c.getTime();
+
+        String wtid="MG01_01";
+
+        HealthMainService healthMainService= SpringUtils.getBean("healthMainService");
+
+
+        Map<String, Object> map =healthMainService.findHealthMatrix();
+
+        List<String[]> list=(List<String[]>)map.get("MHS_FDC_wtIdls");
+
+
+
+
+        for(String[] wtd:list)
+        {
+            System.out.println(wtd[0]+"----------------"+wtd[1]);
+        }
+
+        System.out.println("***************************************************************************************");
+
+
+    }
+
+
+
+
+}