增加流量计表结构支持
This commit is contained in:
parent
1f252a7c52
commit
246483f4ec
|
|
@ -80,7 +80,7 @@ public class MybatisPlusGenerator {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
new MybatisPlusGenerator().generator("surv_transdata_vocs","surv_transdata_vocs_min");//指标
|
new MybatisPlusGenerator().generator("surv_transdata_flowmeter","surv_hisdata_flowmeter");//指标
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ public interface PollutionConstants {
|
||||||
String SOIL_SURV = "soil";
|
String SOIL_SURV = "soil";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String STINK = "stink";
|
String STINK = "stink";
|
||||||
|
|
||||||
String CAMERA = "camera";
|
String CAMERA = "camera";
|
||||||
|
|
@ -64,6 +66,11 @@ public interface PollutionConstants {
|
||||||
*/
|
*/
|
||||||
String PEST_LIGHT="9_pestlight";
|
String PEST_LIGHT="9_pestlight";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计
|
||||||
|
*/
|
||||||
|
String FLOWMETER = "10_flowmeter";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据生成间隔 单位秒
|
* 数据生成间隔 单位秒
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.lanhai.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测历史数据 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/survHisdataFlowmeter")
|
||||||
|
public class SurvHisdataFlowmeterController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.lanhai.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测数据 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/survTransdataFlowmeter")
|
||||||
|
public class SurvTransdataFlowmeterController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测历史数据
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SurvHisdataFlowmeter extends Model<SurvHisdataFlowmeter> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据1
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA1")
|
||||||
|
private String sData1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据2
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA2")
|
||||||
|
private String sData2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据3
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA3")
|
||||||
|
private String sData3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据4
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA4")
|
||||||
|
private String sData4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据5
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA5")
|
||||||
|
private String sData5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据更新时间
|
||||||
|
*/
|
||||||
|
@TableField("DATA_DATE_TIME")
|
||||||
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
*/
|
||||||
|
@TableField("DATA_GATHER_TYPE")
|
||||||
|
private String dataGatherType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点ID
|
||||||
|
*/
|
||||||
|
@TableField("STATION_ID")
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
@TableField("DEPLOY_ID")
|
||||||
|
private String deployId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点编号
|
||||||
|
*/
|
||||||
|
@TableField("STATION_CODE")
|
||||||
|
private String stationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
@TableField("DEPLOY_CODE")
|
||||||
|
private String deployCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构ID
|
||||||
|
*/
|
||||||
|
@TableField("CORP_ID")
|
||||||
|
private String corpId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
@TableField("STATION_NAME")
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@TableField("DEVICE_NAME")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转储时间
|
||||||
|
*/
|
||||||
|
@TableField("TRANS_DATE")
|
||||||
|
private Date transDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户号
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测数据
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SurvTransdataFlowmeter extends Model<SurvTransdataFlowmeter> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据1
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA1")
|
||||||
|
private String sData1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据2
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA2")
|
||||||
|
private String sData2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据3
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA3")
|
||||||
|
private String sData3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据4
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA4")
|
||||||
|
private String sData4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据5
|
||||||
|
*/
|
||||||
|
@TableField("S_DATA5")
|
||||||
|
private String sData5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据更新时间
|
||||||
|
*/
|
||||||
|
@TableField("DATA_DATE_TIME")
|
||||||
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
*/
|
||||||
|
@TableField("DATA_GATHER_TYPE")
|
||||||
|
private String dataGatherType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点ID
|
||||||
|
*/
|
||||||
|
@TableField("STATION_ID")
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
@TableField("DEPLOY_ID")
|
||||||
|
private String deployId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点编号
|
||||||
|
*/
|
||||||
|
@TableField("STATION_CODE")
|
||||||
|
private String stationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
@TableField("DEPLOY_CODE")
|
||||||
|
private String deployCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构ID
|
||||||
|
*/
|
||||||
|
@TableField("CORP_ID")
|
||||||
|
private String corpId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
@TableField("STATION_NAME")
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@TableField("DEVICE_NAME")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户号
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,12 +12,23 @@ public enum DeviceDeployEnum {
|
||||||
WATER_LIVE("water_live", "畜禽水污染监测","surv"),
|
WATER_LIVE("water_live", "畜禽水污染监测","surv"),
|
||||||
/** 水质监测 */
|
/** 水质监测 */
|
||||||
WATER_QULITY("6_water", "水质监测","surv"),
|
WATER_QULITY("6_water", "水质监测","surv"),
|
||||||
|
/**
|
||||||
|
* 虫情监测
|
||||||
|
*/
|
||||||
|
BUG_SURV("7_bugsurv", "虫情监测", "surv"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孢子监测
|
||||||
|
*/
|
||||||
|
SPORE_SURV("8_sporesurv", "孢子监测", "surv"),
|
||||||
/**损耗出库*/
|
/**损耗出库*/
|
||||||
STINK("stink", "恶臭设备","surv"),
|
STINK("stink", "恶臭设备","surv"),
|
||||||
|
|
||||||
CAMERA("camera", "摄像头","surv"),
|
CAMERA("camera", "摄像头","surv"),
|
||||||
|
|
||||||
PEST_LIGHT("pestlight", "杀虫灯","guard"),
|
PEST_LIGHT("9_pestlight", "杀虫灯","guard"),
|
||||||
|
|
||||||
|
FLOWMETER("10_flowmeter", "流量计","surv"),
|
||||||
|
|
||||||
CONTROL_CAB("control_cab", "温室控制柜","control"),
|
CONTROL_CAB("control_cab", "温室控制柜","control"),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.lanhai.mapper;
|
||||||
|
|
||||||
|
import com.lanhai.entity.SurvHisdataFlowmeter;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测历史数据 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
public interface SurvHisdataFlowmeterMapper extends BaseMapper<SurvHisdataFlowmeter> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.lanhai.mapper;
|
||||||
|
|
||||||
|
import com.lanhai.entity.SurvTransdataFlowmeter;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测数据 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
public interface SurvTransdataFlowmeterMapper extends BaseMapper<SurvTransdataFlowmeter> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.lanhai.mapper.SurvHisdataFlowmeterMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.lanhai.mapper.SurvTransdataFlowmeterMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.lanhai.service;
|
||||||
|
|
||||||
|
import com.lanhai.entity.SurvDeviceDeploy;
|
||||||
|
import com.lanhai.entity.SurvHisdataFlowmeter;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测历史数据 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
public interface ISurvHisdataFlowmeterService extends IService<SurvHisdataFlowmeter> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.lanhai.service;
|
||||||
|
|
||||||
|
import com.lanhai.entity.SurvDeviceDeploy;
|
||||||
|
import com.lanhai.entity.SurvTransdataFlowmeter;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测数据 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
public interface ISurvTransdataFlowmeterService extends IService<SurvTransdataFlowmeter> {
|
||||||
|
void saveBaowen(Map<String, String> dataMap, SurvDeviceDeploy deploy, Map<String, SurvDeviceDeploy> deviceDeployMap);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.lanhai.service.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.lanhai.entity.*;
|
||||||
|
import com.lanhai.mapper.SurvHisdataFlowmeterMapper;
|
||||||
|
import com.lanhai.service.ISurvHisdataFlowmeterService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.lanhai.util.DateTimeUtils;
|
||||||
|
import com.lanhai.util.TUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测历史数据 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvHisdataFlowmeterServiceImpl extends ServiceImpl<SurvHisdataFlowmeterMapper, SurvHisdataFlowmeter> implements ISurvHisdataFlowmeterService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
package com.lanhai.service.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.lanhai.entity.*;
|
||||||
|
import com.lanhai.mapper.SurvTransdataFlowmeterMapper;
|
||||||
|
import com.lanhai.service.ISurvAlertRecordService;
|
||||||
|
import com.lanhai.service.ISurvDeviceDeployService;
|
||||||
|
import com.lanhai.service.ISurvTransdataFlowmeterService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.lanhai.util.DateTimeUtils;
|
||||||
|
import com.lanhai.util.TUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 流量计监测数据 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since 2026-07-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SurvTransdataFlowmeterServiceImpl extends ServiceImpl<SurvTransdataFlowmeterMapper, SurvTransdataFlowmeter> implements ISurvTransdataFlowmeterService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SurvAlertRecordServiceImpl alertRecordService;
|
||||||
|
@Autowired
|
||||||
|
private SurvDeviceDeployServiceImpl deviceDeployService;
|
||||||
|
@Autowired
|
||||||
|
private SurvHisdataFlowmeterServiceImpl flowmeterService;
|
||||||
|
@Autowired
|
||||||
|
private SurvStationInfoServiceImpl survStationInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveBaowen(Map<String, String> baowenMap, SurvDeviceDeploy survDeviceDeploy, Map<String, SurvDeviceDeploy> deviceDeployMap) {
|
||||||
|
|
||||||
|
String mn = baowenMap.get("mn");
|
||||||
|
String DataTime = baowenMap.get("DataTime");
|
||||||
|
//保存或者更新实时表
|
||||||
|
SurvTransdataFlowmeter flowmeter = getOneByDeviceId(survDeviceDeploy.getId());
|
||||||
|
LocalDateTime kDateTime = null;
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
if(flowmeter == null){
|
||||||
|
flowmeter = new SurvTransdataFlowmeter();
|
||||||
|
flowmeter.setCreatedBy("task");//创建人
|
||||||
|
flowmeter.setCreateTime(nowTime);//创建时间
|
||||||
|
}else{
|
||||||
|
flowmeter.setUpdatedBy("task");//创建人
|
||||||
|
flowmeter.setUpdatedTime(nowTime);//创建时间
|
||||||
|
kDateTime = flowmeter.getDataDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
int soilCount = 0;
|
||||||
|
String formatSoilTime = kDateTime!=null? DateUtil.format(kDateTime,"yyyy-MM-dd HH:mm:ss"):"";
|
||||||
|
if(!formatSoilTime.equals(DataTime)){
|
||||||
|
if(!survDeviceDeploy.getScEquZhibiaoList().isEmpty()){
|
||||||
|
for (ScEquZhibiao scEquZhibiao : survDeviceDeploy.getScEquZhibiaoList()) {
|
||||||
|
boolean isSuccess = TUtil.setFieldValue(flowmeter,scEquZhibiao.getEntityField(),baowenMap.get(scEquZhibiao.getCode()));
|
||||||
|
if(isSuccess){
|
||||||
|
soilCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// System.out.println("nSoilCheck==============:"+soilCount);
|
||||||
|
if(soilCount > 0){//只有数据有效时才入库
|
||||||
|
flowmeter.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
|
flowmeter.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
flowmeter.setDeployCode(mn);//设备编号
|
||||||
|
flowmeter.setTenantId(survDeviceDeploy.getTenantId());
|
||||||
|
|
||||||
|
// SurvDeviceDeploy survDeviceDeploy = deviceDeployMap.get(deploy.getDeployCode()+"_"+ DeviceDeployEnum.SURV_SOIL.getType());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(survDeviceDeploy!=null){
|
||||||
|
flowmeter.setDeployId(survDeviceDeploy.getId());
|
||||||
|
flowmeter.setStationCode(survDeviceDeploy.getStationCode());
|
||||||
|
flowmeter.setDeviceName(survDeviceDeploy.getDeployDes());
|
||||||
|
if(StringUtils.isNotBlank(survDeviceDeploy.getStationCode())){
|
||||||
|
SurvStationInfo survStationInfo = survStationInfoService.getByCode(survDeviceDeploy.getStationCode());
|
||||||
|
if(survStationInfo!=null) {
|
||||||
|
flowmeter.setStationName(survStationInfo.getStationName());
|
||||||
|
flowmeter.setStationId(survStationInfo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveOrUpdate(flowmeter);
|
||||||
|
//更新设备的上次更新时间
|
||||||
|
deviceDeployService.update(new LambdaUpdateWrapper<SurvDeviceDeploy>()
|
||||||
|
.eq(SurvDeviceDeploy::getId, survDeviceDeploy.getId())
|
||||||
|
.set(SurvDeviceDeploy::getLastsyncTime, nowTime));
|
||||||
|
|
||||||
|
//保存土壤历史表
|
||||||
|
if(kDateTime == null || !DataTime.equals(DateUtil.format(kDateTime,"yyyy-MM-dd HH:mm:ss"))){
|
||||||
|
SurvHisdataFlowmeter hisdataFlowmeter = new SurvHisdataFlowmeter();
|
||||||
|
BeanUtil.copyProperties(flowmeter,hisdataFlowmeter);
|
||||||
|
hisdataFlowmeter.setId(IdUtil.getSnowflakeNextIdStr());
|
||||||
|
hisdataFlowmeter.setCreateTime(nowTime);
|
||||||
|
flowmeterService.save(hisdataFlowmeter);
|
||||||
|
}else{
|
||||||
|
String dateStr = kDateTime!=null?DateUtil.format(kDateTime,"yyyy-MM-dd HH:mm:ss"):"";
|
||||||
|
log.error("****** 跳过,数据日期为:{},已存在于土壤历史表******",dateStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新设备的上次更新时间
|
||||||
|
deviceDeployService.update(new LambdaUpdateWrapper<SurvDeviceDeploy>()
|
||||||
|
.eq(SurvDeviceDeploy::getId, survDeviceDeploy.getId())//只能根据设备号更新,因为存在单个设备同时对应土壤空气的情况
|
||||||
|
.set(SurvDeviceDeploy::getLastsyncTime, nowTime));
|
||||||
|
|
||||||
|
//处理报警
|
||||||
|
if(survDeviceDeploy != null){
|
||||||
|
alertRecordService.saveBaojingV2(baowenMap,survDeviceDeploy,deviceDeployMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SurvTransdataFlowmeter getOneByDeviceId(String deployId) {
|
||||||
|
LambdaQueryWrapper<SurvTransdataFlowmeter> queryWrapper = new LambdaQueryWrapper<SurvTransdataFlowmeter>();
|
||||||
|
queryWrapper.eq(SurvTransdataFlowmeter::getDeployId,deployId).last("limit 1");
|
||||||
|
return getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -66,6 +66,8 @@ public class MultithreadTask {
|
||||||
deviceType.add(PollutionConstants.AIR_SURV);
|
deviceType.add(PollutionConstants.AIR_SURV);
|
||||||
deviceType.add(PollutionConstants.SOIL_SURV);
|
deviceType.add(PollutionConstants.SOIL_SURV);
|
||||||
deviceType.add(PollutionConstants.WATER_QULITY);
|
deviceType.add(PollutionConstants.WATER_QULITY);
|
||||||
|
deviceType.add(PollutionConstants.FLOWMETER);
|
||||||
|
|
||||||
List<String> protocolList = new ArrayList<String>(){
|
List<String> protocolList = new ArrayList<String>(){
|
||||||
{add(IotConstants.xph_v2);
|
{add(IotConstants.xph_v2);
|
||||||
add(IotConstants.tuya_standard);
|
add(IotConstants.tuya_standard);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.lanhai.util;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.lanhai.constant.PollutionConstants;
|
||||||
|
import com.lanhai.enums.DeviceDeployEnum;
|
||||||
|
import com.lanhai.service.*;
|
||||||
import com.xxl.job.core.context.XxlJobHelper;
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
import com.lanhai.constant.IotConstants;
|
import com.lanhai.constant.IotConstants;
|
||||||
import com.lanhai.entity.SurvConfig;
|
import com.lanhai.entity.SurvConfig;
|
||||||
|
|
@ -12,9 +15,6 @@ import com.lanhai.o.iot.renke.RenkeDataRealTimeDetail;
|
||||||
import com.lanhai.o.iot.renke.RenkeDataRealTimePack;
|
import com.lanhai.o.iot.renke.RenkeDataRealTimePack;
|
||||||
import com.lanhai.o.vo.HttpResponseVo;
|
import com.lanhai.o.vo.HttpResponseVo;
|
||||||
import com.lanhai.o.vo.VOIotAccess;
|
import com.lanhai.o.vo.VOIotAccess;
|
||||||
import com.lanhai.service.ISurvSurvConfigService;
|
|
||||||
import com.lanhai.service.IScEquZhibiaoService;
|
|
||||||
import com.lanhai.service.ISurvTransdataSoilService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
@ -25,10 +25,7 @@ import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,6 +41,7 @@ public class SdrkUtils {
|
||||||
static ISurvSurvConfigService configService = SpringContextUtil.getBean(ISurvSurvConfigService.class);
|
static ISurvSurvConfigService configService = SpringContextUtil.getBean(ISurvSurvConfigService.class);
|
||||||
static IScEquZhibiaoService scEquZhibiaoService = SpringContextUtil.getBean(IScEquZhibiaoService.class);
|
static IScEquZhibiaoService scEquZhibiaoService = SpringContextUtil.getBean(IScEquZhibiaoService.class);
|
||||||
static ISurvTransdataSoilService survTransdataSoilService = SpringContextUtil.getBean(ISurvTransdataSoilService.class);
|
static ISurvTransdataSoilService survTransdataSoilService = SpringContextUtil.getBean(ISurvTransdataSoilService.class);
|
||||||
|
static ISurvTransdataFlowmeterService flowmeterService = SpringContextUtil.getBean(ISurvTransdataFlowmeterService.class);
|
||||||
|
|
||||||
private static String domain = "http://www.0531yun.com";
|
private static String domain = "http://www.0531yun.com";
|
||||||
|
|
||||||
|
|
@ -96,8 +94,14 @@ public class SdrkUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataMap.size()>1){//不值包含mn
|
if(dataMap.size()>1){//不值包含mn
|
||||||
survTransdataSoilService.saveBaowen(dataMap, deploy,deviceDeployMap);
|
if(DeviceDeployEnum.SURV_SOIL.getType().equals(deploy.getDeployType())){//土壤监测设备
|
||||||
|
survTransdataSoilService.saveBaowen(dataMap, deploy,deviceDeployMap);
|
||||||
|
}else if(DeviceDeployEnum.FLOWMETER.getType().equals(deploy.getDeployType())){
|
||||||
|
flowmeterService.saveBaowen(dataMap, deploy,deviceDeployMap);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,11 +227,12 @@ public class SdrkUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String token = getToken(voIotAccess.getAppId(),voIotAccess.getAppSecret());
|
String token = getToken(voIotAccess.getAppId(),voIotAccess.getAppSecret());
|
||||||
String url = domain + "/api/data/getRealTimeDataByDeviceAddr?deviceAddrs={deviceAddrs}";
|
String url = domain + "/api/data/getRealTimeDataByDeviceAddr?deviceAddrs={deviceAddrs}&rc={rc}";
|
||||||
Map<String,String> headerMap = new HashMap<>();
|
Map<String,String> headerMap = new HashMap<>();
|
||||||
headerMap.put("authorization",token);
|
headerMap.put("authorization",token);
|
||||||
Map<String,Object> requestMap = new HashMap<>();
|
Map<String,Object> requestMap = new HashMap<>();
|
||||||
requestMap.put("deviceAddrs",deploy.getDeployCode());
|
requestMap.put("deviceAddrs",deploy.getDeployCode());
|
||||||
|
requestMap.put("rc", UUID.randomUUID().toString().replace("-",""));
|
||||||
String result = HttpReqestUtils.getExchangeImgs(url,requestMap,headerMap);
|
String result = HttpReqestUtils.getExchangeImgs(url,requestMap,headerMap);
|
||||||
XxlJobHelper.log("===============实时数据返回:{}===========",result);
|
XxlJobHelper.log("===============实时数据返回:{}===========",result);
|
||||||
log.warn("===============实时数据返回:{}===========",result);
|
log.warn("===============实时数据返回:{}===========",result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue