Prechádzať zdrojové kódy

用能预测改造2

learshaw 1 mesiac pred
rodič
commit
32c21099df

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

@@ -1,107 +0,0 @@
-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.ElecExpendForecast;
-import com.ruoyi.ems.service.IElecExpendForecastService;
-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 ElecExpendForecastController extends BaseController
-{
-    @Autowired
-    private IElecExpendForecastService elecExpendForecastService;
-
-    /**
-     * 查询电力消耗预测列表
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(ElecExpendForecast elecExpendForecast)
-    {
-        startPage();
-        List<ElecExpendForecast> list = elecExpendForecastService.selectElecExpendForecastList(elecExpendForecast);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出电力消耗预测列表
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:export')")
-    @Log(title = "电力消耗预测", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, ElecExpendForecast elecExpendForecast)
-    {
-        List<ElecExpendForecast> list = elecExpendForecastService.selectElecExpendForecastList(elecExpendForecast);
-        ExcelUtil<ElecExpendForecast> util = new ExcelUtil<ElecExpendForecast>(ElecExpendForecast.class);
-        util.exportExcel(response, list, "电力消耗预测数据");
-    }
-
-    /**
-     * 获取电力消耗预测详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(elecExpendForecastService.selectElecExpendForecastById(id));
-    }
-
-    /**
-     * 新增电力消耗预测
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:add')")
-    @Log(title = "电力消耗预测", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody ElecExpendForecast elecExpendForecast)
-    {
-        return toAjax(elecExpendForecastService.insertElecExpendForecast(elecExpendForecast));
-    }
-
-    /**
-     * 修改电力消耗预测
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:edit')")
-    @Log(title = "电力消耗预测", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody ElecExpendForecast elecExpendForecast)
-    {
-        return toAjax(elecExpendForecastService.updateElecExpendForecast(elecExpendForecast));
-    }
-
-    /**
-     * 删除电力消耗预测
-     */
-    @PreAuthorize("@ss.hasPermi('prediction:consume:remove')")
-    @Log(title = "电力消耗预测", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(elecExpendForecastService.deleteElecExpendForecastByIds(ids));
-    }
-}

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

@@ -1,105 +0,0 @@
-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.ElecExpendForecast;
-import com.ruoyi.ems.service.IElecExpendForecastService;
-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 ElecExpendForecastController extends BaseController {
-    @Autowired
-    private IElecExpendForecastService elecExpendForecastService;
-
-    /**
-     * 查询电力消耗预测列表
-     */
-    @RequiresPermissions("prediction:consume:list")
-    @GetMapping("/list")
-    public TableDataInfo list(ElecExpendForecast elecExpendForecast) {
-        startPage();
-        List<ElecExpendForecast> list = elecExpendForecastService.selectElecExpendForecastList(elecExpendForecast);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出电力消耗预测列表
-     */
-    @RequiresPermissions("prediction:consume:export")
-    @Log(title = "电力消耗预测", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, ElecExpendForecast elecExpendForecast) {
-        List<ElecExpendForecast> list = elecExpendForecastService.selectElecExpendForecastList(elecExpendForecast);
-        ExcelUtil<ElecExpendForecast> util = new ExcelUtil<ElecExpendForecast>(ElecExpendForecast.class);
-        util.exportExcel(response, list, "电力消耗预测数据");
-    }
-
-    /**
-     * 获取电力消耗预测详细信息
-     */
-    @RequiresPermissions("prediction:consume:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(elecExpendForecastService.selectElecExpendForecastById(id));
-    }
-
-    /**
-     * 新增电力消耗预测
-     */
-    @RequiresPermissions("prediction:consume:add")
-    @Log(title = "电力消耗预测", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody ElecExpendForecast elecExpendForecast) {
-        return toAjax(elecExpendForecastService.insertElecExpendForecast(elecExpendForecast));
-    }
-
-    /**
-     * 修改电力消耗预测
-     */
-    @RequiresPermissions("prediction:consume:edit")
-    @Log(title = "电力消耗预测", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody ElecExpendForecast elecExpendForecast) {
-        return toAjax(elecExpendForecastService.updateElecExpendForecast(elecExpendForecast));
-    }
-
-    /**
-     * 删除电力消耗预测
-     */
-    @RequiresPermissions("prediction:consume:remove")
-    @Log(title = "电力消耗预测", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(elecExpendForecastService.deleteElecExpendForecastByIds(ids));
-    }
-
-    @GetMapping(value = "/cal/dateRange")
-    public AjaxResult calcElecExpendForecastDateRange(ElecExpendForecast param) {
-        return success(elecExpendForecastService.calcElecExpendForecastDateRange(param));
-    }
-}

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

@@ -1,74 +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 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 ElecExpendForecast 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();
-    }
-}

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

@@ -1,63 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import com.ruoyi.ems.domain.ElecExpendForecast;
-
-import java.util.List;
-
-/**
- * 电力消耗预测Mapper接口
- *
- * @author ruoyi
- * @date 2024-08-12
- */
-public interface ElecExpendForecastMapper {
-    /**
-     * 查询电力消耗预测
-     *
-     * @param id 电力消耗预测主键
-     * @return 电力消耗预测
-     */
-    ElecExpendForecast selectElecExpendForecastById(Long id);
-
-    /**
-     * 查询电力消耗预测列表
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 电力消耗预测集合
-     */
-    List<ElecExpendForecast> selectElecExpendForecastList(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 新增电力消耗预测
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    int insertElecExpendForecast(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 修改电力消耗预测
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    int updateElecExpendForecast(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 删除电力消耗预测
-     *
-     * @param id 电力消耗预测主键
-     * @return 结果
-     */
-    int deleteElecExpendForecastById(Long id);
-
-    /**
-     * 批量删除电力消耗预测
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteElecExpendForecastByIds(Long[] ids);
-
-    List<ElecExpendForecast> calcElecExpendForecastDateRange(ElecExpendForecast emsElecExpendForecast);
-}

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

@@ -1,63 +0,0 @@
-package com.ruoyi.ems.service;
-
-import com.ruoyi.ems.domain.ElecExpendForecast;
-
-import java.util.List;
-
-/**
- * 电力消耗预测Service接口
- *
- * @author ruoyi
- * @date 2024-08-12
- */
-public interface IElecExpendForecastService {
-    /**
-     * 查询电力消耗预测
-     *
-     * @param id 电力消耗预测主键
-     * @return 电力消耗预测
-     */
-    ElecExpendForecast selectElecExpendForecastById(Long id);
-
-    /**
-     * 查询电力消耗预测列表
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 电力消耗预测集合
-     */
-    List<ElecExpendForecast> selectElecExpendForecastList(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 新增电力消耗预测
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    int insertElecExpendForecast(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 修改电力消耗预测
-     *
-     * @param emsElecExpendForecast 电力消耗预测
-     * @return 结果
-     */
-    int updateElecExpendForecast(ElecExpendForecast emsElecExpendForecast);
-
-    /**
-     * 批量删除电力消耗预测
-     *
-     * @param ids 需要删除的电力消耗预测主键集合
-     * @return 结果
-     */
-    int deleteElecExpendForecastByIds(Long[] ids);
-
-    /**
-     * 删除电力消耗预测信息
-     *
-     * @param id 电力消耗预测主键
-     * @return 结果
-     */
-    int deleteElecExpendForecastById(Long id);
-
-    List<ElecExpendForecast> calcElecExpendForecastDateRange(ElecExpendForecast admEmsElecExpendForecast);
-}

+ 0 - 112
ems/ems-core/src/main/resources/mapper/ems/ElecExpendForecastMapper.xml

@@ -1,112 +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.ElecExpendForecastMapper">
-
-    <resultMap type="com.ruoyi.ems.domain.ElecExpendForecast" id="ElecExpendForecastResult">
-        <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="selectElecExpendForecastVo">
-        select id, area_code, obj_code, obj_type, date, elec_use_quantity from adm_ems_elec_expend_forecast
-    </sql>
-
-    <select id="selectElecExpendForecastList" parameterType="com.ruoyi.ems.domain.ElecExpendForecast" resultMap="ElecExpendForecastResult">
-        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_expend_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="date != null ">and f.date = #{date}</if>
-            <if test="elecUseQuantity != null ">and elec_use_quantity = #{elecUseQuantity}</if>
-        </where>
-    </select>
-
-    <select id="selectElecExpendForecastById" parameterType="Long" resultMap="ElecExpendForecastResult">
-        <include refid="selectElecExpendForecastVo"/>
-        where id = #{id}
-    </select>
-
-    <insert id="insertElecExpendForecast" parameterType="com.ruoyi.ems.domain.ElecExpendForecast" 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="updateElecExpendForecast" parameterType="com.ruoyi.ems.domain.ElecExpendForecast">
-        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="deleteElecExpendForecastById" parameterType="Long">
-        delete from adm_ems_elec_expend_forecast where id = #{id}
-    </delete>
-
-    <delete id="deleteElecExpendForecastByIds" parameterType="String">
-        delete from adm_ems_elec_expend_forecast where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-    <select id="calcElecExpendForecastDateRange" parameterType="ElecExpendForecast" resultMap="ElecExpendForecastResult">
-        select sum(
-        COALESCE(CAST(elec_use_quantity AS DECIMAL(10, 2)), 0)) elec_use_quantity,
-        `date`
-        from adm_ems_elec_expend_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>