فهرست منبع

数据分析接口开发

lv.wenbin 9 ماه پیش
والد
کامیت
c37b87ea0c
18فایلهای تغییر یافته به همراه300 افزوده شده و 464 حذف شده
  1. 18 57
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java
  2. 21 14
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreController.java
  3. 25 102
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecUseHController.java
  4. 26 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/vo/QueryIndex.java
  5. 10 17
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java
  6. 5 16
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecUseHMapper.java
  7. 9 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsElecStoreHMapper.java
  8. 17 18
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java
  9. 10 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecStoreService.java
  10. 10 11
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecUseHService.java
  11. 7 27
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java
  12. 6 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecStoreServiceImpl.java
  13. 10 62
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecUseHServiceImpl.java
  14. 34 63
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml
  15. 52 69
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml
  16. 31 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml
  17. 1 1
      ems-cloud/sql/ems_init_data.sql
  18. 8 7
      ems-cloud/sql/ems_sys.sql

+ 18 - 57
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java

@@ -1,17 +1,5 @@
 package com.ruoyi.ems.controller;
 
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-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;
@@ -20,9 +8,17 @@ 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.ElecPvSupplyH;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import com.ruoyi.ems.service.IElecPvSupplyHService;
-
 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;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 光伏并网计量-小时Controller
@@ -31,7 +27,7 @@ import io.swagger.annotations.Api;
  * @date 2024-08-02
  */
 @RestController
-@RequestMapping("/prod")
+@RequestMapping("/prod/pv")
 @Api(value = "ElecPvSupplyHController", description = "光伏并网计量数据接口")
 public class ElecPvSupplyHController extends BaseController {
     @Autowired
@@ -41,63 +37,28 @@ public class ElecPvSupplyHController extends BaseController {
      * 查询光伏并网计量光伏并网计量-小时列表
      */
     @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list")
+    @GetMapping("/hour/list")
     public TableDataInfo list(ElecPvSupplyH pvSupplyH) {
         startPage();
         List<ElecPvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
         return getDataTable(list);
     }
-    @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/day/index")
-    public AjaxResult listProdIndex(ElecPvSupplyH pvSupplyH) {
-        pvSupplyH.setDate(DateUtils.getNowDate());
-        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
-        return success(list);
-    }
-
-    @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/month/index")
-    public AjaxResult listProdMonthIndex(ElecPvSupplyH pvSupplyH) {
-        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
-        return success(list);
-    }
-
-    @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/year/index")
-    public AjaxResult listProdYearIndex(ElecPvSupplyH pvSupplyH) {
-        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
-        return success(list);
-    }
-
-    @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/day/total")
-    public AjaxResult listProdThisDayTotalIndex(ElecPvSupplyH pvSupplyH) {
-        List<Map<String, Object>> list = pvSupplyHService
-            .selectAreaSupplyHByThisDay(pvSupplyH.getAreaCode());
-        return success(list);
-    }
-
-    @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/month/total")
-    public AjaxResult listProdThisMonthTotalIndex(ElecPvSupplyH pvSupplyH) {
-        List<Map<String, Object>> list = pvSupplyHService
-            .selectAreaSupplyHByRefMonth(pvSupplyH.getAreaCode());
-        return success(list);
-    }
 
+    /**
+     * 查询光伏并网计量光伏并网计量-小时列表
+     */
     @RequiresPermissions("ems:prod:list")
-    @GetMapping("/list/prod/this/year/total")
-    public AjaxResult listProdThisYearTotalIndex(ElecPvSupplyH pvSupplyH) {
-        List<Map<String, Object>> list = pvSupplyHService.selectAreaSupplyHByYear(pvSupplyH.getAreaCode());
+    @GetMapping("/day/list")
+    public AjaxResult listByDay(QueryIndex queryIndex) {
+        List<ElecPvSupplyH> list = pvSupplyHService.selectPvSupplyDayList(queryIndex);
         return success(list);
     }
 
     /**
      * 导出光伏并网计量光伏并网计量-小时列表
      */
-    @RequiresPermissions("ems:prod:export")
     @Log(title = "光伏并网计量光伏并网计量-小时", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
+    @PostMapping("/hour/export")
     public void export(HttpServletResponse response, ElecPvSupplyH pvSupplyH) {
         List<ElecPvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
         ExcelUtil<ElecPvSupplyH> util = new ExcelUtil<ElecPvSupplyH>(ElecPvSupplyH.class);

+ 21 - 14
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreController.java

@@ -1,29 +1,30 @@
 package com.ruoyi.ems.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+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.ElecStoreH;
 import com.ruoyi.ems.domain.vo.ElecStoreAnalyze;
+import com.ruoyi.ems.domain.vo.QueryIndex;
+import com.ruoyi.ems.service.IElecStoreService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
-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.ElecStoreH;
-import com.ruoyi.ems.service.IElecStoreService;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.page.TableDataInfo;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 储能计量-小时Controller
@@ -48,6 +49,12 @@ public class ElecStoreController extends BaseController {
         return getDataTable(list);
     }
 
+    @GetMapping("/day/list")
+    public AjaxResult listByDay(QueryIndex queryIndex) {
+        List<ElecStoreH> list = elecStoreService.selectDayList(queryIndex);
+        return success(list);
+    }
+
     /**
      * 查询储能计量-小时列表
      */

+ 25 - 102
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecUseHController.java

@@ -1,32 +1,25 @@
 package com.ruoyi.ems.controller;
 
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruoyi.ems.domain.vo.ElecUseSta;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
 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.ElecUseH;
+import com.ruoyi.ems.domain.vo.ElecUseSta;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import com.ruoyi.ems.service.IElecUseHService;
-
 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.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 用能计量-小时Controller
@@ -35,7 +28,7 @@ import io.swagger.annotations.Api;
  * @date 2024-08-15
  */
 @RestController
-@RequestMapping("/elec/use/hour")
+@RequestMapping("/elec/use")
 @Api(value = "ElecUseHController", description = "用电计量数据接口")
 public class ElecUseHController extends BaseController {
     @Autowired
@@ -44,26 +37,32 @@ public class ElecUseHController extends BaseController {
     /**
      * 查询用能计量-小时列表
      */
-    @GetMapping("/list")
-    public TableDataInfo list(ElecUseH elecUseH) {
+    @GetMapping("/hour/list")
+    public TableDataInfo hourList(ElecUseH elecUseH) {
         startPage();
         List<ElecUseH> list = elecUseHService.getElecUseHList(elecUseH);
         return getDataTable(list);
     }
 
-    @GetMapping("/sumBySubCategory")
+    @GetMapping("/day/list")
+    public TableDataInfo dayList(QueryIndex queryIndex) {
+        List<ElecUseH> list = elecUseHService.getElecUseDayList(queryIndex);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/hour/sumBySubCategory")
     public AjaxResult sumBySubCategory(ElecUseH elecUseH) {
         List<ElecUseSta> list = elecUseHService.getSumBySubCategory(elecUseH);
         return success(list);
     }
 
-    @GetMapping("/sumByFacs")
+    @GetMapping("/hour/sumByFacs")
     public AjaxResult sumByFacs(ElecUseH elecUseH) {
         List<ElecUseSta> list = elecUseHService.getSumByFacs(elecUseH);
         return success(list);
     }
 
-    @GetMapping("/listSum")
+    @GetMapping("/hour/listSum")
     public TableDataInfo listSum(ElecUseH elecUseH) {
         startPage();
         List<ElecUseH> list = elecUseHService.getElecUseHListSum(elecUseH);
@@ -73,9 +72,8 @@ public class ElecUseHController extends BaseController {
     /**
      * 导出用能计量-小时列表
      */
-
     @Log(title = "用能计量-小时", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
+    @PostMapping("/hour/export")
     public void export(HttpServletResponse response, ElecUseH elecUseH) {
         List<ElecUseH> list = elecUseHService.getElecUseHList(elecUseH);
         ExcelUtil<ElecUseH> util = new ExcelUtil<ElecUseH>(ElecUseH.class);
@@ -85,83 +83,8 @@ public class ElecUseHController extends BaseController {
     /**
      * 获取用能计量-小时详细信息
      */
-    @GetMapping(value = "/{id}")
+    @GetMapping(value = "/hour/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(elecUseHService.getElecUseHById(id));
     }
-
-    /**
-     * 新增用能计量-小时
-     */
-    @RequiresPermissions("ems:h:add")
-    @Log(title = "用能计量-小时", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody ElecUseH elecUseH) {
-        return toAjax(elecUseHService.insertElecUseH(elecUseH));
-    }
-
-    /**
-     * 修改用能计量-小时
-     */
-    @RequiresPermissions("ems:h:edit")
-    @Log(title = "用能计量-小时", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody ElecUseH elecUseH) {
-        return toAjax(elecUseHService.updateElecUseH(elecUseH));
-    }
-
-    /**
-     * 删除用能计量-小时
-     */
-    @RequiresPermissions("ems:h:remove")
-    @Log(title = "用能计量-小时", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(elecUseHService.deleteElecUseHByIds(ids));
-    }
-
-    /**
-     * 网-用电量月度统计
-     *
-     * @param area the area
-     * @return the area month use supply
-     * @author chen.cheng
-     */
-    @GetMapping("/area/month/use/supply")
-    public AjaxResult getAreaMonthUseSupply(@RequestParam("area") String area) {
-        return success(elecUseHService.selectElecAndPower(area));
-    }
-
-    /**
-     * 荷-近一年用能
-     *
-     * @param area
-     * @return
-     */
-    @GetMapping("/area/month/elec/use")
-    public AjaxResult getAreaMonthElecUse(@RequestParam(value = "area", required = false) String area) {
-        return success(elecUseHService.getMonthElecUse(area));
-    }
-
-    /**
-     * 荷-当日用能-设备类型占比
-     *
-     * @param area
-     * @return
-     */
-    @GetMapping("/area/thisday/fac/category/elec/use")
-    public AjaxResult getAreaThisDayFacCategoryElecUse(@RequestParam(value = "area", required = false) String area) {
-        return success(elecUseHService.getThisDayFacsCategoryElecUse(area));
-    }
-
-    /**
-     * 荷-当日用能
-     *
-     * @param area
-     * @return
-     */
-    @GetMapping("/area/thisday/elec/use")
-    public AjaxResult getAreaThisDayElecUse(@RequestParam(value = "area", required = false) String area) {
-        return success(elecUseHService.getThisDayAreaElecUse(area));
-    }
 }

+ 26 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/vo/QueryIndex.java

@@ -45,6 +45,16 @@ public class QueryIndex {
      */
     private String endTime;
 
+    /**
+     * 设施分类
+     */
+    private String facsCategory;
+
+    /**
+     * 设施子类
+     */
+    private String facsSubCategory;
+
     public String getAreaCode() {
         return areaCode;
     }
@@ -84,4 +94,20 @@ public class QueryIndex {
     public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
+
+    public String getFacsCategory() {
+        return facsCategory;
+    }
+
+    public void setFacsCategory(String facsCategory) {
+        this.facsCategory = facsCategory;
+    }
+
+    public String getFacsSubCategory() {
+        return facsSubCategory;
+    }
+
+    public void setFacsSubCategory(String facsSubCategory) {
+        this.facsSubCategory = facsSubCategory;
+    }
 }

+ 10 - 17
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.mapper;
 import java.util.List;
 import java.util.Map;
 
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Param;
 
@@ -14,15 +15,14 @@ import com.ruoyi.ems.domain.ElecPvSupplyH;
  * @author ruoyi
  * @date 2024-08-02
  */
-public interface ElecPvSupplyHMapper
-{
+public interface ElecPvSupplyHMapper {
     /**
      * 查询光伏并网计量光伏并网计量-小时
      *
      * @param id 光伏并网计量光伏并网计量-小时主键
      * @return 光伏并网计量光伏并网计量-小时
      */
-     ElecPvSupplyH selectPvSupplyHById(Long id);
+    ElecPvSupplyH selectPvSupplyHById(Long id);
 
     /**
      * 查询光伏并网计量光伏并网计量-小时列表
@@ -30,31 +30,24 @@ public interface ElecPvSupplyHMapper
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 光伏并网计量光伏并网计量-小时集合
      */
-     List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
+    List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
 
     List<ElecPvSupplyH> selectPvSupplyHAll(ElecPvSupplyH pvSupplyH);
 
+    List<ElecPvSupplyH> selectPvSupplyDayList(QueryIndex queryIndex);
+
     Map<String, Object> calThisDayPv(@Param("thisDay") String thisDay);
 
     @MapKey("timeIndex")
     Map<String, Map<String, Object>> calThisDayPvByH(@Param("thisDay") String thisDay);
 
-     List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH pvSupplyH);
-
-
-    List<Map<String,Object>> selectAreaSupplyByDate(@Param("areaCode")String areaCode, @Param("date")String date);
-
-    List<Map<String,Object>> selectAreaSupplyByThisYear(@Param("areaCode")String areaCode, @Param("date")String date);
-
-    List<Map<String,Object>> selectAreaSupplyByMonth(@Param("areaCode")String areaCode, @Param("date")String date);
-
     /**
      * 新增光伏并网计量光伏并网计量-小时
      *
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-     int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
+    int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 修改光伏并网计量光伏并网计量-小时
@@ -62,7 +55,7 @@ public interface ElecPvSupplyHMapper
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-     int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
+    int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 删除光伏并网计量光伏并网计量-小时
@@ -70,7 +63,7 @@ public interface ElecPvSupplyHMapper
      * @param id 光伏并网计量光伏并网计量-小时主键
      * @return 结果
      */
-     int deletePvSupplyHById(Long id);
+    int deletePvSupplyHById(Long id);
 
     /**
      * 批量删除光伏并网计量光伏并网计量-小时
@@ -78,5 +71,5 @@ public interface ElecPvSupplyHMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-     int deletePvSupplyHByIds(Long[] ids);
+    int deletePvSupplyHByIds(Long[] ids);
 }

+ 5 - 16
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecUseHMapper.java

@@ -1,13 +1,10 @@
 package com.ruoyi.ems.mapper;
 
-import java.util.List;
-import java.util.Map;
-
+import com.ruoyi.ems.domain.ElecUseH;
 import com.ruoyi.ems.domain.vo.ElecUseSta;
-import org.apache.ibatis.annotations.MapKey;
-import org.apache.ibatis.annotations.Param;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 
-import com.ruoyi.ems.domain.ElecUseH;
+import java.util.List;
 
 /**
  * 用能计量-小时Mapper接口
@@ -32,6 +29,8 @@ public interface ElecUseHMapper {
      */
     List<ElecUseH> selectElecUseHList(ElecUseH elecUseH);
 
+    List<ElecUseH> selectElecUseDayList(QueryIndex queryIndex);
+
     List<ElecUseH> selectElecUseHListSum(ElecUseH elecUseH);
 
     /**
@@ -81,14 +80,4 @@ public interface ElecUseHMapper {
      * @return 结果
      */
     int deleteElecUseHByIds(Long[] ids);
-
-    List<Map<String, Object>> selectElecUseHByMonth(@Param("areaCode") String areaCode, @Param("date") String date);
-
-    @MapKey("areaCode")
-    Map<String, Object> selectThisDayElecUse(@Param("areaCode") String areaCode, @Param("date") String date);
-
-    List<Map<String, Object>> selectMonthElecUse(@Param("areaCode") String areaCode, @Param("date") String date);
-
-    List<Map<String, Object>> selectThisDayFacsCategoryElecUse(@Param("areaCode") String areaCode,
-        @Param("date") String date);
 }

+ 9 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsElecStoreHMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.mapper;
 import com.ruoyi.ems.domain.ElecPgSupplyH;
 import com.ruoyi.ems.domain.ElecStoreH;
 import com.ruoyi.ems.domain.vo.ElecStoreSta;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -45,6 +46,14 @@ public interface EmsElecStoreHMapper {
     List<ElecStoreH> selectStoreHList(ElecStoreH elecStoreH);
 
     /**
+     * 查询储能计量-日列表
+     *
+     * @param queryIndex 参数
+     * @return 储能计量-日集合
+     */
+    List<ElecStoreH> selectStoreDayList(QueryIndex queryIndex);
+
+    /**
      * 查询储能计量-小时列表(全部区域)
      *
      * @param elecStoreH 储能计量-小时

+ 17 - 18
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java

@@ -1,9 +1,9 @@
 package com.ruoyi.ems.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.ruoyi.ems.domain.ElecPvSupplyH;
+import com.ruoyi.ems.domain.vo.QueryIndex;
+
+import java.util.List;
 
 /**
  * 光伏并网计量-小时Service接口
@@ -11,15 +11,14 @@ import com.ruoyi.ems.domain.ElecPvSupplyH;
  * @author ruoyi
  * @date 2024-08-02
  */
-public interface IElecPvSupplyHService
-{
+public interface IElecPvSupplyHService {
     /**
      * 查询光伏并网计量-小时
      *
      * @param id 光伏并网计量-小时主键
      * @return 光伏并网计量-小时
      */
-     ElecPvSupplyH selectPvSupplyHById(Long id);
+    ElecPvSupplyH selectPvSupplyHById(Long id);
 
     /**
      * 查询光伏并网计量-小时列表
@@ -27,23 +26,23 @@ public interface IElecPvSupplyHService
      * @param pvSupplyH 光伏并网计量-小时
      * @return 光伏并网计量-小时集合
      */
-     List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
-
-
-     List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH pvSupplyH);
+    List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
 
-    List<Map<String, Object>> selectAreaSupplyHByThisDay(String areaCode);
-
-    List<Map<String, Object>> selectAreaSupplyHByRefMonth(String areaCode);
+    /**
+     * 查询光伏并网计量-小时列表
+     *
+     * @param queryIndex 光伏并网计量-小时
+     * @return 光伏并网计量-小时集合
+     */
+    List<ElecPvSupplyH> selectPvSupplyDayList(QueryIndex queryIndex);
 
-    List<Map<String, Object>> selectAreaSupplyHByYear(String areaCode);
     /**
      * 新增光伏并网计量-小时
      *
      * @param pvSupplyH 光伏并网计量-小时
      * @return 结果
      */
-     int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
+    int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 修改光伏并网计量-小时
@@ -51,7 +50,7 @@ public interface IElecPvSupplyHService
      * @param pvSupplyH 光伏并网计量-小时
      * @return 结果
      */
-     int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
+    int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 批量删除光伏并网计量-小时
@@ -59,7 +58,7 @@ public interface IElecPvSupplyHService
      * @param ids 需要删除的光伏并网计量-小时主键集合
      * @return 结果
      */
-     int deletePvSupplyHByIds(Long[] ids);
+    int deletePvSupplyHByIds(Long[] ids);
 
     /**
      * 删除光伏并网计量-小时信息
@@ -67,5 +66,5 @@ public interface IElecPvSupplyHService
      * @param id 光伏并网计量-小时主键
      * @return 结果
      */
-     int deletePvSupplyHById(Long id);
+    int deletePvSupplyHById(Long id);
 }

+ 10 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecStoreService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.ruoyi.ems.domain.ElecStoreH;
 import com.ruoyi.ems.domain.vo.ElecStoreAnalyze;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 
 /**
  * 储能计量-小时Service接口
@@ -22,6 +23,7 @@ public interface IElecStoreService {
 
     /**
      * 获取日分析
+     *
      * @param date 日期
      * @return 日分析
      */
@@ -36,6 +38,14 @@ public interface IElecStoreService {
     List<ElecStoreH> selectHourList(ElecStoreH elecStoreH);
 
     /**
+     * 查询储能计量-日列表
+     *
+     * @param queryIndex 参数
+     * @return 储能计量-日集合
+     */
+    List<ElecStoreH> selectDayList(QueryIndex queryIndex);
+
+    /**
      * 新增储能计量-小时
      *
      * @param elecStoreH 储能计量-小时

+ 10 - 11
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecUseHService.java

@@ -5,6 +5,7 @@ import java.util.Map;
 
 import com.ruoyi.ems.domain.ElecUseH;
 import com.ruoyi.ems.domain.vo.ElecUseSta;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 
 /**
  * 用能计量-小时Service接口
@@ -30,7 +31,16 @@ public interface IElecUseHService {
     List<ElecUseH> getElecUseHList(ElecUseH elecUseH);
 
     /**
+     * 查询用能计量-日列表
+     *
+     * @param queryIndex 条件参数
+     * @return 用能计量-日集合
+     */
+    List<ElecUseH> getElecUseDayList(QueryIndex queryIndex);
+
+    /**
      * 查询用能计量-小时列表(合并计算)
+     *
      * @param elecUseH 条件参数
      * @return 用能计量-小时集合
      */
@@ -71,15 +81,4 @@ public interface IElecUseHService {
      * @return 结果
      */
     int deleteElecUseHById(Long id);
-
-    /**
-     * 查询用能和发电量
-     */
-    List<Map> selectElecAndPower(String areaCode);
-
-    Map<String, List<Map<String, Object>>> getMonthElecUse(String areaCode);
-
-    List<Map<String, Object>> getThisDayFacsCategoryElecUse(String areaCode);
-
-    Map<String, Object> getThisDayAreaElecUse(String areaCode);
 }

+ 7 - 27
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java

@@ -1,16 +1,14 @@
 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;
-
-import com.ruoyi.common.core.utils.DateTimeUtil;
 import com.ruoyi.ems.domain.ElecPvSupplyH;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import com.ruoyi.ems.mapper.ElecPvSupplyHMapper;
 import com.ruoyi.ems.service.IElecPvSupplyHService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * 光伏并网计量光伏并网计量-小时Service业务层处理
@@ -51,26 +49,8 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
     }
 
     @Override
-    public List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH PvSupplyH) {
-        return pvSupplyHMapper.selectAreaSupplyH(PvSupplyH);
-    }
-
-    @Override
-    public List<Map<String, Object>> selectAreaSupplyHByThisDay(String areaCode) {
-        String dateTime = DateTimeUtil.currentDateTime(DateTimeUtil.DateFormatter.yyyy_MM_dd);
-        return pvSupplyHMapper.selectAreaSupplyByDate(areaCode, dateTime);
-    }
-
-    @Override
-    public List<Map<String, Object>> selectAreaSupplyHByRefMonth(String areaCode) {
-        String firstDayOfRecentMonth = DateTimeUtil.getFirstDayOfRecentMonth();
-        return pvSupplyHMapper.selectAreaSupplyByDate(areaCode, firstDayOfRecentMonth);
-    }
-
-    @Override
-    public List<Map<String, Object>> selectAreaSupplyHByYear(String areaCode) {
-        String dateTime = DateTimeUtil.getFirstDayOfThisYear(DateTimeUtil.DateFormatter.yyyy_MM_dd);
-        return pvSupplyHMapper.selectAreaSupplyByThisYear(areaCode, dateTime);
+    public List<ElecPvSupplyH> selectPvSupplyDayList(QueryIndex queryIndex) {
+        return pvSupplyHMapper.selectPvSupplyDayList(queryIndex);
     }
 
     /**

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

@@ -4,6 +4,7 @@ import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.ems.domain.ElecStoreH;
 import com.ruoyi.ems.domain.vo.ElecStoreAnalyze;
 import com.ruoyi.ems.domain.vo.ElecStoreSta;
+import com.ruoyi.ems.domain.vo.QueryIndex;
 import com.ruoyi.ems.mapper.EmsElecStoreHMapper;
 import com.ruoyi.ems.service.IElecStoreService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -61,6 +62,11 @@ public class ElecStoreServiceImpl implements IElecStoreService {
         }
     }
 
+    @Override
+    public List<ElecStoreH> selectDayList(QueryIndex queryIndex) {
+        return elecStoreHMapper.selectStoreDayList(queryIndex);
+    }
+
     /**
      * 新增储能计量-小时
      *

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

@@ -1,23 +1,15 @@
 package com.ruoyi.ems.service.impl;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
+import com.ruoyi.ems.domain.ElecUseH;
 import com.ruoyi.ems.domain.vo.ElecUseSta;
+import com.ruoyi.ems.domain.vo.QueryIndex;
+import com.ruoyi.ems.mapper.ElecUseHMapper;
+import com.ruoyi.ems.service.IElecUseHService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.ruoyi.common.core.utils.DateTimeUtil;
-import com.ruoyi.common.core.utils.StreamUtils;
-import com.ruoyi.ems.domain.ElecUseH;
-import com.ruoyi.ems.mapper.ElecUseHMapper;
-import com.ruoyi.ems.mapper.ElecPvSupplyHMapper;
-import com.ruoyi.ems.service.IElecUseHService;
-
-import cn.hutool.core.map.MapUtil;
+import java.util.List;
 
 /**
  * 用能计量-小时Service业务层处理
@@ -30,9 +22,6 @@ public class ElecUseHServiceImpl implements IElecUseHService {
     @Autowired
     private ElecUseHMapper elecUseHMapper;
 
-    @Autowired
-    private ElecPvSupplyHMapper pvSupplyHMapper;
-
     /**
      * 查询用能计量-小时
      *
@@ -56,6 +45,11 @@ public class ElecUseHServiceImpl implements IElecUseHService {
     }
 
     @Override
+    public List<ElecUseH> getElecUseDayList(QueryIndex queryIndex) {
+        return elecUseHMapper.selectElecUseDayList(queryIndex);
+    }
+
+    @Override
     public List<ElecUseH> getElecUseHListSum(ElecUseH elecUseH) {
         return elecUseHMapper.selectElecUseHListSum(elecUseH);
     }
@@ -123,50 +117,4 @@ public class ElecUseHServiceImpl implements IElecUseHService {
     public int deleteElecUseHById(Long id) {
         return elecUseHMapper.deleteElecUseHById(id);
     }
-
-    @Override
-    public List<Map> selectElecAndPower(String areaCode) {
-        String firstDayOfRecentYear = DateTimeUtil.getFirstDayOfRecentYear();
-        List<Map<String, Object>> monthElecUse = elecUseHMapper.selectElecUseHByMonth(areaCode, firstDayOfRecentYear);
-        List<Map<String, Object>> monthPv = pvSupplyHMapper.selectAreaSupplyByMonth(areaCode, firstDayOfRecentYear);
-        Map<String, Map<String, Object>> dateElecUseIndex = StreamUtils.toIdentityMap(monthElecUse,
-            map -> MapUtil.getStr(map, "dateIndex"));
-        Map<String, Map<String, Object>> datePvIndex = StreamUtils.toIdentityMap(monthPv,
-            map -> MapUtil.getStr(map, "dateIndex"));
-        List<String> dates = DateTimeUtil.monthOfRange(firstDayOfRecentYear,
-            DateTimeUtil.currentDateTime(DateTimeUtil.DateFormatter.yyyy_MM_dd), DateTimeUtil.DateFormatter.yyyy_MM_dd,
-            DateTimeUtil.DateFormatter.yyyy_MM);
-        List<Map> result = new ArrayList<>();
-        Map<Object, Object> dateIndex;
-        for (String date : dates) {
-            dateIndex = MapUtil.builder().put("dateIndex", date).map();
-            if (dateElecUseIndex.containsKey(date)) {
-                dateIndex.putAll(dateElecUseIndex.get(date));
-            }
-            if (datePvIndex.containsKey(date)) {
-                dateIndex.putAll(datePvIndex.get(date));
-            }
-            result.add(dateIndex);
-        }
-        return result;
-    }
-
-    @Override
-    public Map<String, List<Map<String, Object>>> getMonthElecUse(String areaCode) {
-        String date = DateTimeUtil.getFirstDayOfRecentYear();
-        List<Map<String, Object>> areaData = elecUseHMapper.selectMonthElecUse(areaCode, date);
-        return StreamUtils.groupByKey(areaData, map -> MapUtil.getStr(map, "areaCode"));
-    }
-
-    @Override
-    public List<Map<String, Object>> getThisDayFacsCategoryElecUse(String areaCode) {
-        String date = DateTimeUtil.currentDateTime(DateTimeUtil.DateFormatter.yyyy_MM_dd);
-        return elecUseHMapper.selectThisDayFacsCategoryElecUse(areaCode, date);
-    }
-
-    @Override
-    public Map<String, Object> getThisDayAreaElecUse(String areaCode) {
-        String date = DateTimeUtil.currentDateTime(DateTimeUtil.DateFormatter.yyyy_MM_dd);
-        return elecUseHMapper.selectThisDayElecUse(areaCode, date);
-    }
 }

+ 34 - 63
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -97,6 +97,39 @@
             pv.`time_index`
     </select>
 
+    <select id="selectPvSupplyDayList" parameterType="com.ruoyi.ems.domain.vo.QueryIndex" resultMap="PvSupplyHResult">
+        SELECT
+            <if test="facsSubCategory != null and facsSubCategory !=''">
+              sc.`name` as facs_name,
+            </if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+              pv.area_code,
+            </if>
+            pv.`date`,
+            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
+            <if test="facsSubCategory != null and facsSubCategory !=''">
+              LEFT JOIN adm_ems_facs f ON pv.`facs_code` = f.`facs_code`
+              LEFT JOIN dim_ems_facs_subcategory sc ON f.facs_subcategory = sc.`code`
+            </if>
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+                and pv.area_code = #{areaCode}
+            </if>
+            <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
+                and pv.`date` &gt;= #{startTime} and pv.`date` &lt;= #{endTime}
+            </if>
+            <if test="facsSubCategory != null and facsSubCategory !=''">
+                and f.facs_subcategory = #{facsSubCategory}
+            </if>
+        </where>
+        GROUP BY pv.`date`
+        ORDER BY pv.`date`
+    </select>
+
     <select id="calThisDayPv" resultType="Map">
 
         SELECT sum(
@@ -113,6 +146,7 @@
         GROUP BY
             DATE
     </select>
+
     <select id="calThisDayPvByH" resultType="Map">
 
         SELECT time_index                                                      timeIndex,
@@ -131,69 +165,6 @@
             DATE, time_index;
     </select>
 
-    <select id="selectAreaSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" resultMap="PvSupplyHResult">
-        SELECT area_code,
-               `date`,
-               time_index,
-               SUM(gen_elec_quantity) as gen_elec_quantity,
-               SUM(use_elec_quantity) as use_elec_quantity,
-               SUM(up_elec_quantity)  as up_elec_quantity,
-               SUM(up_elec_earn)      as up_elec_earn
-        FROM adm_ems_pv_supply_h
-        WHERE area_code = #{areaCode}
-          AND DATE = #{date,jdbcType=DATE}
-        GROUP BY
-            area_code,
-            time_index
-        ORDER BY
-            time_index ASC
-    </select>
-
-    <select id="selectAreaSupplyByDate" resultType="Map">
-        SELECT area_code,
-               DATE_FORMAT(date, '%Y-%m-%d') AS dateIndex,
-               SUM(gen_elec_quantity)        as genElecQuantity,
-               SUM(use_elec_quantity)        as useElecQuantity,
-               SUM(up_elec_quantity)         as upElecQuantity,
-               SUM(up_elec_earn)             as upElecEarn
-        FROM adm_ems_pv_supply_h
-        WHERE area_code = #{areaCode}
-          AND DATE >= #{date}
-        GROUP BY
-            area_code,
-            dateIndex
-    </select>
-
-    <select id="selectAreaSupplyByMonth" resultType="Map">
-        SELECT area_code,
-               DATE_FORMAT(date, '%Y-%m') AS dateIndex,
-               SUM(gen_elec_quantity)        as genElecQuantity,
-               SUM(use_elec_quantity)        as useElecQuantity,
-               SUM(up_elec_quantity)         as upElecQuantity,
-               SUM(up_elec_earn)             as upElecEarn
-        FROM adm_ems_pv_supply_h
-        WHERE area_code = #{areaCode}
-          AND DATE >= #{date}
-        GROUP BY
-            area_code,
-            dateIndex
-    </select>
-
-    <select id="selectAreaSupplyByThisYear" resultType="Map">
-        SELECT area_code,
-               DATE_FORMAT(date, '%Y') AS dateIndex,
-               SUM(gen_elec_quantity)  as genElecQuantity,
-               SUM(use_elec_quantity)  as useElecQuantity,
-               SUM(up_elec_quantity)   as upElecQuantity,
-               SUM(up_elec_earn)       as upElecEarn
-        FROM adm_ems_pv_supply_h
-        WHERE area_code = #{areaCode}
-          AND DATE >= #{date}
-        GROUP BY
-            area_code,
-            dateIndex
-    </select>
-
     <select id="selectPvSupplyHById" parameterType="Long" resultMap="PvSupplyHResult">
         <include refid="selectPvSupplyHVo"/>
         where id = #{id}

+ 52 - 69
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml

@@ -70,6 +70,57 @@
         u.`time_index`
     </select>
 
+    <select id="selectElecUseDayList" parameterType="com.ruoyi.ems.domain.vo.QueryIndex" resultMap="elecUseHResult">
+        select
+        <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+            u.area_code,
+            a.area_name,
+            a.short_name as area_short_name,
+        </if>
+        <if test="objCode != null and objCode != ''">
+            u.obj_code,
+            CASE
+            WHEN u.obj_type = 1 THEN f.facs_name
+            WHEN u.obj_type = 2 THEN d.device_name
+            END as obj_name,
+        </if>
+        <if test="(facsCategory != null and facsCategory != '') or (facsSubCategory != null and facsSubCategory != '')">
+            fa.facs_category,
+            fa.facs_subcategory,
+            <if test="objCode == null or objCode == ''">
+                fs.name as obj_name,
+            </if>
+        </if>
+        u.`date`,
+        sum(COALESCE(u.elec_quantity,0)) elec_quantity
+        from adm_ems_obj_use_h u
+        <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+            LEFT JOIN adm_service_area a ON u.`area_code` = a.`area_code`
+        </if>
+        <if test="(facsCategory != null  and facsCategory != '') or (facsSubCategory != null  and facsSubCategory != '')">
+            LEFT JOIN adm_ems_facs fa ON u.`obj_code` = fa.`facs_code`
+            <if test="objCode == null or objCode == ''">
+                LEFT JOIN dim_ems_facs_subcategory fs ON fa.`facs_subcategory` = fs.`code`
+            </if>
+        </if>
+        <if test="objCode != null and objCode != ''">
+            LEFT JOIN adm_ems_facs f ON u.`obj_code` = f.`facs_code`
+            LEFT JOIN adm_ems_device d ON u.`obj_code` = d.`device_code`
+        </if>
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and u.area_code = #{areaCode}</if>
+            <if test="objType != null ">and u.obj_type = #{objType}</if>
+            <if test="objCode != null and objCode != ''">and u.obj_code = #{objCode}</if>
+            <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
+                and u.`date` &gt;= #{startTime} and u.`date` &lt;= #{endTime}
+            </if>
+            <if test="facsCategory != null and facsCategory != ''">and fa.facs_category = #{facsCategory}</if>
+            <if test="facsSubCategory != null and facsSubCategory != ''">and fa.facs_subcategory = #{facsSubCategory}</if>
+        </where>
+        GROUP BY u.`date`
+        ORDER BY u.`date`
+    </select>
+
     <select id="selectElecUseHListSum" parameterType="com.ruoyi.ems.domain.ElecUseH" resultMap="elecUseHResult">
         select
             <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
@@ -112,6 +163,7 @@
             </if>
         <where>
             <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and u.area_code = #{areaCode}</if>
+            <if test="objType != null ">and u.obj_type = #{objType}</if>
             <if test="objCode != null and objCode != ''">and u.obj_code = #{objCode}</if>
             <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
                 and u.`record_time` &gt;= #{startRecTime} and u.`record_time` &lt;= #{endRecTime}
@@ -227,73 +279,4 @@
             #{id}
         </foreach>
     </delete>
-
-    <select id="selectElecUseHByMonth" resultType="Map">
-        SELECT area_code areaCode,
-        DATE_FORMAT(date, '%Y-%m') AS dateIndex,
-        SUM(elec_quantity) as elecQuantity
-        FROM adm_ems_obj_use_h
-        <where>
-            <if test="areaCode != null and areaCode != ''">
-                and area_code = #{areaCode}
-            </if>
-            <if test="date != null and date != ''">
-                and DATE >= #{date}
-            </if>
-        </where>
-        GROUP BY
-        area_code,
-        dateIndex
-    </select>
-
-    <select id="selectThisDayElecUse" resultType="Map">
-        SELECT area_code areaCode,
-        DATE_FORMAT(date, '%Y-%m-%d') AS dateIndex,
-        SUM(elec_quantity) as elecQuantity
-        FROM adm_ems_obj_use_h
-        <where>
-            <if test="areaCode != null and areaCode != ''">
-                and area_code = #{areaCode}
-            </if>
-            <if test="date != null and date != ''">
-                and DATE >= #{date}
-            </if>
-        </where>
-        GROUP BY
-        area_code,
-        dateIndex
-    </select>
-
-    <select id="selectThisDayFacsCategoryElecUse" resultType="Map">
-        SELECT subcategory.`name`,
-        DATE_FORMAT(DATE, '%Y-%m-%d') AS dateIndex,
-        SUM(elec_quantity) AS elecQuantity
-        FROM adm_ems_obj_use_h facUse
-        inner JOIN adm_ems_facs facs ON facUse.obj_code = facs.facs_code
-        <if test="areaCode != null and areaCode != ''">
-            and facUse.area_code = #{areaCode}
-        </if>
-        LEFT JOIN dim_ems_facs_subcategory subcategory ON facs.facs_subcategory = subcategory.`code`
-        AND subcategory.parent_code = 'Z'
-        WHERE
-         obj_type = 1
-        `DATE` >= #{date}
-        GROUP BY
-        subcategory.`name`,
-        dateIndex
-    </select>
-
-    <select id="selectMonthElecUse" resultType="Map">
-        SELECT area_code                     areaCode,
-               DATE_FORMAT(date, '%Y-%m') AS dateIndex,
-               SUM(elec_quantity)         as elecQuantity
-        FROM adm_ems_facs_use_h
-        WHERE DATE >= #{date}
-        <if test="areaCode != null and areaCode != ''">
-            and area_code = #{areaCode}
-        </if>
-        GROUP BY
-            area_code,
-            dateIndex
-    </select>
 </mapper>

+ 31 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml

@@ -88,6 +88,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         st.`time_index`
     </select>
 
+    <select id="selectStoreDayList" parameterType="com.ruoyi.ems.domain.vo.QueryIndex" resultMap="StoreHResult">
+        SELECT
+            <if test="facsSubCategory != null and facsSubCategory !=''">
+              sc.`name` as facs_name,
+            </if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+              s.area_code,
+            </if>
+            s.`date`,
+            sum(COALESCE(s.`charge_elec_quantity`, 0)) charge_elec_quantity,
+            sum(COALESCE(s.`discharge_elec_quantity`, 0)) discharge_elec_quantity
+        FROM adm_ems_elec_store_h s
+        <if test="facsSubCategory != null and facsSubCategory !=''">
+            LEFT JOIN adm_ems_facs f ON s.`facs_code` = f.`facs_code`
+            LEFT JOIN dim_ems_facs_subcategory sc ON f.facs_subcategory = sc.`code`
+        </if>
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+                and s.area_code = #{areaCode}
+            </if>
+            <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
+                and s.`date` &gt;= #{startTime} and s.`date` &lt;= #{endTime}
+            </if>
+            <if test="facsSubCategory != null and facsSubCategory !=''">
+                and f.facs_subcategory = #{facsSubCategory}
+            </if>
+        </where>
+        GROUP BY s.`date`
+        ORDER BY s.`date`
+    </select>
+
     <select id="selectStoreHById" parameterType="Long" resultMap="StoreHResult">
         <include refid="selectStoreHVo"/>
         where st.id = #{id}

+ 1 - 1
ems-cloud/sql/ems_init_data.sql

@@ -442,7 +442,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202403', 238, '2024-02-29', 365, '2024-03-31', 127, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202404', 365, '2024-03-31', 537, '2024-04-30', 172, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202405', 537, '2024-04-30', 686, '2024-05-31', 149, NULL, NULL);
-INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202406', 686, '2024-05-31', 921, '2024-06-30', 235, NULL, NULL);
+INSERT INTO L (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202406', 686, '2024-05-31', 921, '2024-06-30', 235, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202407', 921, '2024-06-30', 1189, '2024-07-31', 268, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202408', 1189, '2024-07-31', 1464, '2024-08-31', 275, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202409', 1464, '2024-08-31', 1797, '2024-09-30', 333, NULL, NULL);

+ 8 - 7
ems-cloud/sql/ems_sys.sql

@@ -169,7 +169,7 @@ insert into sys_menu values ('9',  '系统对接', '0', '9', 'adapter',
 insert into sys_menu values ('99', '开发工具', '0', '99', 'tool',            null, '', 1, 0, 'M', '0', '0', '',  'tool',        'admin', sysdate(), '', null, '开发工具');
 
 -- 二级菜单
-insert into sys_menu values ('100',  '服务区',         '1',   '1',   'hp-view-sa',         'view/servicearea',          '', 1, 0, 'C', '0', '0',   'view:service-area',      'servicearea',    'admin', sysdate(), '', null, '园区能源概览');
+insert into sys_menu values ('100',  '服务区',         '1',   '1',   '/largeScreen',         'view/servicearea',          '', 1, 0, 'C', '0', '0',   'view:service-area',      'servicearea',    'admin', sysdate(), '', null, '园区能源概览');
 insert into sys_menu values ('101',  '主路光伏',       '1',   '2',   'hp-view-rpv',        'view/road/photovoltaic',    '', 1, 0, 'C', '0', '0',   'view:road-pv',           'photovoltaic',   'admin', sysdate(), '', null, '主路光伏概览');
 
 insert into sys_menu values ('112',  '源网',            '2',    '1',  'strategy-pg',        'mgr/powergrid',             '', 1, 0, 'C', '0', '0',   'power-mgr:pg',           'powergrid',      'admin', sysdate(), '', null, '源网协调');
@@ -894,17 +894,18 @@ insert into sys_dict_data values(29, 2,  '失败',     '1',       'sys_common_st
 INSERT INTO `sys_dict_data` VALUES (100, 0, '运行', '0', 'sys_device_stat', NULL, 'default', 'N', '0', 'admin', '2024-08-07 10:22:55', 'admin', '2024-08-07 11:12:50', NULL);
 INSERT INTO `sys_dict_data` VALUES (101, 0, '故障', '1', 'sys_device_stat', NULL, 'default', 'N', '0', 'admin', '2024-08-07 10:23:36', 'admin', '2024-08-07 11:12:56', NULL);
 INSERT INTO `sys_dict_data` VALUES (102, 0, '未运行', '2', 'sys_device_stat', NULL, 'default', 'N', '0', 'admin', '2024-08-07 10:23:48', 'admin', '2024-08-07 11:13:00', NULL);
-INSERT INTO `sys_dict_data` VALUES (103, 0, '源网协调', '1', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:37', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (104, 0, '源荷互动', '2', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (105, 0, '网储互动', '3', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (103, 0, '源网策略', '1', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:37', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (104, 0, '源荷策略', '2', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (105, 0, '网储策略', '3', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
 INSERT INTO `sys_dict_data` VALUES (106, 0, '其他',    '4', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (107, 0, '定时执行(cron)', '1', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:06', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (108, 0, '手动执行', '99', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:34', '', NULL, '手动执行');
+INSERT INTO `sys_dict_data` VALUES (107, 0, '自动执行', '1', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:06', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (108, 0, '定时执行(cron)', '2', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:06', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (109, 0, '手动执行', '99', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:34', '', NULL, '手动执行');
 INSERT INTO `sys_dict_data` VALUES (111, 0, '不区分', '0', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:23:59', '', NULL, '0:不区分 ');
 INSERT INTO `sys_dict_data` VALUES (112, 0, '峰电计量', '1', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:24:14', '', NULL, '1:峰电计量  ');
 INSERT INTO `sys_dict_data` VALUES (113, 0, '谷电计量', '2', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:24:24', '', NULL, '2:谷电计量');
 INSERT INTO `sys_dict_data` VALUES (114, 0, '区块', '1', 'obj_type', NULL, 'default', 'N', '0', 'admin', '2024-08-12 14:23:19', 'admin', '2024-08-28 15:33:44', '');
-INSERT INTO `sys_dict_data` VALUES (115, 0, '设施 ', '2', 'obj_type', NULL, 'default', 'N', '0', 'admin', '2024-08-12 14:23:30', '', NULL, ' 2-设施 ');
+INSERT INTO `sys_dict_data` VALUES (115, 0, '设施', '2', 'obj_type', NULL, 'default', 'N', '0', 'admin', '2024-08-12 14:23:30', '', NULL, ' 2-设施 ');
 INSERT INTO `sys_dict_data` VALUES (116, 0, '设备', '3', 'obj_type', NULL, 'default', 'N', '0', 'admin', '2024-08-12 14:23:40', 'admin', '2024-08-12 14:23:47', '3-设备');
 INSERT INTO `sys_dict_data` VALUES (117, 1, ' photovoltaic', '100', 'basecfg_lable', NULL, 'default', 'N', '0', 'admin', '2024-08-19 10:50:16', 'admin', '2024-08-19 14:33:00', '光伏');
 INSERT INTO `sys_dict_data` VALUES (118, 2, 'energy', '200', 'basecfg_lable', NULL, 'default', 'N', '0', 'admin', '2024-08-19 10:50:59', '', NULL, '能源');