Commit 81523b04 authored by 耿迪迪's avatar 耿迪迪

设备监测

parent 6b87fec3
...@@ -62,7 +62,7 @@ spring: ...@@ -62,7 +62,7 @@ spring:
# 端口,默认为6379 # 端口,默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 4 database: 0
# 密码 # 密码
password: password:
# 连接超时时间 # 连接超时时间
......
package com.zehong.system.domain; package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal; import com.zehong.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 报警器报警记录对象 t_gas_alarm * 报警器报警记录对象 t_gas_alarm
* *
* @author zehong * @author zehong
* @date 2024-09-10 * @date 2026-04-16
*/ */
public class TGasAlarm extends BaseEntity public class TGasAlarm {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
...@@ -27,204 +24,156 @@ public class TGasAlarm extends BaseEntity ...@@ -27,204 +24,156 @@ public class TGasAlarm extends BaseEntity
private String number; private String number;
/** 设备状态 */ /** 设备状态 */
@Excel(name = "设备状态") @Excel(name = "设备状态",dictType = "t_device_status")
private Integer reportStatus; private Integer reportStatus;
/** 安装位置 */
@Excel(name = "安装位置")
private String position;
/** $column.columnComment */ /** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date starttime; private Date starttime;
/** $column.columnComment */ /** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endtime; private Date endtime;
/** $column.columnComment */ /** $column.columnComment */
@Excel(name = "上报数值") @Excel(name = "上报参数")
private String nd; private String params;
/** $column.columnComment */ /** 本次报警状态,0是已结束,1是报警中,2是报警中离线 */
private String paramsData; @Excel(name = "本次报警状态",dictType = "t_gas_alarm_status")
/** 报警状态 */
@Excel(name = "报警状态",dictType = "t_gas_alarm_status\n")
private Integer status; private Integer status;
/** 类型 */ /** 报警原因,0是未处置,1是误报,2是真实报警,9是其他原因 */
@Excel(name = "类型",dictType = "t_gas_alarm_type")
private Integer type;
/** 报警原因 */
@Excel(name = "报警原因",dictType = "t_gas_alarm_reason") @Excel(name = "报警原因",dictType = "t_gas_alarm_reason")
private Integer reason; private Integer reason;
/** $column.columnComment */ /** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt; private Date createdAt;
/** $column.columnComment */ /** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt; private Date updatedAt;
private BigDecimal longitude; @Excel(name="处置结果")
private String remark;
private BigDecimal latitude; public void setId(Long id)
public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setNumber(String number) public void setNumber(String number)
{ {
this.number = number; this.number = number;
} }
public String getNumber() public String getNumber()
{ {
return number; return number;
} }
public void setReportStatus(Integer reportStatus) public void setReportStatus(Integer reportStatus)
{ {
this.reportStatus = reportStatus; this.reportStatus = reportStatus;
} }
public Integer getReportStatus() public Integer getReportStatus()
{ {
return reportStatus; return reportStatus;
} }
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public void setStarttime(Date starttime) public void setStarttime(Date starttime)
{ {
this.starttime = starttime; this.starttime = starttime;
} }
public Date getStarttime() public Date getStarttime()
{ {
return starttime; return starttime;
} }
public void setEndtime(Date endtime) public void setEndtime(Date endtime)
{ {
this.endtime = endtime; this.endtime = endtime;
} }
public Date getEndtime() public Date getEndtime()
{ {
return endtime; return endtime;
} }
public void setNd(String nd) public void setParams(String params)
{ {
this.nd = nd; this.params = params;
} }
public String getNd() public String getParams()
{ {
return nd; return params;
}
public String getParamsData() {
return paramsData;
} }
public void setParamsData(String paramsData) {
this.paramsData = paramsData;
}
public void setStatus(Integer status) public void setStatus(Integer status)
{ {
this.status = status; this.status = status;
} }
public Integer getStatus() public Integer getStatus()
{ {
return status; return status;
} }
public void setType(Integer type) public void setReason(Integer reason)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setReason(Integer reason)
{ {
this.reason = reason; this.reason = reason;
} }
public Integer getReason() public Integer getReason()
{ {
return reason; return reason;
} }
public void setCreatedAt(Date createdAt) public void setCreatedAt(Date createdAt)
{ {
this.createdAt = createdAt; this.createdAt = createdAt;
} }
public Date getCreatedAt() public Date getCreatedAt()
{ {
return createdAt; return createdAt;
} }
public void setUpdatedAt(Date updatedAt) public void setUpdatedAt(Date updatedAt)
{ {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public Date getUpdatedAt() public Date getUpdatedAt()
{ {
return updatedAt; return updatedAt;
} }
public BigDecimal getLongitude() { public String getRemark() {
return longitude; return remark;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
} }
public void setLatitude(BigDecimal latitude) { public void setRemark(String remark) {
this.latitude = latitude; this.remark = remark;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("number", getNumber()) .append("number", getNumber())
.append("reportStatus", getReportStatus()) .append("reportStatus", getReportStatus())
.append("starttime", getStarttime()) .append("starttime", getStarttime())
.append("endtime", getEndtime()) .append("endtime", getEndtime())
.append("nd", getNd()) .append("params", getParams())
.append("params", getParams()) .append("status", getStatus())
.append("status", getStatus()) .append("reason", getReason())
.append("type", getType()) .append("createdAt", getCreatedAt())
.append("reason", getReason()) .append("updatedAt", getUpdatedAt())
.append("remark", getRemark()) .toString();
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
} }
} }
...@@ -10,9 +10,9 @@ import com.zehong.common.core.domain.BaseEntity; ...@@ -10,9 +10,9 @@ import com.zehong.common.core.domain.BaseEntity;
/** /**
* 监测设备数据对象 t_gas_data * 监测设备数据对象 t_gas_data
* *
* @author zehong * @author zehong
* @date 2024-03-02 * @date 2026-04-16
*/ */
public class TGasData extends BaseEntity public class TGasData extends BaseEntity
{ {
...@@ -25,59 +25,44 @@ public class TGasData extends BaseEntity ...@@ -25,59 +25,44 @@ public class TGasData extends BaseEntity
@Excel(name = "设备编号") @Excel(name = "设备编号")
private String number; private String number;
@Excel(name = "所属厂家",dictType = "t_gas_alarm_type") /** 设备类型*/
private Integer type; @Excel(name = "设备类型")
private String type;
/** 所属厂家:1如阳科技,2海康威视 */
@Excel(name = "所属厂家",readConverterExp = "1=如阳科技,2=海康威视")
private Integer company;
/** 安装位置 */ /** 安装位置 */
@Excel(name = "安装位置") @Excel(name = "安装位置")
private String position; private String position;
/** 高报 */ /** ccid */
@Excel(name = "高报") @Excel(name = "ccid")
private Long highAlarm; private String ccid;
/** 高高报 */
@Excel(name = "高高报")
private Long highHighAlarm;
/** 低报 */
@Excel(name = "低报")
private Long lowAlarm;
/** 低低报 */
@Excel(name = "低低报")
private Long lowLowAlarm;
/** 量程 */ /** imei */
@Excel(name = "量程") @Excel(name = "imei")
private String range; private String imei;
/** 单位 */ /** 联系人 */
@Excel(name = "单位") //@Excel(name = "联系人")
private String unit; private String contacts;
/** 位号 */
@Excel(name = "位号")
private String tag;
/** $column.columnComment */ /** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt; private Date createdAt;
/** $column.columnComment */
@Excel(name = "经度") @Excel(name = "经度")
private BigDecimal longitude; private BigDecimal longitude;
/** $column.columnComment */
@Excel(name = "纬度") @Excel(name = "纬度")
private BigDecimal latitude; private BigDecimal latitude;
private String contacts;
@Excel(name = "联系人")
private String contactsName;
private String contactsTel;
/**上报状态*/ /**上报状态*/
private String reportStatus; private String reportStatus;
...@@ -87,104 +72,104 @@ public class TGasData extends BaseEntity ...@@ -87,104 +72,104 @@ public class TGasData extends BaseEntity
/**上报时间*/ /**上报时间*/
private String reportTime; private String reportTime;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setNumber(String number) public void setCompany(Integer company)
{ {
this.number = number; this.company = company;
} }
public String getNumber() public Integer getCompany()
{ {
return number; return company;
} }
public void setPosition(String position) public void setType(String type)
{ {
this.position = position; this.type = type;
} }
public String getPosition() public String getType()
{ {
return position; return type;
} }
public void setHighAlarm(Long highAlarm) public void setNumber(String number)
{ {
this.highAlarm = highAlarm; this.number = number;
} }
public Long getHighAlarm() public String getNumber()
{ {
return highAlarm; return number;
} }
public void setHighHighAlarm(Long highHighAlarm) public void setPosition(String position)
{ {
this.highHighAlarm = highHighAlarm; this.position = position;
} }
public Long getHighHighAlarm() public String getPosition()
{ {
return highHighAlarm; return position;
} }
public void setLowAlarm(Long lowAlarm) public void setCcid(String ccid)
{ {
this.lowAlarm = lowAlarm; this.ccid = ccid;
} }
public Long getLowAlarm() public String getCcid()
{ {
return lowAlarm; return ccid;
} }
public void setLowLowAlarm(Long lowLowAlarm) public void setImei(String imei)
{ {
this.lowLowAlarm = lowLowAlarm; this.imei = imei;
} }
public Long getLowLowAlarm() public String getImei()
{ {
return lowLowAlarm; return imei;
} }
public void setRange(String range) public void setContacts(String contacts)
{ {
this.range = range; this.contacts = contacts;
} }
public String getRange() public String getContacts()
{ {
return range; return contacts;
} }
public void setUnit(String unit) public void setCreatedAt(Date createdAt)
{ {
this.unit = unit; this.createdAt = createdAt;
} }
public String getUnit() public Date getCreatedAt()
{ {
return unit; return createdAt;
} }
public void setTag(String tag) public void setLongitude(BigDecimal longitude)
{ {
this.tag = tag; this.longitude = longitude;
} }
public String getTag() public BigDecimal getLongitude()
{ {
return tag; return longitude;
} }
public void setCreatedAt(Date createdAt) public void setLatitude(BigDecimal latitude)
{ {
this.createdAt = createdAt; this.latitude = latitude;
} }
public Date getCreatedAt() public BigDecimal getLatitude()
{ {
return createdAt; return latitude;
} }
public String getReportStatus() { public String getReportStatus() {
...@@ -211,68 +196,21 @@ public class TGasData extends BaseEntity ...@@ -211,68 +196,21 @@ public class TGasData extends BaseEntity
this.reportTime = reportTime; this.reportTime = reportTime;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public String getContacts() {
return contacts;
}
public void setContacts(String contacts) {
this.contacts = contacts;
}
public String getContactsName() {
return contactsName;
}
public void setContactsName(String contactsName) {
this.contactsName = contactsName;
}
public String getContactsTel() {
return contactsTel;
}
public void setContactsTel(String contactsTel) {
this.contactsTel = contactsTel;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("number", getNumber()) .append("company", getCompany())
.append("position", getPosition()) .append("type", getType())
.append("highAlarm", getHighAlarm()) .append("number", getNumber())
.append("highHighAlarm", getHighHighAlarm()) .append("position", getPosition())
.append("lowAlarm", getLowAlarm()) .append("ccid", getCcid())
.append("lowLowAlarm", getLowLowAlarm()) .append("imei", getImei())
.append("range", getRange()) .append("remark", getRemark())
.append("unit", getUnit()) .append("contacts", getContacts())
.append("tag", getTag()) .append("createdAt", getCreatedAt())
.append("createdAt", getCreatedAt()) .append("longitude", getLongitude())
.toString(); .append("latitude", getLatitude())
.toString();
} }
} }
...@@ -74,29 +74,13 @@ public class TGasAlarmServiceImpl implements ITGasAlarmService ...@@ -74,29 +74,13 @@ public class TGasAlarmServiceImpl implements ITGasAlarmService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateTGasAlarm(TGasAlarm tGasAlarm) public int updateTGasAlarm(TGasAlarm tGasAlarm) {
{
if(2 == tGasAlarm.getType()){
tGasAlarm.setEndtime(new Date());
tGasAlarm.setStatus(0);
}
int i = tGasAlarmMapper.updateTGasAlarm(tGasAlarm); int i = tGasAlarmMapper.updateTGasAlarm(tGasAlarm);
if(i >0 && null != tGasAlarm.getReason() && !StringUtils.isEmpty(tGasAlarm.getRemark())){ if(i >0 && null != tGasAlarm.getReason() && !StringUtils.isEmpty(tGasAlarm.getRemark())){
//2为安博汇设备特殊处理 JSONObject alarmInfo = redisCache.getCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()));
if(2 == tGasAlarm.getType()){ if(null != alarmInfo){
if(!StringUtils.isEmpty(tGasAlarm.getNumber())){ alarmInfo.put("reason",tGasAlarm.getReason());
redisCache.redisTemplate.opsForHash().delete("alarm_id",tGasAlarm.getNumber()); redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo);
if(null == redisCache.getCacheMapValue("alarm_id",tGasAlarm.getNumber())){
redisCache.redisTemplate.opsForHash().delete("gas_warning",String.valueOf(tGasAlarm.getId()));
}
}
}else{
JSONObject alarmInfo = redisCache.getCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()));
if(null != alarmInfo){
alarmInfo.put("reason",tGasAlarm.getReason());
redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo);
}
} }
} }
return i; return i;
......
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zehong.common.core.redis.RedisCache; import com.zehong.common.core.redis.RedisCache;
import com.zehong.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TGasDataMapper; import com.zehong.system.mapper.TGasDataMapper;
...@@ -33,9 +34,17 @@ public class TGasDataServiceImpl implements ITGasDataService ...@@ -33,9 +34,17 @@ public class TGasDataServiceImpl implements ITGasDataService
* @return 监测设备数据 * @return 监测设备数据
*/ */
@Override @Override
public TGasData selectTGasDataById(Long id) public TGasData selectTGasDataById(Long id) {
{ TGasData data = tGasDataMapper.selectTGasDataById(id);
return tGasDataMapper.selectTGasDataById(id); if(StringUtils.isNotEmpty(data.getNumber())){
JSONObject gasData = redisCache.getCacheMapValue("devices_report",data.getNumber());
if(null != gasData){
data.setReportStatus(gasData.getString("status"));
data.setReportParam(gasData.getString("values"));
data.setReportTime(gasData.getString("time"));
}
}
return data;
} }
/** /**
...@@ -51,7 +60,7 @@ public class TGasDataServiceImpl implements ITGasDataService ...@@ -51,7 +60,7 @@ public class TGasDataServiceImpl implements ITGasDataService
JSONObject gasData = redisCache.getCacheMapValue("devices_report",item.getNumber()); JSONObject gasData = redisCache.getCacheMapValue("devices_report",item.getNumber());
if(null != gasData){ if(null != gasData){
item.setReportStatus(gasData.getString("status")); item.setReportStatus(gasData.getString("status"));
item.setReportParam(gasData.getString("value") + item.getUnit()); item.setReportParam(gasData.getString("values"));
item.setReportTime(gasData.getString("time")); item.setReportTime(gasData.getString("time"));
} }
}); });
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasAlarmMapper"> <mapper namespace="com.zehong.system.mapper.TGasAlarmMapper">
<resultMap type="TGasAlarm" id="TGasAlarmResult"> <resultMap type="TGasAlarm" id="TGasAlarmResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="number" column="number" /> <result property="number" column="number" />
<result property="reportStatus" column="report_status" /> <result property="reportStatus" column="report_status" />
<result property="position" column="position" />
<result property="starttime" column="starttime" /> <result property="starttime" column="starttime" />
<result property="endtime" column="endtime" /> <result property="endtime" column="endtime" />
<result property="nd" column="nd" /> <result property="params" column="params" />
<result property="paramsData" column="params" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="type" column="type" />
<result property="reason" column="reason" /> <result property="reason" column="reason" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
...@@ -22,76 +19,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,76 +19,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTGasAlarmVo"> <sql id="selectTGasAlarmVo">
SELECT select id, number, report_status, starttime, endtime, params, status, reason, remark, created_at, updated_at from t_gas_alarm
alarm.id,
alarm.number,
alarm.report_status,
alarm.position,
alarm.starttime,
alarm.endtime,
alarm.nd,
alarm.params,
alarm.status,
alarm.type,
alarm.reason,
alarm.remark,
alarm.created_at,
alarm.updated_at,
gas.longitude,
gas.latitude
FROM
t_gas_alarm alarm
LEFT JOIN t_gas_data gas ON gas.number = alarm.number
</sql> </sql>
<select id="selectTGasAlarmList" parameterType="TGasAlarm" resultMap="TGasAlarmResult"> <select id="selectTGasAlarmList" parameterType="TGasAlarm" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/> <include refid="selectTGasAlarmVo"/>
<where> <where>
<if test="number != null and number != ''"> and alarm.number like concat('%', #{number}, '%')</if> <if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<if test="status != null "> and alarm.status = #{status}</if> <if test="reportStatus != null "> and report_status = #{reportStatus}</if>
<if test="type != null "> and alarm.type = #{type}</if> <if test="starttime != null "> and starttime = #{starttime}</if>
<if test="reason != null "> and alarm.reason = #{reason}</if> <if test="endtime != null "> and endtime = #{endtime}</if>
<if test="params != null and params != ''"> and params = #{params}</if>
<if test="status != null "> and status = #{status}</if>
<if test="reason != null "> and reason = #{reason}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where> </where>
order by alarm.starttime desc
</select> </select>
<select id="selectTGasAlarmById" parameterType="Long" resultMap="TGasAlarmResult"> <select id="selectTGasAlarmById" parameterType="Long" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/> <include refid="selectTGasAlarmVo"/>
where alarm.id = #{id} where id = #{id}
</select> </select>
<insert id="insertTGasAlarm" parameterType="TGasAlarm" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTGasAlarm" parameterType="TGasAlarm" useGeneratedKeys="true" keyProperty="id">
insert into t_gas_alarm insert into t_gas_alarm
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if> <if test="number != null">number,</if>
<if test="reportStatus != null">report_status,</if> <if test="reportStatus != null">report_status,</if>
<if test="position != null">`position`,</if>
<if test="starttime != null">starttime,</if> <if test="starttime != null">starttime,</if>
<if test="endtime != null">endtime,</if> <if test="endtime != null">endtime,</if>
<if test="nd != null">nd,</if> <if test="params != null">params,</if>
<if test="paramsData != null">params,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="reason != null">reason,</if> <if test="reason != null">reason,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="number != null">#{number},</if> <if test="number != null">#{number},</if>
<if test="reportStatus != null">#{reportStatus},</if> <if test="reportStatus != null">#{reportStatus},</if>
<if test="position != null">#{position},</if>
<if test="starttime != null">#{starttime},</if> <if test="starttime != null">#{starttime},</if>
<if test="endtime != null">#{endtime},</if> <if test="endtime != null">#{endtime},</if>
<if test="nd != null">#{nd},</if> <if test="params != null">#{params},</if>
<if test="paramsData != null">#{paramsData},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="reason != null">#{reason},</if> <if test="reason != null">#{reason},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
</trim> </trim>
</insert> </insert>
<update id="updateTGasAlarm" parameterType="TGasAlarm"> <update id="updateTGasAlarm" parameterType="TGasAlarm">
...@@ -99,13 +75,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -99,13 +75,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if> <if test="number != null">number = #{number},</if>
<if test="reportStatus != null">report_status = #{reportStatus},</if> <if test="reportStatus != null">report_status = #{reportStatus},</if>
<if test="position != null">`position` = #{position},</if>
<if test="starttime != null">starttime = #{starttime},</if> <if test="starttime != null">starttime = #{starttime},</if>
<if test="endtime != null">endtime = #{endtime},</if> <if test="endtime != null">endtime = #{endtime},</if>
<if test="nd != null">nd = #{nd},</if> <if test="params != null">params = #{params},</if>
<if test="paramsData != null">params = #{paramsData},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if> <if test="reason != null">reason = #{reason},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
...@@ -119,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -119,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTGasAlarmByIds" parameterType="String"> <delete id="deleteTGasAlarmByIds" parameterType="String">
delete from t_gas_alarm where id in delete from t_gas_alarm where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasDataMapper"> <mapper namespace="com.zehong.system.mapper.TGasDataMapper">
<resultMap type="TGasData" id="TGasDataResult"> <resultMap type="TGasData" id="TGasDataResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="number" column="number" /> <result property="company" column="company" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="number" column="number" />
<result property="position" column="position" /> <result property="position" column="position" />
<result property="highAlarm" column="high_alarm" /> <result property="ccid" column="ccid" />
<result property="highHighAlarm" column="high_high_alarm" /> <result property="imei" column="imei" />
<result property="lowAlarm" column="low_alarm" /> <result property="remark" column="remark" />
<result property="lowLowAlarm" column="low_low_alarm" /> <result property="contacts" column="contacts" />
<result property="range" column="range" />
<result property="unit" column="unit" />
<result property="tag" column="tag" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
<result property="longitude" column="longitude" /> <result property="longitude" column="longitude" />
<result property="latitude" column="latitude" /> <result property="latitude" column="latitude" />
<result property="contacts" column="contacts" />
</resultMap> </resultMap>
<sql id="selectTGasDataVo"> <sql id="selectTGasDataVo">
SELECT select id, company, type, number, position, ccid, imei, remark, contacts, created_at, longitude, latitude from t_gas_data
id,
number,
type,
position,
high_alarm,
high_high_alarm,
low_alarm,
low_low_alarm,
`range`,
unit,
tag,
created_at,
longitude,
latitude,
contacts,
(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id,contacts)) as contactsName,
(select GROUP_CONCAT(NULLIF(phonenumber, '')) from sys_user where find_in_set(user_id,contacts)) as contactsTel
FROM
t_gas_data
</sql> </sql>
<select id="selectTGasDataList" parameterType="TGasData" resultMap="TGasDataResult"> <select id="selectTGasDataList" parameterType="TGasData" resultMap="TGasDataResult">
<include refid="selectTGasDataVo"/> <include refid="selectTGasDataVo"/>
<where> <where>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if> <if test="company != null "> and company = #{company}</if>
<if test="type != null "> and type = #{type}</if> <if test="type != null "> and type = #{type}</if>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<if test="position != null and position != ''"> and position like concat('%', #{position}, '%')</if> <if test="position != null and position != ''"> and position like concat('%', #{position}, '%')</if>
<if test="highAlarm != null "> and high_alarm = #{highAlarm}</if> <if test="ccid != null and ccid != ''"> and ccid = #{ccid}</if>
<if test="highHighAlarm != null "> and high_high_alarm = #{highHighAlarm}</if> <if test="imei != null and imei != ''"> and imei = #{imei}</if>
<if test="lowAlarm != null "> and low_alarm = #{lowAlarm}</if> <if test="contacts != null and contacts != ''"> and contacts = #{contacts}</if>
<if test="lowLowAlarm != null "> and low_low_alarm = #{lowLowAlarm}</if>
<if test="range != null and range != ''"> and range = #{range}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="tag != null and tag != ''"> and tag = #{tag}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
</where> </where>
</select> </select>
<select id="selectTGasDataById" parameterType="Long" resultMap="TGasDataResult"> <select id="selectTGasDataById" parameterType="Long" resultMap="TGasDataResult">
<include refid="selectTGasDataVo"/> <include refid="selectTGasDataVo"/>
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertTGasData" parameterType="TGasData" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTGasData" parameterType="TGasData" useGeneratedKeys="true" keyProperty="id">
insert into t_gas_data insert into t_gas_data
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if> <if test="company != null">company,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="number != null">number,</if>
<if test="position != null">position,</if> <if test="position != null">position,</if>
<if test="highAlarm != null">high_alarm,</if> <if test="ccid != null">ccid,</if>
<if test="highHighAlarm != null">high_high_alarm,</if> <if test="imei != null">imei,</if>
<if test="lowAlarm != null">low_alarm,</if> <if test="remark != null">remark,</if>
<if test="lowLowAlarm != null">low_low_alarm,</if> <if test="contacts != null">contacts,</if>
<if test="range != null">range,</if>
<if test="unit != null">unit,</if>
<if test="tag != null">tag,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="longitude != null">longitude,</if> <if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if> <if test="latitude != null">latitude,</if>
<if test="contacts != null">contacts,</if> </trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="number != null">#{number},</if> <if test="company != null">#{company},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="number != null">#{number},</if>
<if test="position != null">#{position},</if> <if test="position != null">#{position},</if>
<if test="highAlarm != null">#{highAlarm},</if> <if test="ccid != null">#{ccid},</if>
<if test="highHighAlarm != null">#{highHighAlarm},</if> <if test="imei != null">#{imei},</if>
<if test="lowAlarm != null">#{lowAlarm},</if> <if test="remark != null">#{remark},</if>
<if test="lowLowAlarm != null">#{lowLowAlarm},</if> <if test="contacts != null">#{contacts},</if>
<if test="range != null">#{range},</if>
<if test="unit != null">#{unit},</if>
<if test="tag != null">#{tag},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="longitude != null">#{longitude},</if> <if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if> <if test="latitude != null">#{latitude},</if>
<if test="contacts != null">#{contacts},</if> </trim>
</trim>
</insert> </insert>
<update id="updateTGasData" parameterType="TGasData"> <update id="updateTGasData" parameterType="TGasData">
update t_gas_data update t_gas_data
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if> <if test="company != null">company = #{company},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="number != null">number = #{number},</if>
<if test="position != null">position = #{position},</if> <if test="position != null">position = #{position},</if>
<if test="highAlarm != null">high_alarm = #{highAlarm},</if> <if test="ccid != null">ccid = #{ccid},</if>
<if test="highHighAlarm != null">high_high_alarm = #{highHighAlarm},</if> <if test="imei != null">imei = #{imei},</if>
<if test="lowAlarm != null">low_alarm = #{lowAlarm},</if> <if test="remark != null">remark = #{remark},</if>
<if test="lowLowAlarm != null">low_low_alarm = #{lowLowAlarm},</if> <if test="contacts != null">contacts = #{contacts},</if>
<if test="range != null">range = #{range},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="tag != null">tag = #{tag},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
<if test="longitude != null">longitude = #{longitude},</if> <if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if> <if test="latitude != null">latitude = #{latitude},</if>
<if test="contacts != null">contacts = #{contacts},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -129,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -129,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTGasDataByIds" parameterType="String"> <delete id="deleteTGasDataByIds" parameterType="String">
delete from t_gas_data where id in delete from t_gas_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
......
...@@ -11,17 +11,11 @@ ...@@ -11,17 +11,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备状态"> <el-form-item label="设备状态">
<span v-if="detailInfo.reportStatus">{{ detailInfo.reportStatus }}</span> <span v-if="detailInfo.reportStatus">{{ $parent.deviceStatusFormat(detailInfo) }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="安装位置">
<span v-if="detailInfo.position">{{ detailInfo.position }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="报警开始时间"> <el-form-item label="报警开始时间">
...@@ -38,8 +32,8 @@ ...@@ -38,8 +32,8 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上报数值"> <el-form-item label="上报参数">
<span v-if="detailInfo.nd">{{ detailInfo.nd }}</span> <span v-if="detailInfo.params">{{ detailInfo.params }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -50,15 +44,9 @@ ...@@ -50,15 +44,9 @@
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="所属厂家">
<span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="处置类型"> <el-form-item label="处置类型">
<span v-if="detailInfo.reason">{{ $parent.reasonFormat(detailInfo) }}</span> <span v-if="detailInfo.reason+ ''">{{ $parent.reasonFormat(detailInfo) }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
......
...@@ -20,16 +20,6 @@ ...@@ -20,16 +20,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属厂家" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择所属厂家" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="处置类型" prop="reason"> <el-form-item label="处置类型" prop="reason">
<el-select v-model="queryParams.reason" placeholder="请选择处置类型" clearable size="small"> <el-select v-model="queryParams.reason" placeholder="请选择处置类型" clearable size="small">
<el-option <el-option
...@@ -97,7 +87,6 @@ ...@@ -97,7 +87,6 @@
<!--<el-table-column type="selection" width="55" align="center" />--> <!--<el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="设备编号" align="center" prop="number" /> <el-table-column label="设备编号" align="center" prop="number" />
<el-table-column label="设备状态" align="center" prop="reportStatus" :formatter="deviceStatusFormat"/> <el-table-column label="设备状态" align="center" prop="reportStatus" :formatter="deviceStatusFormat"/>
<el-table-column label="安装位置" align="center" prop="position" :show-overflow-tooltip="true"/>
<el-table-column label="报警开始时间" align="center" prop="starttime"> <el-table-column label="报警开始时间" align="center" prop="starttime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
...@@ -109,9 +98,8 @@ ...@@ -109,9 +98,8 @@
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上报数值" align="center" prop="nd" /> <el-table-column label="上报参数" align="center" prop="params" :show-overflow-tooltip="true"/>
<el-table-column label="报警状态" align="center" prop="status" :formatter="statusFormat" /> <el-table-column label="报警状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="所属厂家" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="处置类型" align="center" prop="reason" :formatter="reasonFormat" /> <el-table-column label="处置类型" align="center" prop="reason" :formatter="reasonFormat" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -326,6 +314,7 @@ export default { ...@@ -326,6 +314,7 @@ export default {
}, },
// 报警原因字典翻译 // 报警原因字典翻译
reasonFormat(row, column) { reasonFormat(row, column) {
console.log("=======",row)
const reason = this.selectDictLabel(this.reasonOptions, row.reason); const reason = this.selectDictLabel(this.reasonOptions, row.reason);
return reason ? reason : '-'; return reason ? reason : '-';
}, },
......
...@@ -11,74 +11,46 @@ ...@@ -11,74 +11,46 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="所属厂家"> <el-form-item label="设备类型">
<span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span> <span v-if="detailInfo.type">{{ detailInfo.type }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="位号"> <el-form-item label="所属厂家">
<span>{{ detailInfo.tag }}</span> <span v-if="detailInfo.company">{{ $parent.companyFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="12">
<el-form-item label="安装位置"> <el-form-item label="安装位置">
<span>{{ detailInfo.position }}</span> <span>{{ detailInfo.position }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="高报"> <el-form-item label="上报状态">
<span v-if="detailInfo.highAlarm">{{ detailInfo.highAlarm }}</span> <span v-if="detailInfo.reportStatus">{{ $parent.deviceStatusFormat(detailInfo) }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="高高报"> <el-form-item label="上报时间">
<span v-if="detailInfo.highHighAlarm">{{ detailInfo.highHighAlarm }}</span> <span v-if="detailInfo.reportTime">{{ detailInfo.reportTime }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="低报"> <el-form-item label="上报参数">
<span v-if="detailInfo.lowAlarm">{{ detailInfo.lowAlarm }}</span> <span v-if="detailInfo.reportParam">{{ detailInfo.reportParam }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="低低报">
<span v-if="detailInfo.lowLowAlarm">{{ detailInfo.lowLowAlarm }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程">
<span v-if="detailInfo.range">{{ detailInfo.range }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位">
<span v-if="detailInfo.unit">{{ detailInfo.unit }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<span v-if="detailInfo.contactsName">{{ detailInfo.contactsName }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="创建时间">
<span v-if="detailInfo.createdAt">{{ detailInfo.createdAt }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-col> </el-col>
......
This diff is collapsed.
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