Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	ems-system/src/main/java/com/xzzn/ems/service/impl/DeviceDataProcessServiceImpl.java
#	ems-system/src/main/java/com/xzzn/ems/service/impl/GeneralQueryServiceImpl.java
This commit is contained in:
2026-02-12 21:06:36 +08:00
23 changed files with 836 additions and 92 deletions

View File

@ -128,6 +128,8 @@
from ems_alarm_records t INNER JOIN ems_devices_setting t2 on t.site_id = t2.site_id and t.device_id = t2.device_id
where t.site_id = #{siteId}
and t.status != 1
and t.alarm_level in ('C','D')
order by t.alarm_start_time desc
</select>
<select id="getAlarmTrendList" resultType="com.xzzn.ems.domain.vo.AlarmTrendList">

View File

@ -1141,4 +1141,24 @@
dataTime
) temp
</select>
<select id="getPowerDataByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PowerStatisListVo">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(DATE_ADD(DATE_FORMAT(p.data_update_time, '%Y-%m-%d %H:00:00'), INTERVAL CEIL(MINUTE(p.data_update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS statisDate,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.data_update_time, '%Y-%m-%d %H:00:00'), CEIL(MINUTE(p.data_update_time) / 5) ORDER BY p.data_update_time DESC) as rn
FROM
ems_ammeter_data p
<include refid="commonFilter"/>
)
SELECT
t.site_id,
t.statisDate,
<include refid="powerFilter"/>
FROM
ranked as t
where t.rn = 1
GROUP BY t.site_id, t.statisDate
</select>
</mapper>

View File

@ -428,4 +428,24 @@
GROUP BY statisDate
ORDER BY statisDate
</select>
<select id="getAvgTempByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="java.util.Map">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(DATE_ADD(DATE_FORMAT(p.update_time, '%Y-%m-%d %H:00:00'), INTERVAL CEIL(MINUTE(p.update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS group_time,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.update_time, '%Y-%m-%d %H:00:00'), CEIL(MINUTE(p.update_time) / 5) ORDER BY p.data_update_time DESC) as rn
FROM
ems_battery_cluster p
<include refid="statisCommonFilter"/>
)
SELECT
t.site_id,
DATE_FORMAT(t.group_time, '%Y-%m-%d %H:%i:00') as statisDate,
avg(t.avg_cell_temp) as avgTemp
FROM
ranked as t
GROUP BY t.site_id, t.group_time
</select>
</mapper>

View File

@ -509,6 +509,49 @@
ORDER BY statisDate
</select>
<select id="getStackPointByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackPointVo">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(DATE_ADD(DATE_FORMAT(p.update_time, '%Y-%m-%d %H:00:00'), INTERVAL CEIL(MINUTE(p.update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS group_time,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.update_time, '%Y-%m-%d %H:00:00'), CEIL(MINUTE(p.update_time) / 5) ORDER BY p.data_update_time DESC) as rn
FROM
ems_battery_stack p
<include refid="statisCommonFilter"/>
)
SELECT
t.site_id,
DATE_FORMAT(t.group_time, '%Y-%m-%d %H:%i:%s') as statisDate,
avg(t.stack_soc) as avgSoc,
avg(t.stack_soh) as avgSoh,
avg(t.avg_temperature) as avgTemp
FROM
ranked as t
GROUP BY t.site_id, t.group_time
</select>
<select id="getStackDataByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(DATE_ADD(DATE_FORMAT(p.update_time, '%Y-%m-%d %H:00:00'), INTERVAL CEIL(MINUTE(p.update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS group_time,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.update_time, '%Y-%m-%d %H:00:00'), CEIL(MINUTE(p.update_time) / 5) ORDER BY p.data_update_time DESC) as rn
FROM
ems_battery_stack p
<include refid="statisCommonFilter"/>
)
SELECT
t.site_id,
t.device_id as deviceId,
DATE_FORMAT(t.group_time, '%Y-%m-%d %H:%i:%s') as statisDate,
<include refid="dataTypeChooseFilter"/>
FROM
ranked as t
where t.rn = 1
</select>
<select id="getAveSocList" resultType="com.xzzn.ems.domain.vo.BatteryAveSOCVo">
WITH ranked AS (
SELECT

View File

@ -599,6 +599,26 @@
order by statisDate desc
</select>
<select id="getPcsActivePowerByMinutes" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(DATE_ADD(DATE_FORMAT(p.data_update_time, '%Y-%m-%d %H:00:00'), INTERVAL CEIL(MINUTE(p.data_update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS statisDate,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.data_update_time, '%Y-%m-%d %H:00:00'), CEIL(MINUTE(p.data_update_time) / 5) ORDER BY p.data_update_time DESC) as rn
FROM
ems_pcs_data p
<include refid="statisCommonFilter"/>
)
select
t.device_id as deviceId,
t.statisDate,
<include refid="dataTypeChooseFilter"/>
FROM
ranked as t
where t.rn = 1
</select>
<select id="getFXMaxTemp" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsMaxTempVo">
SELECT t.site_id,t.device_id as deviceId,
GREATEST(

View File

@ -178,6 +178,7 @@
t.match_field as matchField,
t.device_category as deviceCategory,
t.point_name as pointName,
t.data_point_name as dataPointName,
t.data_type as dataType
from ems_point_match t
where 1=1
@ -190,8 +191,11 @@
<if test="deviceCategory != null and deviceCategory != ''">
and t.device_category = #{deviceCategory}
</if>
<if test="deviceId != null and deviceId != ''">
and t.device_id = #{deviceId}
</if>
<if test="pointName != null and pointName != ''">
and t.point_name like concat('%', #{pointName}, '%')
and (t.point_name like concat('%', #{pointName}, '%') or t.data_point_name like concat('%', #{pointName}, '%'))
</if>
</select>
@ -423,6 +427,7 @@
t.data_point as dataPoint,
t.data_point_name as dataPointName,
t.data_device as dataDevice,
t.match_field as matchField,
t.need_diff_device_id as isNeedDeviceId,
t.data_unit as dataUnit,
t.ip_address as ipAddress,
@ -459,6 +464,7 @@
SELECT tmp.pointName,
tmp.dataPoint,
tmp.dataDevice,
tmp.matchField,
tmp.dataPointName,
tmp.dataUnit,
tmp.ipAddress,
@ -469,6 +475,7 @@
when t.need_diff_device_id = 1 and t.data_device = 'BMSD' then concat(#{parentDeviceId}, t.data_point)
else t.data_point end as dataPoint,
t.data_point_name as dataPointName,
t.match_field as matchField,
t.data_device as dataDevice,
t.data_unit as dataUnit,
t.ip_address as ipAddress,