能源告警模块修改

master
马雪伟 2 days ago
parent ddb9a98d5b
commit 3122c19816

@ -64,8 +64,11 @@ public class TWTempertureDataController extends BaseController
if("温湿度".equals(energyName)){
emsIOTData.monitorTypeArr.add("温度");
emsIOTData.monitorTypeArr.add("湿度");
}
else{
}else if ("pm1".equals(energyName)){
emsIOTData.monitorTypeArr.add("pm1");
emsIOTData.monitorTypeArr.add("pm2");
emsIOTData.monitorTypeArr.add("pm10");
}else{
emsIOTData.monitorTypeArr.add(energyName);
}
emsIOTData.setType("line");

@ -1,5 +1,6 @@
package com.hw.ems.record.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -72,6 +73,66 @@ public class RecordAlarmRule extends BaseEntity
/** 权限标识(用户) */
@Excel(name = "权限标识", readConverterExp = "用=户")
private Long userId;
private BigDecimal pm1;
private BigDecimal pm2;
private BigDecimal pm10;
private BigDecimal temperature;
private BigDecimal humidity;
private BigDecimal noise;
public void setPm1(BigDecimal pm1)
{
this.pm1 = pm1;
}
public BigDecimal getPm1()
{
return pm1;
}
public void setPm2(BigDecimal pm2)
{
this.pm2 = pm2;
}
public BigDecimal getPm2()
{
return pm2;
}
public void setPm10(BigDecimal pm10)
{
this.pm10 = pm10;
}
public BigDecimal getPm10()
{
return pm10;
}
public void setTemperature(BigDecimal temperature)
{
this.temperature = temperature;
}
public BigDecimal getTemperature()
{
return temperature;
}
public void setHumidity(BigDecimal humidity)
{
this.humidity = humidity;
}
public BigDecimal getHumidity()
{
return humidity;
}
public void setNoise(BigDecimal noise)
{
this.noise = noise;
}
public BigDecimal getNoise()
{
return noise;
}
public void setObjId(Long objId)
{

@ -4,6 +4,7 @@ import com.hw.ems.record.domain.RecordAlarmData;
import com.hw.ems.record.domain.RecordDnbInstant;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -93,9 +94,13 @@ public interface RecordDnbInstantMapper
*/
List<RecordDnbInstant> offlineAlerts(RecordDnbInstant recordDnbInstant);
List<RecordAlarmData> selectNoiseCount(@Param("time") Date time,@Param("maxValue") int maxValue);
List<RecordAlarmData> selectNoiseCount(@Param("time") Date time,@Param("maxValue") BigDecimal maxValue);
List<RecordAlarmData> selectDustCount(@Param("time") Date time,@Param("maxValue") int maxValue);
List<RecordAlarmData> selectDustCount(@Param("time") Date time,@Param("maxValue") BigDecimal maxValue);
List<RecordAlarmData> selectDustCount2(@Param("time") Date time,@Param("maxValue") BigDecimal maxValue);
List<RecordAlarmData> selectDustCount10(@Param("time") Date time,@Param("maxValue") BigDecimal maxValue);
List<RecordAlarmData> selectTemAndHumCount(@Param("time") Date time,@Param("maxValue") int maxValue);
List<RecordAlarmData> selectTemAndHumCount(@Param("time") Date time,@Param("maxValue") BigDecimal maxValue);
List<RecordAlarmData> selectTemAndHumCount1(@Param("time")Date time, @Param("maxValue") BigDecimal maxValue);
}

@ -583,7 +583,7 @@ public class RecordAlarmDataServiceImpl implements IRecordAlarmDataService {
triggerNumber = 1L;
}
if (rule.getEnergyType() == 4){
List<RecordAlarmData> records = recordDnbInstantMapper.selectNoiseCount(time,50);
List<RecordAlarmData> records = recordDnbInstantMapper.selectNoiseCount(time,rule.getNoise());
for (RecordAlarmData record : records) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
@ -598,7 +598,7 @@ public class RecordAlarmDataServiceImpl implements IRecordAlarmDataService {
}
}
}else if (rule.getEnergyType() == 6){
List<RecordAlarmData> records = recordDnbInstantMapper.selectDustCount(time,19);
List<RecordAlarmData> records = recordDnbInstantMapper.selectDustCount(time,rule.getPm1());
for (RecordAlarmData record : records) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
@ -606,14 +606,42 @@ public class RecordAlarmDataServiceImpl implements IRecordAlarmDataService {
alarmData.setCollectTime(new Date());
alarmData.setAlarmType(3L);
alarmData.setAlarmStatus(1L);
alarmData.setAlarmData("超过粉尘阈值");
alarmData.setAlarmData("超过pm1阈值");
recordAlarmDataMapper.insertRecordAlarmData(alarmData);
}else {
continue;
}
}
List<RecordAlarmData> records2 = recordDnbInstantMapper.selectDustCount2(time,rule.getPm2());
for (RecordAlarmData record : records2) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
alarmData.setMonitorId(record.getMonitorId());
alarmData.setCollectTime(new Date());
alarmData.setAlarmType(3L);
alarmData.setAlarmStatus(1L);
alarmData.setAlarmData("超过pm2阈值");
recordAlarmDataMapper.insertRecordAlarmData(alarmData);
}else {
continue;
}
}
List<RecordAlarmData> records10 = recordDnbInstantMapper.selectDustCount10(time,rule.getPm10());
for (RecordAlarmData record : records10) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
alarmData.setMonitorId(record.getMonitorId());
alarmData.setCollectTime(new Date());
alarmData.setAlarmType(3L);
alarmData.setAlarmStatus(1L);
alarmData.setAlarmData("超过pm10阈值");
recordAlarmDataMapper.insertRecordAlarmData(alarmData);
}else {
continue;
}
}
}else if (rule.getEnergyType() == 7){
List<RecordAlarmData> records = recordDnbInstantMapper.selectTemAndHumCount(time,30);
List<RecordAlarmData> records = recordDnbInstantMapper.selectTemAndHumCount(time,rule.getTemperature());
for (RecordAlarmData record : records) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
@ -621,7 +649,21 @@ public class RecordAlarmDataServiceImpl implements IRecordAlarmDataService {
alarmData.setCollectTime(new Date());
alarmData.setAlarmType(3L);
alarmData.setAlarmStatus(1L);
alarmData.setAlarmData("超过温湿度阈值");
alarmData.setAlarmData("超过温度阈值");
recordAlarmDataMapper.insertRecordAlarmData(alarmData);
}else {
continue;
}
}
List<RecordAlarmData> records1 = recordDnbInstantMapper.selectTemAndHumCount1(time,rule.getHumidity());
for (RecordAlarmData record : records1) {
if (record.getAlarmCount()>triggerNumber){
RecordAlarmData alarmData = new RecordAlarmData();
alarmData.setMonitorId(record.getMonitorId());
alarmData.setCollectTime(new Date());
alarmData.setAlarmType(3L);
alarmData.setAlarmStatus(1L);
alarmData.setAlarmData("超过湿度阈值");
recordAlarmDataMapper.insertRecordAlarmData(alarmData);
}else {
continue;

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRecordAlarmRuleVo">
select objId, rule_id, rule_name, monitor_id, collect_time, energy_type, trigger_rule, trigger_number, time_range, device_offline_time, notify_user, cause, create_by, create_time, update_by, update_time, dept_id, user_id from record_alarm_rule
select objId, rule_id, rule_name, monitor_id, collect_time, energy_type, trigger_rule, trigger_number, time_range, device_offline_time, notify_user, cause, create_by, create_time, update_by, update_time, dept_id, user_id,pm1,pm2,pm10,temperature,humidity,noise from record_alarm_rule
</sql>
<select id="selectRecordAlarmRuleList" parameterType="RecordAlarmRule" resultMap="RecordAlarmRuleResult">
@ -65,6 +65,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="collectTime != null">collect_time,</if>
<if test="energyType != null">energy_type,</if>
<if test="triggerRule != null">trigger_rule,</if>
<if test="pm1 != null">pm1,</if>
<if test="pm2 != null">pm2,</if>
<if test="pm10 != null">pm10,</if>
<if test="temperature != null">temperature,</if>
<if test="humidity != null">humidity,</if>
<if test="noise != null">noise,</if>
<if test="triggerNumber != null">trigger_number,</if>
<if test="timeRange != null">time_range,</if>
<if test="deviceOfflineTime != null">device_offline_time,</if>
@ -76,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ruleId != null">#{ruleId},</if>
<if test="ruleName != null">#{ruleName},</if>
@ -84,6 +90,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="collectTime != null">#{collectTime},</if>
<if test="energyType != null">#{energyType},</if>
<if test="triggerRule != null">#{triggerRule},</if>
<if test="pm1 != null">#{pm1},</if>
<if test="pm2 != null">#{pm2},</if>
<if test="pm10 != null">#{pm10},</if>
<if test="temperature != null">#{temperature},</if>
<if test="humidity != null">#{humidity},</if>
<if test="noise != null">#{noise},</if>
<if test="triggerNumber != null">#{triggerNumber},</if>
<if test="timeRange != null">#{timeRange},</if>
<if test="deviceOfflineTime != null">#{deviceOfflineTime},</if>
@ -95,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
</trim>
</trim>
</insert>
<update id="updateRecordAlarmRule" parameterType="RecordAlarmRule">
@ -107,6 +119,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="collectTime != null">collect_time = #{collectTime},</if>
<if test="energyType != null">energy_type = #{energyType},</if>
<if test="triggerRule != null">trigger_rule = #{triggerRule},</if>
<if test="pm1 != null">pm1 = #{pm1},</if>
<if test="pm2 != null">pm2 = #{pm2},</if>
<if test="pm10 != null">pm10 = #{pm10},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="humidity != null">humidity = #{humidity},</if>
<if test="noise != null">noise = #{noise},</if>
<if test="triggerNumber != null">trigger_number = #{triggerNumber},</if>
<if test="timeRange != null">time_range = #{timeRange},</if>
<if test="deviceOfflineTime != null">device_offline_time = #{deviceOfflineTime},</if>

@ -184,14 +184,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
join base_monitor_info m on m.monitor_id = rdi.monitor_id and m.monitor_status = 0 and m.is_ammeter = 'false'
where #{recordTime} > d.record_time
</select>
<select id="selectNoiseCount" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.noise >#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<select id="selectDustCount" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where (x.pm1 >#{maxValue} or x.pm2 >#{maxValue} or x.pm10>#{maxValue}) and x.recodeTime >#{time} group by x.monitorId
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.pm1 >#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<select id="selectTemAndHumCount" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where (x.tempreture>#{maxValue} or x.humidity>#{maxValue}) and x.recodeTime >#{time} group by x.monitorId
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.tempreture>#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<select id="selectDustCount2" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.pm2 >#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<select id="selectDustCount10" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.pm10 >#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<select id="selectTemAndHumCount1" resultType="com.hw.ems.record.domain.RecordAlarmData">
SELECT x.monitorId,count(1) alarmCount FROM `hwjy-cloud`.record_iotenv_instant x where x.humidity>#{maxValue} and x.recodeTime >#{time} group by x.monitorId
</select>
<insert id="insertRecordDnbInstant" parameterType="RecordDnbInstant" useGeneratedKeys="true" keyProperty="objid">

@ -132,13 +132,13 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['dms:suplier:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dms:suplier:remove']"
>删除</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['dms:suplier:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>

@ -55,7 +55,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="自增标识" align="center" prop="objId" v-if="false"/>
<el-table-column label="计量设备名称" align="center" prop="monitorName" min-width="110"/>
<el-table-column label="采集设备编号" align="center" prop="collectDeviceId" min-width="110"/>
<!-- <el-table-column label="采集设备编号" align="center" prop="collectDeviceId" min-width="110"/>-->
<el-table-column label="记录时间" align="center" prop="collectTime" width="180">
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.collectTime, '{y}-{m}-{d}') }}</span>-->
@ -71,15 +71,15 @@
<dict-tag :options="dict.type.alarmStatus" :value="scope.row.alarmStatus"/>
</template>
</el-table-column>
<el-table-column label="异常数据" align="center" prop="alarmData" />
<el-table-column label="操作人员" align="center" prop="operationName" />
<el-table-column label="操作时间" align="center" prop="operationTime" width="180">
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.operationTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
</el-table-column>
<el-table-column label="备注" align="center" prop="cause" />
<!-- <el-table-column label="通知用户" align="center" prop="notifyUser" v-if="true"/>-->
<!-- <el-table-column label="异常数据" align="center" prop="alarmData" />-->
<!-- <el-table-column label="操作人员" align="center" prop="operationName" />-->
<!-- <el-table-column label="操作时间" align="center" prop="operationTime" width="180">-->
<!--&lt;!&ndash; <template slot-scope="scope">&ndash;&gt;-->
<!--&lt;!&ndash; <span>{{ parseTime(scope.row.operationTime, '{y}-{m}-{d}') }}</span>&ndash;&gt;-->
<!--&lt;!&ndash; </template>&ndash;&gt;-->
<!-- </el-table-column>-->
<!-- <el-table-column label="备注" align="center" prop="cause" />-->
<!--&lt;!&ndash; <el-table-column label="通知用户" align="center" prop="notifyUser" v-if="true"/>&ndash;&gt;-->
</el-table>
<pagination

@ -16,21 +16,21 @@
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="终端在线状态" prop="onlineState">
<el-select
v-model="queryParams.onlineState"
placeholder="终端在线状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.trigger_rule"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="终端在线状态" prop="onlineState">-->
<!-- <el-select-->
<!-- v-model="queryParams.onlineState"-->
<!-- placeholder="终端在线状态"-->
<!-- clearable-->
<!-- style="width: 240px"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.trigger_rule"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -104,6 +104,12 @@
<dict-tag :options="dict.type.trigger_rule" :value="scope.row.triggerRule"/>
</template>
</el-table-column>
<el-table-column v-if="pm1!==null" label="触发pm1阈值" align="center" prop="pm1" min-width="110"/>
<el-table-column v-if="pm2!==null" label="触发pm2阈值" align="center" prop="pm2" min-width="110"/>
<el-table-column v-if="pm10!==null" label="触发pm10阈值" align="center" prop="pm10" min-width="110"/>
<el-table-column v-if="temperature!==null" label="触发温度阈值" align="center" prop="temperature" min-width="110"/>
<el-table-column v-if="!humidity!==null" label="触发湿度阈值" align="center" prop="humidity" min-width="110"/>
<el-table-column v-if="noise!==null" label="触发噪声阈值" align="center" prop="noise" min-width="110"/>
<el-table-column label="触发阈值次数" align="center" prop="triggerNumber" min-width="110"/>
<el-table-column label="时间范围(分)" align="center" prop="timeRange" min-width="110"/>
<el-table-column label="设备离线时间(分)" align="center" prop="deviceOfflineTime" min-width="120"/>
@ -176,7 +182,24 @@
<!-- placeholder="请选择记录时间">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="pm1阈值" prop="pm1" v-if="form.energyType==4">
<el-input-number v-model="form.pm1" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="PM2阈值" prop="pm2" v-if="form.energyType==4">
<el-input-number v-model="form.pm2" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="pm10阈值" prop="pm10" v-if="form.energyType==4">
<el-input-number v-model="form.pm10" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="温度阈值" prop="temperature" v-if="form.energyType==7">
<el-input-number v-model="form.temperature" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="湿度阈值" prop="humidity" v-if="form.energyType==7">
<el-input-number v-model="form.humidity" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="噪声阈值" prop="noise" v-if="form.energyType==6">
<el-input-number v-model="form.noise" placeholder="请输入触发阈值" />
</el-form-item>
<el-form-item label="触发阈值次数" prop="triggerNumber">
<el-input-number v-model="form.triggerNumber" placeholder="请输入触发阈值次数" />
</el-form-item>

@ -476,6 +476,48 @@ export default {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm1') ? data.dataList.map(e => e.pm1) : []
},{
tooltip: {
show: data.monitorTypeArr.includes('pm2') ? true : false
},
name: 'pm2',
type: data.type,
smooth: data.smooth, //线
showAllSymbol: data.showAllSymbol, //
symbol: data.symbol, //
symbolSize: data.symbolSize, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm2') ? data.dataList.map(e => e.pm2) : []
},{
tooltip: {
show: data.monitorTypeArr.includes('pm10') ? true : false
},
name: 'pm10',
type: data.type,
smooth: data.smooth, //线
showAllSymbol: data.showAllSymbol, //
symbol: data.symbol, //
symbolSize: data.symbolSize, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm10') ? data.dataList.map(e => e.pm10) : []
}
]
}

Loading…
Cancel
Save