change - 智慧场景告警单元处理

main
wenjy 3 years ago
parent 15325511c4
commit d9d559c735

@ -97,7 +97,7 @@ public class BaseAlarmModuleController extends BaseController
public AjaxResult addSave(BaseAlarmModule baseAlarmModule)
{
if(!baseAlarmModule.getMonitorunitId().isEmpty()){
/*if(!baseAlarmModule.getMonitorunitId().isEmpty()){
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
baseMonitorunitInfo.setMonitorunitType(baseAlarmModule.getMonitorunitId());
List<BaseMonitorunitInfo> baseMonitorunitInfos = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
@ -105,7 +105,7 @@ public class BaseAlarmModuleController extends BaseController
baseAlarmModule.setMonitorunitId(baseMonitorunitInfos.get(0).getMonitorunitType());
}
}
*/
baseAlarmModule.setAlarmmoduleId(UUID.randomUUID().toString());
baseAlarmModule.setCreatedBy(ShiroUtils.getLoginName());
baseAlarmModule.setCreatedTime(new Date());
@ -132,14 +132,14 @@ public class BaseAlarmModuleController extends BaseController
@ResponseBody
public AjaxResult editSave(BaseAlarmModule baseAlarmModule)
{
if(!baseAlarmModule.getMonitorunitId().isEmpty()){
/*if(!baseAlarmModule.getMonitorunitId().isEmpty()){
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
baseMonitorunitInfo.setMonitorunitId(baseAlarmModule.getMonitorunitId());
List<BaseMonitorunitInfo> baseMonitorunitInfos = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
if(baseMonitorunitInfos.size() > 0){
baseAlarmModule.setMonitorunitId(baseMonitorunitInfos.get(0).getMonitorunitType());
}
}
}*/
baseAlarmModule.setUpdatedBy(ShiroUtils.getLoginName());
baseAlarmModule.setUpdatedTime(new Date());
return toAjax(baseAlarmModuleService.updateBaseAlarmModule(baseAlarmModule));

@ -1,9 +1,14 @@
package com.ruoyi.web.controller.base;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -36,6 +41,9 @@ public class BaseMonitorunitTypeController extends BaseController {
@Autowired private IBaseMonitorunitTypeService baseMonitorunitTypeService;
@Autowired
private IBaseMonitorunitInfoService baseMonitorunitInfoService;
@RequiresPermissions("base:monitorUnitType:view")
@GetMapping()
public String monitorUnitType() {
@ -144,4 +152,34 @@ public class BaseMonitorunitTypeController extends BaseController {
public AjaxResult remove(String ids) {
return toAjax(baseMonitorunitTypeService.deleteBaseMonitorunitTypeByObjIds(ids));
}
/** 选择智慧場景信息树 */
@GetMapping(value = {"/selectMonitorUnitInfoTree/{ObjId}", "/selectMonitorUnitInfoTree/"})
public String selectMonitorUnitInfoTree(
@PathVariable(value = "ObjId", required = false) String ObjId, ModelMap mmap) {
if (StringUtils.isNotNull(ObjId)) {
mmap.put(
"baseMonitorUnitType",
baseMonitorunitTypeService.selectBaseMonitorunitTypeList(new BaseMonitorunitType(ObjId)).get(0));
}
return prefix + "/tree";
}
/** 加载智慧場景信息树列表 */
@GetMapping("/treeData")
@ResponseBody
public List<Ztree> treeData() {
List<BaseMonitorunitType> baseMonitorunitTypes = baseMonitorunitTypeService.selectBaseMonitorunitTypeList(new BaseMonitorunitType());
List<Ztree> ztrees = new ArrayList<Ztree>();
for (BaseMonitorunitType baseMonitorunitType : baseMonitorunitTypes) {
Ztree ztree = new Ztree();
ztree.setId(baseMonitorunitType.getMonitorunittypeId());
ztree.setpId(baseMonitorunitType.getMonitorunittypeId());
ztree.setName(baseMonitorunitType.getMonitorunittypeName());
ztree.setTitle(baseMonitorunitType.getMonitorunittypeName());
ztrees.add(ztree);
}
return ztrees;
}
}

@ -17,8 +17,10 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Controller
@ -125,12 +127,18 @@ public class WisdomScenarioContorller {
if(baseAlarmModuleDtos.size() < 6){
List<BaseAlarmModuleDto> info = new ArrayList<>();
for (int i = 0;i<6-baseAlarmModuleDtos.size();i++){
info.add(new BaseAlarmModuleDto());
BaseAlarmModuleDto baseAlarmModuleDto = new BaseAlarmModuleDto();
baseAlarmModuleDto.setAlarmmoduleText("----");
baseAlarmModuleDto.setAlarmModuleAmount("-");
baseAlarmModuleDto.setOrderFlag(new Long((baseAlarmModuleDtos.size())+i+1));
info.add(baseAlarmModuleDto);
}
baseAlarmModuleDtos.addAll(baseAlarmModuleDtos.size()-1,info);
baseAlarmModuleDtos.addAll(baseAlarmModuleDtos.size(),info);
}
String result = JSONArray.toJSONString(baseAlarmModuleDtos);
List<BaseAlarmModuleDto> collect = baseAlarmModuleDtos.stream().sorted(Comparator.comparing(BaseAlarmModuleDto::getOrderFlag)).collect(Collectors.toList());
String result = JSONArray.toJSONString(collect);
return result;
}

@ -21,7 +21,7 @@
</div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">监控单元</label>
<label class="col-sm-3 control-label">智慧场景</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control" type="text" name="treeName" onclick="selectMonitorTree()" id="treeName">
@ -38,6 +38,12 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序标识:</label>
<div class="col-sm-8">
<input name="orderFlag" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
@ -78,9 +84,9 @@
/* 选择监控单元树 */
function selectMonitorTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val();
var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId;
var url = ctx + "base/monitorUnitType/selectMonitorUnitInfoTree/" + deptId;
var options = {
title: '选择部门',
title: '选择智慧场景',
width: "380",
url: url,
callBack: doSubmit

@ -10,10 +10,10 @@
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> 监控单元
<i class="fa icon-grid"></i> 智慧场景
</div>
<div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool" href="#" onclick="monitorUnitInfo()" title="监控单元"><i
<a type="button" class="btn btn-box-tool" href="#" onclick="monitorUnitInfo()" 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>
@ -133,13 +133,17 @@
},
{
field: 'monitorunitName',
title: '监控单元'
title: '智慧场景'
},
{
field: 'alarmTypeName',
title: '报警类型'
},
{
{
field: 'orderFlag',
title: '排序标识',
},
{
field: 'enableFlag',
title: '是否启用',
formatter: function(value, row, index) {
@ -177,7 +181,7 @@
}
function queryMonitorTree() {
let url = ctx + "base/monitorUnitInfo/treeData";
let url = ctx + "base/monitorUnitType/treeData";
let options = {
url: url,
expandLevel: 2,
@ -214,8 +218,8 @@
});
function monitorUnitInfo() {
var url = ctx + "base/monitorUnitInfo";
$.modal.openTab("监控单元", url);
var url = ctx + "base/monitorUnitType";
$.modal.openTab("智慧场景", url);
}
</script>
</body>

@ -18,7 +18,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">监控单元</label>
<label class="col-sm-3 control-label">智慧场景</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control" type="text" name="treeName" onclick="selectMonitorTree()" id="treeName" th:field="*{monitorunitName}">
@ -35,6 +35,12 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序标识:</label>
<div class="col-sm-8">
<input name="orderFlag" th:field="*{orderFlag}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
@ -71,12 +77,12 @@
autoclose: true
});
/* 选择监控单元树 */
/* 选择智慧场景树 */
function selectMonitorTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val();
var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId;
var url = ctx + "base/monitorUnitType/selectMonitorUnitInfoTree/" + deptId;
var options = {
title: '选择部门',
title: '选择智慧场景',
width: "380",
url: url,
callBack: doSubmit

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('智慧場景信息树选择')" />
<th:block th:include="include :: ztree-css" />
</head>
<style>
body{height:auto;font-family: "Microsoft YaHei";}
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition box box-main">
<input id="treeId" name="treeId" type="hidden" th:value="${baseMonitorUnitType?.monitorunittypeId}"/>
<input id="treeName" name="treeName" type="hidden" th:value="${baseMonitorUnitType?.monitorunittypeName}"/>
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
<label id="btnShow" title="显示搜索" style="display:none;"></label>
<label id="btnHide" title="隐藏搜索"></label>
</div>
<div class="treeSearchInput" id="search">
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
</div>
<div class="treeExpandCollapse">
<a href="#" onclick="$.tree.expand()">展开</a> /
<a href="#" onclick="$.tree.collapse()">折叠</a>
</div>
<div id="tree" class="ztree treeselect"></div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
$(function() {
var url = ctx + "base/monitorUnitType/treeData";
var options = {
url: url,
expandLevel: 2,
onClick : zOnClick
};
$.tree.init(options);
});
function zOnClick(event, treeId, treeNode) {
var treeId = treeNode.id;
var treeName = treeNode.name;
$("#treeId").val(treeId);
$("#treeName").val(treeName);
}
</script>
</body>
</html>

@ -46,6 +46,9 @@ public class BaseAlarmModule extends BaseEntity
@Excel(name = "是否启用")
private Long enableFlag;
/** 排序字段 */
private Long orderFlag;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
@ -153,6 +156,14 @@ public class BaseAlarmModule extends BaseEntity
this.alarmTypeId = alarmTypeId;
}
public Long getOrderFlag() {
return orderFlag;
}
public void setOrderFlag(Long orderFlag) {
this.orderFlag = orderFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -11,6 +11,7 @@
<result property="monitorunitId" column="MonitorUnit_Id"/>
<result property="alarmTypeId" column="AlarmType_Id"/>
<result property="enableFlag" column="Enable_Flag"/>
<result property="orderFlag" column="Order_Flag"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
@ -26,6 +27,7 @@
<result property="alarmTypeName" column="AlarmType_Name"/>
<result property="monitorunitName" column="MonitorUnit_Name"/>
<result property="alarmTypeId" column="AlarmType_Id"/>
<result property="orderFlag" column="Order_Flag"/>
<result property="enableFlag" column="Enable_Flag"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
@ -39,16 +41,17 @@
t1.AlarmModule_Id,
t1.AlarmModule_Text,
t1.MonitorUnit_Id,
t2.MonitorUnit_Name,
t2.MonitorUnitType_Name as MonitorUnit_Name,
t1.AlarmType_Id,
t3.AlarmType_Name,
t1.Enable_Flag,
t1.CREATED_BY,
t1.CREATED_TIME,
t1.UPDATED_BY,
t1.UPDATED_TIME
t1.UPDATED_TIME,
t1.Order_Flag
from base_alarm_module t1
left join base_monitorunit_info t2 on t1.MonitorUnit_Id = t2.MonitorUnit_Id
left join base_monitorunit_type t2 on t1.MonitorUnit_Id = t2.MonitorUnitType_Id
left join base_alarm_type t3 on t1.AlarmType_Id = t3.alarmType_Id
</sql>
@ -62,6 +65,7 @@
<if test="alarmTypeId != null and alarmTypeId != ''">and t1.AlarmType_Id = #{alarmTypeId}</if>
<if test="enableFlag != null ">and t1.Enable_Flag = #{enableFlag}</if>
</where>
order by t1.order_Flag
</select>
<select id="selectBaseAlarmModuleByObjId" parameterType="String" resultMap="BaseAlarmModuleDtoResult">
@ -78,6 +82,7 @@
<if test="monitorunitId != null">MonitorUnit_Id,</if>
<if test="alarmTypeId != null">AlarmType_Id,</if>
<if test="enableFlag != null">Enable_Flag,</if>
<if test="orderFlag != null">Order_Flag,</if>
<if test="createdBy != null">CREATED_BY,</if>
<if test="createdTime != null">CREATED_TIME,</if>
<if test="updatedBy != null">UPDATED_BY,</if>
@ -90,6 +95,7 @@
<if test="monitorunitId != null">#{monitorunitId},</if>
<if test="alarmTypeId != null">#{alarmTypeId},</if>
<if test="enableFlag != null">#{enableFlag},</if>
<if test="orderFlag != null">#{orderFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
@ -105,6 +111,7 @@
<if test="monitorunitId != null">MonitorUnit_Id = #{monitorunitId},</if>
<if test="alarmTypeId != null">AlarmType_Id = #{alarmTypeId},</if>
<if test="enableFlag != null">Enable_Flag = #{enableFlag},</if>
<if test="orderFlag != null">Order_Flag = #{orderFlag},</if>
<if test="createdBy != null">CREATED_BY = #{createdBy},</if>
<if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
<if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
@ -127,14 +134,15 @@
</delete>
<select id="selectAlarmModuleAmountList" parameterType="BaseAlarmModule" resultMap="BaseAlarmModuleDtoResult">
select t1.AlarmModule_Text,count(t4.Alarm_Value) as alarmModuleAmount from base_alarm_module t1
select t1.AlarmModule_Text,t1.Order_Flag,count(t4.Alarm_Value) as alarmModuleAmount from base_alarm_module t1
left join base_monitorunit_info t2 on t2.MonitorUnit_Type = t1.MonitorUnit_Id
left join base_sensor_info t3 on t2.MonitorUnit_Id = t3.MonitorUnit_Id
left join record_alarm t4 on t3.Sensor_Id = t4.Sensor_Id and t1.AlarmType_Id = t4.AlarmType_Id
<where>
<if test="monitorunitId != null and monitorunitId != ''">and t1.MonitorUnit_Id = #{monitorunitId}</if>
</where>
group by t1.AlarmModule_Text
group by t1.AlarmModule_Text,t1.Order_Flag
order by t1.Order_Flag
</select>
</mapper>
Loading…
Cancel
Save