diff --git a/src/main/java/com/lanhai/MybatisPlusGenerator.java b/src/main/java/com/lanhai/MybatisPlusGenerator.java index a23c331..94618c1 100644 --- a/src/main/java/com/lanhai/MybatisPlusGenerator.java +++ b/src/main/java/com/lanhai/MybatisPlusGenerator.java @@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; */ public class MybatisPlusGenerator { - public static final String database = "jdbc:mysql://8.130.9.244:13306/fx_nsp"; + public static final String database = "jdbc:mysql://172.27.17.13:13306/fx_nsp"; public static final String user = "user_fx"; public static final String passwd = "user_fx"; @@ -80,7 +80,7 @@ public class MybatisPlusGenerator { public static void main(String[] args) { - new MybatisPlusGenerator().generator("surv_device_deploy_relay","surv_device_deploy_relaygroup");//指标 + new MybatisPlusGenerator().generator("surv_transdata_vocs","surv_transdata_vocs_min");//指标 } diff --git a/src/main/java/com/lanhai/controller/SurvHisdataVocsController.java b/src/main/java/com/lanhai/controller/SurvHisdataVocsController.java new file mode 100644 index 0000000..49c76ea --- /dev/null +++ b/src/main/java/com/lanhai/controller/SurvHisdataVocsController.java @@ -0,0 +1,21 @@ +package com.lanhai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 恶臭历史数据 前端控制器 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Controller +@RequestMapping("/survHisdataVocs") +public class SurvHisdataVocsController { + +} + diff --git a/src/main/java/com/lanhai/controller/SurvHisdataVocsMinController.java b/src/main/java/com/lanhai/controller/SurvHisdataVocsMinController.java new file mode 100644 index 0000000..f97a0ef --- /dev/null +++ b/src/main/java/com/lanhai/controller/SurvHisdataVocsMinController.java @@ -0,0 +1,21 @@ +package com.lanhai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 恶臭分钟历史数据 前端控制器 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Controller +@RequestMapping("/survHisdataVocsMin") +public class SurvHisdataVocsMinController { + +} + diff --git a/src/main/java/com/lanhai/controller/SurvTransdataVocsController.java b/src/main/java/com/lanhai/controller/SurvTransdataVocsController.java new file mode 100644 index 0000000..a8d60e8 --- /dev/null +++ b/src/main/java/com/lanhai/controller/SurvTransdataVocsController.java @@ -0,0 +1,21 @@ +package com.lanhai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 恶臭实时数据 前端控制器 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Controller +@RequestMapping("/survTransdataVocs") +public class SurvTransdataVocsController { + +} + diff --git a/src/main/java/com/lanhai/controller/SurvTransdataVocsMinController.java b/src/main/java/com/lanhai/controller/SurvTransdataVocsMinController.java new file mode 100644 index 0000000..2bd414e --- /dev/null +++ b/src/main/java/com/lanhai/controller/SurvTransdataVocsMinController.java @@ -0,0 +1,21 @@ +package com.lanhai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 恶臭分钟数据 前端控制器 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Controller +@RequestMapping("/survTransdataVocsMin") +public class SurvTransdataVocsMinController { + +} + diff --git a/src/main/java/com/lanhai/entity/SurvHisdataVocs.java b/src/main/java/com/lanhai/entity/SurvHisdataVocs.java new file mode 100644 index 0000000..bbcd484 --- /dev/null +++ b/src/main/java/com/lanhai/entity/SurvHisdataVocs.java @@ -0,0 +1,207 @@ +package com.lanhai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.time.LocalDateTime; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 恶臭历史数据 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SurvHisdataVocs extends Model { + + private static final long serialVersionUID=1L; + + /** + * 主键 + */ + @TableId(value = "ID", type = IdType.ID_WORKER_STR) + private String id; + + /** + * 设备ID + */ + @TableField("DEPLOY_ID") + private String deployId; + + /** + * 总挥发性有机物 + */ + @TableField("DATA_TVOC") + private String dataTvoc; + + /** + * 臭气浓度 + */ + @TableField("DATA_OU") + private String dataOu; + + /** + * 氨气 + */ + @TableField("DATA_NH3") + private String dataNh3; + + /** + * 硫化氢 + */ + @TableField("DATA_H2S") + private String dataH2s; + + /** + * 请求编号 + */ + @TableField("DATA_QN") + private String dataQn; + + /** + * 访问密码 + */ + @TableField("DATA_PW") + private String dataPw; + + /** + * CRC校验 + */ + @TableField("DATA_END") + private String dataEnd; + + /** + * 数据长度 + */ + @TableField("DATA_SIZE") + private String dataSize; + + /** + * 指令 + */ + @TableField("DATA_CN") + private String dataCn; + + /** + * 站点ID + */ + @TableField("STATION_ID") + private String stationId; + + /** + * 站点编号 + */ + @TableField("STATION_CODE") + private String stationCode; + + /** + * 设备部署编号 + */ + @TableField("DEPLOY_CODE") + private String deployCode; + + /** + * 数据更新时间 + */ + @TableField("DATA_DATE_TIME") + private LocalDateTime dataDateTime; + + /** + * 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据 + */ + @TableField("DATA_GATHER_TYPE") + private String dataGatherType; + + /** + * 数据时间戳 + */ + @TableField("DATA_TIME") + private String dataTime; + + /** + * 转储时间 + */ + @TableField("TRANS_DATE") + private LocalDateTime transDate; + + + /** + * 规则类型 + */ + @TableField("RULE_TYPE") + private String ruleType; + + + /** + * 设备名称 + */ + @TableField("DEVICE_NAME") + private String deviceName; + + /** + * 站点名称 + */ + @TableField("STATION_NAME") + private String stationName; + + + /** + * 租户号 + */ + @TableField("TENANT_ID") + private String tenantId; + + /** + * 乐观锁 + */ + @TableField("RE_VISION") + private Integer reVision; + + /** + * 创建人 + */ + @TableField("CREATED_BY") + private String createdBy; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField("UPDATED_BY") + private String updatedBy; + + /** + * 逻辑删除 + */ + @TableField("IS_DEL") + private Integer isDel; + + /** + * 更新时间 + */ + @TableField("UPDATED_TIME") + private LocalDateTime updatedTime; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/src/main/java/com/lanhai/entity/SurvHisdataVocsMin.java b/src/main/java/com/lanhai/entity/SurvHisdataVocsMin.java new file mode 100644 index 0000000..4e906f1 --- /dev/null +++ b/src/main/java/com/lanhai/entity/SurvHisdataVocsMin.java @@ -0,0 +1,254 @@ +package com.lanhai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.time.LocalDateTime; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 恶臭分钟历史数据 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SurvHisdataVocsMin extends Model { + + private static final long serialVersionUID=1L; + + /** + * 主键 + */ + @TableId(value = "ID", type = IdType.ID_WORKER_STR) + private String id; + + /** + * 设备ID + */ + @TableField("DEPLOY_ID") + private String deployId; + + /** + * 总挥发性有机物分钟最小 + */ + @TableField("DATA_TVOC_MIN") + private String dataTvocMin; + + /** + * 总挥发性有机物分钟最大 + */ + @TableField("DATA_TVOC_MAX") + private String dataTvocMax; + + /** + * 总挥发性有机物分钟平均 + */ + @TableField("DATA_TVOC_AVG") + private String dataTvocAvg; + + /** + * 臭气浓度分钟最小 + */ + @TableField("DATA_OU_MIN") + private String dataOuMin; + + /** + * 臭气浓度分钟c + */ + @TableField("DATA_OU_MAX") + private String dataOuMax; + + /** + * 臭气浓度分钟平均 + */ + @TableField("DATA_OU_AVG") + private String dataOuAvg; + + /** + * 氨气浓度分钟最小 + */ + @TableField("DATA_NH3_MIN") + private String dataNh3Min; + + /** + * 氨气浓度分钟最小 + */ + @TableField("DATA_NH3_MAX") + private String dataNh3Max; + + /** + * 氨气分钟平均 + */ + @TableField("DATA_NH3_AVG") + private String dataNh3Avg; + + /** + * 硫化氢分钟最大 + */ + @TableField("DATA_H2S_MIN") + private String dataH2sMin; + + /** + * 硫化氢分钟最小 + */ + @TableField("DATA_H2S_MAX") + private String dataH2sMax; + + /** + * 硫化氢分钟平均 + */ + @TableField("DATA_H2S_AVG") + private String dataH2sAvg; + + /** + * 请求编号 + */ + @TableField("DATA_QN") + private String dataQn; + + /** + * 访问密码 + */ + @TableField("DATA_PW") + private String dataPw; + + /** + * CRC校验 + */ + @TableField("DATA_END") + private String dataEnd; + + /** + * 数据长度 + */ + @TableField("DATA_SIZE") + private String dataSize; + + /** + * 指令 + */ + @TableField("DATA_CN") + private String dataCn; + + /** + * 站点ID + */ + @TableField("STATION_ID") + private String stationId; + + /** + * 站点编号 + */ + @TableField("STATION_CODE") + private String stationCode; + + /** + * 设备部署编号 + */ + @TableField("DEPLOY_CODE") + private String deployCode; + + /** + * 数据更新时间 + */ + @TableField("DATA_DATE_TIME") + private LocalDateTime dataDateTime; + + /** + * 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据 + */ + @TableField("DATA_GATHER_TYPE") + private String dataGatherType; + + /** + * 数据时间戳 + */ + @TableField("DATA_TIME") + private String dataTime; + + /** + * 转储时间 + */ + @TableField("TRANS_DATE") + private LocalDateTime transDate; + + + /** + * 规则类型 + */ + @TableField("RULE_TYPE") + private String ruleType; + + + /** + * 设备名称 + */ + @TableField("DEVICE_NAME") + private String deviceName; + + /** + * 站点名称 + */ + @TableField("STATION_NAME") + private String stationName; + + /** + * 租户号 + */ + @TableField("TENANT_ID") + private String tenantId; + + /** + * 乐观锁 + */ + @TableField("RE_VISION") + private Integer reVision; + + /** + * 创建人 + */ + @TableField("CREATED_BY") + private String createdBy; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField("UPDATED_BY") + private String updatedBy; + + /** + * 逻辑删除 + */ + @TableField("IS_DEL") + private Integer isDel; + + /** + * 更新时间 + */ + @TableField("UPDATED_TIME") + private LocalDateTime updatedTime; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/src/main/java/com/lanhai/entity/SurvTransdataVocs.java b/src/main/java/com/lanhai/entity/SurvTransdataVocs.java new file mode 100644 index 0000000..42de4c7 --- /dev/null +++ b/src/main/java/com/lanhai/entity/SurvTransdataVocs.java @@ -0,0 +1,200 @@ +package com.lanhai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.time.LocalDateTime; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 恶臭实时数据 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SurvTransdataVocs extends Model { + + private static final long serialVersionUID=1L; + + /** + * 主键 + */ + @TableId(value = "ID", type = IdType.ID_WORKER_STR) + private String id; + + /** + * 设备ID + */ + @TableField("DEPLOY_ID") + private String deployId; + + /** + * 总挥发性有机物 + */ + @TableField("DATA_TVOC") + private String dataTvoc; + + /** + * 臭气浓度 + */ + @TableField("DATA_OU") + private String dataOu; + + /** + * 氨气 + */ + @TableField("DATA_NH3") + private String dataNh3; + + /** + * 硫化氢 + */ + @TableField("DATA_H2S") + private String dataH2s; + + /** + * 站点ID + */ + @TableField("STATION_ID") + private String stationId; + + /** + * 站点编号 + */ + @TableField("STATION_CODE") + private String stationCode; + + /** + * 设备部署编号 + */ + @TableField("DEPLOY_CODE") + private String deployCode; + + /** + * 数据更新时间 + */ + @TableField("DATA_DATE_TIME") + private LocalDateTime dataDateTime; + + /** + * 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据 + */ + @TableField("DATA_GATHER_TYPE") + private String dataGatherType; + + /** + * 请求编号 + */ + @TableField("DATA_QN") + private String dataQn; + + /** + * 访问密码 + */ + @TableField("DATA_PW") + private String dataPw; + + /** + * CRC校验 + */ + @TableField("DATA_END") + private String dataEnd; + + /** + * 数据长度 + */ + @TableField("DATA_SIZE") + private String dataSize; + + /** + * 指令 + */ + @TableField("DATA_CN") + private String dataCn; + + /** + * 数据时间戳 + */ + @TableField("DATA_TIME") + private String dataTime; + + + /** + * 规则类型 + */ + @TableField("RULE_TYPE") + private String ruleType; + + + /** + * 设备名称 + */ + @TableField("DEVICE_NAME") + private String deviceName; + + /** + * 站点名称 + */ + @TableField("STATION_NAME") + private String stationName; + + /** + * 租户号 + */ + @TableField("TENANT_ID") + private String tenantId; + + /** + * 乐观锁 + */ + @TableField("RE_VISION") + private Integer reVision; + + /** + * 创建人 + */ + @TableField("CREATED_BY") + private String createdBy; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField("UPDATED_BY") + private String updatedBy; + + /** + * 逻辑删除 + */ + @TableField("IS_DEL") + private Integer isDel; + + /** + * 更新时间 + */ + @TableField("UPDATED_TIME") + private LocalDateTime updatedTime; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/src/main/java/com/lanhai/entity/SurvTransdataVocsMin.java b/src/main/java/com/lanhai/entity/SurvTransdataVocsMin.java new file mode 100644 index 0000000..ce710dc --- /dev/null +++ b/src/main/java/com/lanhai/entity/SurvTransdataVocsMin.java @@ -0,0 +1,248 @@ +package com.lanhai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.time.LocalDateTime; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 恶臭分钟数据 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SurvTransdataVocsMin extends Model { + + private static final long serialVersionUID=1L; + + /** + * 主键 + */ + @TableId(value = "ID", type = IdType.ID_WORKER_STR) + private String id; + + /** + * 设备ID + */ + @TableField("DEPLOY_ID") + private String deployId; + + /** + * 总挥发性有机物分钟最小 + */ + @TableField("DATA_TVOC_MIN") + private String dataTvocMin; + + /** + * 总挥发性有机物分钟最大 + */ + @TableField("DATA_TVOC_MAX") + private String dataTvocMax; + + /** + * 总挥发性有机物分钟平均 + */ + @TableField("DATA_TVOC_AVG") + private String dataTvocAvg; + + /** + * 臭气浓度分钟最小 + */ + @TableField("DATA_OU_MIN") + private String dataOuMin; + + /** + * 臭气浓度分钟c + */ + @TableField("DATA_OU_MAX") + private String dataOuMax; + + /** + * 臭气浓度分钟平均 + */ + @TableField("DATA_OU_AVG") + private String dataOuAvg; + + /** + * 氨气浓度分钟最小 + */ + @TableField("DATA_NH3_MIN") + private String dataNh3Min; + + /** + * 氨气浓度分钟最小 + */ + @TableField("DATA_NH3_MAX") + private String dataNh3Max; + + /** + * 氨气分钟平均 + */ + @TableField("DATA_NH3_AVG") + private String dataNh3Avg; + + /** + * 硫化氢分钟最大 + */ + @TableField("DATA_H2S_MIN") + private String dataH2sMin; + + /** + * 硫化氢分钟最小 + */ + @TableField("DATA_H2S_MAX") + private String dataH2sMax; + + /** + * 硫化氢分钟平均 + */ + @TableField("DATA_H2S_AVG") + private String dataH2sAvg; + + /** + * 请求编号 + */ + @TableField("DATA_QN") + private String dataQn; + + /** + * 访问密码 + */ + @TableField("DATA_PW") + private String dataPw; + + /** + * CRC校验 + */ + @TableField("DATA_END") + private String dataEnd; + + /** + * 数据长度 + */ + @TableField("DATA_SIZE") + private String dataSize; + + /** + * 指令 + */ + @TableField("DATA_CN") + private String dataCn; + + /** + * 站点ID + */ + @TableField("STATION_ID") + private String stationId; + + /** + * 站点编号 + */ + @TableField("STATION_CODE") + private String stationCode; + + /** + * 设备部署编号 + */ + @TableField("DEPLOY_CODE") + private String deployCode; + + /** + * 数据更新时间 + */ + @TableField("DATA_DATE_TIME") + private LocalDateTime dataDateTime; + + /** + * 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据 + */ + @TableField("DATA_GATHER_TYPE") + private String dataGatherType; + + /** + * 数据时间戳 + */ + @TableField("DATA_TIME") + private String dataTime; + + + /** + * 规则类型 + */ + @TableField("RULE_TYPE") + private String ruleType; + + + /** + * 设备名称 + */ + @TableField("DEVICE_NAME") + private String deviceName; + + /** + * 站点名称 + */ + @TableField("STATION_NAME") + private String stationName; + + /** + * 租户号 + */ + @TableField("TENANT_ID") + private String tenantId; + + /** + * 乐观锁 + */ + @TableField("RE_VISION") + private Integer reVision; + + /** + * 创建人 + */ + @TableField("CREATED_BY") + private String createdBy; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField("UPDATED_BY") + private String updatedBy; + + /** + * 逻辑删除 + */ + @TableField("IS_DEL") + private Integer isDel; + + /** + * 更新时间 + */ + @TableField("UPDATED_TIME") + private LocalDateTime updatedTime; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/src/main/java/com/lanhai/mapper/SurvHisdataVocsMapper.java b/src/main/java/com/lanhai/mapper/SurvHisdataVocsMapper.java new file mode 100644 index 0000000..d0c6a83 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/SurvHisdataVocsMapper.java @@ -0,0 +1,16 @@ +package com.lanhai.mapper; + +import com.lanhai.entity.SurvHisdataVocs; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 恶臭历史数据 Mapper 接口 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface SurvHisdataVocsMapper extends BaseMapper { + +} diff --git a/src/main/java/com/lanhai/mapper/SurvHisdataVocsMinMapper.java b/src/main/java/com/lanhai/mapper/SurvHisdataVocsMinMapper.java new file mode 100644 index 0000000..5bb9d1e --- /dev/null +++ b/src/main/java/com/lanhai/mapper/SurvHisdataVocsMinMapper.java @@ -0,0 +1,16 @@ +package com.lanhai.mapper; + +import com.lanhai.entity.SurvHisdataVocsMin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 恶臭分钟历史数据 Mapper 接口 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface SurvHisdataVocsMinMapper extends BaseMapper { + +} diff --git a/src/main/java/com/lanhai/mapper/SurvTransdataVocsMapper.java b/src/main/java/com/lanhai/mapper/SurvTransdataVocsMapper.java new file mode 100644 index 0000000..eeac934 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/SurvTransdataVocsMapper.java @@ -0,0 +1,16 @@ +package com.lanhai.mapper; + +import com.lanhai.entity.SurvTransdataVocs; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 恶臭实时数据 Mapper 接口 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface SurvTransdataVocsMapper extends BaseMapper { + +} diff --git a/src/main/java/com/lanhai/mapper/SurvTransdataVocsMinMapper.java b/src/main/java/com/lanhai/mapper/SurvTransdataVocsMinMapper.java new file mode 100644 index 0000000..c8343eb --- /dev/null +++ b/src/main/java/com/lanhai/mapper/SurvTransdataVocsMinMapper.java @@ -0,0 +1,16 @@ +package com.lanhai.mapper; + +import com.lanhai.entity.SurvTransdataVocsMin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 恶臭分钟数据 Mapper 接口 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface SurvTransdataVocsMinMapper extends BaseMapper { + +} diff --git a/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMapper.xml b/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMapper.xml new file mode 100644 index 0000000..f607190 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMinMapper.xml b/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMinMapper.xml new file mode 100644 index 0000000..635a9d7 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/xml/SurvHisdataVocsMinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMapper.xml b/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMapper.xml new file mode 100644 index 0000000..fa9e331 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMinMapper.xml b/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMinMapper.xml new file mode 100644 index 0000000..2742a51 --- /dev/null +++ b/src/main/java/com/lanhai/mapper/xml/SurvTransdataVocsMinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/lanhai/service/ISurvHisdataVocsMinService.java b/src/main/java/com/lanhai/service/ISurvHisdataVocsMinService.java new file mode 100644 index 0000000..61abf28 --- /dev/null +++ b/src/main/java/com/lanhai/service/ISurvHisdataVocsMinService.java @@ -0,0 +1,16 @@ +package com.lanhai.service; + +import com.lanhai.entity.SurvHisdataVocsMin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 恶臭分钟历史数据 服务类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface ISurvHisdataVocsMinService extends IService { + +} diff --git a/src/main/java/com/lanhai/service/ISurvHisdataVocsService.java b/src/main/java/com/lanhai/service/ISurvHisdataVocsService.java new file mode 100644 index 0000000..769177d --- /dev/null +++ b/src/main/java/com/lanhai/service/ISurvHisdataVocsService.java @@ -0,0 +1,20 @@ +package com.lanhai.service; + +import com.lanhai.entity.SurvDeviceDeploy; +import com.lanhai.entity.SurvHisdataVocs; +import com.baomidou.mybatisplus.extension.service.IService; +import com.lanhai.entity.SurvTransdataVocs; +import com.lanhai.o.iot.task.DataExamineDetail; + +/** + *

+ * 恶臭历史数据 服务类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface ISurvHisdataVocsService extends IService { + + SurvTransdataVocs genDataAuto(SurvDeviceDeploy deploy, DataExamineDetail config); +} diff --git a/src/main/java/com/lanhai/service/ISurvTransdataVocsMinService.java b/src/main/java/com/lanhai/service/ISurvTransdataVocsMinService.java new file mode 100644 index 0000000..f08375b --- /dev/null +++ b/src/main/java/com/lanhai/service/ISurvTransdataVocsMinService.java @@ -0,0 +1,16 @@ +package com.lanhai.service; + +import com.lanhai.entity.SurvTransdataVocsMin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 恶臭分钟数据 服务类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface ISurvTransdataVocsMinService extends IService { + +} diff --git a/src/main/java/com/lanhai/service/ISurvTransdataVocsService.java b/src/main/java/com/lanhai/service/ISurvTransdataVocsService.java new file mode 100644 index 0000000..f471e72 --- /dev/null +++ b/src/main/java/com/lanhai/service/ISurvTransdataVocsService.java @@ -0,0 +1,18 @@ +package com.lanhai.service; + +import com.lanhai.entity.SurvTransdataSoil; +import com.lanhai.entity.SurvTransdataVocs; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 恶臭实时数据 服务类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +public interface ISurvTransdataVocsService extends IService { + + SurvTransdataVocs getOneByDeviceId(String deployId); +} diff --git a/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsMinServiceImpl.java b/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsMinServiceImpl.java new file mode 100644 index 0000000..0c9ed31 --- /dev/null +++ b/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsMinServiceImpl.java @@ -0,0 +1,20 @@ +package com.lanhai.service.Impl; + +import com.lanhai.entity.SurvHisdataVocsMin; +import com.lanhai.mapper.SurvHisdataVocsMinMapper; +import com.lanhai.service.ISurvHisdataVocsMinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 恶臭分钟历史数据 服务实现类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Service +public class SurvHisdataVocsMinServiceImpl extends ServiceImpl implements ISurvHisdataVocsMinService { + +} diff --git a/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsServiceImpl.java b/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsServiceImpl.java new file mode 100644 index 0000000..5a696ca --- /dev/null +++ b/src/main/java/com/lanhai/service/Impl/SurvHisdataVocsServiceImpl.java @@ -0,0 +1,185 @@ +package com.lanhai.service.Impl; + +import cn.hutool.core.bean.BeanUtil; +import com.lanhai.constant.IotConstants; +import com.lanhai.entity.SurvDeviceDeploy; +import com.lanhai.entity.SurvHisdataVocs; +import com.lanhai.entity.SurvStationInfo; +import com.lanhai.entity.SurvTransdataVocs; +import com.lanhai.mapper.SurvHisdataVocsMapper; +import com.lanhai.o.iot.task.DataExamineDetail; +import com.lanhai.o.iot.task.DataExamineRule; +import com.lanhai.service.ISurvHisdataVocsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lanhai.service.ISurvStationInfoService; +import com.lanhai.util.BigDecimalRandomAdjuster; +import com.lanhai.util.DateTimeConverter; +import com.lanhai.util.DateTimeUtils; +import com.lanhai.util.TUtil; +import com.xxl.job.core.context.XxlJobHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + *

+ * 恶臭历史数据 服务实现类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Service +@Slf4j +public class SurvHisdataVocsServiceImpl extends ServiceImpl implements ISurvHisdataVocsService { + + @Lazy + @Autowired + private SurvTransdataVocsServiceImpl vocsService; + @Lazy + @Autowired + private ISurvStationInfoService survStationInfoService; + + + @Override + public SurvTransdataVocs genDataAuto(SurvDeviceDeploy deploy, DataExamineDetail config) { + if(deploy!=null && config!=null) { + if (config.getRules() != null && !config.getRules().isEmpty()) { + String deployCode = deploy.getDeployCode(); + try { + SurvTransdataVocs newestData = vocsService.getOneByDeviceId(deploy.getId()); + String orgId = null; + if (newestData != null) { + orgId = newestData.getId(); + if (newestData.getDataDateTime() != null) { + log.error(newestData.getDataDateTime()+"====================时间检查=============="+new Date()); + long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now()); + if (secs < config.getExamineGap()) {//间隔不足时不生成 + log.warn("-------------恶臭设备:{}:{},恶臭间隔为:{}秒,限制时间:{}秒,跳过--------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap()); + XxlJobHelper.log("--------------恶臭设备:{}:{},恶臭间隔为:{}秒,,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap()); + return null; + } + } + } + + Map ruleMap = new HashMap<>(); + for (DataExamineRule rule : config.getRules()) { + ruleMap.put(rule.getFields(), rule); + } + SurvHisdataVocs saveEnt = new SurvHisdataVocs(); + if (newestData == null) { + newestData = new SurvTransdataVocs(); + SurvHisdataVocs hisData = getRecentData(deployCode,config.getHistoryRange()); + if(hisData!=null){ //第一逻辑,如果有最近的历史数据,则使用历史数据作为基准值 + XxlJobHelper.log("=====恶臭设备:{}===查询到历史数据,使用历史数据作为基准值==========",deployCode); + BeanUtil.copyProperties(hisData,newestData); + saveEnt.setRuleType(IotConstants.RULE_HISTORY); + }else{//第二逻辑,使用预设的标准值 + XxlJobHelper.log("=====恶臭设备:{}===使用预设标准值进行生成==========",deployCode); + for (String s : ruleMap.keySet()) { + TUtil.setFieldValue(newestData, s, ruleMap.get(s).getStandard()); + } + saveEnt.setRuleType(IotConstants.RULE_PRE); + } + }else{ + long dateGap = DateTimeUtils.getDaysDiff(newestData.getDataDateTime(), LocalDateTime.now()); + XxlJobHelper.log("======恶臭设备:{}-{}=====恶臭水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,config.getHistoryRange()); + if (dateGap > config.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据 + XxlJobHelper.log("xxxx恶臭使用预设数据xxxxx"); + for (String s : ruleMap.keySet()) { + TUtil.setFieldValue(newestData, s, ruleMap.get(s).getStandard()); + } + saveEnt.setRuleType(IotConstants.RULE_PRE); + }else{ + XxlJobHelper.log("xxxx恶臭使用原数据规则类型:{}xxxxx",newestData.getRuleType()); + saveEnt.setRuleType(newestData.getRuleType()); + } + + } + + LocalDateTime nowTime = LocalDateTime.now(); + + saveEnt.setDeployId(deploy.getId()); + + saveEnt.setDataDateTime(nowTime); + saveEnt.setDataGatherType(IotConstants.MARK_GENDATA); + + + if(StringUtils.isNotBlank(deploy.getStationCode())){ + SurvStationInfo info = survStationInfoService.getByCode(deploy.getStationCode()); + if(info!=null){ + saveEnt.setStationName(info.getStationName()); + saveEnt.setStationId(info.getId()); + } + } + + saveEnt.setDeployId(deploy.getId()); + saveEnt.setStationCode(deploy.getStationCode()); + saveEnt.setDeployCode(deploy.getDeployCode()); + saveEnt.setDeviceName(deploy.getDeployDes()); + saveEnt.setTenantId(deploy.getTenantId()); + saveEnt.setTransDate(nowTime); + saveEnt.setReVision(0); + saveEnt.setCreatedBy("ftaskg"); + saveEnt.setCreateTime(nowTime); + saveEnt.setUpdatedBy("ftaskg"); + saveEnt.setIsDel(0); + saveEnt.setUpdatedTime(nowTime); + + + //生成数据 + for (String key : ruleMap.keySet()) { + DataExamineRule rule = ruleMap.get(key); + String vals = TUtil.getFieldValue(newestData, rule.getFields(), String.class); + if (StringUtils.isNotBlank(vals)) { + BigDecimal fixedRange = new BigDecimal(rule.getFactor()); + int scale = rule.getScale();//小数位 + String correctVal = BigDecimalRandomAdjuster.randomAdjustByFixedRange(new BigDecimal(vals), fixedRange, scale); + if(correctVal.contains("-") || "0".equals(correctVal)){//如果是负数或0用原来的值 + correctVal = vals; + } + TUtil.setFieldValue(saveEnt, rule.getFields(), correctVal); + } else { + log.error("==========恶臭设备:{},编号:{}指标:{}配置错误==============,跳过", deploy.getDeployDes(), deploy.getDeployCode(), rule.getFields()); + XxlJobHelper.log("==========恶臭设备:{},编号:{}指标:{}配置错误==============,跳过", deploy.getDeployDes(), deploy.getDeployCode(), rule.getFields()); + } + } + save(saveEnt); + BeanUtil.copyProperties(saveEnt, newestData); + newestData.setId(orgId); + newestData.setTenantId(deploy.getTenantId()); + newestData.setDataDateTime(nowTime); + newestData.setRuleType(newestData.getRuleType()); + newestData.setDataGatherType(newestData.getDataGatherType()); + vocsService.saveOrUpdate(newestData); + }catch (Exception e) { + e.printStackTrace(); + XxlJobHelper.log(e.getMessage()); + log.error(e.getMessage()); + } + } + } + return null; + } + + + private SurvHisdataVocs getRecentData(String deployCode,Integer dayRange) { + LocalDateTime daysAgo = LocalDateTime.now().minusDays(dayRange); + SurvHisdataVocs oldVoc = lambdaQuery() + .eq(SurvHisdataVocs::getDeployCode,deployCode) + .ge(SurvHisdataVocs::getDataDateTime, DateTimeConverter.toDate(daysAgo)) + .orderByDesc(SurvHisdataVocs::getDataDateTime) + .last("limit 1") + .one(); + + return oldVoc; + } +} diff --git a/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsMinServiceImpl.java b/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsMinServiceImpl.java new file mode 100644 index 0000000..b8a1c7e --- /dev/null +++ b/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsMinServiceImpl.java @@ -0,0 +1,20 @@ +package com.lanhai.service.Impl; + +import com.lanhai.entity.SurvTransdataVocsMin; +import com.lanhai.mapper.SurvTransdataVocsMinMapper; +import com.lanhai.service.ISurvTransdataVocsMinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 恶臭分钟数据 服务实现类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Service +public class SurvTransdataVocsMinServiceImpl extends ServiceImpl implements ISurvTransdataVocsMinService { + +} diff --git a/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsServiceImpl.java b/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsServiceImpl.java new file mode 100644 index 0000000..dcde6f0 --- /dev/null +++ b/src/main/java/com/lanhai/service/Impl/SurvTransdataVocsServiceImpl.java @@ -0,0 +1,29 @@ +package com.lanhai.service.Impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.lanhai.entity.SurvTransdataSoil; +import com.lanhai.entity.SurvTransdataVocs; +import com.lanhai.mapper.SurvTransdataVocsMapper; +import com.lanhai.service.ISurvTransdataVocsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 恶臭实时数据 服务实现类 + *

+ * + * @author ${author} + * @since 2026-07-21 + */ +@Service +public class SurvTransdataVocsServiceImpl extends ServiceImpl implements ISurvTransdataVocsService { + + @Override + public SurvTransdataVocs getOneByDeviceId(String deployId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(SurvTransdataVocs::getDeployId,deployId).last("limit 1"); + return getOne(queryWrapper); + } +} diff --git a/src/main/java/com/lanhai/task/DataExamineTask.java b/src/main/java/com/lanhai/task/DataExamineTask.java index 09c28f1..9896dae 100644 --- a/src/main/java/com/lanhai/task/DataExamineTask.java +++ b/src/main/java/com/lanhai/task/DataExamineTask.java @@ -14,8 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Date; import java.util.List; import com.xxl.job.core.handler.annotation.XxlJob; @@ -30,16 +32,16 @@ public class DataExamineTask { private ISurvDeviceDeployService deployService; @Autowired private ISurvHisdataOrientwaterService historyOrientwaterService; - @Autowired - private ISurvTransdataOrientwaterService orientWaterService; + @Autowired private ISurvHisdataLivestockwaterService historyLiveWaterService; - @Autowired - private ISurvTransdataLivestockwaterService livestockWaterService; + @Autowired private ISurvTaskConfigService taskConfigService; @Autowired private ISurvHisdataSoilService soilService; + @Autowired + private ISurvHisdataVocsService vocsService; @XxlJob("DataExamineGather") public void TaskHandler() throws Exception{ @@ -58,6 +60,7 @@ public class DataExamineTask { XxlJobHelper.log("配置有误1"); return; } + List updDeploy = new ArrayList<>(); for (DataExamineDetail config : dataExamineConfig.getConfigs()) { if(config.getDeployId()==null || config.getDeployId().isEmpty()){ XxlJobHelper.log("设备未配置"); @@ -80,43 +83,60 @@ public class DataExamineTask { if(deploy.getDeployType().equals(PollutionConstants.WATER_LIVE)){ SurvTransdataLivestockwater survTransdataLivestockwater = historyLiveWaterService.genDataAuto(deploy,config); if(survTransdataLivestockwater!=null){ - log.error("----------new设备号:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(survTransdataLivestockwater.getDataDateTime())); + updDeploy.add(deploy); + log.error("----------new设备号1:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(survTransdataLivestockwater.getDataDateTime())); }else{ - log.error("----------new设备号:{},跳过------------",deploy.getDeployCode()); + log.error("----------new设备号1:{},跳过------------",deploy.getDeployCode()); } } else if (deploy.getDeployType().equals(PollutionConstants.WATER_ORIENT)) { SurvTransdataOrientwater survTransdataOrientwater = historyOrientwaterService.genDataAuto(deploy,config); if(survTransdataOrientwater!=null){ - log.error("----------new设备号:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(survTransdataOrientwater.getDataDateTime())); + updDeploy.add(deploy); + log.error("----------new设备号2:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(survTransdataOrientwater.getDataDateTime())); }else{ - log.error("----------new设备号:{},跳过------------",deploy.getDeployCode()); + log.error("----------new设备号2:{},跳过------------",deploy.getDeployCode()); } }else if (deploy.getDeployType().equals(PollutionConstants.WATER_QULITY)) { SurvTransdataSoil soil = soilService.genDataAuto(deploy,config); if(soil!=null){ - log.error("----------new设备号:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(soil.getDataDateTime())); + updDeploy.add(deploy); + log.error("----------new设备号3:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(soil.getDataDateTime())); }else{ - log.error("----------new设备号:{},跳过------------",deploy.getDeployCode()); + log.error("----------new设备号3:{},跳过------------",deploy.getDeployCode()); + } + }else if (deploy.getDeployType().equals(PollutionConstants.STINK)) {//恶臭设备 + SurvTransdataVocs vocs = vocsService.genDataAuto(deploy,config); + if(vocs!=null){ + updDeploy.add(deploy); + log.error("----------new设备号4:{},生成成功,时间:{}-----------",deploy.getDeployCode(),sdf.format(vocs.getDataDateTime())); + }else{ + log.error("----------new设备号4:{},跳过------------",deploy.getDeployCode()); } } } } + if(!updDeploy.isEmpty()){ + List upds = new ArrayList<>(); + for (SurvDeviceDeploy survDeviceDeploy : updDeploy) { + SurvDeviceDeploy ents = new SurvDeviceDeploy(); + ents.setId(survDeviceDeploy.getId()); + ents.setLastsyncTime(new Date()); + upds.add(ents); + } + if(!upds.isEmpty()){ + deployService.updateBatchById(upds); + } + } + + log.warn("=============更新设备上次同步时间数量:{}==============",updDeploy.size()); + XxlJobHelper.log("=============更新设备上次同步时间数量:{}==============",updDeploy.size()); }else { XxlJobHelper.log("未配置任务执行设置"); } - List deviceType = new ArrayList(); - deviceType.add(PollutionConstants.WATER_LIVE); - deviceType.add(PollutionConstants.WATER_ORIENT); - //获取所有设备 - List deployList = deployService - .lambdaQuery() - .in(SurvDeviceDeploy::getDeployType,deviceType) - .eq(SurvDeviceDeploy::getRunStatus,0) - .list(); - log.warn("=============new查询到设备数量:{}==============",deployList.size()); + } catch (Exception e) {