add - 配电柜实时监控接口添加限制时间范围。

worktree-temp-progress-bar-color
yinq 5 days ago
parent bf6420c8f1
commit cea9b11bda

@ -285,7 +285,7 @@
<div class="ui-layout-center">
<div class="monitor-header">
<div class="monitor-header-title">实时监控平台</div>
<div class="monitor-header-title">配电柜实时监控平台</div>
<div class="monitor-header-time" id="currentTime"></div>
</div>
@ -373,9 +373,9 @@
+ "<div class=\"card-image\"><img src=\"" + cabinetImg + "\" alt=\"配电柜\"></div>"
+ "<div class=\"card-info\">"
+ "<div class=\"temperature-min\">最低温度:" + formatValue(v.humidity) + "℃</div>"
+ "<div class=\"temperature-average\">" + formatValue(v.tempreture) + "<span class=\"unit\"></span></div>"
+ "<div class=\"temperature-average\">" + formatValue(v.illuminance) + "<span class=\"unit\"></span></div>"
+ "<div class=\"temperature-progress\"><div class=\"temperature-progress-bar\" style=\"width: " + progress + "%;\"></div></div>"
+ "<div class=\"temperature-max\">最高温度:" + formatValue(v.illuminance) + "℃</div>"
+ "<div class=\"temperature-max\">最高温度:" + formatValue(v.tempreture) + "℃</div>"
+ "</div>"
+ "</div>"
+ "</div>";

@ -1,7 +1,12 @@
package com.ruoyi.system.service.impl;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.common.utils.StringUtils;
@ -97,7 +102,21 @@ public class T_W_TemperturedataServiceImpl implements IT_W_TemperturedataService
if (monitorIdList.isEmpty()) {
return null;
}
t_W_Temperturedata.getParams().put("monitorIdList", monitorIdList);
Map<String, Object> params = t_W_Temperturedata.getParams();
Object beginCollectTime = params.get("beginCollectTime");
if (beginCollectTime == null || StringUtils.isBlank(String.valueOf(beginCollectTime))) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR, -1);
Map<String, Object> timeParams = new HashMap<>();
timeParams.put("beginCollectTime", simpleDateFormat.format(calendar.getTime()));
timeParams.put("endCollectTime", simpleDateFormat.format(new Date()));
timeParams.put("monitorIdList", monitorIdList);
t_W_Temperturedata.setParams(timeParams);
} else {
params.put("monitorIdList", monitorIdList);
}
return t_W_TemperturedataMapper.selectDistributionCabinetRealTimeMonitor(t_W_Temperturedata);
}

@ -179,11 +179,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ROW_NUMBER() OVER (PARTITION BY t1.monitorId ORDER BY t1.collectTime DESC) AS rn
FROM T_W_TempertureData t1
<where>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and t1.collectTime between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="params.monitorIdList != null and params.monitorIdList.size() > 0">
and t1.monitorId in
<foreach collection="params.monitorIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
and exists (
select 1
from T_Monitor m1
where m1.monitorId = t1.monitorId
and (
m1.monitorId in
<foreach collection="params.monitorIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
or m1.p_monitorId in
<foreach collection="params.monitorIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
)
)
</if>
</where>
)

Loading…
Cancel
Save