change - 温度阵列阈值设置、报警
parent
4c0e49fb13
commit
2e0fb5d4d4
@ -0,0 +1,300 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('温度阵列阈值设置')" />
|
||||
<th:block th:include="include :: layout-latest-css" />
|
||||
<th:block th:include="include :: ztree-css" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="ui-layout-west">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-grid"></i> 测控点信息
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息"><i class="fa fa-edit"></i></a>
|
||||
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
<!--<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
能源类型:
|
||||
<select id="monitorType" style="width: 50%; height: 20px" th:with="type=${@energyTypeService.getEnergyType()}">
|
||||
<!–<option value="">所有</option>–>
|
||||
<option th:each="dict : ${type}" th:text="${dict.energyName}" th:value="${dict.energyTypeId}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded" onclick="queryDeptTree()" style="width: 60px;height: 23px;padding: 1px 7px"><i class="fa fa-search" ></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded" style="width: 60px;height: 23px;padding: 1px 7px"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<div id="tree" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-layout-center">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<input type="text" id="monitorType" name="monitorType" hidden="true"/>
|
||||
<input type="text" id="monitorId" name="monitorId" hidden="true"/>
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>是否启用:</label>
|
||||
<select name="deleted" th:with="type=${@dict.getType('isKey')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:SetMonitorThresholdValue:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>-->
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:SetMonitorThresholdValue:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:SetMonitorThresholdValue:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>-->
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:SetMonitorThresholdValue:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: layout-latest-js" />
|
||||
<th:block th:include="include :: ztree-js" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:SetMonitorThresholdValue:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:SetMonitorThresholdValue:remove')}]];
|
||||
var deletedDatas = [[${@dict.getType('isKey')}]];
|
||||
var prefix = ctx + "system/SetMonitorThresholdValue";
|
||||
$("#monitorType").val(30);
|
||||
$(function() {
|
||||
var panehHidden = false;
|
||||
if ($(this).width() < 769) {
|
||||
panehHidden = true;
|
||||
}
|
||||
$('body').layout({ initClosed: panehHidden, west__size: 245 });
|
||||
queryUserList();
|
||||
queryDeptTree();
|
||||
});
|
||||
|
||||
function queryUserList() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "仪阈值设置信息",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'objId',
|
||||
title: '标识',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'monitorId',
|
||||
title: '测控点编号',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'monitorName',
|
||||
title: '测控点名称',
|
||||
width: '180'
|
||||
},
|
||||
{
|
||||
field: 'monitorType',
|
||||
title: '类型',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'temperatureMax',
|
||||
title: '温度最大值'
|
||||
},
|
||||
{
|
||||
field: 'temperatureMin',
|
||||
title: '温度最小值',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'tMaxIdea',
|
||||
title: '温度过高意见'
|
||||
},
|
||||
{
|
||||
field: 'humidityMax',
|
||||
title: '湿度最大值',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'humidityMin',
|
||||
title: '湿度最小值',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'illuminanceMax',
|
||||
title: '照度最大值',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'illuminanceMin',
|
||||
title: '照度最小值',
|
||||
visible: false
|
||||
},
|
||||
/*{
|
||||
field: 'iAMax',
|
||||
title: 'A相电流最大值'
|
||||
},
|
||||
{
|
||||
field: 'iAMin',
|
||||
title: 'A相电流最小值'
|
||||
},
|
||||
{
|
||||
field: 'iBMax',
|
||||
title: 'B相电流最大值'
|
||||
},
|
||||
{
|
||||
field: 'iBMin',
|
||||
title: 'B相电流最小值'
|
||||
},
|
||||
{
|
||||
field: 'iCMax',
|
||||
title: 'C相电流最大值'
|
||||
},
|
||||
{
|
||||
field: 'iCMin',
|
||||
title: 'C相电流最小值'
|
||||
},
|
||||
{
|
||||
field: 'vAMax',
|
||||
title: 'A相电压最大值'
|
||||
},
|
||||
{
|
||||
field: 'vAMin',
|
||||
title: 'A相电压最小值'
|
||||
},
|
||||
{
|
||||
field: 'vBMax',
|
||||
title: 'B相电压最大值'
|
||||
},
|
||||
{
|
||||
field: 'vBMin',
|
||||
title: 'B相电压最小值'
|
||||
},
|
||||
{
|
||||
field: 'vCMax',
|
||||
title: 'C相电压最大值'
|
||||
},
|
||||
{
|
||||
field: 'vCMin',
|
||||
title: 'C相电压最小值'
|
||||
},*/
|
||||
{
|
||||
field: 'deleted',
|
||||
title: '是否启用',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(deletedDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
function queryDeptTree()
|
||||
{
|
||||
var url = ctx + "system/Monitor/treeData?monitorType=30";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 1,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
$("#monitorId").val(treeNode.id);
|
||||
//alert(treeNode.level);
|
||||
$.table.search();
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
$._tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
|
||||
$('#btnCollapse').click(function() {
|
||||
$._tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
|
||||
$('#btnRefresh').click(function() {
|
||||
queryDeptTree();
|
||||
});
|
||||
|
||||
/* 测控点信息 */
|
||||
function dept() {
|
||||
var url = ctx + "system/Monitor?id=30";
|
||||
$.modal.openTab("测控点信息", url);
|
||||
}
|
||||
|
||||
<!-- laydate示例 -->
|
||||
layui.use('laydate', function(){
|
||||
var laydate = layui.laydate;
|
||||
|
||||
laydate.render({
|
||||
elem: '#laydate-demo-3',
|
||||
type: 'datetime',
|
||||
trigger: 'click'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#laydate-demo-4',
|
||||
type: 'datetime',
|
||||
trigger: 'click'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,49 +1,94 @@
|
||||
package com.ruoyi.quartz.task;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.TArraytemperaturedata;
|
||||
import com.ruoyi.system.domain.T_Alarm_Data;
|
||||
import com.ruoyi.system.domain.dto.T_Alarm_DataDTO;
|
||||
import com.ruoyi.system.mapper.TArraytemperaturedataMapper;
|
||||
import com.ruoyi.system.mapper.T_Alarm_DataMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component("ryTask")
|
||||
public class RyTask
|
||||
{
|
||||
public class RyTask {
|
||||
|
||||
@Autowired
|
||||
private TArraytemperaturedataMapper tArraytemperaturedataMapper;
|
||||
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
|
||||
{
|
||||
@Autowired
|
||||
private T_Alarm_DataMapper tAlarmDataMapper;
|
||||
|
||||
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
|
||||
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
|
||||
}
|
||||
|
||||
public void ryParams(String params)
|
||||
{
|
||||
public void ryParams(String params) {
|
||||
System.out.println("执行有参方法:" + params);
|
||||
}
|
||||
|
||||
public void ryNoParams()
|
||||
{
|
||||
public void ryNoParams() {
|
||||
System.out.println("执行无参方法");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除红外温度阵列历史数据
|
||||
*
|
||||
* @param days
|
||||
*/
|
||||
public void deleteArrayDataTask(Integer days){
|
||||
public void deleteArrayDataTask(Integer days) {
|
||||
days = -days;
|
||||
System.out.printf("deleteArrayDataTask: %s!", days);
|
||||
tArraytemperaturedataMapper.deleteTArraytemperaturedataBycollectTime(days);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void ArrayTemperatureSensorAlarm() {
|
||||
String nowTime = DateUtils.getTime();
|
||||
String beginTime = LocalDateTime
|
||||
.parse(nowTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
|
||||
.plusMinutes(-1) // 加一分钟
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
TArraytemperaturedata selectData = new TArraytemperaturedata();
|
||||
HashMap<String, Object> selectMap = new HashMap<>();
|
||||
selectMap.put("beginTime", beginTime);
|
||||
selectMap.put("endTime", nowTime);
|
||||
selectData.setParams(selectMap);
|
||||
List<TArraytemperaturedata> dataList = tArraytemperaturedataMapper.selectArrayTemperatureSensorAlarmList(selectData);
|
||||
T_Alarm_Data alarmData = new T_Alarm_Data();
|
||||
alarmData.setAlarmStatus(1); //0-已处理 1-未处理
|
||||
List<T_Alarm_DataDTO> dataDTOList = tAlarmDataMapper.selectT_Alarm_DataList(alarmData);
|
||||
List<String> alarmList = dataDTOList.stream().map(T_Alarm_DataDTO::getMonitorId).collect(Collectors.toList());
|
||||
for (TArraytemperaturedata data : dataList) {
|
||||
if (alarmList.contains(data.getMonitorId())){
|
||||
continue;
|
||||
}
|
||||
if (data.getMaxTemperature().compareTo(data.getTemperatureMax()) > 0){
|
||||
T_Alarm_Data insertData = new T_Alarm_Data();
|
||||
insertData.setMonitorId(data.getMonitorId());
|
||||
insertData.setCollectTime(DateUtils.getNowDate());
|
||||
insertData.setAlarmType(0);//0-过高报警 1-过低报警
|
||||
insertData.setMonitorType(30);
|
||||
insertData.setAlarmStatus(1);
|
||||
insertData.setAlarmData(data.getMaxTemperature());
|
||||
insertData.setCause(data.gettMaxIdea());
|
||||
tAlarmDataMapper.insertT_Alarm_Data(insertData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue