Переглянути джерело

建筑用能模块:能耗排名优化

sl 1 рік тому
батько
коміт
59ba917a40

+ 25 - 0
module_ems/src/main/java/org/jeecg/modules/emsStatistics/mapper/xml/EmsStatisticsMapper.xml

@@ -195,4 +195,29 @@
         </foreach>
     </select>
 
+    <!--依据多个设备ID和开始结束年月获取能耗排名-->
+    <select id="selectRankByEquipmentAndYearmonth" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
+        select equipmentid,equipmentname,ifnull(sum(electricityvalue),0) as howManyValue
+        from ems_data_electricity_day
+        where yearmonth &gt;= #{beginTime} and yearmonth &lt;= #{endTime}
+        and equipmentid in (
+        select equipmentid
+        from tpm_equipment_status
+        )
+        and equipmentid in
+        <foreach collection="ids" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        group by equipmentid
+        order by howManyValue desc
+    </select>
+
+    <!--依据设备ID和年月获取能耗总量-->
+    <select id="selectAllElecByEquipmentAndYearmonth" resultType="java.lang.Float">
+        select ifnull(sum(electricityvalue),0) as howManyValue
+        from ems_data_electricity_day
+        where yearmonth &gt;= #{beginTime} and yearmonth &lt;= #{endTime} and equipmentid = #{equipmentid}
+    </select>
+
+
 </mapper>

+ 15 - 13
module_ems/src/main/java/org/jeecg/modules/emsStatistics/service/impl/EmsStatisticsServiceImpl.java

@@ -377,15 +377,15 @@ public class EmsStatisticsServiceImpl implements IEmsStatisticsService {
             if ("AREA0002".equals(energySpace.getSerialnum()) || "AREA0015".equals(energySpace.getSerialnum())) {
                 EmsStatistics statisticsParams1 = new EmsStatistics();
                 List<String> equip1 = new ArrayList<>();
-                equip1.add("301156882513921L");
+                equip1.add("301156882513921");
                 yongnengList = emsStatisticsMapper.selectEnergyByDay(equip1, day);
             }
             else if (equipmentids != null && equipmentids.size() > 0) {
                 // 去掉配电室的几个表
-                equipmentids.remove("301156882513921L");
-                equipmentids.remove("301156930748417L");
-                equipmentids.remove("301156947525633L");
-                equipmentids.remove("301156962205697L");
+                equipmentids.remove("301156882513921");
+                equipmentids.remove("301156930748417");
+                equipmentids.remove("301156947525633");
+                equipmentids.remove("301156962205697");
                 yongnengList = emsStatisticsMapper.selectEnergyByDay(equipmentids, day);
             }
             float shiji = yongnengList.get(0).getHowManyValue();
@@ -430,6 +430,7 @@ public class EmsStatisticsServiceImpl implements IEmsStatisticsService {
                 "个 周期为耗能状态,与计划耗能相差 " + leijiAll + " kWh,整体状态为 " +
                 (leijiAll > 0 ? "节能" : "耗能"));
 
+        System.out.println("数据整理完毕!");
         return Result.OK(map);
     }
 
@@ -461,18 +462,18 @@ public class EmsStatisticsServiceImpl implements IEmsStatisticsService {
         // 如果选择的是整个厂区、配电室的,则只需要获取配电室的几个表的信息即可
         if ("AREA0002".equals(energySpace.getSerialnum())) {
             // 加上配电室的几个表
-            equipmentids.remove("301156882513921L");
-            equipmentids.remove("301156930748417L");
-            equipmentids.remove("301156947525633L");
-            equipmentids.remove("301156962205697L");
+            equipmentids.remove("301156882513921");
+            equipmentids.remove("301156930748417");
+            equipmentids.remove("301156947525633");
+            equipmentids.remove("301156962205697");
         }
         else if ("AREA0015".equals(energySpace.getSerialnum())) {
             equipmentids = new ArrayList<>();
             // 去掉配电室的几个表
-            equipmentids.add("301156882513921L");
-            equipmentids.add("301156930748417L");
-            equipmentids.add("301156947525633L");
-            equipmentids.add("301156962205697L");
+            equipmentids.add("301156882513921");
+            equipmentids.add("301156930748417");
+            equipmentids.add("301156947525633");
+            equipmentids.add("301156962205697");
         }
 
         if (equipmentids != null && equipmentids.size() > 0) {
@@ -513,6 +514,7 @@ public class EmsStatisticsServiceImpl implements IEmsStatisticsService {
         map.put("numbers", equipelecs);
         map.put("tableData", thisYearList);
 
+        System.out.println("数据整理完毕");
         return Result.OK(map);
     }