Ver Fonte

新增日期和全部区域统计功能

chen.cheng há 10 meses atrás
pai
commit
2e809ebca5

+ 7 - 4
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/PvSupplyHController.java

@@ -5,7 +5,6 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletResponse;
 
-import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -16,12 +15,16 @@ import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.ems.domain.ElecPgSupplyH;
 import com.ruoyi.ems.domain.PvSupplyH;
 import com.ruoyi.ems.service.IPvSupplyHService;
 
+import io.swagger.annotations.Api;
+
 /**
  * 光伏并网计量-小时Controller
  *
@@ -40,11 +43,11 @@ public class PvSupplyHController extends BaseController {
      */
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list")
-    public AjaxResult list(PvSupplyH admEmsPvSupplyH) {
+    public TableDataInfo list(PvSupplyH admEmsPvSupplyH) {
+        startPage();
         List<PvSupplyH> list = admEmsPvSupplyHService.selectPvSupplyHList(admEmsPvSupplyH);
-        return success(list);
+        return getDataTable(list);
     }
-
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/day/index")
     public AjaxResult listProdIndex(PvSupplyH admEmsPvSupplyH) {

+ 10 - 7
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecPgSupplyHMapper.java

@@ -6,7 +6,7 @@ import com.ruoyi.ems.domain.vo.QueryIndex;
 
 /**
  * 电网供应计量-小时Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-08-09
  */
@@ -14,7 +14,7 @@ public interface ElecPgSupplyHMapper
 {
     /**
      * 查询电网供应计量-小时
-     * 
+     *
      * @param id 电网供应计量-小时主键
      * @return 电网供应计量-小时
      */
@@ -22,12 +22,15 @@ public interface ElecPgSupplyHMapper
 
     /**
      * 查询电网供应计量-小时列表
-     * 
+     *
      * @param elecPgSupplyH 电网供应计量-小时
      * @return 电网供应计量-小时集合
      */
      List<ElecPgSupplyH> selectPgSupplyHList(ElecPgSupplyH elecPgSupplyH);
 
+
+     List<ElecPgSupplyH> selectPgSupplyHAllArea(ElecPgSupplyH elecPgSupplyH);
+
     /**
      * 查询电网供应计量-小时列表
      *
@@ -38,7 +41,7 @@ public interface ElecPgSupplyHMapper
 
     /**
      * 新增电网供应计量-小时
-     * 
+     *
      * @param elecPgSupplyH 电网供应计量-小时
      * @return 结果
      */
@@ -46,7 +49,7 @@ public interface ElecPgSupplyHMapper
 
     /**
      * 修改电网供应计量-小时
-     * 
+     *
      * @param elecPgSupplyH 电网供应计量-小时
      * @return 结果
      */
@@ -54,7 +57,7 @@ public interface ElecPgSupplyHMapper
 
     /**
      * 删除电网供应计量-小时
-     * 
+     *
      * @param id 电网供应计量-小时主键
      * @return 结果
      */
@@ -62,7 +65,7 @@ public interface ElecPgSupplyHMapper
 
     /**
      * 批量删除电网供应计量-小时
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 4 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/PvSupplyHMapper.java

@@ -3,9 +3,10 @@ package com.ruoyi.ems.mapper;
 import java.util.List;
 import java.util.Map;
 
-import com.ruoyi.ems.domain.PvSupplyH;
 import org.apache.ibatis.annotations.Param;
 
+import com.ruoyi.ems.domain.PvSupplyH;
+
 /**
  * 光伏并网计量光伏并网计量-小时Mapper接口
  *
@@ -30,6 +31,8 @@ public interface PvSupplyHMapper
      */
      List<PvSupplyH> selectPvSupplyHList(PvSupplyH pvSupplyH);
 
+    List<PvSupplyH> selectPvSupplyHAll(PvSupplyH pvSupplyH);
+
      List<PvSupplyH> selectAreaSupplyH(PvSupplyH pvSupplyH);
 
 

+ 14 - 10
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsPgSupplyHServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.ems.service.impl;
 
 import java.util.List;
 
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.ems.domain.vo.QueryIndex;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,7 +12,7 @@ import com.ruoyi.ems.service.IElecPgSupplyHService;
 
 /**
  * 电网供应计量-小时Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-08-09
  */
@@ -23,7 +24,7 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 查询电网供应计量-小时
-     * 
+     *
      * @param id 电网供应计量-小时主键
      * @return 电网供应计量-小时
      */
@@ -35,16 +36,19 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 查询电网供应计量-小时列表
-     * 
+     *
      * @param admEmsPgSupplyH 电网供应计量-小时
      * @return 电网供应计量-小时
      */
     @Override
-    public List<ElecPgSupplyH> selectPgSupplyHList(ElecPgSupplyH admEmsPgSupplyH)
-    {
-        return emsPgSupplyHMapper.selectPgSupplyHList(admEmsPgSupplyH);
+    public List<ElecPgSupplyH> selectPgSupplyHList(ElecPgSupplyH admEmsPgSupplyH) {
+        if (StringUtils.isNotEmpty(admEmsPgSupplyH.getAreaCode())) {
+            return emsPgSupplyHMapper.selectPgSupplyHList(admEmsPgSupplyH);
+        }
+        return emsPgSupplyHMapper.selectPgSupplyHAllArea(admEmsPgSupplyH);
     }
 
+
     @Override
     public List<ElecPgSupplyH> selectPgSupplyH(QueryIndex queryIndex) {
         return emsPgSupplyHMapper.selectPgSupplyH(queryIndex);
@@ -52,7 +56,7 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 新增电网供应计量-小时
-     * 
+     *
      * @param admEmsPgSupplyH 电网供应计量-小时
      * @return 结果
      */
@@ -64,7 +68,7 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 修改电网供应计量-小时
-     * 
+     *
      * @param admEmsPgSupplyH 电网供应计量-小时
      * @return 结果
      */
@@ -76,7 +80,7 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 批量删除电网供应计量-小时
-     * 
+     *
      * @param ids 需要删除的电网供应计量-小时主键
      * @return 结果
      */
@@ -88,7 +92,7 @@ public class EmsPgSupplyHServiceImpl implements IElecPgSupplyHService
 
     /**
      * 删除电网供应计量-小时信息
-     * 
+     *
      * @param id 电网供应计量-小时主键
      * @return 结果
      */

+ 6 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/PvSupplyHServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.service.impl;
 import java.util.List;
 import java.util.Map;
 
+import com.ruoyi.common.core.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -40,8 +41,11 @@ public class PvSupplyHServiceImpl implements IPvSupplyHService {
      * @return 光伏并网计量光伏并网计量-小时
      */
     @Override
-    public List<PvSupplyH> selectPvSupplyHList(PvSupplyH PvSupplyH) {
-        return pvSupplyHMapper.selectPvSupplyHList(PvSupplyH);
+    public List<PvSupplyH> selectPvSupplyHList(PvSupplyH pvSupplyH) {
+        if (StringUtils.isNotEmpty(pvSupplyH.getAreaCode())) {
+            return pvSupplyHMapper.selectPvSupplyHList(pvSupplyH);
+        }
+        return pvSupplyHMapper.selectPvSupplyHAll(pvSupplyH);
     }
 
     @Override

+ 45 - 9
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPgSupplyHMapper.xml

@@ -32,18 +32,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectPgSupplyHList" parameterType="com.ruoyi.ems.domain.ElecPgSupplyH" resultMap="PgSupplyHResult">
         <include refid="selectPgSupplyHVo"/>
         <where>
-            <if test="areaCode != null  and areaCode != ''"> and pg.`area_code` = #{areaCode}</if>
-            <if test="facsCode != null  and facsCode != ''"> and pg.`facs_code` = #{facsCode}</if>
-            <if test="date != null "> and pg.`date` = #{date}</if>
-            <if test="time != null "> and pg.`time` = #{time}</if>
-            <if test="timeIndex != null "> and pg.`time_index` = #{timeIndex}</if>
-            <if test="meterType != null "> and pg.`meter_type` = #{meterType}</if>
-            <if test="meterUnitPrice != null "> and pg.`meter_unit_price` = #{meterUnitPrice}</if>
-            <if test="useElecQuantity != null "> and pg.`use_elec_quantity` = #{useElecQuantity}</if>
-            <if test="useElecCost != null "> and pg.`use_elec_cost` = #{useElecCost}</if>
+            <if test="areaCode != null  and areaCode != ''">and pg.`area_code` = #{areaCode}</if>
+            <if test="facsCode != null  and facsCode != ''">and pg.`facs_code` = #{facsCode}</if>
+            <if test="date != null ">and pg.`date` = #{date}</if>
+            <if test="time != null ">and pg.`time` = #{time}</if>
+            <if test="timeIndex != null ">and pg.`time_index` = #{timeIndex}</if>
+            <if test="meterType != null ">and pg.`meter_type` = #{meterType}</if>
+            <if test="meterUnitPrice != null ">and pg.`meter_unit_price` = #{meterUnitPrice}</if>
+            <if test="useElecQuantity != null ">and pg.`use_elec_quantity` = #{useElecQuantity}</if>
+            <if test="useElecCost != null ">and pg.`use_elec_cost` = #{useElecCost}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and pg.`record_time` &gt;= #{startRecTime} and pg.`record_time` &lt;= #{endRecTime}
+            </if>
+        </where>
+        ORDER BY pg.`date` DESC,
+        pg.`time` DESC,
+        pg.`time_index`
+    </select>
+    <select id="selectPgSupplyHAllArea" parameterType="com.ruoyi.ems.domain.ElecPgSupplyH" resultMap="PgSupplyHResult">
+        SELECT facCategory.`code` facs_code,
+        facCategory.`name` facs_name,
+        pg.`date`,
+        pg.`time`,
+        pg.`time_index`,
+        pg.`meter_type`,
+        pg.`meter_unit_price`,
+        sum(COALESCE(pg.`use_elec_quantity`, 0)) use_elec_quantity,
+        sum(COALESCE(pg.`use_elec_cost`, 0)) use_elec_cost
+        FROM adm_ems_pg_supply_h pg
+        inner JOIN adm_service_area a ON pg.`area_code` = a.`area_code`
+        inner JOIN adm_ems_facs f ON pg.`facs_code` = f.`facs_code`
+        inner JOIN dim_ems_facs_category facCategory ON f.facs_category = facCategory.`code`
+        <where>
+            <if test="areaCode != null  and areaCode != ''">and pg.`area_code` = #{areaCode}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and pg.`record_time` &gt;= #{startRecTime} and pg.`record_time` &lt;= #{endRecTime}
+            </if>
         </where>
+        GROUP BY facCategory.`code`,
+        pg.DATE,
+        pg.time_index,
+        pg.TIME
+        ORDER BY pg.`date` DESC,
+        pg.`time` DESC,
+        pg.`time_index`
     </select>
 
+
+
     <select id="selectPgSupplyH" parameterType="com.ruoyi.ems.domain.vo.QueryIndex" resultMap="PgSupplyHResult">
         <include refid="selectPgSupplyHVo"/>
         <where>

+ 41 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -55,7 +55,48 @@
             <if test="useElecQuantity != null ">and pv.use_elec_quantity = #{useElecQuantity}</if>
             <if test="upElecQuantity != null ">and pv.up_elec_quantity = #{upElecQuantity}</if>
             <if test="upElecEarn != null ">and pv.up_elec_earn = #{upElecEarn}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and pv.`record_time` &gt;= #{startRecTime} and pv.`record_time` &lt;= #{endRecTime}
+            </if>
         </where>
+        ORDER BY
+        pv.`date` DESC,
+        pv.`time` DESC,
+        pv.`time_index`
+    </select>
+
+    <select id="selectPvSupplyHAll" parameterType="com.ruoyi.ems.domain.PvSupplyH" resultMap="PvSupplyHResult">
+        SELECT
+            facCategory.`name` facs_name,
+            pv.`record_time`,
+            pv.`date`,
+            pv.`time`,
+            pv.time_index,
+            pv.up_unit_price,
+            sum(COALESCE(pv.gen_elec_quantity,0)) gen_elec_quantity,
+            sum(COALESCE(pv.use_elec_quantity,0)) use_elec_quantity,
+            sum(COALESCE(pv.up_elec_quantity,0)) up_elec_quantity,
+            sum(COALESCE(pv.up_elec_earn,0)) up_elec_earn
+        FROM
+            adm_ems_pv_supply_h pv
+                INNER JOIN adm_service_area a ON pv.`area_code` = a.`area_code`
+                INNER JOIN adm_ems_facs f ON pv.`facs_code` = f.`facs_code`
+                INNER JOIN dim_ems_facs_category facCategory ON f.facs_category = facCategory.`code`
+        <where>
+            <if test="areaCode != null  and areaCode != ''">and pv.`area_code` = #{areaCode}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and pv.`record_time` &gt;= #{startRecTime} and pv.`record_time` &lt;= #{endRecTime}
+            </if>
+        </where>
+        GROUP BY
+            facCategory.`code`,
+            pv.DATE,
+            pv.time_index,
+            pv.TIME
+        ORDER BY
+            pv.`date` DESC,
+            pv.`time` DESC,
+            pv.`time_index`
     </select>
 
     <select id="selectAreaSupplyH" parameterType="com.ruoyi.ems.domain.PvSupplyH" resultMap="PvSupplyHResult">

+ 23 - 1
ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java

@@ -4,13 +4,14 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 /**
  * Entity基类
- * 
+ *
  * @author ruoyi
  */
 public class BaseEntity implements Serializable
@@ -42,6 +43,10 @@ public class BaseEntity implements Serializable
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private Map<String, Object> params;
 
+    private String startRecTime;
+
+    private String endRecTime;
+
     public String getSearchValue()
     {
         return searchValue;
@@ -115,4 +120,21 @@ public class BaseEntity implements Serializable
     {
         this.params = params;
     }
+
+
+    public String getStartRecTime() {
+        return startRecTime;
+    }
+
+    public void setStartRecTime(String startRecTime) {
+        this.startRecTime = startRecTime;
+    }
+
+    public String getEndRecTime() {
+        return endRecTime;
+    }
+
+    public void setEndRecTime(String endRecTime) {
+        this.endRecTime = endRecTime;
+    }
 }