消防数据存表
This commit is contained in:
@ -42,6 +42,11 @@ public class RedisKeyConstants
|
|||||||
*/
|
*/
|
||||||
public static final String DH = "DH_";
|
public static final String DH = "DH_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消防数据 redis key
|
||||||
|
*/
|
||||||
|
public static final String XF = "XF_";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电池组 redis key
|
* 电池组 redis key
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.xzzn.ems.domain;
|
||||||
|
|
||||||
|
import com.xzzn.common.core.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.xzzn.common.annotation.Excel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点topic配置对象 ems_mqtt_topic_config
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-10-21
|
||||||
|
*/
|
||||||
|
public class EmsMqttTopicConfig extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 站点id */
|
||||||
|
@Excel(name = "站点id")
|
||||||
|
private String siteId;
|
||||||
|
|
||||||
|
/** 订阅topic */
|
||||||
|
@Excel(name = "订阅topic")
|
||||||
|
private String mqttTopic;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(String siteId)
|
||||||
|
{
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSiteId()
|
||||||
|
{
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMqttTopic(String mqttTopic)
|
||||||
|
{
|
||||||
|
this.mqttTopic = mqttTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMqttTopic()
|
||||||
|
{
|
||||||
|
return mqttTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("siteId", getSiteId())
|
||||||
|
.append("mqttTopic", getMqttTopic())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
151
ems-system/src/main/java/com/xzzn/ems/domain/EmsXfData.java
Normal file
151
ems-system/src/main/java/com/xzzn/ems/domain/EmsXfData.java
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
package com.xzzn.ems.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xzzn.common.core.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.xzzn.common.annotation.Excel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消防数据对象 ems_xf_data
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-10-21
|
||||||
|
*/
|
||||||
|
public class EmsXfData extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据采集时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "数据采集时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date dataTimestamp;
|
||||||
|
|
||||||
|
/** 主电源备用电池状态 */
|
||||||
|
@Excel(name = "主电源备用电池状态")
|
||||||
|
private BigDecimal dczt;
|
||||||
|
|
||||||
|
/** 手自动状态延时状态 */
|
||||||
|
@Excel(name = "手自动状态延时状态")
|
||||||
|
private BigDecimal yszt;
|
||||||
|
|
||||||
|
/** 启动喷洒气体喷洒状态 */
|
||||||
|
@Excel(name = "启动喷洒气体喷洒状态")
|
||||||
|
private BigDecimal pszt;
|
||||||
|
|
||||||
|
/** 压力开关状态电磁阀状态 */
|
||||||
|
@Excel(name = "压力开关状态电磁阀状态")
|
||||||
|
private BigDecimal dcfzt;
|
||||||
|
|
||||||
|
/** 站点id */
|
||||||
|
@Excel(name = "站点id")
|
||||||
|
private String siteId;
|
||||||
|
|
||||||
|
/** 设备唯一标识符 */
|
||||||
|
@Excel(name = "设备唯一标识符")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataTimestamp(Date dataTimestamp)
|
||||||
|
{
|
||||||
|
this.dataTimestamp = dataTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataTimestamp()
|
||||||
|
{
|
||||||
|
return dataTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDczt(BigDecimal dczt)
|
||||||
|
{
|
||||||
|
this.dczt = dczt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDczt()
|
||||||
|
{
|
||||||
|
return dczt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYszt(BigDecimal yszt)
|
||||||
|
{
|
||||||
|
this.yszt = yszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getYszt()
|
||||||
|
{
|
||||||
|
return yszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPszt(BigDecimal pszt)
|
||||||
|
{
|
||||||
|
this.pszt = pszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPszt()
|
||||||
|
{
|
||||||
|
return pszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDcfzt(BigDecimal dcfzt)
|
||||||
|
{
|
||||||
|
this.dcfzt = dcfzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDcfzt()
|
||||||
|
{
|
||||||
|
return dcfzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(String siteId)
|
||||||
|
{
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSiteId()
|
||||||
|
{
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId)
|
||||||
|
{
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId()
|
||||||
|
{
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("dataTimestamp", getDataTimestamp())
|
||||||
|
.append("dczt", getDczt())
|
||||||
|
.append("yszt", getYszt())
|
||||||
|
.append("pszt", getPszt())
|
||||||
|
.append("dcfzt", getDcfzt())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("siteId", getSiteId())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xzzn.ems.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xzzn.ems.domain.EmsXfData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消防数据Mapper接口
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-10-21
|
||||||
|
*/
|
||||||
|
public interface EmsXfDataMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询消防数据
|
||||||
|
*
|
||||||
|
* @param id 消防数据主键
|
||||||
|
* @return 消防数据
|
||||||
|
*/
|
||||||
|
public EmsXfData selectEmsXfDataById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询消防数据列表
|
||||||
|
*
|
||||||
|
* @param emsXfData 消防数据
|
||||||
|
* @return 消防数据集合
|
||||||
|
*/
|
||||||
|
public List<EmsXfData> selectEmsXfDataList(EmsXfData emsXfData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增消防数据
|
||||||
|
*
|
||||||
|
* @param emsXfData 消防数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEmsXfData(EmsXfData emsXfData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改消防数据
|
||||||
|
*
|
||||||
|
* @param emsXfData 消防数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEmsXfData(EmsXfData emsXfData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除消防数据
|
||||||
|
*
|
||||||
|
* @param id 消防数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsXfDataById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除消防数据
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsXfDataByIds(Long[] ids);
|
||||||
|
}
|
||||||
@ -84,6 +84,8 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
|||||||
private EmsDailyEnergyDataMapper emsDailyEnergyDataMapper;
|
private EmsDailyEnergyDataMapper emsDailyEnergyDataMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEmsDeviceSettingService iEmsDeviceSettingService;
|
private IEmsDeviceSettingService iEmsDeviceSettingService;
|
||||||
|
@Autowired
|
||||||
|
private EmsXfDataMapper emsXfDataMapper;
|
||||||
|
|
||||||
public DDSDataProcessServiceImpl(ObjectMapper objectMapper) {
|
public DDSDataProcessServiceImpl(ObjectMapper objectMapper) {
|
||||||
super(objectMapper);
|
super(objectMapper);
|
||||||
@ -127,7 +129,7 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
|||||||
} else if (deviceId.contains("METE0")) {
|
} else if (deviceId.contains("METE0")) {
|
||||||
meteBranchDataProcess(deviceId, jsonData);
|
meteBranchDataProcess(deviceId, jsonData);
|
||||||
} else if (deviceId.contains("XF")) {
|
} else if (deviceId.contains("XF")) {
|
||||||
meteXFProcess(deviceId, jsonData);
|
meteXFProcess(deviceId, jsonData, dataUpdateTime);
|
||||||
} else if (deviceId.contains("DH")) {
|
} else if (deviceId.contains("DH")) {
|
||||||
dhDataProcess(deviceId, jsonData);
|
dhDataProcess(deviceId, jsonData);
|
||||||
}
|
}
|
||||||
@ -155,12 +157,29 @@ public class DDSDataProcessServiceImpl extends AbstractBatteryDataProcessor impl
|
|||||||
redisCache.setCacheObject(RedisKeyConstants.DH + SITE_ID + "_" +deviceId, dhData);
|
redisCache.setCacheObject(RedisKeyConstants.DH + SITE_ID + "_" +deviceId, dhData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void meteXFProcess(String deviceId, String dataJson) {
|
private void meteXFProcess(String deviceId, String dataJson, Date dataUpdateTime) {
|
||||||
//消防
|
//消防
|
||||||
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
|
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 暂时只更新设备表的设备状态 ZDYBYDCZT-主电源备用电池状态
|
// 暂时只更新设备表的设备状态 ZDYBYDCZT-主电源备用电池状态
|
||||||
|
// 数据存表
|
||||||
|
EmsXfData xfData = new EmsXfData();
|
||||||
|
xfData.setDataTimestamp(dataUpdateTime);
|
||||||
|
xfData.setDcfzt(StringUtils.getBigDecimal(obj.get("YLKGDCFZT")));
|
||||||
|
xfData.setDczt(StringUtils.getBigDecimal(obj.get("ZDYBYDCZT")));
|
||||||
|
xfData.setPszt(StringUtils.getBigDecimal(obj.get("QDQTPSZT")));
|
||||||
|
xfData.setYszt(StringUtils.getBigDecimal(obj.get("SZDYSZT")));
|
||||||
|
|
||||||
|
xfData.setCreateBy("system");
|
||||||
|
xfData.setCreateTime(DateUtils.getNowDate());
|
||||||
|
xfData.setUpdateBy("system");
|
||||||
|
xfData.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
xfData.setSiteId(SITE_ID);
|
||||||
|
xfData.setDeviceId(deviceId);
|
||||||
|
emsXfDataMapper.insertEmsXfData(xfData);
|
||||||
|
|
||||||
|
redisCache.setCacheObject(RedisKeyConstants.XF + SITE_ID + "_" +deviceId, xfData);
|
||||||
// 状态枚举还没有提供
|
// 状态枚举还没有提供
|
||||||
EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, SITE_ID);
|
EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, SITE_ID);
|
||||||
emsDevicesSetting.setCommunicationStatus(StringUtils.getString(obj.get("ZDYBYDCZT")));
|
emsDevicesSetting.setCommunicationStatus(StringUtils.getString(obj.get("ZDYBYDCZT")));
|
||||||
|
|||||||
106
ems-system/src/main/resources/mapper/ems/EmsXfDataMapper.xml
Normal file
106
ems-system/src/main/resources/mapper/ems/EmsXfDataMapper.xml
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xzzn.ems.mapper.EmsXfDataMapper">
|
||||||
|
|
||||||
|
<resultMap type="EmsXfData" id="EmsXfDataResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataTimestamp" column="data_timestamp" />
|
||||||
|
<result property="dczt" column="dczt" />
|
||||||
|
<result property="yszt" column="yszt" />
|
||||||
|
<result property="pszt" column="pszt" />
|
||||||
|
<result property="dcfzt" column="dcfzt" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="siteId" column="site_id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEmsXfDataVo">
|
||||||
|
select id, data_timestamp, dczt, yszt, pszt, dcfzt, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_xf_data
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEmsXfDataList" parameterType="EmsXfData" resultMap="EmsXfDataResult">
|
||||||
|
<include refid="selectEmsXfDataVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataTimestamp != null "> and data_timestamp = #{dataTimestamp}</if>
|
||||||
|
<if test="dczt != null "> and dczt = #{dczt}</if>
|
||||||
|
<if test="yszt != null "> and yszt = #{yszt}</if>
|
||||||
|
<if test="pszt != null "> and pszt = #{pszt}</if>
|
||||||
|
<if test="dcfzt != null "> and dcfzt = #{dcfzt}</if>
|
||||||
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEmsXfDataById" parameterType="Long" resultMap="EmsXfDataResult">
|
||||||
|
<include refid="selectEmsXfDataVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEmsXfData" parameterType="EmsXfData" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ems_xf_data
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataTimestamp != null">data_timestamp,</if>
|
||||||
|
<if test="dczt != null">dczt,</if>
|
||||||
|
<if test="yszt != null">yszt,</if>
|
||||||
|
<if test="pszt != null">pszt,</if>
|
||||||
|
<if test="dcfzt != null">dcfzt,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="siteId != null">site_id,</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataTimestamp != null">#{dataTimestamp},</if>
|
||||||
|
<if test="dczt != null">#{dczt},</if>
|
||||||
|
<if test="yszt != null">#{yszt},</if>
|
||||||
|
<if test="pszt != null">#{pszt},</if>
|
||||||
|
<if test="dcfzt != null">#{dcfzt},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="siteId != null">#{siteId},</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEmsXfData" parameterType="EmsXfData">
|
||||||
|
update ems_xf_data
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataTimestamp != null">data_timestamp = #{dataTimestamp},</if>
|
||||||
|
<if test="dczt != null">dczt = #{dczt},</if>
|
||||||
|
<if test="yszt != null">yszt = #{yszt},</if>
|
||||||
|
<if test="pszt != null">pszt = #{pszt},</if>
|
||||||
|
<if test="dcfzt != null">dcfzt = #{dcfzt},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEmsXfDataById" parameterType="Long">
|
||||||
|
delete from ems_xf_data where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEmsXfDataByIds" parameterType="String">
|
||||||
|
delete from ems_xf_data where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user