فهرست منبع

用能预测1

learshaw 1 ماه پیش
والد
کامیت
b8992451c7

+ 107 - 0
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/ElecConsumeForecastController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.web.controller.ems;
+
+import com.huashe.common.domain.AjaxResult;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.ems.domain.ElecConsumeForecast;
+import com.ruoyi.ems.service.IElecConsumeForecastService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+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-12
+ */
+@RestController
+@RequestMapping("/ems/forecastConsume")
+@Api(value = "ElecExpendForecastController", description = "电力消耗预测数据访问接口")
+public class ElecConsumeForecastController extends BaseController
+{
+    @Autowired
+    private IElecConsumeForecastService elecExpendForecastService;
+
+    /**
+     * 查询电力消耗预测列表
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(ElecConsumeForecast forecast)
+    {
+        startPage();
+        List<ElecConsumeForecast> list = elecExpendForecastService.selectForecastList(forecast);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出电力消耗预测列表
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:export')")
+    @Log(title = "电力消耗预测", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ElecConsumeForecast forecast)
+    {
+        List<ElecConsumeForecast> list = elecExpendForecastService.selectForecastList(forecast);
+        ExcelUtil<ElecConsumeForecast> util = new ExcelUtil<ElecConsumeForecast>(ElecConsumeForecast.class);
+        util.exportExcel(response, list, "电力消耗预测数据");
+    }
+
+    /**
+     * 获取电力消耗预测详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(elecExpendForecastService.selectForecastById(id));
+    }
+
+    /**
+     * 新增电力消耗预测
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:add')")
+    @Log(title = "电力消耗预测", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ElecConsumeForecast forecast)
+    {
+        return toAjax(elecExpendForecastService.insertForecast(forecast));
+    }
+
+    /**
+     * 修改电力消耗预测
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:edit')")
+    @Log(title = "电力消耗预测", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ElecConsumeForecast forecast)
+    {
+        return toAjax(elecExpendForecastService.updateForecast(forecast));
+    }
+
+    /**
+     * 删除电力消耗预测
+     */
+    @PreAuthorize("@ss.hasPermi('prediction:consume:remove')")
+    @Log(title = "电力消耗预测", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(elecExpendForecastService.deleteForecastByIds(ids));
+    }
+}

+ 105 - 0
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecConsumeForecastController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.ems.controller;
+
+import com.huashe.common.domain.AjaxResult;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+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.ElecConsumeForecast;
+import com.ruoyi.ems.service.IElecConsumeForecastService;
+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-12
+ */
+@RestController
+@RequestMapping("/forecastConsume")
+@Api(value = "ElecExpendForecastController", description = "电力消耗预测数据访问接口")
+public class ElecConsumeForecastController extends BaseController {
+    @Autowired
+    private IElecConsumeForecastService forecastService;
+
+    /**
+     * 查询电力消耗预测列表
+     */
+    @RequiresPermissions("prediction:consume:list")
+    @GetMapping("/list")
+    public TableDataInfo list(ElecConsumeForecast forecast) {
+        startPage();
+        List<ElecConsumeForecast> list = forecastService.selectForecastList(forecast);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出电力消耗预测列表
+     */
+    @RequiresPermissions("prediction:consume:export")
+    @Log(title = "电力消耗预测", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ElecConsumeForecast elecExpendForecast) {
+        List<ElecConsumeForecast> list = forecastService.selectForecastList(elecExpendForecast);
+        ExcelUtil<ElecConsumeForecast> util = new ExcelUtil<ElecConsumeForecast>(ElecConsumeForecast.class);
+        util.exportExcel(response, list, "电力消耗预测数据");
+    }
+
+    /**
+     * 获取电力消耗预测详细信息
+     */
+    @RequiresPermissions("prediction:consume:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(forecastService.selectForecastById(id));
+    }
+
+    /**
+     * 新增电力消耗预测
+     */
+    @RequiresPermissions("prediction:consume:add")
+    @Log(title = "电力消耗预测", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ElecConsumeForecast elecExpendForecast) {
+        return toAjax(forecastService.insertForecast(elecExpendForecast));
+    }
+
+    /**
+     * 修改电力消耗预测
+     */
+    @RequiresPermissions("prediction:consume:edit")
+    @Log(title = "电力消耗预测", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ElecConsumeForecast elecExpendForecast) {
+        return toAjax(forecastService.updateForecast(elecExpendForecast));
+    }
+
+    /**
+     * 删除电力消耗预测
+     */
+    @RequiresPermissions("prediction:consume:remove")
+    @Log(title = "电力消耗预测", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(forecastService.deleteForecastByIds(ids));
+    }
+
+    @GetMapping(value = "/cal/dateRange")
+    public AjaxResult calcElecExpendForecastDateRange(ElecConsumeForecast param) {
+        return success(forecastService.calcForecastDateRange(param));
+    }
+}

+ 9 - 0
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/task/TaskService.java

@@ -280,4 +280,13 @@ public class TaskService {
             log.error("pv forecast fail!", e);
         }
     }
+
+    /**
+     * 用电预测
+     */
+    @Async
+    @Scheduled(cron = "${analysis-task.pv-forecast.cron}")
+    public void elecConsumeForecastTask() {
+
+    }
 }

+ 3 - 0
ems/ems-cloud/ems-server/src/main/resources/application-local.yml

@@ -66,6 +66,9 @@ analysis-task:
     area-codes: 321283124S3001,321283124S3002,321283124S3003
     forecastDays: 5
     cron: 0 30 8 * * ?
+  elec-consume:
+    cron: 0 0 3 * * ?
+    obj-areaCodes: 321283124S3001,321283124S3002
 
 # mybatis配置
 mybatis:

+ 74 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecConsumeForecast.java

@@ -0,0 +1,74 @@
+package com.ruoyi.ems.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huashe.common.annotation.Excel;
+import com.huashe.common.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 电力消耗预测对象 adm_ems_elec_expend_forecast
+ *
+ * @author ruoyi
+ * @date 2024-08-12
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ElecConsumeForecast extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 序号
+     */
+    private Long id;
+
+    /**
+     * 园区代码
+     */
+    @Excel(name = "园区代码")
+    private String areaCode;
+
+    /**
+     * 对象代码
+     */
+    @Excel(name = "对象代码")
+    private String objCode;
+
+    private String objName;
+
+    /**
+     * 对象类型
+     */
+    @Excel(name = "对象类型")
+    private Integer objType;
+
+    /**
+     * 日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date date;
+
+    /**
+     * 功率 (千瓦)
+     */
+    @Excel(name = "功率 ")
+    private Double elecUseQuantity;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("areaCode", getAreaCode())
+                .append("objCode", getObjCode())
+                .append("objType", getObjType())
+                .append("date", getDate())
+                .append("elecUseQuantity", getElecUseQuantity())
+                .toString();
+    }
+}

+ 63 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecConsumeForecastMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.ems.mapper;
+
+import com.ruoyi.ems.domain.ElecConsumeForecast;
+
+import java.util.List;
+
+/**
+ * 电力消耗预测Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-08-12
+ */
+public interface ElecConsumeForecastMapper {
+    /**
+     * 查询电力消耗预测
+     *
+     * @param id 电力消耗预测主键
+     * @return 电力消耗预测
+     */
+    ElecConsumeForecast selectForecastById(Long id);
+
+    /**
+     * 查询电力消耗预测列表
+     *
+     * @param forecast 电力消耗预测
+     * @return 电力消耗预测集合
+     */
+    List<ElecConsumeForecast> selectForecastList(ElecConsumeForecast forecast);
+
+    /**
+     * 新增电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    int insertForecast(ElecConsumeForecast forecast);
+
+    /**
+     * 修改电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    int updateForecast(ElecConsumeForecast forecast);
+
+    /**
+     * 删除电力消耗预测
+     *
+     * @param id 电力消耗预测主键
+     * @return 结果
+     */
+    int deleteForecastById(Long id);
+
+    /**
+     * 批量删除电力消耗预测
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteForecastByIds(Long[] ids);
+
+    List<ElecConsumeForecast> calcForecastDateRange(ElecConsumeForecast forecast);
+}

+ 63 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecConsumeForecastService.java

@@ -0,0 +1,63 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.ElecConsumeForecast;
+
+import java.util.List;
+
+/**
+ * 电力消耗预测Service接口
+ *
+ * @author ruoyi
+ * @date 2024-08-12
+ */
+public interface IElecConsumeForecastService {
+    /**
+     * 查询电力消耗预测
+     *
+     * @param id 电力消耗预测主键
+     * @return 电力消耗预测
+     */
+    ElecConsumeForecast selectForecastById(Long id);
+
+    /**
+     * 查询电力消耗预测列表
+     *
+     * @param forecast 电力消耗预测
+     * @return 电力消耗预测集合
+     */
+    List<ElecConsumeForecast> selectForecastList(ElecConsumeForecast forecast);
+
+    /**
+     * 新增电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    int insertForecast(ElecConsumeForecast forecast);
+
+    /**
+     * 修改电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    int updateForecast(ElecConsumeForecast forecast);
+
+    /**
+     * 批量删除电力消耗预测
+     *
+     * @param ids 需要删除的电力消耗预测主键集合
+     * @return 结果
+     */
+    int deleteForecastByIds(Long[] ids);
+
+    /**
+     * 删除电力消耗预测信息
+     *
+     * @param id 电力消耗预测主键
+     * @return 结果
+     */
+    int deleteForecastById(Long id);
+
+    List<ElecConsumeForecast> calcForecastDateRange(ElecConsumeForecast forecast);
+}

+ 92 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecConsumeForecastServiceImpl.java

@@ -0,0 +1,92 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.ElecConsumeForecast;
+import com.ruoyi.ems.mapper.ElecConsumeForecastMapper;
+import com.ruoyi.ems.service.IElecConsumeForecastService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 电力消耗预测Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-08-12
+ */
+@Service
+public class ElecConsumeForecastServiceImpl implements IElecConsumeForecastService {
+    @Autowired
+    private ElecConsumeForecastMapper forecastMapper;
+
+    /**
+     * 查询电力消耗预测
+     *
+     * @param id 电力消耗预测主键
+     * @return 电力消耗预测
+     */
+    @Override
+    public ElecConsumeForecast selectForecastById(Long id) {
+        return forecastMapper.selectForecastById(id);
+    }
+
+    /**
+     * 查询电力消耗预测列表
+     *
+     * @param forecast 电力消耗预测
+     * @return 电力消耗预测
+     */
+    @Override
+    public List<ElecConsumeForecast> selectForecastList(ElecConsumeForecast forecast) {
+        return forecastMapper.selectForecastList(forecast);
+    }
+
+    /**
+     * 新增电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    @Override
+    public int insertForecast(ElecConsumeForecast forecast) {
+        return forecastMapper.insertForecast(forecast);
+    }
+
+    /**
+     * 修改电力消耗预测
+     *
+     * @param forecast 电力消耗预测
+     * @return 结果
+     */
+    @Override
+    public int updateForecast(ElecConsumeForecast forecast) {
+        return forecastMapper.updateForecast(forecast);
+    }
+
+    /**
+     * 批量删除电力消耗预测
+     *
+     * @param ids 需要删除的电力消耗预测主键
+     * @return 结果
+     */
+    @Override
+    public int deleteForecastByIds(Long[] ids) {
+        return forecastMapper.deleteForecastByIds(ids);
+    }
+
+    /**
+     * 删除电力消耗预测信息
+     *
+     * @param id 电力消耗预测主键
+     * @return 结果
+     */
+    @Override
+    public int deleteForecastById(Long id) {
+        return forecastMapper.deleteForecastById(id);
+    }
+
+    @Override
+    public List<ElecConsumeForecast> calcForecastDateRange(ElecConsumeForecast forecast) {
+        return forecastMapper.calcForecastDateRange(forecast);
+    }
+}

+ 0 - 92
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecExpendForecastServiceImpl.java

@@ -1,92 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.ElecExpendForecast;
-import com.ruoyi.ems.mapper.ElecExpendForecastMapper;
-import com.ruoyi.ems.service.IElecExpendForecastService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 电力消耗预测Service业务层处理
- *
- * @author ruoyi
- * @date 2024-08-12
- */
-@Service
-public class ElecExpendForecastServiceImpl implements IElecExpendForecastService {
-    @Autowired
-    private ElecExpendForecastMapper emsElecExpendForecastMapper;
-
-    /**
-     * 查询电力消耗预测
-     *
-     * @param id 电力消耗预测主键
-     * @return 电力消耗预测
-     */
-    @Override
-    public ElecExpendForecast selectElecExpendForecastById(Long id) {
-        return emsElecExpendForecastMapper.selectElecExpendForecastById(id);
-    }
-
-    /**
-     * 查询电力消耗预测列表
-     *
-     * @param admEmsElecExpendForecast 电力消耗预测
-     * @return 电力消耗预测
-     */
-    @Override
-    public List<ElecExpendForecast> selectElecExpendForecastList(ElecExpendForecast admEmsElecExpendForecast) {
-        return emsElecExpendForecastMapper.selectElecExpendForecastList(admEmsElecExpendForecast);
-    }
-
-    /**
-     * 新增电力消耗预测
-     *
-     * @param admEmsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    @Override
-    public int insertElecExpendForecast(ElecExpendForecast admEmsElecExpendForecast) {
-        return emsElecExpendForecastMapper.insertElecExpendForecast(admEmsElecExpendForecast);
-    }
-
-    /**
-     * 修改电力消耗预测
-     *
-     * @param admEmsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    @Override
-    public int updateElecExpendForecast(ElecExpendForecast admEmsElecExpendForecast) {
-        return emsElecExpendForecastMapper.updateElecExpendForecast(admEmsElecExpendForecast);
-    }
-
-    /**
-     * 批量删除电力消耗预测
-     *
-     * @param ids 需要删除的电力消耗预测主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElecExpendForecastByIds(Long[] ids) {
-        return emsElecExpendForecastMapper.deleteElecExpendForecastByIds(ids);
-    }
-
-    /**
-     * 删除电力消耗预测信息
-     *
-     * @param id 电力消耗预测主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElecExpendForecastById(Long id) {
-        return emsElecExpendForecastMapper.deleteElecExpendForecastById(id);
-    }
-
-    @Override
-    public List<ElecExpendForecast> calcElecExpendForecastDateRange(ElecExpendForecast admEmsElecExpendForecast) {
-        return emsElecExpendForecastMapper.calcElecExpendForecastDateRange(admEmsElecExpendForecast);
-    }
-}

+ 103 - 0
ems/ems-core/src/main/resources/mapper/ems/ElecConsumeForecastMapper.xml

@@ -0,0 +1,103 @@
+<?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.ElecConsumeForecastMapper">
+
+    <resultMap type="com.ruoyi.ems.domain.ElecConsumeForecast" id="ElecConsumeForecastResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="objCode"    column="obj_code"    />
+        <result property="objType"    column="obj_type"    />
+        <result property="date"    column="date"    />
+        <result property="elecUseQuantity"    column="elec_use_quantity"    />
+    </resultMap>
+
+    <sql id="selectForecastVo">
+        select id, area_code, obj_code, obj_type, date, elec_use_quantity from adm_ems_elec_consume_forecast
+    </sql>
+
+    <select id="selectForecastList" parameterType="com.ruoyi.ems.domain.ElecConsumeForecast" resultMap="ElecConsumeForecastResult">
+        select
+        f.id,
+        f.area_code,
+        f.obj_code,
+        f.obj_type,
+        date,
+        elec_use_quantity,
+        COALESCE(a.area_name, fc.facs_name, d.device_name) AS obj_name
+        FROM
+        adm_ems_elec_consume_forecast f
+          LEFT JOIN adm_area a ON f.obj_code = a.area_code AND f.obj_type = 1
+          LEFT JOIN adm_ems_facs fc ON f.obj_code = fc.facs_code AND f.obj_type = 2
+          LEFT JOIN adm_ems_device d ON f.obj_code = d.device_code AND f.obj_type = 3
+        <where>
+            <if test="areaCode != null  and areaCode != ''">and f.area_code = #{areaCode}</if>
+            <if test="objCode != null  and objCode != ''">and f.obj_code = #{objCode}</if>
+            <if test="objType != null ">and f.obj_type = #{objType}</if>
+            <if test="startRecTime != null and startRecTime != ''">and f.date &gt;= #{startRecTime}</if>
+            <if test="endRecTime != null and endRecTime != ''">and DATE &lt;=#{endRecTime}</if>
+        </where>
+    </select>
+
+    <select id="selectForecastById" parameterType="Long" resultMap="ElecConsumeForecastResult">
+        <include refid="selectForecastVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertForecast" parameterType="com.ruoyi.ems.domain.ElecConsumeForecast" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_ems_elec_expend_forecast
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="objCode != null and objCode != ''">obj_code,</if>
+            <if test="objType != null">obj_type,</if>
+            <if test="date != null">date,</if>
+            <if test="elecUseQuantity != null">elec_use_quantity,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="objCode != null and objCode != ''">#{objCode},</if>
+            <if test="objType != null">#{objType},</if>
+            <if test="date != null">#{date},</if>
+            <if test="elecUseQuantity != null">#{elecUseQuantity},</if>
+         </trim>
+    </insert>
+
+    <update id="updateForecast" parameterType="com.ruoyi.ems.domain.ElecConsumeForecast">
+        update adm_ems_elec_expend_forecast
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="objCode != null and objCode != ''">obj_code = #{objCode},</if>
+            <if test="objType != null">obj_type = #{objType},</if>
+            <if test="date != null">date = #{date},</if>
+            <if test="elecUseQuantity != null">elec_use_quantity = #{elecUseQuantity},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteForecastById" parameterType="Long">
+        delete from adm_ems_elec_consume_forecast where id = #{id}
+    </delete>
+
+    <delete id="deleteForecastByIds" parameterType="String">
+        delete from adm_ems_elec_consume_forecast where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <select id="calcForecastDateRange" parameterType="ElecConsumeForecast" resultMap="ElecConsumeForecastResult">
+        select sum(
+        COALESCE(CAST(elec_use_quantity AS DECIMAL(10, 2)), 0)) elec_use_quantity,
+        `date`
+        from adm_ems_elec_consume_forecast d
+        <where>
+            obj_type = 1
+            <if test="startRecTime != null and startRecTime != ''">and DATE >=#{startRecTime}</if>
+            <if test="endRecTime != null and endRecTime != ''">and DATE <![CDATA[ <= ]]>#{endRecTime}</if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
+                and obj_code = #{areaCode}
+            </if>
+        </where>
+        group by `date`
+    </select>
+</mapper>

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

@@ -210,8 +210,8 @@
         DATE_FORMAT(date, '%Y-%m') AS startRecTime
         FROM adm_ems_pv_supply_h pv
         <where>
-            <if test="startRecTime != null and startRecTime != ''">and DATE >=#{startRecTime}</if>
-            <if test="endRecTime != null and endRecTime != ''">and DATE <![CDATA[ <= ]]>#{endRecTime}</if>
+            <if test="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>

+ 54 - 0
ems/sql/ems_init_data.sql

@@ -771,6 +771,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202501', 2570, '2024-12-31', 2815, '2025-01-31', 245, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202502', 2815, '2025-01-31', 3123, '2025-02-28', 308, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202503', 3123, '2025-02-28', 3441, '2025-03-31', 318, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202504', 3441, '2025-03-31', 3853, '2025-04-30', 412, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202505', 3853, '2025-04-30', 4211, '2025-05-31', 358, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202506', 4211, '2025-05-31', 4605, '2025-06-30', 394, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202507', 4605, '2025-06-30', 5016, '2025-07-31', 411, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202402', 100, '2024-01-31', 238, '2024-02-28', 138, NULL, NULL);
@@ -787,6 +791,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202501', 2620, '2024-12-31', 2877, '2025-01-31', 257, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202502', 2877, '2025-01-31', 3111, '2025-02-28', 234, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202503', 3111, '2025-02-28', 3254, '2025-03-31', 143, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202504', 3254, '2025-03-31', 3452, '2025-04-30', 198, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202505', 3452, '2025-04-30', 3666, '2025-05-31', 214, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '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-D-B-102', '321283124S3001', '2025', '202507', 3915, '2025-06-30', 4182, '2025-07-31', 267, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202402', 100, '2024-01-31', 250, '2024-02-28', 150, NULL, NULL);
@@ -803,6 +812,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202501', 1690, '2024-12-31', 1928, '2025-01-31', 238, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202502', 1928, '2025-01-31', 2247, '2025-02-28', 319, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202503', 2247, '2025-02-28', 2630, '2025-03-31', 383, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202504', 2630, '2025-03-31', 2971, '2025-04-30', 341, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202505', 2971, '2025-04-30', 3354, '2025-05-31', 383, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202506', 3354, '2025-05-31', 3728, '2025-06-30', 374, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202507', 3728, '2025-06-30', 4118, '2025-07-31', 390, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -819,6 +833,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202501', 1200, '2024-11-30', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -835,6 +854,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -851,6 +875,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202504', 1500, '2025-02-28', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -868,6 +896,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
+
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -885,6 +918,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -902,6 +939,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -919,6 +960,11 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202504', 1500, '2025-03-31', 1600, '2025-04-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202505', 1600, '2025-04-30', 1700, '2025-05-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202506', 1700, '2025-05-31', 1800, '2025-06-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202507', 1800, '2025-06-30', 1900, '2025-07-31', 100, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202401', 0, '2024-12-31', 1000, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202402', 1000, '2024-01-31', 2120, '2024-02-28', 1120, NULL, NULL);
@@ -935,6 +981,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202501', 14720, '2024-12-31', 16720, '2025-01-31', 1200, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202502', 16720, '2025-01-31', 18820, '2025-02-28', 2100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202503', 18820, '2025-02-28', 19900, '2025-03-31', 1080, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202504', 19900, '2025-03-31', 21325, '2025-04-30', 1425, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202505', 21325, '2025-04-30', 22536, '2025-05-31', 1211, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202506', 22536, '2025-05-31', 24286, '2025-06-30', 1750, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202507', 24286, '2025-06-30', 25790, '2025-07-31', 1504, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202401', 0, '2023-12-31', 25, '2024-01-31', 1250, NULL, NULL);
@@ -952,6 +1002,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202501', 1237, '2024-12-31', 1547, '2025-01-31', 15500, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202502', 1547, '2025-01-31', 1823, '2025-02-28', 13800, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202503', 1823, '2025-02-28', 2074, '2025-03-31', 12550, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202504', 2074, '2025-03-31', 2322, '2025-04-30', 12400, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202505', 2322, '2025-04-30', 2741, '2025-05-31', 20950, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202506', 2741, '2025-05-31', 3000, '2025-06-30', 12950, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202507', 3000, '2025-06-30', 3200, '2025-07-31', 10000, NULL, NULL);
 
 
 -- 台账数据

+ 3 - 3
ems/sql/ems_server.sql

@@ -1499,14 +1499,14 @@ create table adm_ems_elec_prod_forecast (
 -- ----------------------------
 -- 电力消耗预测表
 -- ----------------------------
-drop table if exists adm_ems_elec_expend_forecast;
-create table adm_ems_elec_expend_forecast (
+drop table if exists adm_ems_elec_consume_forecast;
+create table adm_ems_elec_consume_forecast (
   `id`                        bigint(20)      not null auto_increment      comment '序号',
   `area_code`                 varchar(32)     not null                     comment '园区代码',
   `obj_code`                  varchar(32)     not null                     comment '对象代码',
   `obj_type`                  int             not null                     comment '1-建筑 2-设施 3-设备',
   `date`                      date            not null                     comment '日期 yyyy-MM-dd',
-  `elec_use_quantity`         double          default null                 comment '功率 单位:kW(千瓦)',
+  `elec_use_quantity`         double          default null                 comment '用电量 (kW·h)',
   primary key (`id`),
   unique key ux_ems_elec_expend_forecast(`obj_code`, `date`)
 ) engine=innodb auto_increment=1 comment = '电力消耗预测表';