单体电池-增加簇号
This commit is contained in:
@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel;
|
|||||||
* Modbus设备配置对象 ems_devices_setting
|
* Modbus设备配置对象 ems_devices_setting
|
||||||
*
|
*
|
||||||
* @author xzzn
|
* @author xzzn
|
||||||
* @date 2025-06-29
|
* @date 2025-07-01
|
||||||
*/
|
*/
|
||||||
public class EmsDevicesSetting extends BaseEntity
|
public class EmsDevicesSetting extends BaseEntity
|
||||||
{
|
{
|
||||||
@ -86,14 +86,18 @@ public class EmsDevicesSetting extends BaseEntity
|
|||||||
@Excel(name = "站点id")
|
@Excel(name = "站点id")
|
||||||
private String siteId;
|
private String siteId;
|
||||||
|
|
||||||
/** 通信状态 */
|
/** 通信状态:0-正常 1-通信中断 2-异常 */
|
||||||
@Excel(name = "通信状态")
|
@Excel(name = "通信状态:0-正常 1-通信中断 2-异常")
|
||||||
private String communicationStatus;
|
private String communicationStatus;
|
||||||
|
|
||||||
/** 设备唯一标识符 */
|
/** 设备唯一标识符 */
|
||||||
@Excel(name = "设备唯一标识符")
|
@Excel(name = "设备唯一标识符")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 上级设备id */
|
||||||
|
@Excel(name = "上级设备id")
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -284,6 +288,16 @@ public class EmsDevicesSetting extends BaseEntity
|
|||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setParentId(String parentId)
|
||||||
|
{
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentId()
|
||||||
|
{
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -306,6 +320,7 @@ public class EmsDevicesSetting extends BaseEntity
|
|||||||
.append("siteId", getSiteId())
|
.append("siteId", getSiteId())
|
||||||
.append("communicationStatus", getCommunicationStatus())
|
.append("communicationStatus", getCommunicationStatus())
|
||||||
.append("deviceId", getDeviceId())
|
.append("deviceId", getDeviceId())
|
||||||
|
.append("parentId", getParentId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ public class BatteryDataStatsListVo {
|
|||||||
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 簇号 */
|
||||||
|
private String clusterDeviceId;
|
||||||
|
|
||||||
public String getDeviceId() {
|
public String getDeviceId() {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
@ -73,4 +76,12 @@ public class BatteryDataStatsListVo {
|
|||||||
public void setUpdateTime(Date updateTime) {
|
public void setUpdateTime(Date updateTime) {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClusterDeviceId() {
|
||||||
|
return clusterDeviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClusterDeviceId(String clusterDeviceId) {
|
||||||
|
this.clusterDeviceId = clusterDeviceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,17 +139,15 @@
|
|||||||
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime
|
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime
|
||||||
from ems_alarm_records t
|
from ems_alarm_records t
|
||||||
where t.site_id = #{siteId}
|
where t.site_id = #{siteId}
|
||||||
<if test="deviceType != null and deviceType != 0">
|
<if test="deviceType != null and deviceType != ''">
|
||||||
AND t.device_type = #{deviceType}
|
AND t.device_type = #{deviceType}
|
||||||
</if>
|
</if>
|
||||||
<if test="alarmLevel != null and alarmLevel != ''">
|
<if test="alarmLevel != null and alarmLevel != ''">
|
||||||
AND t.alarm_level = #{alarmLevel}
|
AND t.alarm_level = #{alarmLevel}
|
||||||
</if>
|
</if>
|
||||||
<if test="alarmStartTime != null and alarmStartTime != ''">
|
<if test="alarmStartTime != null and alarmStartTime != null and alarmEndTime != null and alarmEndTime != ''">
|
||||||
AND date_format(t.alarm_start_time,'%Y%m%d') >= date_format(#{alarmStartTime},'%Y%m%d')
|
AND (date_format(t.alarm_start_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d')
|
||||||
</if>
|
or date_format(t.alarm_end_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d') )
|
||||||
<if test="alarmEndTime != null and alarmEndTime != ''"><!-- 结束时间检索 -->
|
|
||||||
AND date_format(t.alarm_end_time,'%Y%m%d') <= date_format(#{alarmEndTime},'%Y%m%d')
|
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -179,16 +179,18 @@
|
|||||||
|
|
||||||
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
||||||
SELECT t.data_timestamp as updateTime, t.voltage, t.temperature,
|
SELECT t.data_timestamp as updateTime, t.voltage, t.temperature,
|
||||||
t.soc, t.soh, t.device_id as deviceId
|
t.soc, t.soh, t.device_id as deviceId,t.cluster_device_id as clusterDeviceId
|
||||||
FROM ems_battery_data t
|
FROM ems_battery_data t
|
||||||
JOIN ( SELECT device_id, MAX(data_timestamp) AS max_update_time
|
INNER JOIN ( SELECT device_id, cluster_device_id, MAX(data_timestamp) AS max_update_time
|
||||||
FROM ems_battery_data
|
FROM ems_battery_data
|
||||||
WHERE site_id = #{siteId}
|
WHERE site_id = #{siteId}
|
||||||
|
and data_timestamp >= CURDATE()
|
||||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||||
and cluster_device_id = #{clusterDeviceId}
|
and cluster_device_id = #{clusterDeviceId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY device_id
|
GROUP BY device_id, cluster_device_id
|
||||||
) latest ON t.device_id = latest.device_id AND t.data_timestamp = latest.max_update_time
|
) latest ON t.device_id = latest.device_id AND t.data_timestamp = latest.max_update_time
|
||||||
|
AND t.cluster_device_id = latest.cluster_device_id
|
||||||
WHERE t.site_id = #{siteId}
|
WHERE t.site_id = #{siteId}
|
||||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||||
and t.cluster_device_id = #{clusterDeviceId}
|
and t.cluster_device_id = #{clusterDeviceId}
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
<result property="siteId" column="site_id" />
|
<result property="siteId" column="site_id" />
|
||||||
<result property="communicationStatus" column="communication_status" />
|
<result property="communicationStatus" column="communication_status" />
|
||||||
<result property="deviceId" column="device_id" />
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="parentId" column="parent_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsDevicesSettingVo">
|
<sql id="selectEmsDevicesSettingVo">
|
||||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id from ems_devices_setting
|
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id from ems_devices_setting
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
|
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
|
||||||
@ -51,6 +52,7 @@
|
|||||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||||
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
|
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
|
||||||
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
|
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -80,6 +82,7 @@
|
|||||||
<if test="siteId != null">site_id,</if>
|
<if test="siteId != null">site_id,</if>
|
||||||
<if test="communicationStatus != null">communication_status,</if>
|
<if test="communicationStatus != null">communication_status,</if>
|
||||||
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
||||||
|
<if test="parentId != null">parent_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||||
@ -100,6 +103,7 @@
|
|||||||
<if test="siteId != null">#{siteId},</if>
|
<if test="siteId != null">#{siteId},</if>
|
||||||
<if test="communicationStatus != null">#{communicationStatus},</if>
|
<if test="communicationStatus != null">#{communicationStatus},</if>
|
||||||
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||||
|
<if test="parentId != null">#{parentId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -124,6 +128,7 @@
|
|||||||
<if test="siteId != null">site_id = #{siteId},</if>
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||||||
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
|
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
|
||||||
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||||
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -146,9 +151,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllClusterInfoByStackId" parameterType="String" resultType="java.util.Map">
|
<select id="getAllClusterInfoByStackId" parameterType="String" resultType="java.util.Map">
|
||||||
select device_id as id,device_name as deviceName
|
select distinct t.device_id,t.device_name from ems_devices_setting t where t.parent_id = #{stackDeviceId}
|
||||||
from ems_devices_setting
|
|
||||||
where device_id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
|
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
|
||||||
|
Reference in New Issue
Block a user