Browse Source

修改故障统计接口

shilin 2 years ago
parent
commit
5590aa1f7e

+ 6 - 5
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/FailurestatisticsmainMapper.java

@@ -41,7 +41,8 @@ public interface FailurestatisticsmainMapper extends BaseMapper<Failurestatistic
 
         @Select(" select  s.windpowerstationid wpId,s.windturbineid wtId,max(s.num) eventnum " +
             "from (select t.windpowerstationid,t.windturbineid,w.id,w.chinesetext,count(*) num " +
-            "from shutdownevent t inner join Warning2 w on t.warningid = w.id  where  t.stopTime>=#{beginDate} " +
+            "from shutdownevent t ,warning2 w,windturbine b WHERE " +
+                " t.warningid=w.ednavalue and t.windturbineid=b.id  and b.modelid=w.modelid  and  t.stopTime>=#{beginDate} " +
             "and t.stopTime<=#{endDate}  group by t.windpowerstationid,w.id,w.chinesetext,t.windturbineid order by t.windturbineid,num desc) s " +
             " group by s.windpowerstationid,s.windturbineid order by  s.windpowerstationid,eventnum desc,s.windturbineid ")
 //    @Select("select  s.windpowerstationid wpId,s.windturbineid wtId,max(s.num) eventnum from" +
@@ -57,8 +58,8 @@ public interface FailurestatisticsmainMapper extends BaseMapper<Failurestatistic
     public List<EventVo> getCountOrderNum(@Param(value = "beginDate")Date beginDate, @Param(value = "endDate")Date endDate);
 
 
-        @Select(" select t.windturbineid wtId,w.id warnId,w.chinesetext warnName,count(*) eventnum from shutdownevent t inner join Warning2 w " +
-            "on t.warningid = w.id where t.stopTime>=#{beginDate} and t.stopTime<=#{endDate}  group by w.id,w.chinesetext,t.windturbineid " +
+        @Select(" select t.windturbineid wtId,w.id warnId,w.chinesetext warnName,count(*) eventnum from shutdownevent t ,warning2 w,windturbine b WHERE " +
+                "  t.warningid=w.ednavalue and t.windturbineid=b.id  and b.modelid=w.modelid and t.stopTime>=#{beginDate} and t.stopTime<=#{endDate}  group by w.id,w.chinesetext,t.windturbineid " +
             "order by t.windturbineid,eventnum desc ")
 //    @Select(" select t.windturbineid wtId,s.id warnId,s.alerttext warnName,count(*) eventnum from shutdownevent t inner " +
 //            "join(select n.alerttext,w.faulttime,n.windturbineid,n.stationid id from faulthistory w " +
@@ -69,8 +70,8 @@ public interface FailurestatisticsmainMapper extends BaseMapper<Failurestatistic
 //            " order by t.windturbineid,eventnum desc ")
     public List<EventVo> getCountMap(@Param(value = "beginDate")Date beginDate, @Param(value = "endDate")Date endDate);
 
-        @Select(" select t.id,t.windTurbineId,t.warningId,w.chinesetext warnDesc,t.stopTime,t.startTime,t.stopHours,t.lossPower from shutdownevent t " +
-            "inner join Warning2 w on t.warningid = w.id  where t.stopTime>=#{beginDate} and t.stopTime<=#{endDate}  order by t.windturbineid,t.starttime desc  ")
+        @Select(" select t.id,t.windTurbineId,t.warningId,w.chinesetext warnDesc,t.stopTime,t.startTime,t.stopHours,t.lossPower from shutdownevent t ,warning2 w,windturbine b WHERE " +
+                "  t.warningid=w.ednavalue and t.windturbineid=b.id  and b.modelid=w.modelid and t.stopTime>=#{beginDate} and t.stopTime<=#{endDate}  order by t.windturbineid,t.starttime desc  ")
 //    @Select("select t.id,t.windTurbineId,s.warningId,s.alerttext warnDesc,t.stopTime,t.startTime,t.stopHours,t.lossPower" +
 //            " from shutdownevent t inner join (select n.alerttext,w.faulttime,n.windturbineid,n.stationid warningId  from faulthistory w " +
 //            "  inner join faultsnap n on n.id=w.snapid  where w.faulttime >=#{beginDate} " +

+ 1 - 1
realtime/failurestatistics-server-cph/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: hf
+    active: hb
 #    active: jn

+ 4 - 1
realtime/failurestatistics-server-cph/src/test/java/FailuresTest.java

@@ -1,9 +1,12 @@
+import com.gyee.common.util.DateUtils;
 import com.gyee.failurestatistics.FailurestatisticsMain;
 import com.gyee.failurestatistics.service.FailurestatisticsService;
 import com.gyee.failurestatistics.util.SpringUtils;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
+import java.util.Date;
+
 public class FailuresTest {
 
     @SneakyThrows
@@ -15,7 +18,7 @@ public class FailuresTest {
 //
         FailurestatisticsService failurestatisticsService= SpringUtils.getBean("failurestatisticsService");
 
-
+        failurestatisticsService.deleteFailurestatisticsmain(DateUtils.truncate(new Date()));
         failurestatisticsService.saveFailurestatisticsmain();