change - 异常数据记录批量处理

main
wenjy 3 years ago
parent 5a128d1a14
commit 381fbb6a36

@ -115,6 +115,29 @@ public class RecordAlarmController extends BaseController
return toAjax(recordAlarmService.updateRecordAlarm(recordAlarm)); return toAjax(recordAlarmService.updateRecordAlarm(recordAlarm));
} }
@PostMapping("/batchProcessing")
@ResponseBody
public AjaxResult batchProcessing(String alarmuid,String disposeMode,String alarmReason){
boolean success = false;
List<String> strings = JSONArray.parseArray(alarmuid, String.class);
try{
for (String string : strings) {
RecordAlarm recordAlarm =new RecordAlarm();
recordAlarm.setAlarmuid(string);
recordAlarm.setDisposeFlag(1L);
recordAlarm.setDisposeMode(disposeMode);
recordAlarm.setAlarmReason(alarmReason);
int i = recordAlarmService.updateRecordAlarm(recordAlarm);
}
success = true;
}catch (Exception ex){
success = false;
}
return toAjax(success);
}
/** /**
* *
*/ */

@ -40,8 +40,19 @@
<input type="text" name="alarmtypeId"/> <input type="text" name="alarmtypeId"/>
</li> </li>
<li> <li>
<label>处理状态:</label>
<select name="disposeFlag" th:with="type=${@dict.getType('dispose_flag')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li class="select-time">
<label>采集时间:</label> <label>采集时间:</label>
<input type="text" name="collectTime"/> <input type="text" class="time-input" id="startTime" placeholder="开始时间"
name="beginCollectTime"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
name="endCollectTime"/>
</li> </li>
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
@ -78,9 +89,11 @@
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js"/> <th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/> <th:block th:include="include :: ztree-js"/>
<script th:src="@{/js/Iot-ui/MiniDialog-es5.min.js}"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('record:recordAlarm:edit')}]]; var editFlag = [[${@permission.hasPermi('record:recordAlarm:edit')}]];
var removeFlag = [[${@permission.hasPermi('record:recordAlarm:remove')}]]; var removeFlag = [[${@permission.hasPermi('record:recordAlarm:remove')}]];
var disposeFlag = [[${@dict.getType('dispose_flag')}]];
var prefix = ctx + "record/recordAlarm"; var prefix = ctx + "record/recordAlarm";
$(function () { $(function () {
@ -114,7 +127,8 @@
}, },
{ {
field: 'alarmuid', field: 'alarmuid',
title: '告警编号' title: '告警编号',
visible: false
}, },
{ {
field: 'sensorId', field: 'sensorId',
@ -135,6 +149,20 @@
{ {
field: 'maxValue', field: 'maxValue',
title: '最大值' title: '最大值'
},{
field: 'disposeFlag',
title: '处理状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(disposeFlag, value);
}
},
{
field: 'alarmReason',
title: '告警原因'
},
{
field: 'disposeMode',
title: '处理方式'
}, },
{ {
field: 'collectTime', field: 'collectTime',
@ -176,9 +204,75 @@
}); });
function selectColumns() { function selectColumns() {
var column = $.table.selectColumns('alarmuid'); var columns = $.table.selectColumns('alarmuid');
alert(column.length); if(columns.length > 0){
alarmDisposeInfo(columns);
}else{
$.modal.msgError("请选择告警信息!!!");
}
}
<!-- laydate示例 -->
layui.use('laydate', function () {
var laydate = layui.laydate;
laydate.render({
elem: '#startTime',
type: 'datetime',
trigger: 'click'
});
laydate.render({
elem: '#endTime',
type: 'datetime',
trigger: 'click'
});
});
const alarmDisposeInfo = function (res) {
let html = `<div>
<p style="margin-top: 13px;">
<label>告警原因</label>
<input type="text" name="alarmReason" id="alarmReason" style="width: 70%;">
</p>
<p style="margin-top: 13px;">
<label>处理方式</label>
<input type="text" name="disposeMode" id="disposeMode" style="width: 70%;">
</p>
</div>`
Dialog({
title: "批量告警处理",
width: 600,
content: html,
ok: {
callback: function () {
$.post(prefix+"/batchProcessing",
{
alarmuid: JSON.stringify(res),
disposeMode: $("#disposeMode").val(),
alarmReason: $("#alarmReason").val()
},
function (data, status) {
if(status.includes("succ")){
$.modal.msgSuccess("告警处理成功");
}else{
$.modal.msgError("告警处理失败!!!");
}
});
}
}
});
} }
</script> </script>
<style>
.mini-dialog-footer {
text-align: right;
height: 63px;
padding: 15px 0;
border-top: #e6e6e6 solid 1px;
}
</style>
</body> </body>
</html> </html>

@ -51,6 +51,10 @@ public class RecordAlarm extends BaseEntity
/** 告警原因 */ /** 告警原因 */
private String alarmReason; private String alarmReason;
private String beginCollectTime;
private String endCollectTime;
public void setSensorId(String sensorId) public void setSensorId(String sensorId)
{ {
this.sensorId = sensorId; this.sensorId = sensorId;
@ -138,6 +142,22 @@ public class RecordAlarm extends BaseEntity
this.alarmuid = alarmuid; this.alarmuid = alarmuid;
} }
public String getBeginCollectTime() {
return beginCollectTime;
}
public void setBeginCollectTime(String beginCollectTime) {
this.beginCollectTime = beginCollectTime;
}
public String getEndCollectTime() {
return endCollectTime;
}
public void setEndCollectTime(String endCollectTime) {
this.endCollectTime = endCollectTime;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -44,11 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRecordAlarmVo"/> <include refid="selectRecordAlarmVo"/>
<where> <where>
<if test="sensorId != null and sensorId != ''"> and Sensor_Id = #{sensorId}</if> <if test="sensorId != null and sensorId != ''"> and Sensor_Id = #{sensorId}</if>
<if test="disposeFlag != null"> and Dispose_Flag = #{disposeFlag}</if>
<if test="alarmtypeId != null and alarmtypeId != ''"> and AlarmType_Id = #{alarmtypeId}</if> <if test="alarmtypeId != null and alarmtypeId != ''"> and AlarmType_Id = #{alarmtypeId}</if>
<if test="minValue != null "> and Min_Value = #{minValue}</if> <if test="minValue != null "> and Min_Value = #{minValue}</if>
<if test="alarmValue != null "> and Alarm_Value = #{alarmValue}</if> <if test="alarmValue != null "> and Alarm_Value = #{alarmValue}</if>
<if test="maxValue != null "> and Max_Value = #{maxValue}</if> <if test="maxValue != null "> and Max_Value = #{maxValue}</if>
<if test="collectTime != null and collectTime != ''"> and Collect_Time = #{collectTime}</if> <if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != '' ">and Collect_Time between #{beginCollectTime} and #{endCollectTime}</if>
</where> </where>
</select> </select>
@ -84,11 +85,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateRecordAlarm" parameterType="RecordAlarm"> <update id="updateRecordAlarm" parameterType="RecordAlarm">
update record_alarm update record_alarm
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<!--<if test="alarmtypeId != null">AlarmType_Id = #{alarmtypeId},</if>
<if test="minValue != null">Min_Value = #{minValue},</if>
<if test="alarmValue != null">Alarm_Value = #{alarmValue},</if>
<if test="maxValue != null">Max_Value = #{maxValue},</if>
<if test="collectTime != null">Collect_Time = #{collectTime},</if>-->
<if test="disposeFlag != null">Dispose_Flag = #{disposeFlag},</if> <if test="disposeFlag != null">Dispose_Flag = #{disposeFlag},</if>
<if test="disposeMode != null">Dispose_Mode = #{disposeMode},</if> <if test="disposeMode != null">Dispose_Mode = #{disposeMode},</if>
<if test="alarmReason != null">Alarm_Reason = #{alarmReason},</if> <if test="alarmReason != null">Alarm_Reason = #{alarmReason},</if>

Loading…
Cancel
Save