learshaw 2 месяцев назад
Родитель
Сommit
c087dd70c2
39 измененных файлов с 1359 добавлено и 1717 удалено
  1. 0 107
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/AdmEmsElecPgIndexController.java
  2. 45 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java
  3. 0 7
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreController.java
  4. 95 0
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreIndexController.java
  5. 0 11
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsFacsController.java
  6. 0 51
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/task/FacTask.java
  7. 0 140
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/AdmEmsElecPgIndex.java
  8. 0 234
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecPvSupplyH.java
  9. 65 0
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecStoreIndex.java
  10. 0 99
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsElecStoreIndex.java
  11. 0 72
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/AdmEmsElecPgIndexMapper.java
  12. 1 2
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecMeterHMapper.java
  13. 20 28
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java
  14. 61 0
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecStoreIndexMapper.java
  15. 0 3
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsElecStoreHMapper.java
  16. 8 0
      ems/ems-core/src/main/java/com/ruoyi/ems/model/PvSupplyVO.java
  17. 5 164
      ems/ems-core/src/main/java/com/ruoyi/ems/model/QueryMeter.java
  18. 0 61
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IAdmEmsElecPgIndexService.java
  19. 0 14
      ems/ems-core/src/main/java/com/ruoyi/ems/service/ICaMeterDService.java
  20. 0 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecPgSupplyHService.java
  21. 14 0
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java
  22. 61 0
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecStoreIndexService.java
  23. 0 3
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecStoreService.java
  24. 0 4
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsFacsService.java
  25. 0 2
      ems/ems-core/src/main/java/com/ruoyi/ems/service/analysis/CarbonCalculationService.java
  26. 0 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/analysis/ElecProdForecastService.java
  27. 0 87
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/AdmEmsElecPgIndexServiceImpl.java
  28. 0 35
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/CaMeterDServiceImpl.java
  29. 47 6
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java
  30. 87 0
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecStoreIndexServiceImpl.java
  31. 0 6
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecStoreServiceImpl.java
  32. 0 78
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  33. 0 125
      ems/ems-core/src/main/resources/mapper/ems/AdmEmsElecPgIndexMapper.xml
  34. 124 225
      ems/ems-core/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml
  35. 110 0
      ems/ems-core/src/main/resources/mapper/ems/ElecStoreIndexMapper.xml
  36. 11 21
      ems/ems-core/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml
  37. 440 81
      ems/sql/ems_init_data_ctfwq.sql
  38. 159 42
      ems/sql/ems_server.sql
  39. 6 6
      ems/sql/ems_sys_data.sql

+ 0 - 107
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/AdmEmsElecPgIndexController.java

@@ -1,107 +0,0 @@
-package com.ruoyi.ems.controller;
-
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.huashe.common.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.AdmEmsElecPgIndex;
-import com.ruoyi.ems.service.IAdmEmsElecPgIndexService;
-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.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 电网设施指标Controller
- * 
- * @author ruoyi
- * @date 2024-08-30
- */
-@RestController
-@RequestMapping("/elecPgIndex")
-@Api(value = "AdmEmsElecPgIndexController", description = "电网设施指标")
-public class AdmEmsElecPgIndexController extends BaseController
-{
-    @Autowired
-    private IAdmEmsElecPgIndexService elecPgIndexService;
-
-    /**
-     * 查询电网设施指标列表
-     */
-    @RequiresPermissions("ems:elecPgIndex:list")
-    @GetMapping("/list")
-    public TableDataInfo list(AdmEmsElecPgIndex elecPgIndex)
-    {
-        startPage();
-        List<AdmEmsElecPgIndex> list = elecPgIndexService.selectAdmEmsElecPgIndexList(elecPgIndex);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出电网设施指标列表
-     */
-    @RequiresPermissions("ems:elecPgIndex:export")
-    @Log(title = "电网设施指标", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, AdmEmsElecPgIndex elecPgIndex)
-    {
-        List<AdmEmsElecPgIndex> list = elecPgIndexService.selectAdmEmsElecPgIndexList(elecPgIndex);
-        ExcelUtil<AdmEmsElecPgIndex> util = new ExcelUtil<AdmEmsElecPgIndex>(AdmEmsElecPgIndex.class);
-        util.exportExcel(response, list, "电网设施指标数据");
-    }
-
-    /**
-     * 获取电网设施指标详细信息
-     */
-    @RequiresPermissions("ems:elecPgIndex:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(elecPgIndexService.selectAdmEmsElecPgIndexById(id));
-    }
-
-    /**
-     * 新增电网设施指标
-     */
-    @RequiresPermissions("ems:elecPgIndex:add")
-    @Log(title = "电网设施指标", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody AdmEmsElecPgIndex elecPgIndex)
-    {
-        return toAjax(elecPgIndexService.insertAdmEmsElecPgIndex(elecPgIndex));
-    }
-
-    /**
-     * 修改电网设施指标
-     */
-    @RequiresPermissions("ems:elecPgIndex:edit")
-    @Log(title = "电网设施指标", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody AdmEmsElecPgIndex elecPgIndex)
-    {
-        return toAjax(elecPgIndexService.updateAdmEmsElecPgIndex(elecPgIndex));
-    }
-
-    /**
-     * 删除电网设施指标
-     */
-    @RequiresPermissions("ems:elecPgIndex:remove")
-    @Log(title = "电网设施指标", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(elecPgIndexService.deleteAdmEmsElecPgIndexByIds(ids));
-    }
-}

+ 45 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java

@@ -18,9 +18,13 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+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.time.LocalDate;
 import java.util.List;
 
 /**
@@ -102,6 +106,46 @@ public class ElecPvSupplyHController extends BaseController {
     }
 
     /**
+     * 查询光伏产能按区域分布(用于饼图)
+     * 当areaCode为空或-1时,返回所有区域的分组数据
+     */
+    @RequiresPermissions("ems:prod:list")
+    @GetMapping("/hour/distribution")
+    @ApiOperation("查询光伏产能按区域分布")
+    public AjaxResult getDistribution(@ApiParam("查询参数") QueryMeter queryMeter) {
+        // 设置默认时间范围
+        if (StringUtils.isBlank(queryMeter.getStartRecTime()) || StringUtils.isBlank(queryMeter.getEndRecTime())) {
+            // 默认最近30天
+            LocalDate today = LocalDate.now();
+            LocalDate startDate = today.minusDays(30);
+            queryMeter.setStartRecTime(startDate.toString() + " 00:00:00");
+            queryMeter.setEndRecTime(today.toString() + " 23:59:59");
+        }
+
+        List<PvSupplyVO> list = pvSupplyHService.selectPvSupplyDistribution(queryMeter);
+        return success(list);
+    }
+
+    /**
+     * 查询光伏产能分布明细(按区域和日期分组,用于对比柱状图)
+     */
+    @RequiresPermissions("ems:prod:list")
+    @GetMapping("/hour/distribution/detail")
+    @ApiOperation("查询光伏产能分布明细")
+    public AjaxResult getDistributionDetail(@ApiParam("查询参数") QueryMeter queryMeter) {
+        // 设置默认时间范围
+        if (StringUtils.isBlank(queryMeter.getStartRecTime()) || StringUtils.isBlank(queryMeter.getEndRecTime())) {
+            LocalDate today = LocalDate.now();
+            LocalDate startDate = today.minusDays(30);
+            queryMeter.setStartRecTime(startDate.toString() + " 00:00:00");
+            queryMeter.setEndRecTime(today.toString() + " 23:59:59");
+        }
+
+        List<PvSupplyVO> list = pvSupplyHService.selectPvSupplyDistributionDetail(queryMeter);
+        return success(list);
+    }
+
+    /**
      * 校验并设置默认参数
      */
     private void validateAndSetDefaults(QueryMeter queryMeter) {

+ 0 - 7
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreController.java

@@ -8,7 +8,6 @@ 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.EmsElecStoreIndex;
 import com.ruoyi.ems.model.ElecStoreAnalyze;
 import com.ruoyi.ems.model.QueryMeter;
 import com.ruoyi.ems.service.IElecStoreService;
@@ -81,12 +80,6 @@ public class ElecStoreController extends BaseController {
         return success(elecStoreService.selectStoreHByDataRange(elecStoreH));
     }
 
-    @GetMapping("/sum/realtime/storage")
-    public AjaxResult selectStorageIndex(EmsElecStoreIndex elecStoreIndex) {
-        return success(elecStoreService.selectStorageIndex(elecStoreIndex));
-    }
-
-
     /**
      * 获取储能计量-小时详细信息
      */

+ 95 - 0
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecStoreIndexController.java

@@ -0,0 +1,95 @@
+package com.ruoyi.ems.controller;
+
+import com.ruoyi.common.core.web.controller.BaseController;
+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.ElecStoreIndex;
+import com.ruoyi.ems.service.IElecStoreIndexService;
+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.RestController;
+import com.huashe.common.domain.AjaxResult;
+import java.util.List;
+
+/**
+ * 储能设施指标Controller
+ * 
+ * @author ruoyi
+ * @date 2026-01-28
+ */
+@RestController
+@RequestMapping("/elec/store/index")
+public class ElecStoreIndexController extends BaseController
+{
+    @Autowired
+    private IElecStoreIndexService elecStoreIndexService;
+
+    /**
+     * 查询储能设施指标列表
+     */
+    @RequiresPermissions("ems:ElecStoreIndex:list")
+    @GetMapping("/list")
+    public TableDataInfo list(ElecStoreIndex elecStoreIndex)
+    {
+        startPage();
+        List<ElecStoreIndex> list = elecStoreIndexService.selectElecStoreIndexList(elecStoreIndex);
+        return getDataTable(list);
+    }
+
+    @RequiresPermissions("ems:ElecStoreIndex:list")
+    @GetMapping("/latest")
+    public AjaxResult latest(ElecStoreIndex elecStoreIndex)
+    {
+        List<ElecStoreIndex> list = elecStoreIndexService.selectLatestByDevice(elecStoreIndex);
+        return success(list);
+    }
+
+    @RequiresPermissions("ems:ElecStoreIndex:list")
+    @GetMapping("/listAll")
+    public AjaxResult listAll(ElecStoreIndex elecStoreIndex)
+    {
+        List<ElecStoreIndex> list = elecStoreIndexService.selectElecStoreIndexList(elecStoreIndex);
+        return success(list);
+    }
+
+    /**
+     * 新增储能设施指标
+     */
+    @RequiresPermissions("ems:ElecStoreIndex:add")
+    @Log(title = "储能设施指标", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ElecStoreIndex elecStoreIndex)
+    {
+        return toAjax(elecStoreIndexService.insertElecStoreIndex(elecStoreIndex));
+    }
+
+    /**
+     * 修改储能设施指标
+     */
+    @RequiresPermissions("ems:ElecStoreIndex:edit")
+    @Log(title = "储能设施指标", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ElecStoreIndex elecStoreIndex)
+    {
+        return toAjax(elecStoreIndexService.updateElecStoreIndex(elecStoreIndex));
+    }
+
+    /**
+     * 删除储能设施指标
+     */
+    @RequiresPermissions("ems:ElecStoreIndex:remove")
+    @Log(title = "储能设施指标", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(elecStoreIndexService.deleteElecStoreIndexByIds(ids));
+    }
+}

+ 0 - 11
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsFacsController.java

@@ -129,17 +129,6 @@ public class EmsFacsController extends BaseController {
     }
 
     /**
-     * 网-服务区日功率指标
-     *
-     * @param areaCode
-     * @return
-     */
-    @GetMapping("/area/day/power/index")
-    public AjaxResult qryAreaDayPowerIndex(@RequestParam("areaCode") String areaCode) {
-        return success(facsService.qryAreaDayPowerIndex(areaCode));
-    }
-
-    /**
      * 查询区域树 (根据设施类型过滤)
      *
      * @param parentCode   父区域编码

+ 0 - 51
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/task/FacTask.java

@@ -1,51 +0,0 @@
-package com.ruoyi.ems.task;
-
-import com.huashe.common.utils.DateUtils;
-import com.ruoyi.ems.core.BaseTask;
-import com.ruoyi.ems.domain.AdmOpInspectionReport;
-import com.ruoyi.ems.enums.ResultStatus;
-import com.ruoyi.ems.service.impl.AdmOpInspectionReportServiceImpl;
-import com.ruoyi.ems.service.impl.EmsFacsServiceImpl;
-import com.ruoyi.quartz.domain.SysJob;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * 定时任务调度测试
- *
- * @author ruoyi
- */
-@Component("facInspectionTask")
-public class FacTask extends BaseTask {
-
-    @Autowired
-    private EmsFacsServiceImpl emsFacsService;
-
-    @Autowired
-    private AdmOpInspectionReportServiceImpl admOpInspectionReportService;
-
-    @Override
-    public void run(SysJob taskProperties) {
-        List<String> errorReport = emsFacsService.inspectFacIndex();
-        AdmOpInspectionReport facInspectionTask = new AdmOpInspectionReport() {
-            {
-                setTaskCode(taskProperties.getJobGroup() + "." + taskProperties.getJobId());
-                setResultStatus(ResultStatus.NORMAL.getCode());
-                setSubTime(DateUtils.getNowDate());
-                setFinishTime(DateUtils.getNowDate());
-                setSubmitter("facInspectionTask");
-            }
-        };
-        if (!errorReport.isEmpty()) {
-            log.error("facs index error report: {}", errorReport);
-            facInspectionTask.setResultStatus(ResultStatus.ABNORMAL.getCode());
-            facInspectionTask.setSubTime(DateUtils.getNowDate());
-            facInspectionTask.setFinishTime(DateUtils.getNowDate());
-            facInspectionTask.setResultMsg(StringUtils.join(errorReport, "\\r\\n"));
-        }
-        admOpInspectionReportService.insertAdmOpInspectionReport(facInspectionTask);
-    }
-}

+ 0 - 140
ems/ems-core/src/main/java/com/ruoyi/ems/domain/AdmEmsElecPgIndex.java

@@ -1,140 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.huashe.common.annotation.Excel;
-import com.huashe.common.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.util.Date;
-
-/**
- * 电网设施指标对象 adm_ems_elec_pg_index
- * 
- * @author ruoyi
- * @date 2024-08-30
- */
-public class AdmEmsElecPgIndex extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 园区代码 */
-    @Excel(name = "园区代码")
-    private String areaCode;
-
-    /** 设施代码 */
-    @Excel(name = "设施代码")
-    private String facsCode;
-
-    /** 日期 yyyy-MM-dd */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "日期 yyyy-MM-dd", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date date;
-
-    /** 时间 yyyy-MM-dd HH:mm:ss */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "时间 yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date time;
-
-    /** 电压 单位:kV(千伏) */
-    @Excel(name = "电压 单位:kV")
-    private Double voltage;
-
-    /** 电流 单位:A(安培) */
-    @Excel(name = "电流 单位:A")
-    private Double electricity;
-
-    /** 功率 单位:kW(千瓦) */
-    @Excel(name = "功率 单位:kW")
-    private Double power;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setAreaCode(String areaCode) 
-    {
-        this.areaCode = areaCode;
-    }
-
-    public String getAreaCode() 
-    {
-        return areaCode;
-    }
-    public void setFacsCode(String facsCode) 
-    {
-        this.facsCode = facsCode;
-    }
-
-    public String getFacsCode() 
-    {
-        return facsCode;
-    }
-    public void setDate(Date date) 
-    {
-        this.date = date;
-    }
-
-    public Date getDate() 
-    {
-        return date;
-    }
-    public void setTime(Date time) 
-    {
-        this.time = time;
-    }
-
-    public Date getTime() 
-    {
-        return time;
-    }
-    public void setVoltage(Double voltage) 
-    {
-        this.voltage = voltage;
-    }
-
-    public Double getVoltage() 
-    {
-        return voltage;
-    }
-    public void setElectricity(Double electricity) 
-    {
-        this.electricity = electricity;
-    }
-
-    public Double getElectricity() 
-    {
-        return electricity;
-    }
-    public void setPower(Double power) 
-    {
-        this.power = power;
-    }
-
-    public Double getPower() 
-    {
-        return power;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("areaCode", getAreaCode())
-            .append("facsCode", getFacsCode())
-            .append("date", getDate())
-            .append("time", getTime())
-            .append("voltage", getVoltage())
-            .append("electricity", getElectricity())
-            .append("power", getPower())
-            .toString();
-    }
-}

+ 0 - 234
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecPvSupplyH.java

@@ -1,234 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.huashe.common.annotation.Excel;
-import com.huashe.common.domain.BaseEntity;
-
-import java.sql.Time;
-import java.util.Date;
-
-/**
- * 光伏并网计量-小时对象 adm_ems_pv_supply_h
- *
- * @author ruoyi
- * @date 2024-08-02
- */
-public class ElecPvSupplyH extends BaseEntity {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 序号
-     */
-    private Long id;
-
-    /**
-     * 园区代码
-     */
-    private String areaCode;
-
-    /**
-     * 园区名称
-     */
-    @Excel(name = "位置")
-    private String areaName;
-
-    /**
-     * 园区简称
-     */
-    private String areaShortName;
-
-    /**
-     * 设施代码
-     */
-    private String facsCode;
-
-    /**
-     * 设施名称
-     */
-    private String facsName;
-
-    /**
-     * 记录时间 yyyy-MM-dd HH:mm:ss
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private String recordTime;
-
-    /**
-     * 日期 yyyy-MM-dd
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date date;
-
-    /**
-     * 时间 HH:mm:ss
-     */
-    @JsonFormat(pattern = "HH:mm:ss")
-    @Excel(name = "时间", width = 30, dateFormat = "HH:mm:ss")
-    private Time time;
-
-    /**
-     * 时间序列
-     */
-    @Excel(name = "时间序列")
-    private Long timeIndex;
-
-    /**
-     * 上网电价(1度电)
-     */
-    @Excel(name = "单位电价")
-    private Double upUnitPrice;
-
-    /**
-     * 发电量 单位:kW-h(千瓦时)
-     */
-    @Excel(name = "发电量(kW·h)")
-    private Double genElecQuantity;
-
-    /**
-     * 自用电量 单位:kW-h(千瓦时)
-     */
-    @Excel(name = "自用电量(kW·h)")
-    private Double useElecQuantity;
-
-    /**
-     * 上网电量 单位:kW-h(千瓦时)
-     */
-    @Excel(name = "上网电量(kW·h)")
-    private Double upElecQuantity;
-
-    /**
-     * 发电收益 单位: ¥(元)
-     */
-    @Excel(name = "发电收益(元)")
-    private Double upElecEarn;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getAreaCode() {
-        return areaCode;
-    }
-
-    public void setAreaCode(String areaCode) {
-        this.areaCode = areaCode;
-    }
-
-    public String getAreaName() {
-        return areaName;
-    }
-
-    public void setAreaName(String areaName) {
-        this.areaName = areaName;
-    }
-
-    public String getAreaShortName() {
-        return areaShortName;
-    }
-
-    public void setAreaShortName(String areaShortName) {
-        this.areaShortName = areaShortName;
-    }
-
-    public String getFacsCode() {
-        return facsCode;
-    }
-
-    public void setFacsCode(String facsCode) {
-        this.facsCode = facsCode;
-    }
-
-    public String getFacsName() {
-        return facsName;
-    }
-
-    public void setFacsName(String facsName) {
-        this.facsName = facsName;
-    }
-
-    public String getRecordTime() {
-        return recordTime;
-    }
-
-    public void setRecordTime(String recordTime) {
-        this.recordTime = recordTime;
-    }
-
-    public Date getDate() {
-        return date;
-    }
-
-    public void setDate(Date date) {
-        this.date = date;
-    }
-
-    public Time getTime() {
-        return time;
-    }
-
-    public void setTime(Time time) {
-        this.time = time;
-    }
-
-    public Long getTimeIndex() {
-        return timeIndex;
-    }
-
-    public void setTimeIndex(Long timeIndex) {
-        this.timeIndex = timeIndex;
-    }
-
-    public Double getUpUnitPrice() {
-        return upUnitPrice;
-    }
-
-    public void setUpUnitPrice(Double upUnitPrice) {
-        this.upUnitPrice = upUnitPrice;
-    }
-
-    public Double getGenElecQuantity() {
-        return genElecQuantity;
-    }
-
-    public void setGenElecQuantity(Double genElecQuantity) {
-        this.genElecQuantity = genElecQuantity;
-    }
-
-    public Double getUseElecQuantity() {
-        return useElecQuantity;
-    }
-
-    public void setUseElecQuantity(Double useElecQuantity) {
-        this.useElecQuantity = useElecQuantity;
-    }
-
-    public Double getUpElecQuantity() {
-        return upElecQuantity;
-    }
-
-    public void setUpElecQuantity(Double upElecQuantity) {
-        this.upElecQuantity = upElecQuantity;
-    }
-
-    public Double getUpElecEarn() {
-        return upElecEarn;
-    }
-
-    public void setUpElecEarn(Double upElecEarn) {
-        this.upElecEarn = upElecEarn;
-    }
-
-    @Override
-    public String toString() {
-        return "PvSupplyH{" + "id=" + id + ", areaCode='" + areaCode + '\'' + ", areaName='" + areaName + '\''
-            + ", areaShortName='" + areaShortName + '\'' + ", facsCode='" + facsCode + '\'' + ", facsName='" + facsName
-            + '\'' + ", date=" + date + ", time=" + time + ", timeIndex=" + timeIndex + ", upUnitPrice=" + upUnitPrice
-            + ", genElecQuantity=" + genElecQuantity + ", useElecQuantity=" + useElecQuantity + ", upElecQuantity="
-            + upElecQuantity + ", upElecEarn=" + upElecEarn + '}';
-    }
-}

+ 65 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecStoreIndex.java

@@ -0,0 +1,65 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huashe.common.domain.BaseEntity;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+
+/**
+ * 储能设施指标对象 adm_ems_elec_store_index
+ * 
+ * @author ruoyi
+ * @date 2026-01-28
+ */
+@Data
+public class ElecStoreIndex extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 园区代码 */
+    private String areaCode;
+
+    /** 设施代码 */
+    private String facsCode;
+
+    /** 设备代码 */
+    private String deviceCode;
+
+    /** 日期 yyyy-MM-dd */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date date;
+
+    /** 时间 yyyy-MM-dd HH:mm:ss */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date time;
+
+    /** 充电功率 */
+    private Double chargeVoltage;
+
+    /** 放电功率 */
+    private Double dischargePower;
+
+    /** 当前容量 单位:kW-h(千瓦·时) */
+    private Double currentCapacity;
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("areaCode", getAreaCode())
+            .append("facsCode", getFacsCode())
+            .append("deviceCode", getDeviceCode())
+            .append("date", getDate())
+            .append("time", getTime())
+            .append("chargeVoltage", getChargeVoltage())
+            .append("dischargePower", getDischargePower())
+            .append("currentCapacity", getCurrentCapacity())
+            .toString();
+    }
+}

+ 0 - 99
ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsElecStoreIndex.java

@@ -1,99 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import com.huashe.common.domain.BaseEntity;
-
-import java.util.Date;
-
-public class EmsElecStoreIndex extends BaseEntity {
-    private Long id;                    // 序号
-    private String areaCode;            // 园区代码
-    private String facsCode;            // 设施代码
-    private Date date;                  // 日期 yyyy-MM-dd
-    private Date time;                  // 时间 yyyy-MM-dd HH:mm:ss
-    private Double inputVoltage;        // 输入电压(kV)
-    private Double inputElectricity;    // 输入电流(A)
-    private Double outputVoltage;       // 输出电压(kV)
-    private Double outputElectricity;   // 输出电流(A)
-    private Double currentCapacity;     // 当前容量(kW·h)
-
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getAreaCode() {
-        return areaCode;
-    }
-
-    public void setAreaCode(String areaCode) {
-        this.areaCode = areaCode;
-    }
-
-    public String getFacsCode() {
-        return facsCode;
-    }
-
-    public void setFacsCode(String facsCode) {
-        this.facsCode = facsCode;
-    }
-
-    public Date getDate() {
-        return date;
-    }
-
-    public void setDate(Date date) {
-        this.date = date;
-    }
-
-    public Date getTime() {
-        return time;
-    }
-
-    public void setTime(Date time) {
-        this.time = time;
-    }
-
-    public Double getInputVoltage() {
-        return inputVoltage;
-    }
-
-    public void setInputVoltage(Double inputVoltage) {
-        this.inputVoltage = inputVoltage;
-    }
-
-    public Double getInputElectricity() {
-        return inputElectricity;
-    }
-
-    public void setInputElectricity(Double inputElectricity) {
-        this.inputElectricity = inputElectricity;
-    }
-
-    public Double getOutputVoltage() {
-        return outputVoltage;
-    }
-
-    public void setOutputVoltage(Double outputVoltage) {
-        this.outputVoltage = outputVoltage;
-    }
-
-    public Double getOutputElectricity() {
-        return outputElectricity;
-    }
-
-    public void setOutputElectricity(Double outputElectricity) {
-        this.outputElectricity = outputElectricity;
-    }
-
-    public Double getCurrentCapacity() {
-        return currentCapacity;
-    }
-
-    public void setCurrentCapacity(Double currentCapacity) {
-        this.currentCapacity = currentCapacity;
-    }
-}

+ 0 - 72
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/AdmEmsElecPgIndexMapper.java

@@ -1,72 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import com.ruoyi.ems.domain.AdmEmsElecPgIndex;
-import org.apache.ibatis.annotations.MapKey;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 电网设施指标Mapper接口
- *
- * @author ruoyi
- * @date 2024-08-30
- */
-public interface AdmEmsElecPgIndexMapper {
-    /**
-     * 查询电网设施指标
-     *
-     * @param id 电网设施指标主键
-     * @return 电网设施指标
-     */
-    AdmEmsElecPgIndex selectAdmEmsElecPgIndexById(Long id);
-
-    /**
-     * 查询电网设施指标列表
-     *
-     * @param elecPgIndex 电网设施指标
-     * @return 电网设施指标集合
-     */
-    List<AdmEmsElecPgIndex> selectAdmEmsElecPgIndexList(AdmEmsElecPgIndex elecPgIndex);
-
-    /**
-     * 新增电网设施指标
-     *
-     * @param elecPgIndex 电网设施指标
-     * @return 结果
-     */
-    int insertAdmEmsElecPgIndex(AdmEmsElecPgIndex elecPgIndex);
-
-    /**
-     * 修改电网设施指标
-     *
-     * @param elecPgIndex 电网设施指标
-     * @return 结果
-     */
-    int updateAdmEmsElecPgIndex(AdmEmsElecPgIndex elecPgIndex);
-
-    /**
-     * 删除电网设施指标
-     *
-     * @param id 电网设施指标主键
-     * @return 结果
-     */
-    int deleteAdmEmsElecPgIndexById(Long id);
-
-    /**
-     * 批量删除电网设施指标
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteAdmEmsElecPgIndexByIds(Long[] ids);
-
-    @MapKey("facsCode")
-    Map<String, Map<String, Object>> qryLatestObjIndex(@Param("set") List<String> set);
-
-    @MapKey("dateIndex")
-    Map<String, Map<String, Object>> qryAreaDayPowerIndex(@Param("areaCode") String areaCode,
-        @Param("date") String date);
-
-}

+ 1 - 2
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecMeterHMapper.java

@@ -1,8 +1,7 @@
 package com.ruoyi.ems.mapper;
 
-import com.ruoyi.ems.domain.ElecPvSupplyH;
-import com.ruoyi.ems.domain.EnergyMeter;
 import com.ruoyi.ems.domain.ElecMeterH;
+import com.ruoyi.ems.domain.EnergyMeter;
 import com.ruoyi.ems.model.QueryMeter;
 import org.apache.ibatis.annotations.Param;
 

+ 20 - 28
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java

@@ -1,6 +1,5 @@
 package com.ruoyi.ems.mapper;
 
-import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.model.PvSupplyVO;
 import com.ruoyi.ems.model.QueryMeter;
 import org.apache.ibatis.annotations.MapKey;
@@ -43,56 +42,49 @@ public interface ElecPvSupplyHMapper {
      */
     PvSupplyVO selectPvSupplySummary(@Param("queryMeter") QueryMeter queryMeter);
 
-
     /**
-     * 查询光伏并网计量光伏并网计量-小时
-     *
-     * @param id 光伏并网计量光伏并网计量-小时主键
-     * @return 光伏并网计量光伏并网计量-小时
+     * 查询光伏产能按区域分布(用于饼图)
+     * 当areaCode为空或-1时,返回所有区域的分组数据
+     * 当指定areaCode时,只返回该区域的数据
+     * @param queryMeter 查询参数
+     * @return 按区域分组的产能数据列表
      */
-    ElecPvSupplyH selectPvSupplyHById(Long id);
+    List<PvSupplyVO> selectPvSupplyDistribution(@Param("queryMeter") QueryMeter queryMeter);
 
     /**
-     * 查询光伏并网计量光伏并网计量-小时列表
-     *
-     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
-     * @return 光伏并网计量光伏并网计量-小时集合
+     * 查询光伏产能分布明细(按区域和日期分组,用于对比柱状图)
+     * @param queryMeter 查询参数
+     * @return 按区域和日期分组的产能数据列表
      */
-    List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
+    List<PvSupplyVO> selectPvSupplyDistributionDetail(@Param("queryMeter") QueryMeter queryMeter);
 
-    List<ElecPvSupplyH> selectPvSupplyHAll(ElecPvSupplyH pvSupplyH);
-
-    List<ElecPvSupplyH> selectPvSupplyDayList(QueryMeter param);
+    /**
+     * 查询光伏产能按区域对比数据(堆叠柱状图)
+     * @param queryMeter 查询参数
+     * @return 按区域分组的产能对比数据
+     */
+    List<PvSupplyVO> selectPvSupplyAreaCompare(@Param("queryMeter") QueryMeter queryMeter);
 
     Map<String, Object> calThisDayPv(@Param("thisDay") String thisDay);
 
     @MapKey("timeIndex")
     Map<String, Map<String, Object>> calThisDayPvByH(@Param("thisDay") String thisDay);
 
-
-    ElecPvSupplyH calPvByDateRange(QueryMeter param);
-
-    List<ElecPvSupplyH> calMonthPvByDateRange(QueryMeter param);
-
-    List<ElecPvSupplyH> calDayPvRange(QueryMeter param);
-
-    List<ElecPvSupplyH> calHourPvRange(QueryMeter param);
-
     /**
      * 新增光伏并网计量光伏并网计量-小时
      *
-     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
+     * @param pvSupplyVO 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-    int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
+    int insertPvSupplyH(PvSupplyVO pvSupplyVO);
 
     /**
      * 修改光伏并网计量光伏并网计量-小时
      *
-     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
+     * @param pvSupplyVO 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-    int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
+    int updatePvSupplyH(PvSupplyVO pvSupplyVO);
 
     /**
      * 删除光伏并网计量光伏并网计量-小时

+ 61 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecStoreIndexMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+import com.ruoyi.ems.domain.ElecStoreIndex;
+
+/**
+ * 储能设施指标Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2026-01-28
+ */
+public interface ElecStoreIndexMapper 
+{
+    /**
+     * 查询储能设施指标列表
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 储能设施指标集合
+     */
+    List<ElecStoreIndex> selectElecStoreIndexList(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 查询每个设备最新一条记录
+     *
+     * @param elecStoreIndex 查询条件(可按areaCode、facsCode筛选)
+     * @return 每个设备的最新记录列表
+     */
+    List<ElecStoreIndex> selectLatestByDevice(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 新增储能设施指标
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    int insertElecStoreIndex(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 修改储能设施指标
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    int updateElecStoreIndex(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 删除储能设施指标
+     * 
+     * @param id 储能设施指标主键
+     * @return 结果
+     */
+    int deleteElecStoreIndexById(Long id);
+
+    /**
+     * 批量删除储能设施指标
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteElecStoreIndexByIds(Long[] ids);
+}

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

@@ -1,7 +1,6 @@
 package com.ruoyi.ems.mapper;
 
 import com.ruoyi.ems.domain.ElecStoreH;
-import com.ruoyi.ems.domain.EmsElecStoreIndex;
 import com.ruoyi.ems.model.ElecStoreSta;
 import com.ruoyi.ems.model.QueryMeter;
 import org.apache.ibatis.annotations.Param;
@@ -50,8 +49,6 @@ public interface EmsElecStoreHMapper {
 
     ElecStoreH selectStoreHByDataRange(ElecStoreH elecStoreH);
 
-    EmsElecStoreIndex selectStorageIndex(EmsElecStoreIndex emsElecStoreIndex);
-
 
     /**
      * 查询储能计量-日列表

+ 8 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/model/PvSupplyVO.java

@@ -73,6 +73,14 @@ public class PvSupplyVO {
     @Excel(name = "统计小时")
     private String statisticHour;
 
+    private Date recordTime;
+
+    private Date date;
+
+    private Date time;
+
+    private Double upUnitPrice;
+
     public Double getGenElecQuantityValue() {
         return genElecQuantity != null ? genElecQuantity.doubleValue() : 0;
     }

+ 5 - 164
ems/ems-core/src/main/java/com/ruoyi/ems/model/QueryMeter.java

@@ -13,6 +13,7 @@ package com.ruoyi.ems.model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.huashe.common.domain.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.util.Set;
 
@@ -25,6 +26,7 @@ import java.util.Set;
  * @see [相关类/方法]
  * @since [产品/模块版本]
  */
+@Data
 public class QueryMeter extends BaseEntity  {
     @ApiModelProperty("区域代码")
     private String areaCode;
@@ -67,6 +69,9 @@ public class QueryMeter extends BaseEntity  {
     @ApiModelProperty("页大小")
     private Integer pageSize = 10;
 
+    @ApiModelProperty("是否按区域分组")
+    private Boolean groupByArea = false;
+
     private String areaName;
 
     /**
@@ -116,168 +121,4 @@ public class QueryMeter extends BaseEntity  {
         this.setStartRecTime(startTime);
         this.setEndRecTime(endTime);
     }
-
-    public String getAreaCode() {
-        return areaCode;
-    }
-
-    public void setAreaCode(String areaCode) {
-        this.areaCode = areaCode;
-    }
-
-    public String getDeviceCode() {
-        return deviceCode;
-    }
-
-    public void setDeviceCode(String deviceCode) {
-        this.deviceCode = deviceCode;
-    }
-
-    public Set<String> getDeviceCodes() {
-        return deviceCodes;
-    }
-
-    public void setDeviceCodes(Set<String> deviceCodes) {
-        this.deviceCodes = deviceCodes;
-    }
-
-    public Integer getObjType() {
-        return objType;
-    }
-
-    public void setObjType(Integer objType) {
-        this.objType = objType;
-    }
-
-    public String getObjCode() {
-        return objCode;
-    }
-
-    public void setObjCode(String objCode) {
-        this.objCode = objCode;
-    }
-
-    public String getObjName() {
-        return objName;
-    }
-
-    public void setObjName(String objName) {
-        this.objName = objName;
-    }
-
-    public String getFacsCategory() {
-        return facsCategory;
-    }
-
-    public void setFacsCategory(String facsCategory) {
-        this.facsCategory = facsCategory;
-    }
-
-    @Override
-    public String getStartRecTime() {
-        return startRecTime;
-    }
-
-    @Override
-    public void setStartRecTime(String startRecTime) {
-        this.startRecTime = startRecTime;
-    }
-
-    @Override
-    public String getEndRecTime() {
-        return endRecTime;
-    }
-
-    @Override
-    public void setEndRecTime(String endRecTime) {
-        this.endRecTime = endRecTime;
-    }
-
-    public String getTimeDimension() {
-        return timeDimension;
-    }
-
-    public void setTimeDimension(String timeDimension) {
-        this.timeDimension = timeDimension;
-    }
-
-    public String getOrderFlag() {
-        return orderFlag;
-    }
-
-    public void setOrderFlag(String orderFlag) {
-        this.orderFlag = orderFlag;
-    }
-
-    public Integer getPageNum() {
-        return pageNum;
-    }
-
-    public void setPageNum(Integer pageNum) {
-        this.pageNum = pageNum;
-    }
-
-    public Integer getPageSize() {
-        return pageSize;
-    }
-
-    public void setPageSize(Integer pageSize) {
-        this.pageSize = pageSize;
-    }
-
-    public String getAreaName() {
-        return areaName;
-    }
-
-    public void setAreaName(String areaName) {
-        this.areaName = areaName;
-    }
-
-    public String getFacsCode() {
-        return facsCode;
-    }
-
-    public void setFacsCode(String facsCode) {
-        this.facsCode = facsCode;
-    }
-
-    public Integer getObjTag() {
-        return objTag;
-    }
-
-    public void setObjTag(Integer objTag) {
-        this.objTag = objTag;
-    }
-
-    public Integer getMeterCls() {
-        return meterCls;
-    }
-
-    public void setMeterCls(Integer meterCls) {
-        this.meterCls = meterCls;
-    }
-
-    public String getYear() {
-        return year;
-    }
-
-    public void setYear(String year) {
-        this.year = year;
-    }
-
-    public String getFacsSubCategory() {
-        return facsSubCategory;
-    }
-
-    public void setFacsSubCategory(String facsSubCategory) {
-        this.facsSubCategory = facsSubCategory;
-    }
-
-    public String getDate() {
-        return date;
-    }
-
-    public void setDate(String date) {
-        this.date = date;
-    }
 }

+ 0 - 61
ems/ems-core/src/main/java/com/ruoyi/ems/service/IAdmEmsElecPgIndexService.java

@@ -1,61 +0,0 @@
-package com.ruoyi.ems.service;
-
-import com.ruoyi.ems.domain.AdmEmsElecPgIndex;
-
-import java.util.List;
-
-/**
- * 电网设施指标Service接口
- *
- * @author ruoyi
- * @date 2024-08-30
- */
-public interface IAdmEmsElecPgIndexService {
-    /**
-     * 查询电网设施指标
-     *
-     * @param id 电网设施指标主键
-     * @return 电网设施指标
-     */
-    AdmEmsElecPgIndex selectAdmEmsElecPgIndexById(Long id);
-
-    /**
-     * 查询电网设施指标列表
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 电网设施指标集合
-     */
-    List<AdmEmsElecPgIndex> selectAdmEmsElecPgIndexList(AdmEmsElecPgIndex admEmsElecPgIndex);
-
-    /**
-     * 新增电网设施指标
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 结果
-     */
-    int insertAdmEmsElecPgIndex(AdmEmsElecPgIndex admEmsElecPgIndex);
-
-    /**
-     * 修改电网设施指标
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 结果
-     */
-    int updateAdmEmsElecPgIndex(AdmEmsElecPgIndex admEmsElecPgIndex);
-
-    /**
-     * 批量删除电网设施指标
-     *
-     * @param ids 需要删除的电网设施指标主键集合
-     * @return 结果
-     */
-    int deleteAdmEmsElecPgIndexByIds(Long[] ids);
-
-    /**
-     * 删除电网设施指标信息
-     *
-     * @param id 电网设施指标主键
-     * @return 结果
-     */
-    int deleteAdmEmsElecPgIndexById(Long id);
-}

+ 0 - 14
ems/ems-core/src/main/java/com/ruoyi/ems/service/ICaMeterDService.java

@@ -10,21 +10,9 @@ public interface ICaMeterDService {
 
     CaMeterD selectCaMeterDById(Long id);
 
-    List<CaMeterD> selectCaMeterDList(CaMeterD caMeterD);
-
-    List<CaMeterD> selectCaMeterDListByMonth(CaMeterD caMeterD);
-
-    List<CaMeterD> selectCaMeterDListByYear(CaMeterD caMeterD);
-
     /** 根据时间类型查询列表(分页) */
     List<CaMeterD> selectCaMeterDListByTimeType(CaMeterD caMeterD, String timeType);
 
-    List<CaMeterD> selectSumCaMeterDList(CaMeterD caMeterD);
-
-    List<CaMeterD> selectSumCaMeterDListByMonth(CaMeterD caMeterD);
-
-    List<CaMeterD> selectSumCaMeterDListByYear(CaMeterD caMeterD);
-
     /** 根据时间类型查询汇总(统计用) */
     List<CaMeterD> selectSumCaMeterDListByTimeType(CaMeterD caMeterD, String timeType);
 
@@ -35,6 +23,4 @@ public interface ICaMeterDService {
     int updateCaMeterD(CaMeterD caMeterD);
 
     int deleteCaMeterDByIds(Long[] ids);
-
-    int deleteCaMeterDById(Long id);
 }

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

@@ -1,7 +1,6 @@
 package com.ruoyi.ems.service;
 
 import com.ruoyi.ems.domain.ElecPgSupplyH;
-import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.model.QueryMeter;
 
 import java.util.List;

+ 14 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java

@@ -30,4 +30,18 @@ public interface IElecPvSupplyHService {
      * 转换为导出VO列表
      */
     List<PvSupplyExportVO> convertToPvSupplyExportVOList(List<PvSupplyVO> originalList, String timeDimension);
+
+    /**
+     * 查询光伏产能按区域分布(用于饼图)
+     * @param queryMeter 查询参数
+     * @return 按区域分组的产能数据列表
+     */
+    List<PvSupplyVO> selectPvSupplyDistribution(QueryMeter queryMeter);
+
+    /**
+     * 查询光伏产能分布明细(按区域和日期分组)
+     * @param queryMeter 查询参数
+     * @return 按区域和日期分组的产能数据列表
+     */
+    List<PvSupplyVO> selectPvSupplyDistributionDetail(QueryMeter queryMeter);
 }

+ 61 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecStoreIndexService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecStoreIndex;
+
+/**
+ * 储能设施指标Service接口
+ *
+ * @author ruoyi
+ * @date 2026-01-28
+ */
+public interface IElecStoreIndexService {
+    /**
+     * 查询储能设施指标列表
+     *
+     * @param elecStoreIndex 储能设施指标
+     * @return 储能设施指标集合
+     */
+    List<ElecStoreIndex> selectElecStoreIndexList(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 查询每个设备最新一条记录
+     *
+     * @param elecStoreIndex 查询条件
+     * @return 每个设备的最新记录列表
+     */
+    List<ElecStoreIndex> selectLatestByDevice(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 新增储能设施指标
+     *
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    int insertElecStoreIndex(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 修改储能设施指标
+     *
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    int updateElecStoreIndex(ElecStoreIndex elecStoreIndex);
+
+    /**
+     * 批量删除储能设施指标
+     *
+     * @param ids 需要删除的储能设施指标主键集合
+     * @return 结果
+     */
+    int deleteElecStoreIndexByIds(Long[] ids);
+
+    /**
+     * 删除储能设施指标信息
+     *
+     * @param id 储能设施指标主键
+     * @return 结果
+     */
+    int deleteElecStoreIndexById(Long id);
+}

+ 0 - 3
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecStoreService.java

@@ -1,7 +1,6 @@
 package com.ruoyi.ems.service;
 
 import com.ruoyi.ems.domain.ElecStoreH;
-import com.ruoyi.ems.domain.EmsElecStoreIndex;
 import com.ruoyi.ems.model.ElecStoreAnalyze;
 import com.ruoyi.ems.model.QueryMeter;
 
@@ -40,8 +39,6 @@ public interface IElecStoreService {
 
     ElecStoreH selectStoreHByDataRange(ElecStoreH elecStoreH);
 
-    EmsElecStoreIndex selectStorageIndex(EmsElecStoreIndex emsElecStoreIndex);
-
     /**
      * 查询储能计量-日列表
      *

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

@@ -86,8 +86,4 @@ public interface IEmsFacsService {
      * @return 结果
      */
     int deleteEmsFacsById(Long id);
-
-    List<String> inspectFacIndex();
-
-    Map<String, Map<String, Object>> qryAreaDayPowerIndex(String areaCode);
 }

+ 0 - 2
ems/ems-core/src/main/java/com/ruoyi/ems/service/analysis/CarbonCalculationService.java

@@ -13,7 +13,6 @@ package com.ruoyi.ems.service.analysis;
 import com.ruoyi.ems.domain.CaEmissionForecast;
 import com.ruoyi.ems.domain.CaMeterD;
 import com.ruoyi.ems.domain.ElecPgSupplyH;
-import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.domain.EmissionFactor;
 import com.ruoyi.ems.domain.PlantCarbonSink;
 import com.ruoyi.ems.mapper.CaEmissionForecastMapper;
@@ -40,7 +39,6 @@ import java.time.temporal.TemporalAdjusters;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**

+ 0 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/analysis/ElecProdForecastService.java

@@ -13,7 +13,6 @@ package com.ruoyi.ems.service.analysis;
 import com.huashe.common.domain.model.WeatherForecast;
 import com.huashe.common.utils.DateUtils;
 import com.ruoyi.ems.domain.ElecProdForecast;
-import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.mapper.ElecProdForecastMapper;
 import com.ruoyi.ems.model.PvSupplyVO;
 import com.ruoyi.ems.model.QueryMeter;

+ 0 - 87
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/AdmEmsElecPgIndexServiceImpl.java

@@ -1,87 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.AdmEmsElecPgIndex;
-import com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper;
-import com.ruoyi.ems.service.IAdmEmsElecPgIndexService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 电网设施指标Service业务层处理
- *
- * @author ruoyi
- * @date 2024-08-30
- */
-@Service
-public class AdmEmsElecPgIndexServiceImpl implements IAdmEmsElecPgIndexService {
-    @Autowired
-    private AdmEmsElecPgIndexMapper admEmsElecPgIndexMapper;
-
-    /**
-     * 查询电网设施指标
-     *
-     * @param id 电网设施指标主键
-     * @return 电网设施指标
-     */
-    @Override
-    public AdmEmsElecPgIndex selectAdmEmsElecPgIndexById(Long id) {
-        return admEmsElecPgIndexMapper.selectAdmEmsElecPgIndexById(id);
-    }
-
-    /**
-     * 查询电网设施指标列表
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 电网设施指标
-     */
-    @Override
-    public List<AdmEmsElecPgIndex> selectAdmEmsElecPgIndexList(AdmEmsElecPgIndex admEmsElecPgIndex) {
-        return admEmsElecPgIndexMapper.selectAdmEmsElecPgIndexList(admEmsElecPgIndex);
-    }
-
-    /**
-     * 新增电网设施指标
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 结果
-     */
-    @Override
-    public int insertAdmEmsElecPgIndex(AdmEmsElecPgIndex admEmsElecPgIndex) {
-        return admEmsElecPgIndexMapper.insertAdmEmsElecPgIndex(admEmsElecPgIndex);
-    }
-
-    /**
-     * 修改电网设施指标
-     *
-     * @param admEmsElecPgIndex 电网设施指标
-     * @return 结果
-     */
-    @Override
-    public int updateAdmEmsElecPgIndex(AdmEmsElecPgIndex admEmsElecPgIndex) {
-        return admEmsElecPgIndexMapper.updateAdmEmsElecPgIndex(admEmsElecPgIndex);
-    }
-
-    /**
-     * 批量删除电网设施指标
-     *
-     * @param ids 需要删除的电网设施指标主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAdmEmsElecPgIndexByIds(Long[] ids) {
-        return admEmsElecPgIndexMapper.deleteAdmEmsElecPgIndexByIds(ids);
-    }
-
-    /**
-     * 删除电网设施指标信息
-     *
-     * @param id 电网设施指标主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAdmEmsElecPgIndexById(Long id) {
-        return admEmsElecPgIndexMapper.deleteAdmEmsElecPgIndexById(id);
-    }
-}

+ 0 - 35
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/CaMeterDServiceImpl.java

@@ -21,21 +21,6 @@ public class CaMeterDServiceImpl implements ICaMeterDService {
         return caMeterDMapper.selectCaMeterDById(id);
     }
 
-    @Override
-    public List<CaMeterD> selectCaMeterDList(CaMeterD caMeterD) {
-        return caMeterDMapper.selectCaMeterDList(caMeterD);
-    }
-
-    @Override
-    public List<CaMeterD> selectCaMeterDListByMonth(CaMeterD caMeterD) {
-        return caMeterDMapper.selectCaMeterDListByMonth(caMeterD);
-    }
-
-    @Override
-    public List<CaMeterD> selectCaMeterDListByYear(CaMeterD caMeterD) {
-        return caMeterDMapper.selectCaMeterDListByYear(caMeterD);
-    }
-
     /**
      * 根据时间类型查询列表(分页用)
      */
@@ -55,21 +40,6 @@ public class CaMeterDServiceImpl implements ICaMeterDService {
         }
     }
 
-    @Override
-    public List<CaMeterD> selectSumCaMeterDList(CaMeterD caMeterD) {
-        return caMeterDMapper.selectSumCaMeterDList(caMeterD);
-    }
-
-    @Override
-    public List<CaMeterD> selectSumCaMeterDListByMonth(CaMeterD caMeterD) {
-        return caMeterDMapper.selectSumCaMeterDListByMonth(caMeterD);
-    }
-
-    @Override
-    public List<CaMeterD> selectSumCaMeterDListByYear(CaMeterD caMeterD) {
-        return caMeterDMapper.selectSumCaMeterDListByYear(caMeterD);
-    }
-
     /**
      * 根据时间类型查询汇总(统计用)
      */
@@ -108,9 +78,4 @@ public class CaMeterDServiceImpl implements ICaMeterDService {
     public int deleteCaMeterDByIds(Long[] ids) {
         return caMeterDMapper.deleteCaMeterDByIds(ids);
     }
-
-    @Override
-    public int deleteCaMeterDById(Long id) {
-        return caMeterDMapper.deleteCaMeterDById(id);
-    }
 }

+ 47 - 6
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java

@@ -34,7 +34,8 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
         }
 
         try {
-            log.info("查询光伏产能统计,时间维度: {}, 区域: {}", queryMeter.getTimeDimension(), queryMeter.getAreaCode());
+            log.info("查询光伏产能统计,时间维度: {}, 区域: {}", queryMeter.getTimeDimension(),
+                queryMeter.getAreaCode());
 
             // 根据时间维度调用相应的查询方法
             switch (queryMeter.getTimeDimension().toLowerCase()) {
@@ -50,7 +51,8 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
                     log.warn("未识别的时间维度: {},使用月统计", queryMeter.getTimeDimension());
                     return pvSupplyHMapper.selectPvSupplyMonthlyList(queryMeter);
             }
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             log.error("查询光伏产能统计列表异常", e);
             return Collections.emptyList();
         }
@@ -68,7 +70,8 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
 
             PvSupplyVO summary = pvSupplyHMapper.selectPvSupplySummary(queryMeter);
             return summary != null ? summary : new PvSupplyVO();
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             log.error("查询光伏产能统计汇总异常", e);
             return new PvSupplyVO();
         }
@@ -93,7 +96,8 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
             log.info("导出光伏产能统计完成,记录数: {}", result.size());
 
             return result;
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             log.error("导出光伏产能统计异常", e);
             return Collections.emptyList();
         }
@@ -105,11 +109,48 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
             return Collections.emptyList();
         }
 
-        return originalList.stream()
-            .map(vo -> convertToPvSupplyExportVO(vo, timeDimension))
+        return originalList.stream().map(vo -> convertToPvSupplyExportVO(vo, timeDimension))
             .collect(java.util.stream.Collectors.toList());
     }
 
+    @Override
+    public List<PvSupplyVO> selectPvSupplyDistribution(QueryMeter queryMeter) {
+        if (queryMeter == null) {
+            log.warn("查询参数为空,返回空列表");
+            return Collections.emptyList();
+        }
+
+        try {
+            log.info("查询光伏产能分布,区域: {}", queryMeter.getAreaCode());
+            List<PvSupplyVO> result = pvSupplyHMapper.selectPvSupplyDistribution(queryMeter);
+            log.info("查询光伏产能分布完成,记录数: {}", result.size());
+            return result;
+        }
+        catch (Exception e) {
+            log.error("查询光伏产能分布异常", e);
+            return Collections.emptyList();
+        }
+    }
+
+    @Override
+    public List<PvSupplyVO> selectPvSupplyDistributionDetail(QueryMeter queryMeter) {
+        if (queryMeter == null) {
+            log.warn("查询参数为空,返回空列表");
+            return Collections.emptyList();
+        }
+
+        try {
+            log.info("查询光伏产能分布明细,区域: {}", queryMeter.getAreaCode());
+            List<PvSupplyVO> result = pvSupplyHMapper.selectPvSupplyDistributionDetail(queryMeter);
+            log.info("查询光伏产能分布明细完成,记录数: {}", result.size());
+            return result;
+        }
+        catch (Exception e) {
+            log.error("查询光伏产能分布明细异常", e);
+            return Collections.emptyList();
+        }
+    }
+
     /**
      * 转换单个产能VO为导出VO
      */

+ 87 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecStoreIndexServiceImpl.java

@@ -0,0 +1,87 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.ems.mapper.ElecStoreIndexMapper;
+import com.ruoyi.ems.domain.ElecStoreIndex;
+import com.ruoyi.ems.service.IElecStoreIndexService;
+
+/**
+ * 储能设施指标Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2026-01-28
+ */
+@Service
+public class ElecStoreIndexServiceImpl implements IElecStoreIndexService 
+{
+    @Autowired
+    private ElecStoreIndexMapper elecStoreIndexMapper;
+
+    /**
+     * 查询储能设施指标列表
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 储能设施指标
+     */
+    @Override
+    public List<ElecStoreIndex> selectElecStoreIndexList(ElecStoreIndex elecStoreIndex)
+    {
+        return elecStoreIndexMapper.selectElecStoreIndexList(elecStoreIndex);
+    }
+
+    @Override
+    public List<ElecStoreIndex> selectLatestByDevice(ElecStoreIndex elecStoreIndex)
+    {
+        return elecStoreIndexMapper.selectLatestByDevice(elecStoreIndex);
+    }
+
+    /**
+     * 新增储能设施指标
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    @Override
+    public int insertElecStoreIndex(ElecStoreIndex elecStoreIndex)
+    {
+        return elecStoreIndexMapper.insertElecStoreIndex(elecStoreIndex);
+    }
+
+    /**
+     * 修改储能设施指标
+     * 
+     * @param elecStoreIndex 储能设施指标
+     * @return 结果
+     */
+    @Override
+    public int updateElecStoreIndex(ElecStoreIndex elecStoreIndex)
+    {
+        return elecStoreIndexMapper.updateElecStoreIndex(elecStoreIndex);
+    }
+
+    /**
+     * 批量删除储能设施指标
+     * 
+     * @param ids 需要删除的储能设施指标主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecStoreIndexByIds(Long[] ids)
+    {
+        return elecStoreIndexMapper.deleteElecStoreIndexByIds(ids);
+    }
+
+    /**
+     * 删除储能设施指标信息
+     * 
+     * @param id 储能设施指标主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecStoreIndexById(Long id)
+    {
+        return elecStoreIndexMapper.deleteElecStoreIndexById(id);
+    }
+}

+ 0 - 6
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecStoreServiceImpl.java

@@ -1,7 +1,6 @@
 package com.ruoyi.ems.service.impl;
 
 import com.ruoyi.ems.domain.ElecStoreH;
-import com.ruoyi.ems.domain.EmsElecStoreIndex;
 import com.ruoyi.ems.mapper.EmsElecStoreHMapper;
 import com.ruoyi.ems.model.ElecStoreAnalyze;
 import com.ruoyi.ems.model.ElecStoreSta;
@@ -68,11 +67,6 @@ public class ElecStoreServiceImpl implements IElecStoreService {
     }
 
     @Override
-    public EmsElecStoreIndex selectStorageIndex(EmsElecStoreIndex emsElecStoreIndex) {
-        return elecStoreHMapper.selectStorageIndex(emsElecStoreIndex);
-    }
-
-    @Override
     public List<ElecStoreH> selectDayList(QueryMeter param) {
         return elecStoreHMapper.selectStoreDayList(param);
     }

+ 0 - 78
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java

@@ -1,17 +1,9 @@
 package com.ruoyi.ems.service.impl;
 
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.map.MapUtil;
 import com.huashe.common.utils.DateUtils;
-import com.ruoyi.common.core.utils.DateTimeUtil;
-import com.ruoyi.common.core.utils.ExpressUtil;
-import com.ruoyi.common.core.utils.StreamUtils;
 import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsFacs;
-import com.ruoyi.ems.enums.FacTypes;
-import com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper;
 import com.ruoyi.ems.mapper.AdmEmsIndexRangeMapper;
 import com.ruoyi.ems.mapper.EmsFacsMapper;
 import com.ruoyi.ems.model.BoundaryObj;
@@ -30,13 +22,9 @@ import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -60,9 +48,6 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     @Autowired
     private AdmEmsIndexRangeMapper admEmsIndexRangeMapper;
 
-    @Autowired
-    private AdmEmsElecPgIndexMapper admEmsElecPgIndexMapper;
-
     /**
      * 查询能源设施
      *
@@ -265,67 +250,4 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     public int deleteEmsFacsById(Long id) {
         return emsFacsMapper.deleteEmsFacsById(id);
     }
-
-    @Override
-    public List<String> inspectFacIndex() {
-        List<Map<String, Object>> admEmsIndexRanges = admEmsIndexRangeMapper.selectAdmEmsIndexRange();
-        Map<String, List<Map<String, Object>>> facTypeRangeMap = StreamUtils.groupByKey(admEmsIndexRanges,
-            stringObjectMap -> MapUtil.getStr(stringObjectMap, "facsCategory"));
-        List<String> errorReport = Collections.synchronizedList(new ArrayList<String>());
-        Map<String, BiFunction<List<String>, Map.Entry<String, List<Map<String, Object>>>, Void>> handlers = new HashMap<String, BiFunction<List<String>, Map.Entry<String, List<Map<String, Object>>>, Void>>() {
-            {
-                put(FacTypes.TRANSMIT.getCode(), (strings, stringListEntry) -> {
-                    pgIndexInspection(errorReport, stringListEntry);
-                    return null;
-                });
-            }
-        };
-        for (Map.Entry<String, List<Map<String, Object>>> facTypeRange : facTypeRangeMap.entrySet()) {
-            String key = facTypeRange.getKey();
-            if (!handlers.containsKey(key)) {
-                continue;
-            }
-            handlers.get(key).apply(errorReport, facTypeRange);
-        }
-        return errorReport;
-    }
-
-    @Override
-    public Map<String, Map<String, Object>> qryAreaDayPowerIndex(String areaCode) {
-        String firstDayOfRecentMonth = DateTimeUtil.getFirstDayOfRecentMonth();
-        return admEmsElecPgIndexMapper.qryAreaDayPowerIndex(areaCode, firstDayOfRecentMonth);
-    }
-
-    private void pgIndexInspection(List<String> errorReport,
-        Map.Entry<String, List<Map<String, Object>>> facTypeRange) {
-        Map<String, List<Map<String, Object>>> objCodeRangeMap = StreamUtils.groupByKey(facTypeRange.getValue(),
-            stringObjectMap -> MapUtil.getStr(stringObjectMap, "objCode"));
-        Set<String> objCodes = objCodeRangeMap.keySet();
-        List<List<String>> splitObjCodes = StreamUtils.splitSet(objCodes, 100);
-        for (List<String> splitObjCode : splitObjCodes) {
-            Map<String, Map<String, Object>> objCodePgIndexes = admEmsElecPgIndexMapper.qryLatestObjIndex(splitObjCode);
-            for (Map.Entry<String, Map<String, Object>> objCodePgIndex : objCodePgIndexes.entrySet()) {
-                if (!objCodeRangeMap.containsKey(objCodePgIndex.getKey())) {
-                    continue;
-                }
-                Date time = MapUtil.getDate(objCodePgIndex.getValue(), "time");
-                long between = DateUtil.between(time, new Date(), DateUnit.DAY);
-                List<Map<String, Object>> ranges = objCodeRangeMap.get(objCodePgIndex.getKey());
-                String objTypeName = MapUtil.getStr(ranges.get(0), "facsName");
-                if (between > 1) {
-                    errorReport.add(String.format("%s(%s)已经离线", objCodePgIndex.getKey(), objTypeName));
-                    continue;
-                }
-                List<Map<String, Object>> errors = ExpressUtil.hitExpress(objCodePgIndex.getValue(),
-                    objCodeRangeMap.get(objCodePgIndex.getKey()));
-                if (CollectionUtils.isEmpty(errors)) {
-                    continue;
-                }
-                for (Map<String, Object> error : errors) {
-                    errorReport.add(String.format("%s(%s)超出%s", objCodePgIndex.getKey(), objTypeName,
-                        MapUtil.getStr(error, "indexDesc")));
-                }
-            }
-        }
-    }
 }

+ 0 - 125
ems/ems-core/src/main/resources/mapper/ems/AdmEmsElecPgIndexMapper.xml

@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper">
-
-    <resultMap type="com.ruoyi.ems.domain.AdmEmsElecPgIndex" id="AdmEmsElecPgIndexResult">
-        <result property="id" column="id"/>
-        <result property="areaCode" column="area_code"/>
-        <result property="facsCode" column="facs_code"/>
-        <result property="date" column="date"/>
-        <result property="time" column="time"/>
-        <result property="voltage" column="voltage"/>
-        <result property="electricity" column="electricity"/>
-        <result property="power" column="power"/>
-    </resultMap>
-
-    <sql id="selectAdmEmsElecPgIndexVo">
-        select id, area_code, facs_code, date, time, voltage, electricity, power
-        from adm_ems_elec_pg_index
-    </sql>
-
-    <select id="selectAdmEmsElecPgIndexList" parameterType="com.ruoyi.ems.domain.AdmEmsElecPgIndex"
-            resultMap="AdmEmsElecPgIndexResult">
-        <include refid="selectAdmEmsElecPgIndexVo"/>
-        <where>
-            <if test="areaCode != null  and areaCode != ''">and area_code = #{areaCode}</if>
-            <if test="facsCode != null  and facsCode != ''">and facs_code = #{facsCode}</if>
-            <if test="date != null ">and date = #{date}</if>
-            <if test="time != null ">and time = #{time}</if>
-            <if test="voltage != null ">and voltage = #{voltage}</if>
-            <if test="electricity != null ">and electricity = #{electricity}</if>
-            <if test="power != null ">and power = #{power}</if>
-        </where>
-    </select>
-
-    <select id="selectAdmEmsElecPgIndexById" parameterType="Long" resultMap="AdmEmsElecPgIndexResult">
-        <include refid="selectAdmEmsElecPgIndexVo"/>
-        where id = #{id}
-    </select>
-
-    <insert id="insertAdmEmsElecPgIndex" parameterType="com.ruoyi.ems.domain.AdmEmsElecPgIndex" useGeneratedKeys="true"
-            keyProperty="id">
-        insert into adm_ems_elec_pg_index
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">area_code,</if>
-            <if test="facsCode != null and facsCode != ''">facs_code,</if>
-            <if test="date != null">date,</if>
-            <if test="time != null">time,</if>
-            <if test="voltage != null">voltage,</if>
-            <if test="electricity != null">electricity,</if>
-            <if test="power != null">power,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
-            <if test="facsCode != null and facsCode != ''">#{facsCode},</if>
-            <if test="date != null">#{date},</if>
-            <if test="time != null">#{time},</if>
-            <if test="voltage != null">#{voltage},</if>
-            <if test="electricity != null">#{electricity},</if>
-            <if test="power != null">#{power},</if>
-        </trim>
-    </insert>
-
-    <update id="updateAdmEmsElecPgIndex" parameterType="com.ruoyi.ems.domain.AdmEmsElecPgIndex">
-        update adm_ems_elec_pg_index
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
-            <if test="facsCode != null and facsCode != ''">facs_code = #{facsCode},</if>
-            <if test="date != null">date = #{date},</if>
-            <if test="time != null">time = #{time},</if>
-            <if test="voltage != null">voltage = #{voltage},</if>
-            <if test="electricity != null">electricity = #{electricity},</if>
-            <if test="power != null">power = #{power},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteAdmEmsElecPgIndexById" parameterType="Long">
-        delete
-        from adm_ems_elec_pg_index
-        where id = #{id}
-    </delete>
-
-    <delete id="deleteAdmEmsElecPgIndexByIds" parameterType="String">
-        delete from adm_ems_elec_pg_index where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-
-    <select id="qryLatestObjIndex" resultType="Map">
-        SELECT
-        id, area_code as areaCode, facs_code as facsCode, date, time, voltage, electricity, power
-        FROM
-        ( SELECT *, RANK() OVER ( PARTITION BY facs_code ORDER BY time DESC ) AS num FROM adm_ems_elec_pg_index pgInde
-        where facs_code
-        <foreach item="item" index="index" collection="set" open="in (" separator=", " close=")">
-            #{item}
-        </foreach>
-        ) f
-        WHERE
-        f.num =1
-    </select>
-
-    <select id="qryAreaDayPowerIndex" resultType="Map">
-        SELECT avgIndex.area_code areaCode,
-               DATE_FORMAT(avgIndex.DATE, '%Y-%m-%d') AS dateIndex,
-               sum(power)                                power
-        FROM (SELECT pgIndex.area_code,
-                     pgIndex.DATE,
-                     pgIndex.facs_code,
-                     AVG(power) power
-              FROM adm_ems_elec_pg_index pgIndex
-              WHERE area_code = #{areaCode}
-                AND pgIndex.DATE >= #{date}
-                AND power > 0
-              GROUP BY pgIndex.area_code,
-                       pgIndex.DATE,
-                       pgIndex.facs_code) avgIndex
-        GROUP BY avgIndex.area_code,
-                 dateIndex
-    </select>
-
-</mapper>

+ 124 - 225
ems/ems-core/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -13,21 +13,6 @@
         <result property="statisticYear" column="statistic_year"/>
         <result property="statisticMonth" column="statistic_month"/>
         <result property="timeDimension" column="time_dimension"/>
-        <result property="genElecQuantity" column="gen_elec_quantity"/>
-        <result property="useElecQuantity" column="use_elec_quantity"/>
-        <result property="upElecQuantity" column="up_elec_quantity"/>
-        <result property="upElecEarn" column="up_elec_earn"/>
-        <result property="createTime" column="create_time"/>
-    </resultMap>
-
-    <!-- 原有的结果映射保留 -->
-    <resultMap type="com.ruoyi.ems.domain.ElecPvSupplyH" id="PvSupplyHResult">
-        <result property="id" column="id"/>
-        <result property="areaCode" column="area_code"/>
-        <result property="areaName" column="area_name"/>
-        <result property="areaShortName" column="area_short_name"/>
-        <result property="facsCode" column="facs_code"/>
-        <result property="facsName" column="facs_name"/>
         <result property="recordTime" column="record_time"/>
         <result property="date" column="date" jdbcType="DATE"/>
         <result property="time" column="time"/>
@@ -37,6 +22,7 @@
         <result property="useElecQuantity" column="use_elec_quantity"/>
         <result property="upElecQuantity" column="up_elec_quantity"/>
         <result property="upElecEarn" column="up_elec_earn"/>
+        <result property="createTime" column="create_time"/>
     </resultMap>
 
     <select id="selectPvSupplyHourlyList" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyVOResult">
@@ -93,6 +79,10 @@
                 pv.area_code,
                 a.area_name,
             </when>
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code,
+                a.area_name,
+            </when>
             <otherwise>
                 '-1' as area_code,
                 '全部' as area_name,
@@ -120,21 +110,37 @@
             AND pv.date IS NOT NULL
         </where>
         GROUP BY
-        <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
-            pv.area_code, a.area_name,
-        </if>
+        <choose>
+            <when test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                pv.area_code, a.area_name,
+            </when>
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code, a.area_name,
+            </when>
+        </choose>
         pv.date
-        ORDER BY pv.date ${queryMeter.orderFlag}
+        ORDER BY
+        <if test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+            a.area_name ASC,
+        </if>
+        pv.date ${queryMeter.orderFlag}
     </select>
 
     <!-- ==================== 光伏产能按月汇总统计 ==================== -->
     <select id="selectPvSupplyMonthlyList" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyVOResult">
         SELECT
         <choose>
+            <!-- 指定了具体区域 -->
             <when test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
                 pv.area_code,
                 a.area_name,
             </when>
+            <!-- 全部区域 + 需要按区域分组(报表场景) -->
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code,
+                a.area_name,
+            </when>
+            <!-- 全部区域 + 不分组(分析场景,返回汇总) -->
             <otherwise>
                 '-1' as area_code,
                 '全部' as area_name,
@@ -163,11 +169,22 @@
             AND pv.date IS NOT NULL
         </where>
         GROUP BY
-        <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
-            pv.area_code, a.area_name,
-        </if>
+        <choose>
+            <!-- 指定了具体区域 -->
+            <when test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                pv.area_code, a.area_name,
+            </when>
+            <!-- 全部区域 + 需要按区域分组(报表场景) -->
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code, a.area_name,
+            </when>
+        </choose>
         DATE_FORMAT(pv.date, '%Y-%m')
-        ORDER BY DATE_FORMAT(pv.date, '%Y-%m') ${queryMeter.orderFlag}
+        ORDER BY
+        <if test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+            a.area_name ASC,
+        </if>
+        DATE_FORMAT(pv.date, '%Y-%m') ${queryMeter.orderFlag}
     </select>
 
     <!-- ==================== 光伏产能按年汇总统计 ==================== -->
@@ -178,6 +195,10 @@
                 pv.area_code,
                 a.area_name,
             </when>
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code,
+                a.area_name,
+            </when>
             <otherwise>
                 '-1' as area_code,
                 '全部' as area_name,
@@ -206,11 +227,20 @@
             AND pv.date IS NOT NULL
         </where>
         GROUP BY
-        <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
-            pv.area_code, a.area_name,
-        </if>
+        <choose>
+            <when test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                pv.area_code, a.area_name,
+            </when>
+            <when test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+                pv.area_code, a.area_name,
+            </when>
+        </choose>
         YEAR(pv.date)
-        ORDER BY YEAR(pv.date) ${queryMeter.orderFlag}
+        ORDER BY
+        <if test="queryMeter.groupByArea != null and queryMeter.groupByArea == true">
+            a.area_name ASC,
+        </if>
+        YEAR(pv.date) ${queryMeter.orderFlag}
     </select>
 
     <!-- ==================== 光伏产能汇总统计 ==================== -->
@@ -238,125 +268,6 @@
         </where>
     </select>
 
-    <sql id="selectPvSupplyHVo">
-        select pv.id,
-               pv.area_code,
-               a.area_name,
-               a.short_name as area_short_name,
-               pv.facs_code,
-               f.facs_name,
-               pv.`record_time`,
-               pv.`date`,
-               pv.`time`,
-               pv.time_index,
-               pv.up_unit_price,
-               pv.gen_elec_quantity,
-               pv.use_elec_quantity,
-               pv.up_elec_quantity,
-               pv.up_elec_earn
-        from adm_ems_pv_supply_h pv
-                 LEFT JOIN adm_area a ON pv.`area_code` = a.`area_code`
-                 LEFT JOIN adm_ems_facs f ON pv.`facs_code` = f.`facs_code`
-    </sql>
-
-    <select id="selectPvSupplyHList" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" resultMap="PvSupplyHResult">
-        <include refid="selectPvSupplyHVo"/>
-        <where>
-            <if test="areaCode != null  and areaCode != ''">and pv.area_code = #{areaCode}</if>
-            <if test="facsCode != null  and facsCode != ''">and pv.facs_code = #{facsCode}</if>
-            <if test="date != null ">and pv.`date` = #{date}</if>
-            <if test="time != null ">and pv.`time` = #{time}</if>
-            <if test="timeIndex != null ">and pv.time_index = #{timeIndex}</if>
-            <if test="upUnitPrice != null ">and pv.up_unit_price = #{upUnitPrice}</if>
-            <if test="genElecQuantity != null ">and pv.gen_elec_quantity = #{genElecQuantity}</if>
-            <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.ElecPvSupplyH" resultMap="PvSupplyHResult">
-        SELECT
-        '全部' as area_name,
-        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_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="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="selectPvSupplyDayList" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyHResult">
-        SELECT
-        <if test="facsSubCategory != null and facsSubCategory !=''">
-            sc.`name` as facs_name,
-        </if>
-        <if test="facsCode != null and facsCode !=''">
-            pv.`facs_code`,
-        </if>
-        <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-            pv.area_code,
-        </if>
-        area.area_name,
-        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
-        inner join adm_area area on area.area_code = pv.area_code and area.parent_code = '0'
-        <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="areaName != null  and areaName != ''">and area.area_name like concat('%', #{areaName}, '%')</if>
-            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-                and pv.facs_code = #{facsCode}
-            </if>
-            <if test="facsCode != null and facsCode != ''">
-                and pv.area_code = #{areaCode}
-            </if>
-            <if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
-                and pv.`date` &gt;= #{startRecTime} and pv.`date` &lt;= #{endRecTime}
-            </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(
@@ -392,108 +303,96 @@
             DATE, time_index;
     </select>
 
-    <select id="calPvByDateRange" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyHResult">
+    <!-- 查询光伏产能按区域分布(用于饼图) -->
+    <select id="selectPvSupplyDistribution" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyVOResult">
         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
+        pv.area_code,
+        a.area_name,
+        'DISTRIBUTION' as time_dimension,
+        ROUND(SUM(COALESCE(pv.gen_elec_quantity, 0)), 2) as gen_elec_quantity,
+        ROUND(SUM(COALESCE(pv.use_elec_quantity, 0)), 2) as use_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_quantity, 0)), 2) as up_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_earn, 0)), 2) as up_elec_earn,
+        NOW() as create_time
         FROM adm_ems_pv_supply_h pv
+        LEFT JOIN adm_area a ON pv.area_code = a.area_code
         <where>
-            <if test="date != null and date != ''">DATE like concat(#{date}, '%')</if>
-            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-                and pv.area_code = #{areaCode}
+            <!-- 关键修改:当areaCode为空或-1时,不加area_code条件,返回所有区域分组数据 -->
+            <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                AND pv.area_code = #{queryMeter.areaCode}
             </if>
-        </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 &gt;= #{startRecTime}</if>
-            <if test="endRecTime != null and endRecTime != ''">and DATE &lt;=#{endRecTime}</if>
-            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-                and pv.area_code = #{areaCode}
+            <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
+                AND pv.date &gt;= DATE(#{queryMeter.startRecTime})
+            </if>
+            <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
+                AND pv.date &lt;= DATE(#{queryMeter.endRecTime})
             </if>
+            AND pv.date IS NOT NULL
         </where>
-        group by startRecTime
+        GROUP BY pv.area_code, a.area_name
+        ORDER BY gen_elec_quantity DESC
     </select>
 
-    <select id="calHourPvRange" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyHResult">
+    <!-- 查询光伏产能分布明细(按区域和日期分组,用于对比柱状图) -->
+    <select id="selectPvSupplyDistributionDetail" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyVOResult">
         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,
-        time_index,
-        `date`
+        pv.area_code,
+        a.area_name,
+        pv.date as statistic_date,
+        'DISTRIBUTION_DETAIL' as time_dimension,
+        ROUND(SUM(COALESCE(pv.gen_elec_quantity, 0)), 2) as gen_elec_quantity,
+        ROUND(SUM(COALESCE(pv.use_elec_quantity, 0)), 2) as use_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_quantity, 0)), 2) as up_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_earn, 0)), 2) as up_elec_earn,
+        NOW() as create_time
         FROM adm_ems_pv_supply_h pv
+        LEFT JOIN adm_area a ON pv.area_code = a.area_code
         <where>
-            <if test="date != null and date != ''">DATE like concat(#{date}, '%')</if>
-            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-                and pv.area_code = #{areaCode}
+            <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                AND pv.area_code = #{queryMeter.areaCode}
+            </if>
+            <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
+                AND pv.date &gt;= DATE(#{queryMeter.startRecTime})
             </if>
+            <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
+                AND pv.date &lt;= DATE(#{queryMeter.endRecTime})
+            </if>
+            AND pv.date IS NOT NULL
         </where>
-        group by DATE, time_index
+        GROUP BY pv.area_code, a.area_name, pv.date
+        ORDER BY pv.date ASC, pv.area_code ASC
     </select>
 
-    <select id="calDayPvRange" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyHResult">
+    <!-- 查询光伏产能按区域对比(堆叠柱状图数据) -->
+    <select id="selectPvSupplyAreaCompare" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="PvSupplyVOResult">
         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`
+        pv.area_code,
+        a.area_name,
+        'AREA_COMPARE' as time_dimension,
+        ROUND(SUM(COALESCE(pv.gen_elec_quantity, 0)), 2) as gen_elec_quantity,
+        ROUND(SUM(COALESCE(pv.use_elec_quantity, 0)), 2) as use_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_quantity, 0)), 2) as up_elec_quantity,
+        ROUND(SUM(COALESCE(pv.up_elec_earn, 0)), 2) as up_elec_earn,
+        NOW() as create_time
         FROM adm_ems_pv_supply_h pv
+        LEFT JOIN adm_area a ON pv.area_code = a.area_code
         <where>
-            <if test="date != null and date != ''">DATE like concat(#{date}, '%')</if>
-            <if test="startRecTime != null and startRecTime != '' ">
-                and DATE &gt;= #{startRecTime}
+            <if test="queryMeter.areaCode != null and queryMeter.areaCode != '' and queryMeter.areaCode != '-1'">
+                AND pv.area_code = #{queryMeter.areaCode}
             </if>
-            <if test="endRecTime != null and endRecTime !=''">
-                and DATE &lt;= #{endRecTime}
+            <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
+                AND pv.date &gt;= DATE(#{queryMeter.startRecTime})
             </if>
-            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-                and pv.area_code = #{areaCode}
+            <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
+                AND pv.date &lt;= DATE(#{queryMeter.endRecTime})
             </if>
+            AND pv.date IS NOT NULL
         </where>
-        group by DATE
-    </select>
-
-    <select id="selectPvSupplyHById" parameterType="Long" resultMap="PvSupplyHResult">
-        <include refid="selectPvSupplyHVo"/>
-        where id = #{id}
+        GROUP BY pv.area_code, a.area_name
+        ORDER BY gen_elec_quantity DESC
     </select>
 
-    <insert id="insertPvSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" useGeneratedKeys="true"
+    <insert id="insertPvSupplyH" parameterType="com.ruoyi.ems.model.PvSupplyVO" useGeneratedKeys="true"
             keyProperty="id">
         insert into adm_ems_pv_supply_h
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -524,7 +423,7 @@
         </trim>
     </insert>
 
-    <update id="updatePvSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH">
+    <update id="updatePvSupplyH" parameterType="com.ruoyi.ems.model.PvSupplyVO">
         update adm_ems_pv_supply_h
         <trim prefix="SET" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>

+ 110 - 0
ems/ems-core/src/main/resources/mapper/ems/ElecStoreIndexMapper.xml

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.ems.mapper.ElecStoreIndexMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ElecStoreIndex" id="ElecStoreIndexResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="facsCode"    column="facs_code"    />
+        <result property="deviceCode"    column="device_code"    />
+        <result property="date"    column="date"    />
+        <result property="time"    column="time"    />
+        <result property="chargeVoltage"    column="charge_voltage"    />
+        <result property="dischargePower"    column="discharge_power"    />
+        <result property="currentCapacity"    column="current_capacity"    />
+    </resultMap>
+
+    <sql id="selectElecStoreIndexVo">
+        select id, area_code, facs_code, device_code, date, time, charge_voltage, discharge_power, current_capacity from adm_ems_elec_store_index
+    </sql>
+
+    <select id="selectElecStoreIndexList" parameterType="com.ruoyi.ems.domain.ElecStoreIndex" resultMap="ElecStoreIndexResult">
+        <include refid="selectElecStoreIndexVo"/>
+        <where>  
+            <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
+            <if test="facsCode != null  and facsCode != ''"> and facs_code = #{facsCode}</if>
+            <if test="deviceCode != null  and deviceCode != ''"> and device_code = #{deviceCode}</if>
+            <if test="date != null "> and `date` = #{date}</if>
+            <if test="time != null "> and `time` = #{time}</if>
+            <if test="startRecTime != null and startRecTime != ''">
+                AND `time` &gt;= #{startRecTime}
+            </if>
+            <if test="endRecTime != null and endRecTime != ''">
+                AND `time` &lt;= #{endRecTime}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectLatestByDevice" parameterType="com.ruoyi.ems.domain.ElecStoreIndex" resultMap="ElecStoreIndexResult">
+        SELECT t1.id, t1.area_code, t1.facs_code, t1.device_code, t1.date, t1.time,
+        t1.charge_voltage, t1.discharge_power, t1.current_capacity
+        FROM adm_ems_elec_store_index t1
+        INNER JOIN (
+        SELECT device_code, MAX(`time`) AS max_time
+        FROM adm_ems_elec_store_index
+        <where>
+            <if test="areaCode != null and areaCode != ''">AND area_code = #{areaCode}</if>
+            <if test="facsCode != null and facsCode != ''">AND facs_code = #{facsCode}</if>
+        </where>
+        GROUP BY device_code
+        ) t2 ON t1.device_code = t2.device_code AND t1.`time` = t2.max_time
+        <where>
+            <if test="areaCode != null and areaCode != ''">AND t1.area_code = #{areaCode}</if>
+            <if test="facsCode != null and facsCode != ''">AND t1.facs_code = #{facsCode}</if>
+        </where>
+        ORDER BY t1.area_code, t1.facs_code, t1.device_code
+    </select>
+
+        
+    <insert id="insertElecStoreIndex" parameterType="com.ruoyi.ems.domain.ElecStoreIndex" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_ems_elec_store_index
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="facsCode != null and facsCode != ''">facs_code,</if>
+            <if test="deviceCode != null and deviceCode != ''">device_code,</if>
+            <if test="date != null">`date`,</if>
+            <if test="time != null">`time`,</if>
+            <if test="chargeVoltage != null">charge_voltage,</if>
+            <if test="dischargePower != null">discharge_power,</if>
+            <if test="currentCapacity != null">current_capacity,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="facsCode != null and facsCode != ''">#{facsCode},</if>
+            <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
+            <if test="date != null">#{date},</if>
+            <if test="time != null">#{time},</if>
+            <if test="chargeVoltage != null">#{chargeVoltage},</if>
+            <if test="dischargePower != null">#{dischargePower},</if>
+            <if test="currentCapacity != null">#{currentCapacity},</if>
+         </trim>
+    </insert>
+
+    <update id="updateElecStoreIndex" parameterType="com.ruoyi.ems.domain.ElecStoreIndex">
+        update adm_ems_elec_store_index
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="facsCode != null and facsCode != ''">facs_code = #{facsCode},</if>
+            <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
+            <if test="date != null">`date` = #{date},</if>
+            <if test="time != null">`time` = #{time},</if>
+            <if test="chargeVoltage != null">charge_voltage = #{chargeVoltage},</if>
+            <if test="dischargePower != null">discharge_power = #{dischargePower},</if>
+            <if test="currentCapacity != null">current_capacity = #{currentCapacity},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteElecStoreIndexById" parameterType="Long">
+        delete from adm_ems_elec_store_index where id = #{id}
+    </delete>
+
+    <delete id="deleteElecStoreIndexByIds" parameterType="String">
+        delete from adm_ems_elec_store_index where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 11 - 21
ems/ems-core/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml

@@ -70,20 +70,7 @@
             <if test="startRecTime != null and startRecTime !='' ">and st.`date` like concat(#{startRecTime},'%')</if>
         </where>
     </select>
-    <select id="selectStorageIndex" resultType="EmsElecStoreIndex">
-        SELECT
-        SUM(aeesi.current_capacity) current_capacity
-        FROM (SELECT MAX(id) id
-        FROM adm_ems_elec_store_index storeIndex
-        <where>
-            <if test="areaCode != null  and areaCode != ''  and areaCode != '-1'">and storeIndex.area_code =
-                #{areaCode}
-            </if>
-            <if test="startRecTime != null and startRecTime !='' ">and storeIndex.`date` like concat(#{startRecTime},'%')</if>
-        </where>
-        group by facs_code) AS latest_records
-        inner join adm_ems_elec_store_index aeesi on latest_records.id = aeesi.id
-    </select>
+
     <select id="selectStoreHAllArea" parameterType="com.ruoyi.ems.domain.ElecStoreH" resultMap="StoreHResult">
         SELECT facCategory.`code` facs_code,
         facCategory.`name` facs_name,
@@ -111,18 +98,21 @@
 
     <select id="selectStoreDayList" parameterType="com.ruoyi.ems.model.QueryMeter" resultMap="StoreHResult">
         SELECT
+        s.area_code,
+        a.area_name,
+        a.short_name as area_short_name,
+        s.facs_code,
+        f.facs_name,
         <if test="facsSubCategory != null and facsSubCategory !=''">
-            sc.`name` as facs_name,
-        </if>
-        <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-            s.area_code,
+            sc.`name` as facs_subcategory_name,
         </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
+        LEFT JOIN adm_area a ON s.area_code = a.area_code
+        LEFT JOIN adm_ems_facs f ON s.facs_code = f.facs_code
         <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>
@@ -136,8 +126,8 @@
                 and f.facs_subcategory = #{facsSubCategory}
             </if>
         </where>
-        GROUP BY s.`date`
-        ORDER BY s.`date`
+        GROUP BY s.area_code, s.facs_code, s.`date`
+        ORDER BY s.`date`, s.area_code, s.facs_code
     </select>
 
     <select id="selectStoreHById" parameterType="Long" resultMap="StoreHResult">

+ 440 - 81
ems/sql/ems_init_data_ctfwq.sql

@@ -200,18 +200,18 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `dev
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'W4-E-C-1007', '南区宿舍能耗采集器', '-', '-', '1', '宿舍', '321283124S300203', '321283124S3002', 'M_W4_DEV_BA_GA', 'NH02', 'SM', 'SYS_BA');
 
 -- BA新风、空调设备
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-5', '北1F-5新风系统', '-', '-', '1', '综合楼-食堂', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-4', '北1F-4新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-3', '北1F-3新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-2F-1', '北2F-1新风系统', '-', '-', '1', '综合楼-二楼', '321283124S30010104', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-5', '南1F-5新风系统', '-', '-', '1', '综合楼-食堂', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-4', '南1F-4新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-3', '南1F-3新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-2F-1', '南2F-1新风系统', '-', '-', '1', '综合楼-二楼', '321283124S30020104', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-AHU-1F-1', '北1F-1空调系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_AHU', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-AHU-2F-1', '北2F-1空调系统', '-', '-', '1', '综合楼-二楼', '321283124S30010104', '321283124S3001', 'M_Z020_DEV_BA_AHU', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-AHU-1F-1', '南1F-1空调系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_AHU', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-AHU-2F-1', '南2F-1空调系统', '-', '-', '1', '综合楼-二楼', '321283124S30020104', '321283124S3002', 'M_Z020_DEV_BA_AHU', 'Z-KT-02', NULL, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-5', '北1F-5新风系统', '-', '-', '1', '综合楼-食堂', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-4', '北1F-4新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-1F-3', '北1F-3新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-XF-2F-1', '北2F-1新风系统', '-', '-', '1', '综合楼-二楼', '321283124S30010104', '321283124S3001', 'M_Z020_DEV_BA_XF', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-5', '南1F-5新风系统', '-', '-', '1', '综合楼-食堂', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-4', '南1F-4新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-1F-3', '南1F-3新风系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-XF-2F-1', '南2F-1新风系统', '-', '-', '1', '综合楼-二楼', '321283124S30020104', '321283124S3002', 'M_Z020_DEV_BA_XF', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-AHU-1F-1', '北1F-1空调系统', '-', '-', '1', '综合楼-一楼', '321283124S30010101', '321283124S3001', 'M_Z020_DEV_BA_AHU', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-AHU-2F-1', '北2F-1空调系统', '-', '-', '1', '综合楼-二楼', '321283124S30010104', '321283124S3001', 'M_Z020_DEV_BA_AHU', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-AHU-1F-1', '南1F-1空调系统', '-', '-', '1', '综合楼-一楼', '321283124S30020101', '321283124S3002', 'M_Z020_DEV_BA_AHU', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-AHU-2F-1', '南2F-1空调系统', '-', '-', '1', '综合楼-二楼', '321283124S30020104', '321283124S3002', 'M_Z020_DEV_BA_AHU', 'Z-KT-02', NULL, 'SYS_DEVC');
 
 -- 光伏设备
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E5-B-COL-GFZL-1', '北区主楼光伏采集器1', 'Growatt-古瑞瓦特', 'Shine4G-X2-GD', '1', '北区主楼', '321283124S30015001', '321283124S3001', 'M_W2_DEV_PHOTOVOLTAIC_COL', 'NH01', NULL, 'SYS_GF');
@@ -254,42 +254,42 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `dev
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E5-ZX-INV-GF-6', '主线光伏逆变器6', 'Growatt-古瑞瓦特', '-', '1', '服务区主线', '321283124S3003', '321283124S3003', 'M_E5_DEV_PHOTOVOLTAIC_INVERTER', 'E503', NULL, 'SYS_GF');
 
 -- BA设备
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WT-1', '北区水箱', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WT', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WT-1', '南区水箱', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WT', 'Z-KT-02', NULL, 'SYS_BA');
-
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-1', '北区1号泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-2', '北区2号泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-1', '北区1号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-2', '北区2号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-3', '北区3号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WP-1', '南区1号泵', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WP', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WP-2', '南区2号泵', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WP', 'Z-KT-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-01', '(照明)工具间+母婴室+第三卫生间+洗手池', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-02', '(照明)洗手池', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-03', '(照明)男卫小便区', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-04', '(照明)男卫左一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-05', '(照明)男卫左二', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-06', '(照明)女卫左一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-07', '(照明)女卫左二', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-08', '(照明)女卫左三', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-09', '(照明)女卫北一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-10', '(照明)女卫灯带', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-11', '(照明)转换区', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-01', '(照明)工具间+母婴室+第三卫生间', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-02', '(照明)洗手池', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-03', '(照明)男卫小便区', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-04', '(照明)男卫左一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-05', '(照明)男卫左二', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-06', '(照明)女卫左一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-07', '(照明)女卫左二', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-08', '(照明)女卫左三', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-09', '(照明)女卫北一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-10', '(照明)女卫灯带', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-11', '(照明)转换区', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-12', '(照明)转换区灯带', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-13', '(照明)卫生间', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-14', '(照明)走廊', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WT-1', '北区水箱', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WT', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WT-1', '南区水箱', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WT', 'Z-KT-02', NULL, 'SYS_DEVC');
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-1', '北区1号泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-2', '北区2号泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-1', '北区1号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-2', '北区2号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-WP-SH-3', '北区3号生活泵', '-', '-', '1', '综合楼', '321283124S300101', '321283124S3001', 'M_Z020_DEV_BA_WP', 'Z-KT-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WP-1', '南区1号泵', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WP', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-WP-2', '南区2号泵', '-', '-', '1', '综合楼', '321283124S300201', '321283124S3002', 'M_Z020_DEV_BA_WP', 'Z-KT-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-01', '(照明)工具间+母婴室+第三卫生间+洗手池', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-02', '(照明)洗手池', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-03', '(照明)男卫小便区', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-04', '(照明)男卫左一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-05', '(照明)男卫左二', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-06', '(照明)女卫左一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-07', '(照明)女卫左二', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-08', '(照明)女卫左三', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-09', '(照明)女卫北一', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-10', '(照明)女卫灯带', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-B-LIGHT-11', '(照明)转换区', '-', '-', '1', '综合楼', 'B-10101', '321283124S3001', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-01', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-01', '(照明)工具间+母婴室+第三卫生间', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-02', '(照明)洗手池', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-03', '(照明)男卫小便区', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-04', '(照明)男卫左一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-05', '(照明)男卫左二', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-06', '(照明)女卫左一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-07', '(照明)女卫左二', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-08', '(照明)女卫左三', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-09', '(照明)女卫北一', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-10', '(照明)女卫灯带', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-11', '(照明)转换区', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-12', '(照明)转换区灯带', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-13', '(照明)卫生间', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z020-N-LIGHT-14', '(照明)走廊', '-', '-', '1', '综合楼', 'N-10101', '321283124S3002', 'M_Z020_DEV_BA_LIGHT', 'Z-ZM-02', NULL, 'SYS_DEVC');
 
 -- 充电桩设备
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'W2-B-CHARGING-HOST-01', '充电桩群控箱01', '科士达', 'CDS66', '0', '北区广场', '321283124S300170', '321283124S3001', 'M_W2_DEV_CHARGING_HOST', 'Charge01', NULL, 'SYS_CD');
@@ -327,26 +327,6 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `dev
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'W2-N-CHARGING-PILE-0207', '(南)充电枪0207', '科士达', 'CDS1', '0', '南区广场', '321283124S300270', '321283124S3002', 'M_W2_DEV_CHARGING_PILE', 'Charge02', NULL, 'SYS_CD');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'W2-N-CHARGING-PILE-0208', '(南)充电枪0208', '科士达', 'CDS1', '0', '南区广场', '321283124S300270', '321283124S3002', 'M_W2_DEV_CHARGING_PILE', 'Charge02', NULL, 'SYS_CD');
 
--- mock设备
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-001', '光储设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-002', '光储设备2',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-003', '光储设备3',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-004', '光储设备4',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-005', '光储设备5',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-006', '光储设备6',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-007', '光储设备7',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-008', '光储设备8',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('ZHHM-01', '海绵设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_ZHHM');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('ZHHM-02', '海绵设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_ZHHM');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('LGCY-01', '厨余垃圾设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_LG');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('LGCY-02', '厨余垃圾设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_LG');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-ZHLD-001', '光伏板1','Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-CPD-001', '光伏板2', 'Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-ZHLD-001', '光伏板3','Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-CPD-001', '光伏板4', 'Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-001', '光伏板5',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-002', '光伏板6',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-003', '光伏板7',        'Canadian Solar', 'x1', '1', null, 'S30K150-S30K180', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
 
 -- 策略初始数据
 
@@ -369,9 +349,9 @@ INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `par
 
 -- 对象模型表
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_SYS_BA', 'BA楼控系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/ba/ct/abilityCall', null);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_SYS_BA', 'BA楼控系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/ba/ct/abilityCall', null);
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', '广场照明系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/square-light-ctl/ct/abilityCall', NULL);
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_SYS_ELEC_MONITOR', '电力监控系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/elec-monitor-acrel/ct/abilityCall', NULL);
-INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_TEST', '测试', 3, NULL, NULL);
 
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_DEV_BA_GA', 'BA采集控制网关', 2, 'http://172.17.60.27:9203/ems-dev-adapter/ba/ct/abilityCall', NULL);
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_DEV_BA_METER_E', 'BA电能采集测点', 2, 'http://172.17.60.27:9203/ems-dev-adapter/ba/ct/abilityCall', NULL);
@@ -403,6 +383,11 @@ INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_na
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_BA', 'Protocol', 'url', '服务地址', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_BA', 'Protocol', 'appId', 'appId', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_BA', 'State', 'interfaceStatus', '通道状态', NULL, 'Enum');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_BA', 'Protocol', 'interfaceType', '协议类型', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_BA', 'Protocol', 'url', '服务地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_BA', 'Protocol', 'appId', 'appId', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_BA', 'State', 'interfaceStatus', '通道状态', NULL, 'Enum');
+
 
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_DEV_BA_GA', 'Base', 'ip', '网络地址', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_DEV_BA_GA', 'Base', 'gateway', '网关地址', NULL, 'String');
@@ -705,6 +690,8 @@ INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_na
 
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W4_SYS_BA', 'interfaceStatus', '1', '正常');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W4_SYS_BA', 'interfaceStatus', '0', '断开');
+INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z010_SYS_BA', 'interfaceStatus', '1', '正常');
+INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z010_SYS_BA', 'interfaceStatus', '0', '断开');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'interfaceStatus', '1', '正常');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'interfaceStatus', '0', '断开');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W4_SYS_ELEC_MONITOR', 'interfaceStatus', '1', '正常');
@@ -815,6 +802,12 @@ INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `att
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_BA', 'M_W4_SYS_BA', 'appId', 'httpsjy', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_BA', 'M_W4_SYS_BA', 'interfaceStatus', '1', NULL);
 
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_DEVC', 'M_Z010_SYS_BA', 'interfaceType', 'http', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_DEVC', 'M_Z010_SYS_BA', 'url', 'http://172.17.50.186:80', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_DEVC', 'M_Z010_SYS_BA', 'appId', 'httpsjy', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_DEVC', 'M_Z010_SYS_BA', 'interfaceStatus', '1', NULL);
+
+
 -- BA设备属性(计量,控制)
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('W4-E-C-2003', 'M_W4_DEV_BA_GA', 'ip', '172.17.50.175', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('W4-E-C-2003', 'M_W4_DEV_BA_GA', 'gateway', '172.17.50.254', NULL);
@@ -1258,7 +1251,7 @@ INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `att
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'deviceName', '(电表)南区综合楼APKT1', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'interface', '1003D4口', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'location', '二楼强电间', NULL);
-INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'desc', '照明用电', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'desc', '空调用电', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0603', 'M_W4_DEV_BA_METER_E', 'value', NULL, NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0604', 'M_W4_DEV_BA_METER_E', 'deviceName', '(电表)南区综合楼APKT2', NULL);
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('C_1003_AV_0604', 'M_W4_DEV_BA_METER_E', 'interface', '1003D4口', NULL);
@@ -1600,11 +1593,11 @@ INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `att
 
 -- 对象能力数据
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'MeterReadingTotal', '全量抄报-网关', '网关-测点批量抄报', null, 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'SyncXfDevAttr', '采集同步-新风设备', '新风-采集同步', null, 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'SyncAuhDevAttr', '采集同步-空调设备', '空调-采集同步', null, 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'SyncWtDevAttr', '采集同步-水箱监测', '水箱-采集同步', null, 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'SyncWpDevAttr', '采集同步-水泵监测', '水泵-采集同步', null, 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_SYS_BA', 'SyncLightDevAttr', '采集同步-照明监测', '照明-采集同步', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_BA', 'SyncXfDevAttr', '采集同步-新风设备', '新风-采集同步', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_BA', 'SyncAuhDevAttr', '采集同步-空调设备', '空调-采集同步', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_BA', 'SyncWtDevAttr', '采集同步-水箱监测', '水箱-采集同步', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_BA', 'SyncWpDevAttr', '采集同步-水泵监测', '水泵-采集同步', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_BA', 'SyncLightDevAttr', '采集同步-照明监测', '照明-采集同步', null, 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W4_DEV_BA_GA', 'MeterReadingGw', '实时抄报-网关', '网关-测点批量抄报', null, 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z020_DEV_BA_XF', 'StartStopCtl', '启停控制', '启动/停止', '{"type":"Options", "list":[{"key":"启动", "value":"1"},{"key":"停止", "value":"0"}]}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z020_DEV_BA_AHU', 'StartStopCtl', '启停控制', '启动/停止', '{"type":"Options", "list":[{"key":"启动", "value":"1"},{"key":"停止", "value":"0"}]}', 1);
@@ -2198,16 +2191,12 @@ 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-W-B-102', '321283124S3001', '2025', '202506', 3666, '2025-05-31', 3915, '2025-06-30', 249, 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-W-B-102', '321283124S3001', '2025', '202507', 3915, '2025-06-30', 4182, '2025-07-31', 267, NULL, NULL);
 
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_DEVC', 'BA楼宇设备管理', 'BA楼宇设备管理', 'M_Z010_SYS_BA', '能耗监测厂商', '东边', '', '', '', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_BA', 'BA楼宇监控采集', 'BA楼宇监控采集', 'M_W4_SYS_BA','能耗监测厂商', '东边', '', '', '', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_ZHZM', '智慧照明系统', '智慧照明', 'M_Z010_SYS_SQUARE_LIGHT', '智慧照明厂商', '林工', '1212121121', '刘工', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_DLJK', '电力监控系统', '电力监控', 'M_W4_SYS_ELEC_MONITOR', '安科瑞', 'gzl', '1212121121', 'gzl', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GF', '光伏系统', '光伏', 'M_E5_SYS_PHOTOVOLTAIC', '古瑞瓦特', '张', '1380000', '李工', '123123', NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_CN', '储能系统', '储能', 'M_TEST','储能厂商', '王', '122112', '陈', '21212', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_CD', '充电桩系统', '充电桩', 'M_W2_SYS_CHARGING', '科士达', NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCC', '光储充系统', '光储充', 'M_TEST', '光储充厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCZR', '光储直柔系统', '光储直柔', 'M_TEST', '光储直柔厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_ZHHM', '智慧海绵系统', '智慧海绵', 'M_TEST', '智慧海绵厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_LG', '垃圾厨余系统', '垃圾厨余', 'M_TEST', '垃圾厨余厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
 
 -- 台账数据
 INSERT INTO `adm_ems_device_rbook` (`record_code`, `area_code`, `obj_type`, `obj_code`, `obj_name`, `record_time`, `ins_location`, `maintain_title`, `maintain_content`, `maintain_person`) VALUES ('TZ-20240901001', '321283124S3001', 1, 'W201', '北区-电网', '2024-09-01 10:32:00', '北区-广场', '北区广场变压器维护', '执行例行维护', '李大航');
@@ -2245,4 +2234,374 @@ INSERT INTO `adm_op_inspection_plan` (`area_code`, `task_code`, `task_name`, `ta
 
 -- 巡检报告
 INSERT INTO `adm_op_inspection_report` (`task_code`, `result_status`, `result_msg`, `finish_time`, `sub_time`, `submitter`) VALUES ('1001', 0, '<p>设施运行正常</p>', '2025-07-12 00:00:00', '2025-07-02 19:08:11', 'admin');
-INSERT INTO `adm_op_inspection_report` (`task_code`, `result_status`, `result_msg`, `finish_time`, `sub_time`, `submitter`) VALUES ('1002', 1, '<p>线材破损</p>', '2025-07-10 00:00:00', '2025-07-02 19:08:53', 'admin');
+INSERT INTO `adm_op_inspection_report` (`task_code`, `result_status`, `result_msg`, `finish_time`, `sub_time`, `submitter`) VALUES ('1002', 1, '<p>线材破损</p>', '2025-07-10 00:00:00', '2025-07-02 19:08:53', 'admin');
+
+
+-- ============================================================================
+-- 示例数据 - 数据源配置
+-- ============================================================================
+
+-- 1. 光伏产能数据源
+INSERT INTO `adm_report_datasource` (`ds_code`, `ds_name`, `ds_desc`, `main_table`, `main_alias`, `base_where`, `default_order`, `category`, `icon`, `sort_order`, `status`) VALUES
+    ('pv_supply', '光伏产能统计', '光伏发电量、自用电量、上网电量及收益统计', 'adm_ems_pv_supply_h', 't', 't.date IS NOT NULL', 't.record_time DESC', 'prod', 'el-icon-sunny', 1, 1);
+
+-- 2. 用电统计数据源
+INSERT INTO `adm_report_datasource` (`ds_code`, `ds_name`, `ds_desc`, `main_table`, `main_alias`, `base_where`, `default_order`, `category`, `icon`, `sort_order`, `status`) VALUES
+    ('elec_meter', '用电统计', '区域/设备用电量及电费统计,支持峰谷电分析', 'adm_elec_meter_h', 't', 't.date IS NOT NULL', 't.record_time DESC', 'elec', 'el-icon-lightning', 2, 1);
+
+-- 3. 用水统计数据源
+INSERT INTO `adm_report_datasource` (`ds_code`, `ds_name`, `ds_desc`, `main_table`, `main_alias`, `base_where`, `default_order`, `category`, `icon`, `sort_order`, `status`) VALUES
+    ('water_meter', '用水统计', '区域/设备用水量及水费统计', 'adm_water_meter_h', 't', 't.date IS NOT NULL', 't.record_time DESC', 'water', 'el-icon-cold-drink', 3, 1);
+
+-- 4. 储能统计数据源
+INSERT INTO `adm_report_datasource` (`ds_code`, `ds_name`, `ds_desc`, `main_table`, `main_alias`, `base_where`, `default_order`, `category`, `icon`, `sort_order`, `status`) VALUES
+    ('elec_store', '储能统计', '储能设备充放电量统计', 'adm_ems_elec_store_h', 't', 't.date IS NOT NULL', 't.record_time DESC', 'store', 'el-icon-coin', 4, 1);
+
+
+-- ============================================================================
+-- 示例数据 - 光伏产能字段配置
+-- ============================================================================
+INSERT INTO `adm_report_field` (`ds_code`, `field_code`, `field_name`, `field_alias`, `field_expr`, `field_type`, `field_format`, `decimals`, `unit`, `is_default`, `is_required`, `is_filterable`, `is_sortable`, `is_aggregatable`, `aggregate_func`, `group_name`, `min_width`, `sort_order`, `status`) VALUES
+-- 基础信息字段
+('pv_supply', 'area_code', '区域代码', NULL, 't.area_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 1, 1),
+('pv_supply', 'area_name', '区域名称', NULL, 'a.area_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 2, 1),
+('pv_supply', 'facs_code', '设施代码', NULL, 't.facs_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 3, 1),
+('pv_supply', 'facs_name', '设施名称', NULL, 'f.facs_name', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 150, 4, 1),
+
+-- 时间字段
+('pv_supply', 'record_time', '记录时间', NULL, 't.record_time', 'datetime', 'yyyy-MM-dd HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 160, 10, 1),
+('pv_supply', 'date', '日期', NULL, 't.date', 'date', 'yyyy-MM-dd', NULL, NULL, 1, 0, 1, 1, 0, NULL, '时间信息', 110, 11, 1),
+('pv_supply', 'time', '时间', NULL, 't.time', 'time', 'HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 12, 1),
+('pv_supply', 'time_index', '时间序列', NULL, 't.time_index', 'number', NULL, 0, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 13, 1),
+('pv_supply', 'stat_month', '统计月份', 'stat_month', 'DATE_FORMAT(t.date, ''%Y-%m'')', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 14, 1),
+('pv_supply', 'stat_year', '统计年份', 'stat_year', 'YEAR(t.date)', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 15, 1),
+
+-- 产能数据字段
+('pv_supply', 'gen_elec_quantity', '发电量', NULL, 't.gen_elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '产能数据', 120, 20, 1),
+('pv_supply', 'use_elec_quantity', '自用电量', NULL, 't.use_elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '产能数据', 120, 21, 1),
+('pv_supply', 'up_elec_quantity', '上网电量', NULL, 't.up_elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '产能数据', 120, 22, 1),
+('pv_supply', 'up_elec_earn', '上网收益', NULL, 't.up_elec_earn', 'number', NULL, 2, '元', 1, 0, 1, 1, 1, 'SUM', '产能数据', 120, 23, 1),
+('pv_supply', 'up_unit_price', '上网电价', NULL, 't.up_unit_price', 'number', NULL, 4, '元/kW·h', 0, 0, 1, 1, 0, 'AVG', '产能数据', 120, 24, 1),
+
+-- 计算字段
+('pv_supply', 'self_use_rate', '自用率', 'self_use_rate', 'ROUND(t.use_elec_quantity / NULLIF(t.gen_elec_quantity, 0) * 100, 2)', 'number', NULL, 2, '%', 0, 0, 1, 1, 0, NULL, '分析指标', 100, 30, 1);
+
+
+-- ============================================================================
+-- 示例数据 - 用电统计字段配置
+-- ============================================================================
+INSERT INTO `adm_report_field` (`ds_code`, `field_code`, `field_name`, `field_alias`, `field_expr`, `field_type`, `field_format`, `decimals`, `unit`, `is_default`, `is_required`, `is_filterable`, `is_sortable`, `is_aggregatable`, `aggregate_func`, `group_name`, `min_width`, `sort_order`, `status`) VALUES
+-- 基础信息字段
+('elec_meter', 'area_code', '区域代码', NULL, 't.area_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 1, 1),
+('elec_meter', 'area_name', '区域名称', NULL, 'a.area_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 2, 1),
+('elec_meter', 'device_code', '设备代码', NULL, 't.device_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 150, 3, 1),
+('elec_meter', 'device_name', '设备名称', NULL, 'd.device_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 4, 1),
+
+-- 时间字段
+('elec_meter', 'record_time', '记录时间', NULL, 't.record_time', 'datetime', 'yyyy-MM-dd HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 160, 10, 1),
+('elec_meter', 'date', '日期', NULL, 't.date', 'date', 'yyyy-MM-dd', NULL, NULL, 1, 0, 1, 1, 0, NULL, '时间信息', 110, 11, 1),
+('elec_meter', 'time', '时间', NULL, 't.time', 'time', 'HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 12, 1),
+('elec_meter', 'time_index', '时间序列', NULL, 't.time_index', 'number', NULL, 0, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 13, 1),
+('elec_meter', 'stat_month', '统计月份', 'stat_month', 'DATE_FORMAT(t.date, ''%Y-%m'')', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 14, 1),
+('elec_meter', 'stat_year', '统计年份', 'stat_year', 'YEAR(t.date)', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 15, 1),
+
+-- 用电数据字段
+('elec_meter', 'elec_quantity', '用电量', NULL, 't.elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '用电数据', 120, 20, 1),
+('elec_meter', 'use_elec_cost', '用电费用', NULL, 't.use_elec_cost', 'number', NULL, 2, '元', 1, 0, 1, 1, 1, 'SUM', '用电数据', 120, 21, 1),
+('elec_meter', 'meter_type', '计量类型', NULL, 't.meter_type', 'number', NULL, 0, NULL, 0, 0, 1, 1, 0, NULL, '用电数据', 100, 22, 1),
+('elec_meter', 'meter_type_name', '计量类型名称', 'meter_type_name', 'CASE t.meter_type WHEN 2 THEN ''尖峰'' WHEN 1 THEN ''高峰'' WHEN 0 THEN ''平峰'' WHEN -1 THEN ''低谷'' WHEN -2 THEN ''深谷'' ELSE ''未知'' END', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '用电数据', 100, 23, 1),
+('elec_meter', 'meter_unit_price', '单位电价', NULL, 't.meter_unit_price', 'number', NULL, 4, '元/kW·h', 0, 0, 1, 1, 0, 'AVG', '用电数据', 100, 24, 1),
+('elec_meter', 'meter_reading', '表计读数', NULL, 't.meter_reading', 'number', NULL, 2, NULL, 0, 0, 1, 1, 0, NULL, '用电数据', 120, 25, 1);
+
+
+-- ============================================================================
+-- 示例数据 - 用水统计字段配置
+-- ============================================================================
+INSERT INTO `adm_report_field` (`ds_code`, `field_code`, `field_name`, `field_alias`, `field_expr`, `field_type`, `field_format`, `decimals`, `unit`, `is_default`, `is_required`, `is_filterable`, `is_sortable`, `is_aggregatable`, `aggregate_func`, `group_name`, `min_width`, `sort_order`, `status`) VALUES
+-- 基础信息字段
+('water_meter', 'area_code', '区域代码', NULL, 't.area_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 1, 1),
+('water_meter', 'area_name', '区域名称', NULL, 'a.area_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 2, 1),
+('water_meter', 'device_code', '设备代码', NULL, 't.device_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 150, 3, 1),
+('water_meter', 'device_name', '设备名称', NULL, 'd.device_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 4, 1),
+
+-- 时间字段
+('water_meter', 'record_time', '记录时间', NULL, 't.record_time', 'datetime', 'yyyy-MM-dd HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 160, 10, 1),
+('water_meter', 'date', '日期', NULL, 't.date', 'date', 'yyyy-MM-dd', NULL, NULL, 1, 0, 1, 1, 0, NULL, '时间信息', 110, 11, 1),
+('water_meter', 'time', '时间', NULL, 't.time', 'time', 'HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 12, 1),
+('water_meter', 'time_index', '时间序列', NULL, 't.time_index', 'number', NULL, 0, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 13, 1),
+('water_meter', 'stat_month', '统计月份', 'stat_month', 'DATE_FORMAT(t.date, ''%Y-%m'')', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 14, 1),
+('water_meter', 'stat_year', '统计年份', 'stat_year', 'YEAR(t.date)', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 15, 1),
+
+-- 用水数据字段
+('water_meter', 'water_quantity', '用水量', NULL, 't.water_quantity', 'number', NULL, 2, '吨', 1, 0, 1, 1, 1, 'SUM', '用水数据', 120, 20, 1),
+('water_meter', 'use_water_cost', '用水费用', NULL, 't.use_water_cost', 'number', NULL, 2, '元', 1, 0, 1, 1, 1, 'SUM', '用水数据', 120, 21, 1),
+('water_meter', 'meter_unit_price', '单位水价', NULL, 't.meter_unit_price', 'number', NULL, 4, '元/吨', 0, 0, 1, 1, 0, 'AVG', '用水数据', 100, 22, 1),
+('water_meter', 'meter_reading', '表计读数', NULL, 't.meter_reading', 'number', NULL, 2, NULL, 0, 0, 1, 1, 0, NULL, '用水数据', 120, 23, 1);
+
+
+-- ============================================================================
+-- 示例数据 - 储能统计字段配置
+-- ============================================================================
+INSERT INTO `adm_report_field` (`ds_code`, `field_code`, `field_name`, `field_alias`, `field_expr`, `field_type`, `field_format`, `decimals`, `unit`, `is_default`, `is_required`, `is_filterable`, `is_sortable`, `is_aggregatable`, `aggregate_func`, `group_name`, `min_width`, `sort_order`, `status`) VALUES
+-- 基础信息字段
+('elec_store', 'area_code', '区域代码', NULL, 't.area_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 1, 1),
+('elec_store', 'area_name', '区域名称', NULL, 'a.area_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 2, 1),
+('elec_store', 'facs_code', '设施代码', NULL, 't.facs_code', 'string', NULL, NULL, NULL, 0, 0, 1, 1, 0, NULL, '基础信息', 120, 3, 1),
+('elec_store', 'facs_name', '设施名称', NULL, 'f.facs_name', 'string', NULL, NULL, NULL, 1, 0, 1, 1, 0, NULL, '基础信息', 150, 4, 1),
+
+-- 时间字段
+('elec_store', 'record_time', '记录时间', NULL, 't.record_time', 'datetime', 'yyyy-MM-dd HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 160, 10, 1),
+('elec_store', 'date', '日期', NULL, 't.date', 'date', 'yyyy-MM-dd', NULL, NULL, 1, 0, 1, 1, 0, NULL, '时间信息', 110, 11, 1),
+('elec_store', 'time', '时间', NULL, 't.time', 'time', 'HH:mm:ss', NULL, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 12, 1),
+('elec_store', 'time_index', '时间序列', NULL, 't.time_index', 'number', NULL, 0, NULL, 0, 0, 1, 1, 0, NULL, '时间信息', 100, 13, 1),
+
+-- 储能数据字段
+('elec_store', 'charge_elec_quantity', '充电电量', NULL, 't.charge_elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '储能数据', 120, 20, 1),
+('elec_store', 'discharge_elec_quantity', '放电电量', NULL, 't.discharge_elec_quantity', 'number', NULL, 2, 'kW·h', 1, 0, 1, 1, 1, 'SUM', '储能数据', 120, 21, 1),
+
+-- 计算字段
+('elec_store', 'net_quantity', '净电量', 'net_quantity', 'ROUND(t.discharge_elec_quantity - t.charge_elec_quantity, 2)', 'number', NULL, 2, 'kW·h', 0, 0, 1, 1, 1, 'SUM', '分析指标', 120, 30, 1);
+
+
+-- ============================================================================
+-- 示例数据 - 字段条件配置(通用条件)
+-- ============================================================================
+
+-- 数值类型通用条件
+INSERT INTO `adm_report_field_condition` (`ds_code`, `field_code`, `condition_type`, `condition_name`, `condition_symbol`, `value_count`, `is_default`, `sort_order`, `status`)
+SELECT ds_code, field_code, 'gt', '大于', '>', 1, 0, 1, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'gte', '大于等于', '>=', 1, 0, 2, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'lt', '小于', '<', 1, 0, 3, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'lte', '小于等于', '<=', 1, 0, 4, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'eq', '等于', '=', 1, 1, 5, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'ne', '不等于', '!=', 1, 0, 6, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'between', '区间', 'BETWEEN', 2, 0, 7, 1 FROM `adm_report_field` WHERE field_type = 'number' AND is_filterable = 1;
+
+-- 字符串类型通用条件
+INSERT INTO `adm_report_field_condition` (`ds_code`, `field_code`, `condition_type`, `condition_name`, `condition_symbol`, `value_count`, `is_default`, `sort_order`, `status`)
+SELECT ds_code, field_code, 'eq', '等于', '=', 1, 1, 1, 1 FROM `adm_report_field` WHERE field_type = 'string' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'ne', '不等于', '!=', 1, 0, 2, 1 FROM `adm_report_field` WHERE field_type = 'string' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'like', '包含', 'LIKE', 1, 0, 3, 1 FROM `adm_report_field` WHERE field_type = 'string' AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'in', '在列表中', 'IN', -1, 0, 4, 1 FROM `adm_report_field` WHERE field_type = 'string' AND is_filterable = 1;
+
+-- 日期/时间类型通用条件
+INSERT INTO `adm_report_field_condition` (`ds_code`, `field_code`, `condition_type`, `condition_name`, `condition_symbol`, `value_count`, `is_default`, `sort_order`, `status`)
+SELECT ds_code, field_code, 'gte', '开始于', '>=', 1, 1, 1, 1 FROM `adm_report_field` WHERE field_type IN ('date', 'datetime') AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'lte', '结束于', '<=', 1, 1, 2, 1 FROM `adm_report_field` WHERE field_type IN ('date', 'datetime') AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'between', '时间范围', 'BETWEEN', 2, 0, 3, 1 FROM `adm_report_field` WHERE field_type IN ('date', 'datetime') AND is_filterable = 1
+UNION ALL
+SELECT ds_code, field_code, 'eq', '等于', '=', 1, 0, 4, 1 FROM `adm_report_field` WHERE field_type IN ('date', 'datetime') AND is_filterable = 1;
+
+
+-- ============================================================================
+-- 示例数据 - 关联关系配置
+-- ============================================================================
+
+-- 光伏产能关联
+INSERT INTO `adm_report_relation` (`ds_code`, `relation_code`, `relation_name`, `join_type`, `join_table`, `join_alias`, `join_condition`, `is_auto_join`, `sort_order`, `status`, `remark`) VALUES
+                                                                                                                                                                                                 ('pv_supply', 'rel_area', '区域关联', 'LEFT', 'adm_area', 'a', 't.area_code = a.area_code', 1, 1, 1, '用于获取区域名称'),
+                                                                                                                                                                                                 ('pv_supply', 'rel_facs', '设施关联', 'LEFT', 'adm_ems_facs', 'f', 't.facs_code = f.facs_code', 1, 2, 1, '用于获取设施名称');
+
+-- 用电统计关联
+INSERT INTO `adm_report_relation` (`ds_code`, `relation_code`, `relation_name`, `join_type`, `join_table`, `join_alias`, `join_condition`, `is_auto_join`, `sort_order`, `status`, `remark`) VALUES
+                                                                                                                                                                                                 ('elec_meter', 'rel_area', '区域关联', 'LEFT', 'adm_area', 'a', 't.area_code = a.area_code', 1, 1, 1, '用于获取区域名称'),
+                                                                                                                                                                                                 ('elec_meter', 'rel_device', '设备关联', 'LEFT', 'adm_meter_device', 'd', 't.device_code = d.device_code', 1, 2, 1, '用于获取设备名称');
+
+-- 用水统计关联
+INSERT INTO `adm_report_relation` (`ds_code`, `relation_code`, `relation_name`, `join_type`, `join_table`, `join_alias`, `join_condition`, `is_auto_join`, `sort_order`, `status`, `remark`) VALUES
+                                                                                                                                                                                                 ('water_meter', 'rel_area', '区域关联', 'LEFT', 'adm_area', 'a', 't.area_code = a.area_code', 1, 1, 1, '用于获取区域名称'),
+                                                                                                                                                                                                 ('water_meter', 'rel_device', '设备关联', 'LEFT', 'adm_meter_device', 'd', 't.device_code = d.device_code', 1, 2, 1, '用于获取设备名称');
+
+-- 储能统计关联
+INSERT INTO `adm_report_relation` (`ds_code`, `relation_code`, `relation_name`, `join_type`, `join_table`, `join_alias`, `join_condition`, `is_auto_join`, `sort_order`, `status`, `remark`) VALUES
+                                                                                                                                                                                                 ('elec_store', 'rel_area', '区域关联', 'LEFT', 'adm_area', 'a', 't.area_code = a.area_code', 1, 1, 1, '用于获取区域名称'),
+                                                                                                                                                                                                 ('elec_store', 'rel_facs', '设施关联', 'LEFT', 'adm_ems_facs', 'f', 't.facs_code = f.facs_code', 1, 2, 1, '用于获取设施名称');
+
+
+-- ============================================================================
+-- 示例数据 - 字段关联映射
+-- ============================================================================
+
+-- 光伏产能字段关联映射
+INSERT INTO `adm_report_field_relation` (`ds_code`, `field_code`, `relation_code`) VALUES
+                                                                                       ('pv_supply', 'area_name', 'rel_area'),
+                                                                                       ('pv_supply', 'facs_name', 'rel_facs');
+
+-- 用电统计字段关联映射
+INSERT INTO `adm_report_field_relation` (`ds_code`, `field_code`, `relation_code`) VALUES
+                                                                                       ('elec_meter', 'area_name', 'rel_area'),
+                                                                                       ('elec_meter', 'device_name', 'rel_device');
+
+-- 用水统计字段关联映射
+INSERT INTO `adm_report_field_relation` (`ds_code`, `field_code`, `relation_code`) VALUES
+                                                                                       ('water_meter', 'area_name', 'rel_area'),
+                                                                                       ('water_meter', 'device_name', 'rel_device');
+
+-- 储能统计字段关联映射
+INSERT INTO `adm_report_field_relation` (`ds_code`, `field_code`, `relation_code`) VALUES
+                                                                                       ('elec_store', 'area_name', 'rel_area'),
+                                                                                       ('elec_store', 'facs_name', 'rel_facs');
+
+
+-- ============================================================================
+-- 示例数据 - 用户报表模板
+-- ============================================================================
+
+-- 模板1: 光伏日发电量统计
+INSERT INTO `adm_report_template` (`template_code`, `template_name`, `template_desc`, `ds_code`, `config_json`, `is_public`, `is_system`, `user_id`, `user_name`, `status`) VALUES
+    ('tpl_pv_daily', '光伏日发电量统计', '按区域统计每日光伏发电量、自用电量、上网电量及收益', 'pv_supply',
+     '{
+       "selectedFields": ["area_name", "date", "gen_elec_quantity", "use_elec_quantity", "up_elec_quantity", "up_elec_earn", "self_use_rate"],
+       "conditions": [
+         {"field": "date", "operator": "gte", "value": "${startDate}"},
+         {"field": "date", "operator": "lte", "value": "${endDate}"},
+         {"field": "area_code", "operator": "eq", "value": "${areaCode}", "optional": true}
+       ],
+       "groupBy": ["area_code", "area_name", "date"],
+       "orderBy": [{"field": "date", "direction": "DESC"}, {"field": "area_name", "direction": "ASC"}],
+       "aggregateFields": {
+         "gen_elec_quantity": "SUM",
+         "use_elec_quantity": "SUM",
+         "up_elec_quantity": "SUM",
+         "up_elec_earn": "SUM"
+       }
+     }', 1, 1, NULL, 'admin', 1);
+
+-- 模板2: 区域用电明细
+INSERT INTO `adm_report_template` (`template_code`, `template_name`, `template_desc`, `ds_code`, `config_json`, `is_public`, `is_system`, `user_id`, `user_name`, `status`) VALUES
+    ('tpl_elec_detail', '区域用电明细', '查询区域用电明细数据,支持按峰谷电筛选', 'elec_meter',
+     '{
+       "selectedFields": ["area_name", "device_name", "record_time", "date", "time", "elec_quantity", "meter_type_name", "meter_unit_price", "use_elec_cost"],
+       "conditions": [
+         {"field": "record_time", "operator": "gte", "value": "${startTime}"},
+         {"field": "record_time", "operator": "lte", "value": "${endTime}"},
+         {"field": "area_code", "operator": "eq", "value": "${areaCode}", "optional": true},
+         {"field": "meter_type", "operator": "eq", "value": "${meterType}", "optional": true}
+       ],
+       "groupBy": null,
+       "orderBy": [{"field": "record_time", "direction": "DESC"}],
+       "aggregateFields": null
+     }', 1, 1, NULL, 'admin', 1);
+
+-- 模板3: 月度用电汇总
+INSERT INTO `adm_report_template` (`template_code`, `template_name`, `template_desc`, `ds_code`, `config_json`, `is_public`, `is_system`, `user_id`, `user_name`, `status`) VALUES
+    ('tpl_elec_monthly', '月度用电汇总', '按区域统计月度用电量和电费', 'elec_meter',
+     '{
+       "selectedFields": ["area_name", "stat_month", "elec_quantity", "use_elec_cost"],
+       "conditions": [
+         {"field": "stat_year", "operator": "eq", "value": "${year}"},
+         {"field": "area_code", "operator": "eq", "value": "${areaCode}", "optional": true}
+       ],
+       "groupBy": ["area_code", "area_name", "stat_month"],
+       "orderBy": [{"field": "stat_month", "direction": "ASC"}, {"field": "area_name", "direction": "ASC"}],
+       "aggregateFields": {
+         "elec_quantity": "SUM",
+         "use_elec_cost": "SUM"
+       }
+     }', 1, 1, NULL, 'admin', 1);
+
+-- 模板4: 用水日报
+INSERT INTO `adm_report_template` (`template_code`, `template_name`, `template_desc`, `ds_code`, `config_json`, `is_public`, `is_system`, `user_id`, `user_name`, `status`) VALUES
+    ('tpl_water_daily', '用水日报', '每日用水量统计', 'water_meter',
+     '{
+       "selectedFields": ["area_name", "date", "water_quantity", "use_water_cost"],
+       "conditions": [
+         {"field": "date", "operator": "gte", "value": "${startDate}"},
+         {"field": "date", "operator": "lte", "value": "${endDate}"},
+         {"field": "area_code", "operator": "eq", "value": "${areaCode}", "optional": true},
+         {"field": "water_quantity", "operator": "gt", "value": "0"}
+       ],
+       "groupBy": ["area_code", "area_name", "date"],
+       "orderBy": [{"field": "date", "direction": "DESC"}],
+       "aggregateFields": {
+         "water_quantity": "SUM",
+         "use_water_cost": "SUM"
+       }
+     }', 1, 0, 1, 'test_user', 1);
+
+
+-- ================== Mock 设备 =========================
+
+-- mock 设备数据
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCC', '光储充系统', '光储充', 'M_W4_SYS_GCC', '光储充厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCZR', '光储直柔系统', '光储直柔', 'M_W4_SYS_GCZR', '光储直柔厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_ZHHM', '智慧海绵系统', '智慧海绵', 'M_Z010_SYS_HM', '智慧海绵厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_LG', '垃圾厨余系统', '垃圾厨余', 'M_Z010_SYS_LJCY', '垃圾厨余厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
+
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_TEST', '测试', 3, NULL, NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_SYS_GCZR', '光储直柔系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/gczr/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_SYS_GCC', '光储充系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/gcc/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W4_DEV_CN', '储能设备', 2, 'http://172.17.60.27:9203/ems-dev-adapter/gcc/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_SYS_HM', '海绵系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/hm/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_DEV_HM', '海绵设备', 2, 'http://172.17.60.27:9203/ems-dev-adapter/hm/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_SYS_LJCY', '垃圾厨余系统', 3, 'http://172.17.60.27:9203/ems-dev-adapter/ljcy/ct/abilityCall', NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z010_DEV_LJCY', '垃圾厨余设备', 2, 'http://172.17.60.27:9203/ems-dev-adapter/ljcy/ct/abilityCall', NULL);
+
+
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCZR', 'Base', 'interfaceType', '协议类型', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCZR', 'Base', 'url', '服务地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCZR', 'Base', 'token', '接口令牌', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCZR', 'Base', 'plantList', '站点信息', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCC', 'Base', 'interfaceType', '协议类型', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCC', 'Base', 'url', '服务地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCC', 'Base', 'token', '接口令牌', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W4_SYS_GCC', 'Base', 'plantList', '站点信息', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_HM', 'Base', 'interfaceType', '协议类型', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_HM', 'Base', 'url', '服务地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_HM', 'Base', 'token', '接口令牌', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_HM', 'Base', 'plantList', '站点信息', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_LJCY', 'Base', 'interfaceType', '协议类型', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_LJCY', 'Base', 'url', '服务地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_LJCY', 'Base', 'token', '接口令牌', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_SYS_LJCY', 'Base', 'plantList', '站点信息', NULL, 'String');
+
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCZR', 'M_W4_SYS_GCZR', 'interfaceType', 'http', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCZR', 'M_W4_SYS_GCZR', 'url', 'https://openapi-cn.growatt.com', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCZR', 'M_W4_SYS_GCZR', 'token', '3g7gdk3264xfw94jn1f7oox76fln8o3q', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCZR', 'M_W4_SYS_GCZR', 'plantList', '北岸(926492)', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCC', 'M_W4_SYS_GCC', 'interfaceType', 'http', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCC', 'M_W4_SYS_GCC', 'url', 'https://0.0.0.0', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCC', 'M_W4_SYS_GCC', 'token', '12345678', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_GCC', 'M_W4_SYS_GCC', 'plantList', '0000', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_ZHHM', 'M_Z010_SYS_HM', 'interfaceType', 'http', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_ZHHM', 'M_Z010_SYS_HM', 'url', 'https://0.0.0.0', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_ZHHM', 'M_Z010_SYS_HM', 'token', '12345678', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_ZHHM', 'M_Z010_SYS_HM', 'plantList', '0000', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_LG', 'M_Z010_SYS_LJCY', 'interfaceType', 'http', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_LG', 'M_Z010_SYS_LJCY', 'url', 'https://0.0.0.0', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_LG', 'M_Z010_SYS_LJCY', 'token', '12345678', NULL);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('SYS_LG', 'M_Z010_SYS_LJCY', 'plantList', '0000', NULL);
+
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('SYS_GCZR', 'SyncDevInverter', '同步逆变器设备', '从Growatt API同步逆变器设备列表和基础属性', null, 1);
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-001', '光储设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'M_W4_DEV_CN', 'C101', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-002', '光储设备2',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'M_W4_DEV_CN', 'C101', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-003', '光储设备3',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'M_W4_DEV_CN', 'C101', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-004', '光储设备4',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'M_W4_DEV_CN', 'C101', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-005', '光储设备5',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'M_W4_DEV_CN', 'C102', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-006', '光储设备6',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'M_W4_DEV_CN', 'C102', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-007', '光储设备7',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'M_W4_DEV_CN', 'C102', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('GCZR-008', '光储设备8',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'M_W4_DEV_CN', 'C102', NULL, 'SYS_GCC');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('ZHHM-01', '海绵设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_ZHHM');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('ZHHM-02', '海绵设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_ZHHM');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('LGCY-01', '厨余垃圾设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_LG');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('LGCY-02', '厨余垃圾设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_LG');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-ZHLD-001', '光伏板1','Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-CPD-001', '光伏板2', 'Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-ZHLD-001', '光伏板3','Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-CPD-001', '光伏板4', 'Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-001', '光伏板5',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-002', '光伏板6',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-003', '光伏板7',        'Canadian Solar', 'x1', '1', null, 'S30K150-S30K180', '321283124S3003', 'test', 'E503', null, 'SYS_GF');

+ 159 - 42
ems/sql/ems_server.sql

@@ -898,7 +898,7 @@ CREATE TABLE adm_op_energy_strategy (
   `area_code` VARCHAR(32) NOT NULL COMMENT '地块代码',
   `strategy_code` VARCHAR(64) NOT NULL COMMENT '策略代码',
   `strategy_name` VARCHAR(64) NOT NULL COMMENT '策略名称',
-  `scene_type` VARCHAR(32) DEFAULT NULL COMMENT '场景类型:PV_ESS-光储协同,DEMAND_RESP-需求响应,PEAK_VALLEY-削峰填谷,EMERGENCY-应急保供,ENERGY_SAVE-节能优化',
+  `scene_type` VARCHAR(32) DEFAULT NULL COMMENT '场景类型:PV_ESS-源网协调,DEMAND_RESP-源荷互动,PEAK_VALLEY-网储互动,EMERGENCY-应急保供,ENERGY_SAVE-节能优化',
   `strategy_category` VARCHAR(32) DEFAULT NULL COMMENT '策略分类:AUTO-自动,MANUAL-手动,SCHEDULE-定时,EVENT-事件',
   `trigger_type` INT DEFAULT NULL COMMENT '触发类型:1-事件触发,2-定时触发,3-手动触发,4-条件触发',
   `trigger_config` TEXT DEFAULT NULL COMMENT '触发配置(JSON)',
@@ -1661,42 +1661,6 @@ create table adm_ems_index_range (
 
 
 -- ----------------------------
--- 电网设施指标表
--- ----------------------------
-drop table if exists adm_ems_elec_pg_index;
-create table adm_ems_elec_pg_index (
-  `id`                        bigint(20)      not null auto_increment      comment '序号',
-  `area_code`                 varchar(32)     not null                     comment '园区代码',
-  `facs_code`                 varchar(16)     not null                     comment '设施代码',
-  `date`                      date            not null                     comment '日期 yyyy-MM-dd',
-  `time`                      datetime        not null                     comment '时间 yyyy-MM-dd HH:mm:ss',
-  `voltage`                   double          default null                 comment '电压 单位:kV(千伏)',
-  `electricity`               double          default null                 comment '电流 单位:A(安培)',
-  `power`                     double          default null                 comment '功率 单位:kW(千瓦)',
-  primary key (`id`),
-  unique key ux_ems_elec_pg_index(`facs_code`, `time`)
-) engine=innodb auto_increment=1 comment = '电网设施指标表';
-
-
--- ----------------------------
--- 光伏设施指标表
--- ----------------------------
-drop table if exists adm_ems_elec_pv_index;
-create table adm_ems_elec_pv_index (
-  `id`                        bigint(20)      not null auto_increment      comment '序号',
-  `area_code`                 varchar(32)     not null                     comment '园区代码',
-  `facs_code`                 varchar(16)     not null                     comment '设施代码',
-  `date`                      date            not null                     comment '日期 yyyy-MM-dd',
-  `time`                      datetime        not null                     comment '时间 yyyy-MM-dd HH:mm:ss',
-  `voltage`                   double          default null                 comment '电压 单位:kV(千伏)',
-  `electricity`               double          default null                 comment '电流 单位:A(安培)',
-  `power`                     double          default null                 comment '功率 单位:kW(千瓦)',
-  primary key (`id`),
-  unique key ux_ems_elec_pg_index(`facs_code`, `time`)
-) engine=innodb auto_increment=1 comment = '光伏设施指标表';
-
-
--- ----------------------------
 -- 储能设施指标表
 -- ----------------------------
 drop table if exists adm_ems_elec_store_index;
@@ -1704,15 +1668,14 @@ create table adm_ems_elec_store_index (
   `id`                        bigint(20)      not null auto_increment      comment '序号',
   `area_code`                 varchar(32)     not null                     comment '园区代码',
   `facs_code`                 varchar(16)     not null                     comment '设施代码',
+  `device_code`               varchar(64)     not null                     comment '设备代码',
   `date`                      date            not null                     comment '日期 yyyy-MM-dd',
   `time`                      datetime        not null                     comment '时间 yyyy-MM-dd HH:mm:ss',
-  `input_voltage`             double          default null                 comment '输入电压 单位:kV(千伏)',
-  `input_electricity`         double          default null                 comment '输入电流 单位:A(安培)',
-  `output_voltage`            double          default null                 comment '输出电压 单位:kV(千伏)',
-  `output_electricity`        double          default null                 comment '输出电流 单位:A(安培)',
+  `charge_voltage`            double          default null                 comment '充电功率 单位:W(瓦)',
+  `discharge_power`           double          default null                 comment '放电功率 单位:W(瓦)',
   `current_capacity`          double          default null                 comment '当前容量 单位:kW-h(千瓦·时)',
   primary key (`id`),
-  unique key ux_ems_elec_store_index(`facs_code`, `time`)
+  unique key ux_ems_elec_store_index(`device_code`, `time`)
 ) engine=innodb auto_increment=1 comment = '储能设施指标表';
 
 -- ----------------------------
@@ -1825,3 +1788,157 @@ create table adm_ems_ca_emission_forecast (
   primary key (`id`),
   unique key ux_ems_ca_emission_forecast(`area_code`, `month`)
 ) engine=innodb auto_increment=1 comment = '碳排放预测表';
+
+
+-- ============================================================================
+-- 报表数据源配置表 (主表) - 定义可查询的数据源
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_datasource`;
+CREATE TABLE `adm_report_datasource` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码(唯一标识)',
+    `ds_name`           varchar(128)    NOT NULL                   COMMENT '数据源名称',
+    `ds_desc`           varchar(512)    DEFAULT NULL               COMMENT '数据源描述',
+    `main_table`        varchar(128)    NOT NULL                   COMMENT '主表名',
+    `main_alias`        varchar(32)     DEFAULT 't'                COMMENT '主表别名',
+    `base_where`        varchar(1024)   DEFAULT NULL               COMMENT '基础查询条件(固定条件)',
+    `default_order`     varchar(256)    DEFAULT NULL               COMMENT '默认排序字段',
+    `category`          varchar(64)     DEFAULT NULL               COMMENT '分类(prod-产能,elec-用电,water-用水,store-储能)',
+    `icon`              varchar(64)     DEFAULT NULL               COMMENT '图标',
+    `sort_order`        int             DEFAULT 0                  COMMENT '排序号',
+    `status`            tinyint(1)      DEFAULT 1                  COMMENT '状态(0-禁用,1-启用)',
+    `remark`            varchar(512)    DEFAULT NULL               COMMENT '备注',
+    `create_by`         varchar(64)     DEFAULT NULL               COMMENT '创建者',
+    `create_time`       datetime        DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
+    `update_by`         varchar(64)     DEFAULT NULL               COMMENT '更新者',
+    `update_time`       datetime        DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_ds_code` (`ds_code`),
+    KEY `idx_category` (`category`),
+    KEY `idx_status` (`status`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-数据源配置表';
+
+
+-- ============================================================================
+-- 报表字段配置表 - 定义数据源的可用字段
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_field`;
+CREATE TABLE `adm_report_field` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码',
+    `field_code`        varchar(64)     NOT NULL                   COMMENT '字段编码(对应数据库列名或别名)',
+    `field_name`        varchar(128)    NOT NULL                   COMMENT '字段显示名称',
+    `field_alias`       varchar(64)     DEFAULT NULL               COMMENT '字段别名(用于SQL SELECT)',
+    `field_expr`        varchar(512)    DEFAULT NULL               COMMENT '字段表达式(复杂计算字段)',
+    `field_type`        varchar(32)     NOT NULL                   COMMENT '字段类型(string/number/date/datetime/time)',
+    `field_format`      varchar(64)     DEFAULT NULL               COMMENT '显示格式(如日期格式yyyy-MM-dd)',
+    `decimals`          int             DEFAULT 2                  COMMENT '小数位数(数值类型)',
+    `unit`              varchar(32)     DEFAULT NULL               COMMENT '单位(如kW·h、元、吨)',
+    `dict_type`         varchar(64)     DEFAULT NULL               COMMENT '字典类型(用于值转换)',
+    `is_default`        tinyint(1)      DEFAULT 0                  COMMENT '是否默认显示(0-否,1-是)',
+    `is_required`       tinyint(1)      DEFAULT 0                  COMMENT '是否必选(0-否,1-是)',
+    `is_filterable`     tinyint(1)      DEFAULT 1                  COMMENT '是否可筛选(0-否,1-是)',
+    `is_sortable`       tinyint(1)      DEFAULT 1                  COMMENT '是否可排序(0-否,1-是)',
+    `is_aggregatable`   tinyint(1)      DEFAULT 0                  COMMENT '是否可聚合统计(0-否,1-是)',
+    `aggregate_func`    varchar(32)     DEFAULT NULL               COMMENT '默认聚合函数(SUM/AVG/MAX/MIN/COUNT)',
+    `group_name`        varchar(64)     DEFAULT NULL               COMMENT '字段分组名称',
+    `width`             int             DEFAULT NULL               COMMENT '列宽度(像素)',
+    `min_width`         int             DEFAULT 100                COMMENT '最小列宽度',
+    `sort_order`        int             DEFAULT 0                  COMMENT '排序号',
+    `status`            tinyint(1)      DEFAULT 1                  COMMENT '状态(0-禁用,1-启用)',
+    `remark`            varchar(512)    DEFAULT NULL               COMMENT '备注',
+    `create_time`       datetime        DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
+    `update_time`       datetime        DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_ds_field` (`ds_code`, `field_code`),
+    KEY `idx_ds_code` (`ds_code`),
+    KEY `idx_field_type` (`field_type`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-字段配置表';
+
+
+-- ============================================================================
+-- 报表字段条件配置表 - 定义字段支持的查询条件
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_field_condition`;
+CREATE TABLE `adm_report_field_condition` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码',
+    `field_code`        varchar(64)     NOT NULL                   COMMENT '字段编码',
+    `condition_type`    varchar(32)     NOT NULL                   COMMENT '条件类型(eq/ne/gt/gte/lt/lte/like/in/between/isNull/isNotNull)',
+    `condition_name`    varchar(64)     NOT NULL                   COMMENT '条件显示名称',
+    `condition_symbol`  varchar(16)     DEFAULT NULL               COMMENT '条件符号(=/>/>=/</<=/!=)',
+    `value_count`       int             DEFAULT 1                  COMMENT '需要的值数量(1-单值,2-双值如between)',
+    `default_value`     varchar(256)    DEFAULT NULL               COMMENT '默认值',
+    `is_default`        tinyint(1)      DEFAULT 0                  COMMENT '是否默认条件',
+    `sort_order`        int             DEFAULT 0                  COMMENT '排序号',
+    `status`            tinyint(1)      DEFAULT 1                  COMMENT '状态',
+    PRIMARY KEY (`id`),
+    KEY `idx_ds_field` (`ds_code`, `field_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-字段条件配置表';
+
+
+-- ============================================================================
+-- 报表关联关系配置表 - 定义表关联(用于code到name的转换等)
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_relation`;
+CREATE TABLE `adm_report_relation` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码',
+    `relation_code`     varchar(64)     NOT NULL                   COMMENT '关联编码',
+    `relation_name`     varchar(128)    DEFAULT NULL               COMMENT '关联名称',
+    `join_type`         varchar(16)     DEFAULT 'LEFT'             COMMENT '关联类型(LEFT/INNER/RIGHT)',
+    `join_table`        varchar(128)    NOT NULL                   COMMENT '关联表名',
+    `join_alias`        varchar(32)     NOT NULL                   COMMENT '关联表别名',
+    `join_condition`    varchar(512)    NOT NULL                   COMMENT '关联条件(如: t.area_code = a.area_code)',
+    `is_auto_join`      tinyint(1)      DEFAULT 1                  COMMENT '是否自动关联(使用相关字段时自动JOIN)',
+    `sort_order`        int             DEFAULT 0                  COMMENT '排序号',
+    `status`            tinyint(1)      DEFAULT 1                  COMMENT '状态',
+    `remark`            varchar(512)    DEFAULT NULL               COMMENT '备注',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_ds_relation` (`ds_code`, `relation_code`),
+    KEY `idx_ds_code` (`ds_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-关联关系配置表';
+
+
+-- ============================================================================
+-- 报表关联字段映射表 - 定义哪些字段需要哪个关联
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_field_relation`;
+CREATE TABLE `adm_report_field_relation` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码',
+    `field_code`        varchar(64)     NOT NULL                   COMMENT '字段编码',
+    `relation_code`     varchar(64)     NOT NULL                   COMMENT '关联编码',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_field_relation` (`ds_code`, `field_code`, `relation_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-字段关联映射表';
+
+
+-- ============================================================================
+-- 报表用户报表模板表 - 保存用户自定义的报表配置
+-- ============================================================================
+DROP TABLE IF EXISTS `adm_report_template`;
+CREATE TABLE `adm_report_template` (
+    `id`                bigint(20)      NOT NULL AUTO_INCREMENT    COMMENT '主键ID',
+    `template_code`     varchar(64)     NOT NULL                   COMMENT '模板编码',
+    `template_name`     varchar(128)    NOT NULL                   COMMENT '模板名称',
+    `template_desc`     varchar(512)    DEFAULT NULL               COMMENT '模板描述',
+    `ds_code`           varchar(64)     NOT NULL                   COMMENT '数据源编码',
+    `config_json`       text            NOT NULL                   COMMENT '配置JSON(包含字段、条件、排序等)',
+    `is_public`         tinyint(1)      DEFAULT 0                  COMMENT '是否公开(0-私有,1-公开)',
+    `is_system`         tinyint(1)      DEFAULT 0                  COMMENT '是否系统模板(0-否,1-是)',
+    `use_count`         int             DEFAULT 0                  COMMENT '使用次数',
+    `user_id`           bigint(20)      DEFAULT NULL               COMMENT '用户ID',
+    `user_name`         varchar(64)     DEFAULT NULL               COMMENT '用户名',
+    `dept_id`           bigint(20)      DEFAULT NULL               COMMENT '部门ID',
+    `status`            tinyint(1)      DEFAULT 1                  COMMENT '状态',
+    `create_by`         varchar(64)     DEFAULT NULL               COMMENT '创建者',
+    `create_time`       datetime        DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
+    `update_by`         varchar(64)     DEFAULT NULL               COMMENT '更新者',
+    `update_time`       datetime        DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_template_code` (`template_code`),
+    KEY `idx_ds_code` (`ds_code`),
+    KEY `idx_user_id` (`user_id`),
+    KEY `idx_is_public` (`is_public`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自定义报表-用户模板表';

+ 6 - 6
ems/sql/ems_sys_data.sql

@@ -84,16 +84,16 @@ insert into sys_menu values ('1170',  '策略中心',       '117',   '1',  'stra
 insert into sys_menu values ('1171',  '策略模板',       '117',   '2',  'strategy-template',  'mgr/strategy/template',    '', 1, 0, 'C', '0', '0',   'power-mgr:strategy:list',     'system',        'admin', sysdate(), '', null, '策略模板');
 insert into sys_menu values ('1172',  '策略日志',       '117',   '3',  'strategy-log',       'mgr/strategy/log',          '', 1, 0, 'C', '0', '0',   'power-mgr:strategy:list',     'system',        'admin', sysdate(), '', null, '策略日志');
 
-insert into sys_menu values ('1550',  '楼控能耗',       '155',   '1',  'adapter-nhjc',       'adapter/nhjc/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',       'admin', sysdate(), '', null, '能耗监测');
-insert into sys_menu values ('1551',  '智慧照明',       '155',   '2',  'adapter-zm',         'adapter/zm/index',      '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',        'admin', sysdate(), '', null, '智慧照明');
-insert into sys_menu values ('1552',  '电力监控',       '155',   '3',  'adapter-dljk',       'adapter/dljk/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',        'admin', sysdate(), '', null, '智慧照明');
-insert into sys_menu values ('1553',  '光伏',          '155',   '4',  'adapter-pv',         'adapter/pv/index',      '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'photovoltaic',   'admin', sysdate(), '', null, '光伏');
-insert into sys_menu values ('1554',  '充电桩',         '155',   '5',  'adapter-cdz',        'adapter/cdz/index',     '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'powerstore',    'admin', sysdate(), '', null, '充电桩');
+insert into sys_menu values ('1550',  '设备管理',       '155',   '1',  'adapter-devc',       'adapter/devc/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',      'system',        'admin', sysdate(), '', null, '设备管理');
+insert into sys_menu values ('1551',  '能耗监测',       '155',   '2',  'adapter-nhjc',       'adapter/nhjc/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',       'admin', sysdate(), '', null, '能耗监测');
+insert into sys_menu values ('1552',  '智慧照明',       '155',   '3',  'adapter-zm',         'adapter/zm/index',      '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',        'admin', sysdate(), '', null, '智慧照明');
+insert into sys_menu values ('1553',  '充电桩',         '155',   '4',  'adapter-cdz',        'adapter/cdz/index',     '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'powerstore',    'admin', sysdate(), '', null, '充电桩');
+insert into sys_menu values ('1554',  '光伏监测',       '155',   '5',  'adapter-pv',         'adapter/pv/index',      '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'photovoltaic',   'admin', sysdate(), '', null, '光伏');
 insert into sys_menu values ('1555',  '光储直柔',       '155',   '6',  'adapter-gczr',       'adapter/gczr/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'deviceaccess',  'admin', sysdate(), '', null, '光储直柔');
 insert into sys_menu values ('1556',  '光储充',         '155',   '7',  'adapter-gcc',        'adapter/gcc/index',     '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'energyconsume', 'admin', sysdate(), '', null, '光储充');
 insert into sys_menu values ('1557',  '智慧海绵',       '155',   '8',  'adapter-hm',         'adapter/hm/index',      '', 1, 0, 'C', '0', '0',   'adapter:devc:list',      'system',        'admin', sysdate(), '', null, '智慧海绵');
 insert into sys_menu values ('1558',  '垃圾厨余',       '155',   '9',  'adapter-ljcy',       'adapter/ljcy/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',      'system',        'admin', sysdate(), '', null, '垃圾厨余');
-
+insert into sys_menu values ('1559',  '电力监控',       '155',   '10',  'adapter-dljk',      'adapter/dljk/index',    '', 1, 0, 'C', '0', '0',   'adapter:devc:list',     'system',        'admin', sysdate(), '', null, '电力监控');
 
 insert into sys_menu values ('997',  '表单构建',       '99',   '1',  'build',              'tool/build/index',       '', 1, 0, 'C', '0', '0',   'tool:build:list',        'build',          'admin', sysdate(), '', null, '表单构建菜单');
 insert into sys_menu values ('998',  '代码生成',       '99',   '2',  'gen',                'tool/gen/index',         '', 1, 0, 'C', '0', '0',   'tool:gen:list',          'code',           'admin', sysdate(), '', null, '代码生成菜单');