From 9225098670c0ca2f82c192c2824fb0e3364e17d4 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Tue, 20 Feb 2024 19:40:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=94=E8=B1=A1=E6=A3=80=E6=B5=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8F=92=E5=85=A5=E4=B8=AD=E9=97=B4=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/domain/MdDeviceData.java | 194 ++++++++++++++++++ .../DcMeteorologicalDetectorDataMapper.java | 16 -- .../business/mapper/MiddleDatabaseMapper.java | 24 +++ .../DevicePropertyReportListener.java | 5 +- .../IDcMeteorologicalDetectorDataService.java | 8 - .../service/IMiddleDatabaseService.java | 24 +++ ...MeteorologicalDetectorDataServiceImpl.java | 13 -- .../impl/MiddleDatabaseServiceImpl.java | 55 +++++ .../DcMeteorologicalDetectorDataMapper.xml | 43 ---- .../mapper/business/MiddleDatabaseMapper.xml | 36 ++++ 10 files changed, 337 insertions(+), 81 deletions(-) create mode 100644 zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java create mode 100644 zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java create mode 100644 zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java create mode 100644 zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml diff --git a/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java b/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java new file mode 100644 index 00000000..71b467ed --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java @@ -0,0 +1,194 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; + +/** + * @Description 中间库设备数据 + * + * @author liuwenge + * @date 2024/2/20 17:30 + */ +public class MdDeviceData { + + /** 主键 */ + private Long id; + + /** 设备编号 */ + @Excel(name = "设备编号") + private String devNo; + + /** 设备类型 */ + @Excel(name = "设备类型") + private String devType; + + /** 时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date timeStamp; + + /** 自定义字段 */ + @Excel(name = "自定义字段") + private String expands; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date creationTime; + + /** 创建人 */ + @Excel(name = "创建人") + private String creatorUserId; + + /** 最后修改时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastModificationTime; + + /** 最后修改人 */ + @Excel(name = "最后修改人") + private Long lastModifierUserId; + + /** 是否删除 */ + @Excel(name = "是否删除") + private Integer isDeleted; + + /** 删除人 */ + @Excel(name = "删除人") + private Long deleterUserId; + + /** 删除时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date deletionTime; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setDevNo(String devNo) + { + this.devNo = devNo; + } + + public String getDevNo() + { + return devNo; + } + + public String getDevType() { + return devType; + } + + public void setDevType(String devType) { + this.devType = devType; + } + + public void setTimeStamp(Date timeStamp) + { + this.timeStamp = timeStamp; + } + + public Date getTimeStamp() + { + return timeStamp; + } + public void setExpands(String expands) + { + this.expands = expands; + } + + public String getExpands() + { + return expands; + } + public void setCreationTime(Date creationTime) + { + this.creationTime = creationTime; + } + + public Date getCreationTime() + { + return creationTime; + } + public void setCreatorUserId(String creatorUserId) + { + this.creatorUserId = creatorUserId; + } + + public String getCreatorUserId() + { + return creatorUserId; + } + public void setLastModificationTime(Date lastModificationTime) + { + this.lastModificationTime = lastModificationTime; + } + + public Date getLastModificationTime() + { + return lastModificationTime; + } + public void setLastModifierUserId(Long lastModifierUserId) + { + this.lastModifierUserId = lastModifierUserId; + } + + public Long getLastModifierUserId() + { + return lastModifierUserId; + } + public void setIsDeleted(Integer isDeleted) + { + this.isDeleted = isDeleted; + } + + public Integer getIsDeleted() + { + return isDeleted; + } + public void setDeleterUserId(Long deleterUserId) + { + this.deleterUserId = deleterUserId; + } + + public Long getDeleterUserId() + { + return deleterUserId; + } + public void setDeletionTime(Date deletionTime) + { + this.deletionTime = deletionTime; + } + + public Date getDeletionTime() + { + return deletionTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("devNo", getDevNo()) + .append("timeStamp", getTimeStamp()) + .append("expands", getExpands()) + .append("creationTime", getCreationTime()) + .append("creatorUserId", getCreatorUserId()) + .append("lastModificationTime", getLastModificationTime()) + .append("lastModifierUserId", getLastModifierUserId()) + .append("isDeleted", getIsDeleted()) + .append("deleterUserId", getDeleterUserId()) + .append("deletionTime", getDeletionTime()) + .toString(); + } + +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java index 2f145e71..7788b60e 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java @@ -44,22 +44,6 @@ public interface DcMeteorologicalDetectorDataMapper */ int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** - * 中间库新增设备数据 - * - * @param mdDeviceData 气象检测器数据 - * @return 结果 - */ - Boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); - - /** - * 中间库修改气象检测器数据 - * - * @param dcMeteorologicalDetectorData 气象检测器数据 - * @return 结果 - */ - Boolean updateIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** * 删除气象检测器数据 * diff --git a/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java new file mode 100644 index 00000000..66e89c07 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java @@ -0,0 +1,24 @@ +package com.zc.business.mapper; + +import com.zc.business.domain.DcBoardReleaseLog; +import com.zc.business.domain.MdDeviceData; + +import java.util.List; + +/** + * 中间库Mapper接口 + * + * @author ruoyi + * @date 2024-01-05 + */ +public interface MiddleDatabaseMapper +{ + + /** + * 中间库新增设备数据 + * + * @param mdDeviceData 气象检测器数据 + * @return 结果 + */ + Boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); +} diff --git a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java index 955d4308..172dadf8 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java +++ b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java @@ -8,6 +8,7 @@ import com.zc.business.domain.DcMeteorologicalDetectorData; import com.zc.business.domain.MdDeviceData; import com.zc.business.enums.IotProductEnum; import com.zc.business.service.IDcMeteorologicalDetectorDataService; +import com.zc.business.service.IMiddleDatabaseService; import com.zc.common.core.redis.stream.RedisStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,6 +40,8 @@ public class DevicePropertyReportListener implements StreamListener message) { @@ -80,7 +83,7 @@ public class DevicePropertyReportListener implements StreamListener - - insert into device_data - - devNo, - devType, - `timeStamp`, - expands, - CreatorUserId, - LastModificationTime, - LastModifierUserId, - IsDeleted, - DeleterUserId, - DeletionTime, - CreationTime - - - #{devNo}, - #{devType}, - #{timeStamp}, - #{expands}, - #{creatorUserId}, - #{lastModificationTime}, - #{isDeleted}, - #{deleterUserId}, - #{deletionTime}, - current_date - - - - - update meteorological_detector_data - - temperature = #{temperature}, - humidity = #{humidity}, - precipitation_type = #{precipitationType}, - rainfall = #{rainfall}, - road_surface_status = #{roadSurfaceStatus}, - water_film_thickness = #{waterFilmThickness}, - update_time = current_date - - where device_id = #{iotDeviceId} - - delete from dc_meteorological_detector_data where id = #{id} diff --git a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml new file mode 100644 index 00000000..b8f1b77b --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml @@ -0,0 +1,36 @@ + + + + + + insert into device_data + + devNo, + devType, + `timeStamp`, + expands, + CreatorUserId, + LastModificationTime, + LastModifierUserId, + IsDeleted, + DeleterUserId, + DeletionTime, + CreationTime + + + #{devNo}, + #{devType}, + #{timeStamp}, + #{expands}, + #{creatorUserId}, + #{lastModificationTime}, + #{isDeleted}, + #{deleterUserId}, + #{deletionTime}, + current_date + + + +