Sfoglia il codice sorgente

+ 大屏网接口对接

chen.cheng 1 mese fa
parent
commit
ff794f2c97

+ 9 - 0
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPgSupplyHController.java

@@ -135,4 +135,13 @@ public class ElecPgSupplyHController extends BaseController {
         return success(pgSupplyHService.calHourPvRange(param));
     }
 
+    @GetMapping(value = "/month/pv")
+    public AjaxResult calMonthPvByDateRange(QueryMeter param) {
+        return success(pgSupplyHService.calMonthPvByDateRange(param));
+    }
+
+    @GetMapping(value = "/month/pg")
+    public AjaxResult calMonthSupplyByH(ElecPgSupplyH param) {
+        return success(pgSupplyHService.calMonthSupplyByH(param));
+    }
 }

+ 3 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecPgSupplyHMapper.java

@@ -62,6 +62,9 @@ public interface ElecPgSupplyHMapper {
      */
     int updatePgSupplyH(ElecPgSupplyH elecPgSupplyH);
 
+
+    List<ElecPgSupplyH> calMonthSupplyByH(ElecPgSupplyH param);
+
     /**
      * 删除电网供应计量-小时
      *

+ 2 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java

@@ -43,6 +43,8 @@ public interface ElecPvSupplyHMapper {
 
     ElecPvSupplyH calPvByDateRange(QueryMeter param);
 
+    List<ElecPvSupplyH> calMonthPvByDateRange(QueryMeter param);
+
     List<ElecPvSupplyH> calDayPvRange(QueryMeter param);
 
     List<ElecPvSupplyH> calHourPvRange(QueryMeter param);

+ 4 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecPgSupplyHService.java

@@ -79,4 +79,8 @@ public interface IElecPgSupplyHService {
     List<ElecPvSupplyH> calDayPvRange(QueryMeter param);
 
     List<ElecPvSupplyH> calHourPvRange(QueryMeter param);
+
+    List<ElecPvSupplyH> calMonthPvByDateRange(QueryMeter param);
+
+    List<ElecPgSupplyH> calMonthSupplyByH(ElecPgSupplyH param);
 }

+ 10 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecPgSupplyHServiceImpl.java

@@ -171,4 +171,14 @@ public class ElecPgSupplyHServiceImpl implements IElecPgSupplyHService {
     public List<ElecPvSupplyH> calHourPvRange(QueryMeter param) {
         return pvSupplyHMapper.calHourPvRange(param);
     }
+
+    @Override
+    public List<ElecPvSupplyH> calMonthPvByDateRange(QueryMeter param) {
+        return pvSupplyHMapper.calMonthPvByDateRange(param);
+    }
+
+    @Override
+    public List<ElecPgSupplyH> calMonthSupplyByH(ElecPgSupplyH param) {
+        return pgSupplyHMapper.calMonthSupplyByH(param);
+    }
 }

+ 20 - 0
ems/ems-core/src/main/resources/mapper/ems/ElecPgSupplyHMapper.xml

@@ -102,6 +102,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             DATE, time_index
     </select>
 
+    <select id="calMonthSupplyByH" parameterType="ElecPgSupplyH" resultType="ElecPgSupplyH">
+        SELECT
+        sum(
+        COALESCE(CAST(use_elec_quantity AS DECIMAL(10, 2)), 0)) use_elec_quantity,
+        sum(
+        COALESCE(CAST(use_elec_cost AS DECIMAL(10, 2)), 0)) use_elec_cost,
+        DATE_FORMAT(date, '%Y-%m') AS startRecTime
+        FROM
+        adm_ems_pg_supply_h pg
+        <where>
+            <if test="startRecTime != null and startRecTime != ''">and DATE >=#{startRecTime}</if>
+            <if test="endRecTime != null and endRecTime != ''">and DATE <![CDATA[ <= ]]>#{endRecTime}</if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+                and pg.area_code = #{areaCode}
+            </if>
+        </where>
+        group by
+        startRecTime
+    </select>
+
     <select id="selectPgSupplyH" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PgSupplyHResult">
         <include refid="selectPgSupplyHVo"/>
         <where>

+ 24 - 0
ems/ems-core/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -189,6 +189,30 @@
         </where>
     </select>
 
+    <select id="calMonthPvByDateRange" parameterType="com.ruoyi.ems.model.QueryMeter" resultType="ElecPvSupplyH">
+        SELECT
+        sum(
+        COALESCE(CAST(gen_elec_quantity AS DECIMAL(10, 2)), 0)) gen_elec_quantity,
+        sum(
+        COALESCE(CAST(use_elec_quantity AS DECIMAL(10, 2)), 0)) use_elec_quantity,
+        sum(
+        COALESCE(CAST(up_elec_quantity AS DECIMAL(10, 2)), 0)) up_elec_quantity,
+        sum(
+        COALESCE(CAST(up_elec_earn AS DECIMAL(10, 2)), 0)) up_elec_earn,
+        sum(
+        COALESCE(CAST(use_elec_quantity AS DECIMAL(10, 2)), 0)) use_elec_quantity,
+        DATE_FORMAT(date, '%Y-%m') AS startRecTime
+        FROM adm_ems_pv_supply_h pv
+        <where>
+            <if test="startRecTime != null and startRecTime != ''">and DATE >=#{startRecTime}</if>
+            <if test="endRecTime != null and endRecTime != ''">and DATE <![CDATA[ <= ]]>#{endRecTime}</if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+                and pv.area_code = #{areaCode}
+            </if>
+        </where>
+        group by startRecTime
+    </select>
+
     <select id="calHourPvRange" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyHResult">
         SELECT
         sum(