Browse Source

宁夏分公司代码修改

shilin 2 months ago
parent
commit
e3c4867396

+ 16 - 17
alarm-web/src/main/java/com/gyee/alarm/controller/AlertRuleController.java

@@ -182,28 +182,27 @@ public class AlertRuleController {
         Map<String, List<ProEconAlarmType>> map = new HashMap<>();
         List<ProEconAlarmType> typels = proEconAlarmTypeService.list();
 
-        List<ProEconAlarmType> fjbjls = new ArrayList<>();
-        List<ProEconAlarmType> gfbjls = new ArrayList<>();
-        List<ProEconAlarmType> yjls = new ArrayList<>();
-        List<ProEconAlarmType> sdls = new ArrayList<>();
+
         if (!typels.isEmpty()) {
-            for (ProEconAlarmType type : typels) {
-                if (type.getCategory().equals(AlarmType.FJBJ.getCode())) {
-                    fjbjls.add(type);
-                }else if (type.getCategory().equals(AlarmType.GFBJ.getCode())) {
-                    gfbjls.add(type);
-                } else if (type.getCategory().equals(AlarmType.YJ.getCode())) {
-                    yjls.add(type);
-                } else if (type.getCategory().equals(AlarmType.SD.getCode())) {
-                    sdls.add(type);
+
+            for(ProEconEquipmentmodel model: CacheContext.equipmentmodels)
+            {
+                List<ProEconAlarmType> ls = new ArrayList<>();
+
+                for (ProEconAlarmType type : typels) {
+                        if (type.getCategory().equals(AlarmType.FJBJ.getCode())) {
+                                 ls.add(type);
+                            map.put("fjbj", ls);
+                        }else  if (type.getCategory().equals(model.getNemCode())) {
+                            ls.add(type);
+                            map.put(model.getNemCode(), ls);
+                        }
                 }
+
             }
+
         }
 
-        map.put("fjbj", fjbjls);
-        map.put("gfbj", gfbjls);
-        map.put("yj", yjls);
-        map.put("sd", sdls);
         if (StringUtils.notEmp(map)) {
 
             return AjaxResult.successData(AjaxStatus.success.code, map);

+ 110 - 13
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/ProEconShutdownEvent2Mapper.java

@@ -24,29 +24,126 @@ import java.util.List;
  */
 public interface ProEconShutdownEvent2Mapper extends BaseMapper<ProEconShutdownEvent2> {
 
-    @Update("update pro_econ_shutdown_event2   set start_time=#{start_time},loss_power=#{loss_power},stop_hours=#{stop_hours}  where id=#{id}")
-    public int  updateShutdownevent2(@Param(value = "start_time") Date start_time, @Param(value = "loss_power")Double loss_power,
-                                    @Param(value = "stop_hours")Double stop_hours, @Param(value = "id")String id);
+
+    @Select({"<script>",
+            "SELECT UPPER(t.name),count(*) FROM pro_econ_shutdown_event2 as s,pro_econ_alarm_configuration as a," +
+                    "pro_econ_alarm_type as t where s.warning_id=a.id and UPPER(a.components)=UPPER(t.nem_code)  " ,
+            "<where>" ,
+
+            "<if test='wpId != null'>",
+            "and a.station_id like #{wpId}",
+            "</if>",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
+            "</if>",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+
+            "</where>",
+            " GROUP BY t.name ",
+            "</script>"})
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByType(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
+
+    @Select({"<script>",
+            "SELECT  DATE(stop_time) AS stop_day, count(*) as times,COALESCE(SUM(s.stop_hours), 0)  hours  FROM pro_econ_shutdown_event2 as s,pro_econ_alarm_configuration as a," +
+                    "pro_econ_alarm_type as t where s.warning_id=a.id  " ,
+            "<where>" ,
+
+            "<if test='wpId != null'>",
+            "and a.station_id like #{wpId}",
+            "</if>",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
+            "</if>",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+
+            "</where>",
+            " GROUP BY stop_day ",
+            "</script>"})
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByDay(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
+
+
     @Select({"<script>",
-            "select * from pro_econ_shutdown_event2  " ,
+            "SELECT TO_CHAR(s.stop_time, 'YYYY-MM') AS year_month, count(*) as times,COALESCE(SUM(s.stop_hours), 0)  hours  FROM pro_econ_shutdown_event2 as s," +
+                    "pro_econ_alarm_configuration as a,pro_econ_alarm_type as t " +
+                    "where s.warning_id=a.id and s.warning_id is not null  " +
+
             "<where>" ,
 
             "<if test='wpId != null'>",
-            "and winpowerstation_id= #{wpId}",
+            "and a.station_id like #{wpId}",
             "</if>",
-            "<if test='description != null'>",
-            "and fault_view like #{description}",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
+            "</if>",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+
+            "</where>",
+            " GROUP BY year_month ",
+            "</script>"})
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByMonth(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
+
+    @Select({"<script>",
+            "SELECT '机械故障' AS 故障类型  ,count(*) as times,COALESCE(SUM(s.stop_hours), 0)  hours  FROM pro_econ_shutdown_event2 as s,pro_econ_alarm_configuration as a," +
+                    "pro_econ_alarm_type as t where s.warning_id=a.id and UPPER(a.components)=UPPER(t.nem_code) and " +
+                    "s.warning_id is not null  " ,
+            "<where>" ,
+
+            "<if test='wpId != null'>",
+            "and a.station_id like #{wpId}",
             "</if>",
-            "<if test='wtId != null'>",
-            "and windturbine_id = #{wtId}",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
             "</if>",
-            "and ts &gt;= #{begin}",
-            "and ts &lt;= #{end}",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+            "and (t.nem_code='YP' or t.nem_code='LG' or t.nem_code='PHXT' or t.nem_code='BJXT' )",
+            "</where>",
 
+            "</script>"})
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByJX(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
+
+    @Select({"<script>",
+            "SELECT '电气故障' AS 故障类型  ,count(*) as times,COALESCE(SUM(s.stop_hours), 0)  hours  FROM pro_econ_shutdown_event2 as s,pro_econ_alarm_configuration as a," +
+                    "pro_econ_alarm_type as t where s.warning_id=a.id and UPPER(a.components)=UPPER(t.nem_code) and " +
+                    "s.warning_id is not null  " ,
+            "<where>" ,
+
+            "<if test='wpId != null'>",
+            "and a.station_id like #{wpId}",
+            "</if>",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
+            "</if>",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+            "and (t.nem_code='FDJ' or t.nem_code='BPQ' or t.nem_code='KZXT'  )",
             "</where>",
-            " order by stop_time desc",
+
             "</script>"})
-    List<ProEconShutdownEvent2> queryShutdownEvent2(@Param("wpId") String wpId, @Param("wtId") String wtId, @Param("description") String description, @Param("begin")Date begin, @Param("end") Date end);
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByDQ(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
+
+
+    @Select({"<script>",
+            "SELECT '其它故障' AS 故障类型 ,count(*) as times,COALESCE(SUM(s.stop_hours), 0)  hours FROM pro_econ_shutdown_event2 as s,pro_econ_alarm_configuration as a," +
+                    "pro_econ_alarm_type as t where s.warning_id=a.id and UPPER(a.components)=UPPER(t.nem_code) and " +
+                    "s.warning_id is not null  " ,
+            "<where>" ,
 
+            "<if test='wpId != null'>",
+            "and a.station_id like #{wpId}",
+            "</if>",
+            "<if test='modelId != null'>",
+            "and  a.model_id=#{modelId}",
+            "</if>",
+            "and s.stop_time &gt;= #{begin}",
+            "and s.stop_time &lt;= #{end}",
+            "and (t.nem_code=!='FDJ' and t.nem_code!='BPQ' and t.nem_code!='KZXT' and t.nem_code!='YP' and t.nem_code!='LG' and t.nem_code!='PHXT' and t.nem_code!='BJXT' )",
+            "</where>",
+
+            "</script>"})
+    List<ProEconShutdownEvent2> queryShutdownEvent2ByOther(@Param("wpId") String wpId, @Param("modelId") String modelId,@Param("begin")Date begin, @Param("end") Date end);
 
 }