瀏覽代碼

+ 网储互动

chen.cheng 11 月之前
父節點
當前提交
3abafdd714

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

@@ -0,0 +1,105 @@
+package com.ruoyi.ems.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.ems.domain.AdmEmsElecStoreH;
+import com.ruoyi.ems.service.IAdmEmsElecStoreHService;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+
+/**
+ * 储能计量-小时Controller
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+@RestController
+@RequestMapping("/elecStoreH")
+public class AdmEmsElecStoreHController extends BaseController
+{
+    @Autowired
+    private IAdmEmsElecStoreHService admEmsElecStoreHService;
+
+    /**
+     * 查询储能计量-小时列表
+     */
+    @RequiresPermissions("ems:elecStoreH:list")
+    @GetMapping("/list")
+    public TableDataInfo list(AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        startPage();
+        List<AdmEmsElecStoreH> list = admEmsElecStoreHService.selectAdmEmsElecStoreHList(admEmsElecStoreH);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出储能计量-小时列表
+     */
+    @RequiresPermissions("ems:elecStoreH:export")
+    @Log(title = "储能计量-小时", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        List<AdmEmsElecStoreH> list = admEmsElecStoreHService.selectAdmEmsElecStoreHList(admEmsElecStoreH);
+        ExcelUtil<AdmEmsElecStoreH> util = new ExcelUtil<AdmEmsElecStoreH>(AdmEmsElecStoreH.class);
+        util.exportExcel(response, list, "储能计量-小时数据");
+    }
+
+    /**
+     * 获取储能计量-小时详细信息
+     */
+    @RequiresPermissions("ems:elecStoreH:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(admEmsElecStoreHService.selectAdmEmsElecStoreHById(id));
+    }
+
+    /**
+     * 新增储能计量-小时
+     */
+    @RequiresPermissions("ems:elecStoreH:add")
+    @Log(title = "储能计量-小时", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        return toAjax(admEmsElecStoreHService.insertAdmEmsElecStoreH(admEmsElecStoreH));
+    }
+
+    /**
+     * 修改储能计量-小时
+     */
+    @RequiresPermissions("ems:elecStoreH:edit")
+    @Log(title = "储能计量-小时", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        return toAjax(admEmsElecStoreHService.updateAdmEmsElecStoreH(admEmsElecStoreH));
+    }
+
+    /**
+     * 删除储能计量-小时
+     */
+    @RequiresPermissions("ems:elecStoreH:remove")
+    @Log(title = "储能计量-小时", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(admEmsElecStoreHService.deleteAdmEmsElecStoreHByIds(ids));
+    }
+}

+ 158 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AdmEmsElecStoreH.java

@@ -0,0 +1,158 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 储能计量-小时对象 adm_ems_elec_store_h
+ *
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public class AdmEmsElecStoreH extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 序号
+     */
+    private Long id;
+
+    /**
+     * 园区代码
+     */
+    @Excel(name = "园区代码")
+    private String areaCode;
+
+    @Excel(name = "园区名称")
+    private String areaName;
+
+    /**
+     * 设施代码
+     */
+    @Excel(name = "设施代码")
+    private String facsCode;
+
+    @Excel(name = "设施名称")
+    private String facsName;
+    /**
+     * 日期 yyyy-MM-dd
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "日期 yyyy-MM-dd", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date date;
+
+    /**
+     * 时间 HH:mm:ss
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "时间 HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date time;
+
+    /**
+     * 时间序列
+     */
+    private Integer timeIndex = 1;
+
+    /**
+     * 充电电量 (kW-h)
+     */
+    @Excel(name = "充电电量 ", readConverterExp = "k=W-h")
+    private Double chargeElecQuantity;
+
+    /**
+     * 放电电量(kW-h)
+     */
+    @Excel(name = "放电电量", readConverterExp = "k=W-h")
+    private Double dischargeElecQuantity;
+
+    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 setTimeIndex(Integer timeIndex) {
+        this.timeIndex = timeIndex;
+    }
+
+    public Integer getTimeIndex() {
+        return timeIndex;
+    }
+
+    public void setChargeElecQuantity(Double chargeElecQuantity) {
+        this.chargeElecQuantity = chargeElecQuantity;
+    }
+
+    public Double getChargeElecQuantity() {
+        return chargeElecQuantity;
+    }
+
+    public void setDischargeElecQuantity(Double dischargeElecQuantity) {
+        this.dischargeElecQuantity = dischargeElecQuantity;
+    }
+
+    public Double getDischargeElecQuantity() {
+        return dischargeElecQuantity;
+    }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public String getFacsName() {
+        return facsName;
+    }
+
+    public void setFacsName(String facsName) {
+        this.facsName = facsName;
+    }
+
+    @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("timeIndex", getTimeIndex()).append("chargeElecQuantity", getChargeElecQuantity()).append("dischargeElecQuantity", getDischargeElecQuantity()).toString();
+    }
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AdmEmsElecStoreHMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+import com.ruoyi.ems.domain.AdmEmsElecStoreH;
+
+/**
+ * 储能计量-小时Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public interface AdmEmsElecStoreHMapper 
+{
+    /**
+     * 查询储能计量-小时
+     * 
+     * @param id 储能计量-小时主键
+     * @return 储能计量-小时
+     */
+    public AdmEmsElecStoreH selectAdmEmsElecStoreHById(Long id);
+
+    /**
+     * 查询储能计量-小时列表
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 储能计量-小时集合
+     */
+    public List<AdmEmsElecStoreH> selectAdmEmsElecStoreHList(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 新增储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    public int insertAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 修改储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    public int updateAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 删除储能计量-小时
+     * 
+     * @param id 储能计量-小时主键
+     * @return 结果
+     */
+    public int deleteAdmEmsElecStoreHById(Long id);
+
+    /**
+     * 批量删除储能计量-小时
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAdmEmsElecStoreHByIds(Long[] ids);
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAdmEmsElecStoreHService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+import com.ruoyi.ems.domain.AdmEmsElecStoreH;
+
+/**
+ * 储能计量-小时Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public interface IAdmEmsElecStoreHService 
+{
+    /**
+     * 查询储能计量-小时
+     * 
+     * @param id 储能计量-小时主键
+     * @return 储能计量-小时
+     */
+    public AdmEmsElecStoreH selectAdmEmsElecStoreHById(Long id);
+
+    /**
+     * 查询储能计量-小时列表
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 储能计量-小时集合
+     */
+    public List<AdmEmsElecStoreH> selectAdmEmsElecStoreHList(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 新增储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    public int insertAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 修改储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    public int updateAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH);
+
+    /**
+     * 批量删除储能计量-小时
+     * 
+     * @param ids 需要删除的储能计量-小时主键集合
+     * @return 结果
+     */
+    public int deleteAdmEmsElecStoreHByIds(Long[] ids);
+
+    /**
+     * 删除储能计量-小时信息
+     * 
+     * @param id 储能计量-小时主键
+     * @return 结果
+     */
+    public int deleteAdmEmsElecStoreHById(Long id);
+}

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

@@ -0,0 +1,93 @@
+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.AdmEmsElecStoreHMapper;
+import com.ruoyi.ems.domain.AdmEmsElecStoreH;
+import com.ruoyi.ems.service.IAdmEmsElecStoreHService;
+
+/**
+ * 储能计量-小时Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+@Service
+public class AdmEmsElecStoreHServiceImpl implements IAdmEmsElecStoreHService 
+{
+    @Autowired
+    private AdmEmsElecStoreHMapper admEmsElecStoreHMapper;
+
+    /**
+     * 查询储能计量-小时
+     * 
+     * @param id 储能计量-小时主键
+     * @return 储能计量-小时
+     */
+    @Override
+    public AdmEmsElecStoreH selectAdmEmsElecStoreHById(Long id)
+    {
+        return admEmsElecStoreHMapper.selectAdmEmsElecStoreHById(id);
+    }
+
+    /**
+     * 查询储能计量-小时列表
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 储能计量-小时
+     */
+    @Override
+    public List<AdmEmsElecStoreH> selectAdmEmsElecStoreHList(AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        return admEmsElecStoreHMapper.selectAdmEmsElecStoreHList(admEmsElecStoreH);
+    }
+
+    /**
+     * 新增储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    @Override
+    public int insertAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        return admEmsElecStoreHMapper.insertAdmEmsElecStoreH(admEmsElecStoreH);
+    }
+
+    /**
+     * 修改储能计量-小时
+     * 
+     * @param admEmsElecStoreH 储能计量-小时
+     * @return 结果
+     */
+    @Override
+    public int updateAdmEmsElecStoreH(AdmEmsElecStoreH admEmsElecStoreH)
+    {
+        return admEmsElecStoreHMapper.updateAdmEmsElecStoreH(admEmsElecStoreH);
+    }
+
+    /**
+     * 批量删除储能计量-小时
+     * 
+     * @param ids 需要删除的储能计量-小时主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAdmEmsElecStoreHByIds(Long[] ids)
+    {
+        return admEmsElecStoreHMapper.deleteAdmEmsElecStoreHByIds(ids);
+    }
+
+    /**
+     * 删除储能计量-小时信息
+     * 
+     * @param id 储能计量-小时主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAdmEmsElecStoreHById(Long id)
+    {
+        return admEmsElecStoreHMapper.deleteAdmEmsElecStoreHById(id);
+    }
+}

+ 2 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/application-local.yml

@@ -46,7 +46,8 @@ mybatis:
   typeAliasesPackage: com.ruoyi.nrg
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
-
+  configuration:
+    map-underscore-to-camel-case: true
 # swagger配置
 swagger:
   title: 能源模块接口文档

+ 98 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AdmEmsElecStoreHMapper.xml

@@ -0,0 +1,98 @@
+<?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.AdmEmsElecStoreHMapper">
+
+    <resultMap type="com.ruoyi.ems.domain.AdmEmsElecStoreH" id="AdmEmsElecStoreHResult">
+        <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="timeIndex"    column="time_index"    />
+        <result property="chargeElecQuantity"    column="charge_elec_quantity"    />
+        <result property="dischargeElecQuantity"    column="discharge_elec_quantity"    />
+    </resultMap>
+
+    <sql id="selectAdmEmsElecStoreHVo">
+        SELECT
+            store.id,
+            store.area_code,
+            area.area_name,
+            facs.facs_name,
+            store.facs_code,
+            DATE,
+            TIME,
+            time_index,
+            charge_elec_quantity,
+            discharge_elec_quantity
+        FROM
+            adm_ems_elec_store_h store
+            INNER JOIN adm_ems_facs facs ON store.facs_code = facs.facs_code
+            INNER JOIN adm_service_area area ON store.area_code = area.area_code
+    </sql>
+
+    <select id="selectAdmEmsElecStoreHList" parameterType="com.ruoyi.ems.domain.AdmEmsElecStoreH" resultType="com.ruoyi.ems.domain.AdmEmsElecStoreH">
+        <include refid="selectAdmEmsElecStoreHVo"/>
+        <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="chargeElecQuantity != null "> and charge_elec_quantity = #{chargeElecQuantity}</if>
+            <if test="dischargeElecQuantity != null "> and discharge_elec_quantity = #{dischargeElecQuantity}</if>
+        </where>
+    </select>
+
+    <select id="selectAdmEmsElecStoreHById" parameterType="Long" resultType="com.ruoyi.ems.domain.AdmEmsElecStoreH">
+        <include refid="selectAdmEmsElecStoreHVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertAdmEmsElecStoreH" parameterType="com.ruoyi.ems.domain.AdmEmsElecStoreH" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_ems_elec_store_h
+        <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="timeIndex != null">time_index,</if>
+            <if test="chargeElecQuantity != null">charge_elec_quantity,</if>
+            <if test="dischargeElecQuantity != null">discharge_elec_quantity,</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="timeIndex != null">#{timeIndex},</if>
+            <if test="chargeElecQuantity != null">#{chargeElecQuantity},</if>
+            <if test="dischargeElecQuantity != null">#{dischargeElecQuantity},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAdmEmsElecStoreH" parameterType="com.ruoyi.ems.domain.AdmEmsElecStoreH">
+        update adm_ems_elec_store_h
+        <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="timeIndex != null">time_index = #{timeIndex},</if>
+            <if test="chargeElecQuantity != null">charge_elec_quantity = #{chargeElecQuantity},</if>
+            <if test="dischargeElecQuantity != null">discharge_elec_quantity = #{dischargeElecQuantity},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAdmEmsElecStoreHById" parameterType="Long">
+        delete from adm_ems_elec_store_h where id = #{id}
+    </delete>
+
+    <delete id="deleteAdmEmsElecStoreHByIds" parameterType="String">
+        delete from adm_ems_elec_store_h where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>