新增运行策略轮询功能
This commit is contained in:
197
ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyLog.java
Normal file
197
ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyLog.java
Normal file
@ -0,0 +1,197 @@
|
||||
package com.xzzn.ems.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 策略运行日志对象 ems_strategy_log
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-12-26
|
||||
*/
|
||||
public class EmsStrategyLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 策略ID */
|
||||
@Excel(name = "策略ID")
|
||||
private Long strategyId;
|
||||
|
||||
/** 模版id */
|
||||
@Excel(name = "模版id")
|
||||
private String templateId;
|
||||
|
||||
/** 站点id */
|
||||
@Excel(name = "站点id")
|
||||
private String siteId;
|
||||
|
||||
/** 设备唯一标识符 */
|
||||
@Excel(name = "设备唯一标识符")
|
||||
private String deviceId;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date endTime;
|
||||
|
||||
/** 功率 (kW) */
|
||||
@Excel(name = "功率 (kW)")
|
||||
private BigDecimal chargeDischargePower;
|
||||
|
||||
/** 充电状态,如“1-充电”、“2-待机”、“3-放电” */
|
||||
@Excel(name = "充电状态,如“1-充电”、“2-待机”、“3-放电”")
|
||||
private String chargeStatus;
|
||||
|
||||
/** 执行时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date executionDate;
|
||||
|
||||
/** 防逆流, 1-是、0-否 */
|
||||
@Excel(name = "防逆流, 1-是、0-否")
|
||||
private Integer antiReverse;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setStrategyId(Long strategyId)
|
||||
{
|
||||
this.strategyId = strategyId;
|
||||
}
|
||||
|
||||
public Long getStrategyId()
|
||||
{
|
||||
return strategyId;
|
||||
}
|
||||
|
||||
public void setTemplateId(String templateId)
|
||||
{
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getTemplateId()
|
||||
{
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId)
|
||||
{
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getSiteId()
|
||||
{
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime)
|
||||
{
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Date getEndTime()
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setChargeDischargePower(BigDecimal chargeDischargePower)
|
||||
{
|
||||
this.chargeDischargePower = chargeDischargePower;
|
||||
}
|
||||
|
||||
public BigDecimal getChargeDischargePower()
|
||||
{
|
||||
return chargeDischargePower;
|
||||
}
|
||||
|
||||
public void setChargeStatus(String chargeStatus)
|
||||
{
|
||||
this.chargeStatus = chargeStatus;
|
||||
}
|
||||
|
||||
public String getChargeStatus()
|
||||
{
|
||||
return chargeStatus;
|
||||
}
|
||||
|
||||
public void setExecutionDate(Date executionDate)
|
||||
{
|
||||
this.executionDate = executionDate;
|
||||
}
|
||||
|
||||
public Date getExecutionDate()
|
||||
{
|
||||
return executionDate;
|
||||
}
|
||||
|
||||
public Integer getAntiReverse() {
|
||||
return antiReverse;
|
||||
}
|
||||
|
||||
public void setAntiReverse(Integer antiReverse) {
|
||||
this.antiReverse = antiReverse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("strategyId", getStrategyId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("siteId", getSiteId())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("antiReverse", getAntiReverse())
|
||||
.append("startTime", getStartTime())
|
||||
.append("endTime", getEndTime())
|
||||
.append("chargeDischargePower", getChargeDischargePower())
|
||||
.append("chargeStatus", getChargeStatus())
|
||||
.append("executionDate", getExecutionDate())
|
||||
.append("antiReverse", getAntiReverse())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,18 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import com.xzzn.ems.domain.EmsPcsData;
|
||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||
import com.xzzn.ems.domain.vo.ElectricIndexList;
|
||||
import com.xzzn.ems.domain.vo.EnergyStoragePowVo;
|
||||
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
|
||||
import com.xzzn.ems.domain.vo.PcsMaxTempVo;
|
||||
import com.xzzn.ems.domain.vo.PcsStatisListVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
||||
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.xzzn.ems.domain.EmsPcsData;
|
||||
import com.xzzn.ems.domain.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -132,4 +140,6 @@ public interface EmsPcsDataMapper
|
||||
public List<PcsMaxTempVo> getFXMaxTemp(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||
// 实时运行-dds-pcs最高温度
|
||||
public List<PcsMaxTempVo> getDDSMaxTemp(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||
|
||||
List<EmsPcsData> getSitePcsDataInfo(@Param("siteId") String siteId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import com.xzzn.ems.domain.EmsStrategyLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 策略运行日志Mapper接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-12-26
|
||||
*/
|
||||
public interface EmsStrategyLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询策略运行日志
|
||||
*
|
||||
* @param id 策略运行日志主键
|
||||
* @return 策略运行日志
|
||||
*/
|
||||
public EmsStrategyLog selectEmsStrategyLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询策略运行日志列表
|
||||
*
|
||||
* @param emsStrategyLog 策略运行日志
|
||||
* @return 策略运行日志集合
|
||||
*/
|
||||
public List<EmsStrategyLog> selectEmsStrategyLogList(EmsStrategyLog emsStrategyLog);
|
||||
|
||||
/**
|
||||
* 新增策略运行日志
|
||||
*
|
||||
* @param emsStrategyLog 策略运行日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsStrategyLog(EmsStrategyLog emsStrategyLog);
|
||||
|
||||
/**
|
||||
* 修改策略运行日志
|
||||
*
|
||||
* @param emsStrategyLog 策略运行日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsStrategyLog(EmsStrategyLog emsStrategyLog);
|
||||
|
||||
/**
|
||||
* 删除策略运行日志
|
||||
*
|
||||
* @param id 策略运行日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除策略运行日志
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyLogByIds(Long[] ids);
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsStrategyTimeConfig;
|
||||
import com.xzzn.ems.domain.vo.StrategyTimeConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -70,6 +72,9 @@ public interface EmsStrategyTimeConfigMapper
|
||||
// 获取该策略下的时间配置
|
||||
List<EmsStrategyTimeConfig> getAllTimeConfigByTempId(String templateId);
|
||||
|
||||
// 获取指定月份和策略下的时间配置
|
||||
List<EmsStrategyTimeConfig> getTimeConfigByTempIdAndMonth(@Param("templateId") String templateId, @Param("month") int month);
|
||||
|
||||
// 设置该模版的时间配置为待下发
|
||||
public void updateTimeConfigWaitingPost(String templateId);
|
||||
|
||||
|
||||
@ -1054,6 +1054,7 @@
|
||||
t.site_id,
|
||||
t.device_id,
|
||||
t.data_update_time,
|
||||
t.total_active_power,
|
||||
t.current_forward_active_total,
|
||||
t.current_reverse_active_total
|
||||
FROM ems_ammeter_data t
|
||||
|
||||
@ -655,4 +655,20 @@
|
||||
group by deviceId,dateDay,createDate,temp
|
||||
order by dateDay,createDate
|
||||
</select>
|
||||
<select id="getSitePcsDataInfo" resultType="com.xzzn.ems.domain.EmsPcsData">
|
||||
select
|
||||
t.device_id as deviceId,
|
||||
t.site_id as siteId,
|
||||
t.cluster_num as clusterNum
|
||||
from ems_pcs_data t
|
||||
INNER JOIN (
|
||||
select p.site_id, p.device_id, MAX(p.create_time) as max_time
|
||||
from ems_pcs_data p
|
||||
where p.site_id = #{siteId}
|
||||
group by p.site_id, p.device_id
|
||||
) latest on t.site_id = latest.site_id
|
||||
and t.device_id = latest.device_id
|
||||
and t.create_time = latest.max_time
|
||||
where t.site_id = #{siteId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,122 @@
|
||||
<?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.xzzn.ems.mapper.EmsStrategyLogMapper">
|
||||
|
||||
<resultMap type="EmsStrategyLog" id="EmsStrategyLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="strategyId" column="strategy_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="chargeDischargePower" column="charge_discharge_power" />
|
||||
<result property="chargeStatus" column="charge_status" />
|
||||
<result property="executionDate" column="execution_date" />
|
||||
<result property="antiReverse" column="anti_reverse" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyLogVo">
|
||||
select id, strategy_id, template_id, site_id, device_id, start_time, end_time, charge_discharge_power, charge_status, execution_date, anti_reverse, create_by, create_time, update_by, update_time, remark from ems_strategy_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyLogList" parameterType="EmsStrategyLog" resultMap="EmsStrategyLogResult">
|
||||
<include refid="selectEmsStrategyLogVo"/>
|
||||
<where>
|
||||
<if test="strategyId != null "> and strategy_id = #{strategyId}</if>
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||
<if test="executionDate != null "> and execution_date = #{executionDate}</if>
|
||||
<if test="antiReverse != null "> and anti_reverse = #{antiReverse}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEmsStrategyLogById" parameterType="Long" resultMap="EmsStrategyLogResult">
|
||||
<include refid="selectEmsStrategyLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsStrategyLog" parameterType="EmsStrategyLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ems_strategy_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">strategy_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power,</if>
|
||||
<if test="chargeStatus != null">charge_status,</if>
|
||||
<if test="executionDate != null">execution_date,</if>
|
||||
<if test="antiReverse != null">anti_reverse,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="chargeDischargePower != null">#{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">#{chargeStatus},</if>
|
||||
<if test="executionDate != null">#{executionDate},</if>
|
||||
<if test="antiReverse != null">#{antiReverse},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsStrategyLog" parameterType="EmsStrategyLog">
|
||||
update ems_strategy_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="strategyId != null">strategy_id = #{strategyId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power = #{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">charge_status = #{chargeStatus},</if>
|
||||
<if test="executionDate != null">execution_date = #{executionDate},</if>
|
||||
<if test="antiReverse != null">anti_reverse = #{antiReverse},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsStrategyLogById" parameterType="Long">
|
||||
delete from ems_strategy_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsStrategyLogByIds" parameterType="String">
|
||||
delete from ems_strategy_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -134,4 +134,10 @@
|
||||
and strategy_id = #{strategyId}
|
||||
and month = #{month}
|
||||
</select>
|
||||
|
||||
<select id="getTimeConfigByTempIdAndMonth" resultType="com.xzzn.ems.domain.EmsStrategyTimeConfig">
|
||||
<include refid="selectEmsStrategyTimeConfigVo"/>
|
||||
where template_id = #{templateId}
|
||||
and month = #{month}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user