Commit 67b1486a authored by 王晓倩's avatar 王晓倩

预警信息模块

parent 840c34fa
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import com.zehong.system.domain.form.TDetectorReportDataQueryForm;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.service.ITDetectorReportDataService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气用户设备上报的数据Controller
*
* @author zehong
* @date 2022-03-04
*/
@RestController
@RequestMapping("/detector/detectorReportData")
public class TDetectorReportDataController extends BaseController
{
@Autowired
private ITDetectorReportDataService tDetectorReportDataService;
/**
* 查询燃气用户设备上报的数据列表
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:list')")
@GetMapping("/list")
public TableDataInfo list(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
startPage();
List<TDetectorReportData> list = tDetectorReportDataService.selectTDetectorReportDataList(tDetectorReportDataQueryForm);
return getDataTable(list);
}
/**
* 导出燃气用户设备上报的数据列表
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:export')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
List<TDetectorReportData> list = tDetectorReportDataService.selectTDetectorReportDataList(tDetectorReportDataQueryForm);
ExcelUtil<TDetectorReportData> util = new ExcelUtil<TDetectorReportData>(TDetectorReportData.class);
return util.exportExcel(list, "燃气用户设备上报的数据数据");
}
/**
* 获取燃气用户设备上报的数据详细信息
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tDetectorReportDataService.selectTDetectorReportDataById(id));
}
/**
* 新增燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:add')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDetectorReportData tDetectorReportData)
{
return toAjax(tDetectorReportDataService.insertTDetectorReportData(tDetectorReportData));
}
/**
* 修改燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:edit')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDetectorReportData tDetectorReportData)
{
return toAjax(tDetectorReportDataService.updateTDetectorReportData(tDetectorReportData));
}
/**
* 删除燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:remove')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tDetectorReportDataService.deleteTDetectorReportDataByIds(ids));
}
}
package com.zehong.system.domain.form;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class TDetectorReportDataQueryForm
{
//设备编号
private String detectorCode;
//状态名称
private String statusName;
//是否销警
private String isCancelAlarm;
/** 发现起始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeStart;
/** 发现截止时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeEnd;
/** 发现起始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date cancelTimeStart;
/** 发现截止时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date cancelTimeEnd;
}
package com.zehong.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
......@@ -9,7 +10,7 @@ import java.util.Date;
* @author zhangzhizhong
*
*/
@Data
public class TDetectorAlarmInfoVO {
// 设备编号
......@@ -25,49 +26,8 @@ public class TDetectorAlarmInfoVO {
private Date alarmTime;
// 处理状态
private String handledStatus;
public String getDetectorCode() {
return detectorCode;
}
public void setDetectorCode(String detectorCode) {
this.detectorCode = detectorCode;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getDetectorType() {
return detectorType;
}
public void setDetectorType(String detectorType) {
this.detectorType = detectorType;
}
public String getStatusName() {
return statusName;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public Date getAlarmTime() {
return alarmTime;
}
public void setAlarmTime(Date alarmTime) {
this.alarmTime = alarmTime;
}
public String getHandledStatus() {
return handledStatus;
}
public void setHandledStatus(String handledStatus) {
this.handledStatus = handledStatus;
}
// 销警时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date cancelTime;
}
......@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.domain.form.TDetectorReportDataQueryForm;
import com.zehong.system.domain.vo.TDetectorAlarmInfoVO;
import java.util.List;
......@@ -34,10 +35,10 @@ public interface TDetectorReportDataMapper
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @param tDetectorReportDataQueryForm 设备上报的数据
* @return 设备上报的数据集合
*/
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData);
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportDataQueryForm tDetectorReportDataQueryForm);
/**
* 新增设备上报的数据
......
......@@ -3,6 +3,7 @@ package com.zehong.system.service;
import com.github.pagehelper.PageInfo;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.domain.form.TDetectorReportDataQueryForm;
import com.zehong.system.domain.vo.TDetectorAlarmInfoVO;
import java.util.List;
......@@ -35,18 +36,18 @@ public interface ITDetectorReportDataService
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @param tDetectorReportDataQueryForm 设备上报的数据
* @return 设备上报的数据集合
*/
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData);
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportDataQueryForm tDetectorReportDataQueryForm);
/**
* 查询设备上报的数据分页列表
*
* @param tDetectorReportData 设备上报的数据
* @param tDetectorReportDataQueryForm 设备上报的数据
* @return 设备上报的数据分页集合
*/
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportData tDetectorReportData);
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportDataQueryForm tDetectorReportDataQueryForm);
/**
* 新增设备上报的数据
......
......@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.domain.form.TDetectorReportDataQueryForm;
import com.zehong.system.domain.vo.TDetectorAlarmInfoVO;
import com.zehong.system.mapper.TDetectorReportDataMapper;
import com.zehong.system.service.ITDetectorReportDataService;
......@@ -62,25 +63,25 @@ public class TDetectorReportDataServiceImpl implements ITDetectorReportDataServi
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @param tDetectorReportDataQueryForm 设备上报的数据
* @return 设备上报的数据
*/
@Override
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData)
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
return tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportData);
return tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportDataQueryForm);
}
/**
* 查询设备上报的数据分页列表
*
* @param tDetectorReportData 设备上报的数据
* @param tDetectorReportDataQueryForm 设备上报的数据
* @return 设备上报的数据
*/
@Override
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportData tDetectorReportData)
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
return new PageInfo(tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportData));
return new PageInfo(tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportDataQueryForm));
}
/**
......
......@@ -24,21 +24,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, source_id, detector_code, detector_status_id, status_name, report_value, zh_host_status_id, net_point, signal_strength, ip_address, create_time, is_cancel_alarm, cancel_time from t_detector_report_data
</sql>
<select id="selectTDetectorReportDataList" parameterType="TDetectorReportData" resultMap="TDetectorReportDataResult">
<include refid="selectTDetectorReportDataVo"/>
<where>
<if test="sourceId != null and sourceId != ''"> and source_id = #{sourceId}</if>
<if test="detectorCode != null and detectorCode != ''"> and detector_code = #{detectorCode}</if>
<if test="detectorStatusId != null and detectorStatusId != ''"> and detector_status_id = #{detectorStatusId}</if>
<if test="statusName != null and statusName != ''"> and status_name = #{statusName}</if>
<if test="reportValue != null "> and report_value = #{reportValue}</if>
<if test="zhHostStatusId != null "> and zh_host_status_id = #{zhHostStatusId}</if>
<if test="netPoint != null "> and net_point = #{netPoint}</if>
<if test="signalStrength != null "> and signal_strength = #{signalStrength}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<select id="selectTDetectorReportDataList" parameterType="TDetectorReportDataForm" resultType="TDetectorAlarmInfoVO">
select rd.id,
rd.cancel_time cancelTime,
rd.detector_code detectorCode,
CONCAT_WS("#",IFNULL(u.nick_name,IFNULL(di.linkman,di.detector_addr)),di.linkman) unitName,
di.detector_type detectorType,
rd.status_name statusName,
rd.create_time alarmTime,
rd.is_cancel_alarm handledStatus
FROM t_detector_report_data rd
LEFT JOIN t_detector_info di ON rd.detector_code = di.detector_code
LEFT JOIN t_detector_user u ON u.user_id = di.user_id
<where> u.is_del = '0' and di.is_del = '0'
<if test="detectorCode != null and detectorCode != ''"> and rd.detector_code = #{detectorCode}</if>
<if test="statusName != null and statusName != ''"> and rd.status_name = #{statusName}</if>
<if test="createTimeStart != null "> and rd.create_time &gt;= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and rd.create_time &lt;= #{createTimeEnd}</if>
<if test="isCancelAlarm != null and isCancelAlarm != ''"> and is_cancel_alarm = #{isCancelAlarm}</if>
<if test="cancelTime != null "> and cancel_time = #{cancelTime}</if>
<if test="cancelTimeStart != null "> and rd.cancel_time &gt;= #{cancelTimeStart}</if>
<if test="cancelTimeEnd != null "> and rd.cancel_time &lt;= #{cancelTimeEnd}</if>
</where>
ORDER BY rd.create_time desc
</select>
<select id="selectTDetectorReportDataById" parameterType="Long" resultMap="TDetectorReportDataResult">
......@@ -65,8 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'未消除',
'已消除'
) handledStatus
FROM
t_detector_report_data rd
FROM t_detector_report_data rd
LEFT JOIN t_detector_info di ON rd.detector_code = di.detector_code
LEFT JOIN t_detector_user u ON u.user_id = di.user_id
WHERE u.is_del = '0' and di.is_del = '0' and rd.is_cancel_alarm = '0'
......
import request from '@/utils/request'
// 查询燃气用户设备上报的数据列表
export function listDetectorReportData(query) {
return request({
url: '/detector/detectorReportData/list',
method: 'get',
params: query
})
}
// 查询燃气用户设备上报的数据详细
export function getDetectorReportData(id) {
return request({
url: '/detector/detectorReportData/' + id,
method: 'get'
})
}
// 新增燃气用户设备上报的数据
export function addDetectorReportData(data) {
return request({
url: '/detector/detectorReportData',
method: 'post',
data: data
})
}
// 修改燃气用户设备上报的数据
export function updateDetectorReportData(data) {
return request({
url: '/detector/detectorReportData',
method: 'put',
data: data
})
}
// 删除燃气用户设备上报的数据
export function delDetectorReportData(id) {
return request({
url: '/detector/detectorReportData/' + id,
method: 'delete'
})
}
// 导出燃气用户设备上报的数据
export function exportDetectorReportData(query) {
return request({
url: '/detector/detectorReportData/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="设备编号" prop="detectorCode">
<el-input
v-model="queryParams.detectorCode"
placeholder="请输入设备编号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="isCancelAlarm">
<el-select v-model="queryParams.isCancelAlarm" placeholder="请选择状态" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="预警时间" prop="createTime">
<el-date-picker clearable size="small"
v-model="queryParams.createTimeStart"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择起始时间">
</el-date-picker><span style="color: #bebfc3"> - </span>
<el-date-picker clearable size="small"
v-model="queryParams.createTimeEnd"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择截止时间">
</el-date-picker>
</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>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="detectorReportDataList">
<el-table-column label="所在单位" align="center" prop="unitName" />
<el-table-column label="设备编号" align="center" prop="detectorCode" />
<el-table-column label="设备类型" align="center" prop="detectorType">
<template slot-scope="scope">
<span v-if="scope.row.detectorType == '1'">家用探测器</span>
<span v-if="scope.row.detectorType == '2'">工业探测器</span>
</template>
</el-table-column>
<el-table-column label="预警信息" align="center" prop="statusName" />
<el-table-column label="预警时间" align="center" prop="alarmTime">
<template slot-scope="scope">
<span>{{ scope.row.alarmTime }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="handledStatus">
<template slot-scope="scope">
<span v-if="scope.row.handledStatus == '0'">未销警</span>
<span v-if="scope.row.handledStatus == '1'">自动消警</span>
<span v-if="scope.row.handledStatus == '2'">手动消警</span>
</template>
</el-table-column>
<el-table-column label="消警时间" align="center" prop="cancelTime">
<template slot-scope="scope">
<span>{{ scope.row.cancelTime }}</span>
</template>
</el-table-column>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-table>
</div>
</template>
<script>
import { listDetectorReportData } from "@/api/detector/detectorReportData";
export default {
name: "DetectorReportData",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 燃气用户设备上报的数据表格数据
detectorReportDataList: [],
// 字典
typeOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
detectorCode: null,
statusName: null,
isCancelAlarm: null,
createTimeStart: null,
createTimeEnd: null
},
};
},
created() {
this.getList();
this.getDicts("t_detector_report_status").then(response => {
this.typeOptions = response.data;
});
},
methods: {
/** 查询燃气用户设备上报的数据列表 */
getList() {
this.loading = true;
listDetectorReportData(this.queryParams).then(response => {
this.detectorReportDataList = response.rows;
console.log(this.detectorReportDataList);
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment