修复时间戳校验bug
This commit is contained in:
parent
1d232808e0
commit
dc6cd97c95
|
|
@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -84,7 +85,7 @@ public class SurvHisdataAir extends Model<SurvHisdataAir> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -144,7 +145,7 @@ public class SurvHisdataAir extends Model<SurvHisdataAir> {
|
||||||
* 转储时间
|
* 转储时间
|
||||||
*/
|
*/
|
||||||
@TableField("TRANS_DATE")
|
@TableField("TRANS_DATE")
|
||||||
private Date transDate;
|
private LocalDateTime transDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户号
|
* 租户号
|
||||||
|
|
@ -168,7 +169,7 @@ public class SurvHisdataAir extends Model<SurvHisdataAir> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -186,7 +187,7 @@ public class SurvHisdataAir extends Model<SurvHisdataAir> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.lanhai.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
@ -123,7 +125,7 @@ public class SurvHisdataLivestockwater extends Model<SurvHisdataLivestockwater>
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -183,7 +185,7 @@ public class SurvHisdataLivestockwater extends Model<SurvHisdataLivestockwater>
|
||||||
* 转储时间
|
* 转储时间
|
||||||
*/
|
*/
|
||||||
@TableField("TRANS_DATE")
|
@TableField("TRANS_DATE")
|
||||||
private Date transDate;
|
private LocalDateTime transDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户号
|
* 租户号
|
||||||
|
|
@ -207,7 +209,7 @@ public class SurvHisdataLivestockwater extends Model<SurvHisdataLivestockwater>
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -225,7 +227,7 @@ public class SurvHisdataLivestockwater extends Model<SurvHisdataLivestockwater>
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.lanhai.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
@ -120,7 +122,7 @@ public class SurvHisdataLivestockwaterError extends Model<SurvHisdataLivestockwa
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -204,7 +206,7 @@ public class SurvHisdataLivestockwaterError extends Model<SurvHisdataLivestockwa
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -222,7 +224,7 @@ public class SurvHisdataLivestockwaterError extends Model<SurvHisdataLivestockwa
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -126,7 +127,7 @@ public class SurvHisdataOrientwater extends Model<SurvHisdataOrientwater> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -186,7 +187,7 @@ public class SurvHisdataOrientwater extends Model<SurvHisdataOrientwater> {
|
||||||
* 转储时间
|
* 转储时间
|
||||||
*/
|
*/
|
||||||
@TableField("TRANS_DATE")
|
@TableField("TRANS_DATE")
|
||||||
private Date transDate;
|
private LocalDateTime transDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户号
|
* 租户号
|
||||||
|
|
@ -210,7 +211,7 @@ public class SurvHisdataOrientwater extends Model<SurvHisdataOrientwater> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -228,7 +229,7 @@ public class SurvHisdataOrientwater extends Model<SurvHisdataOrientwater> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.lanhai.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
@ -159,7 +161,7 @@ public class SurvHisdataOrientwaterError extends Model<SurvHisdataOrientwaterErr
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -243,7 +245,7 @@ public class SurvHisdataOrientwaterError extends Model<SurvHisdataOrientwaterErr
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -261,7 +263,7 @@ public class SurvHisdataOrientwaterError extends Model<SurvHisdataOrientwaterErr
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -208,7 +209,7 @@ public class SurvHisdataSoil extends Model<SurvHisdataSoil> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -268,7 +269,7 @@ public class SurvHisdataSoil extends Model<SurvHisdataSoil> {
|
||||||
* 转储时间
|
* 转储时间
|
||||||
*/
|
*/
|
||||||
@TableField("TRANS_DATE")
|
@TableField("TRANS_DATE")
|
||||||
private Date transDate;
|
private LocalDateTime transDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户号
|
* 租户号
|
||||||
|
|
@ -292,7 +293,7 @@ public class SurvHisdataSoil extends Model<SurvHisdataSoil> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -310,7 +311,7 @@ public class SurvHisdataSoil extends Model<SurvHisdataSoil> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,7 +84,7 @@ public class SurvTransdataAir extends Model<SurvTransdataAir> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -161,7 +162,7 @@ public class SurvTransdataAir extends Model<SurvTransdataAir> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -179,7 +180,7 @@ public class SurvTransdataAir extends Model<SurvTransdataAir> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.lanhai.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
@ -125,7 +127,7 @@ public class SurvTransdataLivestockwater extends Model<SurvTransdataLivestockwat
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据获取类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据获取类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -203,7 +205,7 @@ public class SurvTransdataLivestockwater extends Model<SurvTransdataLivestockwat
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -221,7 +223,7 @@ public class SurvTransdataLivestockwater extends Model<SurvTransdataLivestockwat
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,7 +134,7 @@ public class SurvTransdataOrientwater extends Model<SurvTransdataOrientwater> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -211,7 +212,7 @@ public class SurvTransdataOrientwater extends Model<SurvTransdataOrientwater> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -229,7 +230,7 @@ public class SurvTransdataOrientwater extends Model<SurvTransdataOrientwater> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -210,7 +211,7 @@ public class SurvTransdataSoil extends Model<SurvTransdataSoil> {
|
||||||
* 数据更新时间
|
* 数据更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("DATA_DATE_TIME")
|
@TableField("DATA_DATE_TIME")
|
||||||
private Date dataDateTime;
|
private LocalDateTime dataDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
* 数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
|
|
@ -289,7 +290,7 @@ public class SurvTransdataSoil extends Model<SurvTransdataSoil> {
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
private Date createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人
|
* 更新人
|
||||||
|
|
@ -307,7 +308,7 @@ public class SurvTransdataSoil extends Model<SurvTransdataSoil> {
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@TableField("UPDATED_TIME")
|
@TableField("UPDATED_TIME")
|
||||||
private Date updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
public class RenkeDataRealTimeDetail {
|
public class RenkeDataRealTimeDetail {
|
||||||
|
|
||||||
private String systemCode;
|
private String systemCode;
|
||||||
private long deviceAddr;
|
private Long deviceAddr;
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
private int lat;
|
private int lat;
|
||||||
private int lng;
|
private int lng;
|
||||||
|
|
@ -21,7 +21,7 @@ public class RenkeDataRealTimeDetail {
|
||||||
private String relayStatus;
|
private String relayStatus;
|
||||||
private List<RelayStatusItems> relayStatusItems;
|
private List<RelayStatusItems> relayStatusItems;
|
||||||
private List<DataItem> dataItem;
|
private List<DataItem> dataItem;
|
||||||
private long timeStamp;
|
private Long timeStamp;
|
||||||
public void setSystemCode(String systemCode) {
|
public void setSystemCode(String systemCode) {
|
||||||
this.systemCode = systemCode;
|
this.systemCode = systemCode;
|
||||||
}
|
}
|
||||||
|
|
@ -29,10 +29,10 @@ public class RenkeDataRealTimeDetail {
|
||||||
return systemCode;
|
return systemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeviceAddr(long deviceAddr) {
|
public void setDeviceAddr(Long deviceAddr) {
|
||||||
this.deviceAddr = deviceAddr;
|
this.deviceAddr = deviceAddr;
|
||||||
}
|
}
|
||||||
public long getDeviceAddr() {
|
public Long getDeviceAddr() {
|
||||||
return deviceAddr;
|
return deviceAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,10 +85,10 @@ public class RenkeDataRealTimeDetail {
|
||||||
return dataItem;
|
return dataItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeStamp(long timeStamp) {
|
public void setTimeStamp(Long timeStamp) {
|
||||||
this.timeStamp = timeStamp;
|
this.timeStamp = timeStamp;
|
||||||
}
|
}
|
||||||
public long getTimeStamp() {
|
public Long getTimeStamp() {
|
||||||
return timeStamp;
|
return timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -121,6 +122,7 @@ public class CommonServiceImpl implements ICommonService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(waterCommonTransVo!=null){
|
if(waterCommonTransVo!=null){
|
||||||
|
LocalDateTime nowTime =LocalDateTime.now();
|
||||||
//遍历保存所有租户数据
|
//遍历保存所有租户数据
|
||||||
for (SurvDeviceDeploy deploy : deployList) {
|
for (SurvDeviceDeploy deploy : deployList) {
|
||||||
SurvStationInfo survStationInfo = survStationInfoService.getByCode(deploy.getStationCode());
|
SurvStationInfo survStationInfo = survStationInfoService.getByCode(deploy.getStationCode());
|
||||||
|
|
@ -135,14 +137,14 @@ public class CommonServiceImpl implements ICommonService {
|
||||||
orientwater.setDeviceName(deploy.getDeployDes());
|
orientwater.setDeviceName(deploy.getDeployDes());
|
||||||
orientwater.setDeviceId(deploy.getId());
|
orientwater.setDeviceId(deploy.getId());
|
||||||
orientwater.setCreatedBy("task");//创建人
|
orientwater.setCreatedBy("task");//创建人
|
||||||
orientwater.setCreateTime(new Date());//创建时间
|
orientwater.setCreateTime(nowTime);//创建时间
|
||||||
|
|
||||||
transdataOrientwaterService.save(orientwater);
|
transdataOrientwaterService.save(orientwater);
|
||||||
|
|
||||||
//保存历史表
|
//保存历史表
|
||||||
SurvHisdataOrientwater hisOrientWater= new SurvHisdataOrientwater();
|
SurvHisdataOrientwater hisOrientWater= new SurvHisdataOrientwater();
|
||||||
hisOrientWater.setId(IdUtil.getSnowflakeNextIdStr());
|
hisOrientWater.setId(IdUtil.getSnowflakeNextIdStr());
|
||||||
hisOrientWater.setTransDate(new Date());
|
hisOrientWater.setTransDate(nowTime);
|
||||||
hisdataOrientwaterService.save(hisOrientWater);
|
hisdataOrientwaterService.save(hisOrientWater);
|
||||||
|
|
||||||
} else if (PollutionConstants.WATER_LIVE.equals(deploy.getDeployType())) {
|
} else if (PollutionConstants.WATER_LIVE.equals(deploy.getDeployType())) {
|
||||||
|
|
@ -155,14 +157,14 @@ public class CommonServiceImpl implements ICommonService {
|
||||||
livestockwater.setDeviceName(deploy.getDeployDes());
|
livestockwater.setDeviceName(deploy.getDeployDes());
|
||||||
livestockwater.setDeviceId(deploy.getId());
|
livestockwater.setDeviceId(deploy.getId());
|
||||||
livestockwater.setCreatedBy("task");//创建人
|
livestockwater.setCreatedBy("task");//创建人
|
||||||
livestockwater.setCreateTime(new Date());//创建时间
|
livestockwater.setCreateTime(nowTime);//创建时间
|
||||||
|
|
||||||
transdataLivestockwaterService.save(livestockwater);
|
transdataLivestockwaterService.save(livestockwater);
|
||||||
|
|
||||||
//保存历史表
|
//保存历史表
|
||||||
SurvHisdataLivestockwater hisdataLivestockwater = new SurvHisdataLivestockwater();
|
SurvHisdataLivestockwater hisdataLivestockwater = new SurvHisdataLivestockwater();
|
||||||
hisdataLivestockwater.setId(IdUtil.getSnowflakeNextIdStr());
|
hisdataLivestockwater.setId(IdUtil.getSnowflakeNextIdStr());
|
||||||
hisdataLivestockwater.setTransDate(new Date());
|
hisdataLivestockwater.setTransDate(nowTime);
|
||||||
hisdataLivestockwaterService.save(hisdataLivestockwater);
|
hisdataLivestockwaterService.save(hisdataLivestockwater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
||||||
}
|
}
|
||||||
if(!isNegative){//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
if(!isNegative){//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
||||||
if (newestData.getDataDateTime() != null) {
|
if (newestData.getDataDateTime() != null) {
|
||||||
long secs = DateUtils.getSecondsDiff(newestData.getDataDateTime(), new Date());
|
long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
if (secs < PollutionConstants.dataGenGap) {//间隔不足时不生成
|
if (secs < PollutionConstants.dataGenGap) {//间隔不足时不生成
|
||||||
log.warn("畜禽间隔为:{}秒,跳过", secs);
|
log.warn("畜禽间隔为:{}秒,跳过", secs);
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -126,7 +126,7 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
||||||
int values = rand.nextInt(4);
|
int values = rand.nextInt(4);
|
||||||
|
|
||||||
SurvHisdataLivestockwater hisdataLivestockwater = new SurvHisdataLivestockwater();
|
SurvHisdataLivestockwater hisdataLivestockwater = new SurvHisdataLivestockwater();
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
hisdataLivestockwater.setReVision(0);
|
hisdataLivestockwater.setReVision(0);
|
||||||
hisdataLivestockwater.setCreatedBy("ftask");
|
hisdataLivestockwater.setCreatedBy("ftask");
|
||||||
hisdataLivestockwater.setCreateTime(nowTime);
|
hisdataLivestockwater.setCreateTime(nowTime);
|
||||||
|
|
@ -222,7 +222,7 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
||||||
}
|
}
|
||||||
if (!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
if (!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
||||||
if (newestData.getDataDateTime() != null) {
|
if (newestData.getDataDateTime() != null) {
|
||||||
long secs = DateUtils.getSecondsDiff(newestData.getDataDateTime(), new Date());
|
long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
if (secs < dataExamineDetail.getExamineGap()) {//间隔不足时不生成
|
if (secs < dataExamineDetail.getExamineGap()) {//间隔不足时不生成
|
||||||
log.warn("--------------设备:{}:{},new畜禽间隔为:{}秒,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,dataExamineDetail.getExamineGap());
|
log.warn("--------------设备:{}:{},new畜禽间隔为:{}秒,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,dataExamineDetail.getExamineGap());
|
||||||
XxlJobHelper.log("---------------设备:{}:{},new畜禽间隔为:{}秒,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,dataExamineDetail.getExamineGap());
|
XxlJobHelper.log("---------------设备:{}:{},new畜禽间隔为:{}秒,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,dataExamineDetail.getExamineGap());
|
||||||
|
|
@ -255,7 +255,7 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
||||||
hisdataLivestockwater.setRuleType(IotConstants.RULE_PRE);
|
hisdataLivestockwater.setRuleType(IotConstants.RULE_PRE);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
long dateGap = DateUtils.getDaysDiff(newestData.getDataDateTime(), new Date());
|
long dateGap = DateTimeUtils.getDaysDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,dataExamineDetail.getHistoryRange());
|
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,dataExamineDetail.getHistoryRange());
|
||||||
if (dateGap > dataExamineDetail.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
if (dateGap > dataExamineDetail.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
||||||
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
||||||
|
|
@ -271,7 +271,7 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
hisdataLivestockwater.setReVision(0);
|
hisdataLivestockwater.setReVision(0);
|
||||||
hisdataLivestockwater.setCreatedBy("ftask");
|
hisdataLivestockwater.setCreatedBy("ftask");
|
||||||
hisdataLivestockwater.setCreateTime(nowTime);
|
hisdataLivestockwater.setCreateTime(nowTime);
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
||||||
|
|
||||||
if(!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
if(!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
||||||
if (newestData.getDataDateTime() != null) {
|
if (newestData.getDataDateTime() != null) {
|
||||||
long secs = DateUtils.getSecondsDiff(newestData.getDataDateTime(), new Date());
|
long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
if (secs < PollutionConstants.dataGenGap) {//间隔不足时不生成
|
if (secs < PollutionConstants.dataGenGap) {//间隔不足时不生成
|
||||||
log.warn("面源间隔为:{}秒,跳过", secs);
|
log.warn("面源间隔为:{}秒,跳过", secs);
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -141,7 +141,7 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
||||||
int values = rand.nextInt(4);
|
int values = rand.nextInt(4);
|
||||||
|
|
||||||
SurvHisdataOrientwater hisdataOrientwater = new SurvHisdataOrientwater();
|
SurvHisdataOrientwater hisdataOrientwater = new SurvHisdataOrientwater();
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
hisdataOrientwater.setReVision(0);
|
hisdataOrientwater.setReVision(0);
|
||||||
hisdataOrientwater.setCreatedBy("ftask");
|
hisdataOrientwater.setCreatedBy("ftask");
|
||||||
hisdataOrientwater.setCreateTime(nowTime);
|
hisdataOrientwater.setCreateTime(nowTime);
|
||||||
|
|
@ -242,7 +242,7 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
||||||
|
|
||||||
if (!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
if (!isNegative) {//非负数时,检查时间是否过期,否则直接自动覆盖此数据
|
||||||
if (newestData.getDataDateTime() != null) {
|
if (newestData.getDataDateTime() != null) {
|
||||||
long secs = DateUtils.getSecondsDiff(newestData.getDataDateTime(), new Date());
|
long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
if (secs < config.getExamineGap()) {//间隔不足时不生成
|
if (secs < config.getExamineGap()) {//间隔不足时不生成
|
||||||
log.warn("----------------设备:{}:{},土壤/new面源间隔为:{}秒,限制时间:{}秒,跳过-------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
log.warn("----------------设备:{}:{},土壤/new面源间隔为:{}秒,限制时间:{}秒,跳过-------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
||||||
XxlJobHelper.log("-------------设备:{}:{},new面源间隔为:{}秒,,限制时间:{}秒,跳过-----------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
XxlJobHelper.log("-------------设备:{}:{},new面源间隔为:{}秒,,限制时间:{}秒,跳过-----------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
||||||
|
|
@ -275,7 +275,7 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
||||||
hisdataOrientwater.setRuleType(IotConstants.RULE_PRE);
|
hisdataOrientwater.setRuleType(IotConstants.RULE_PRE);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
long dateGap = DateUtils.getDaysDiff(newestData.getDataDateTime(), new Date());
|
long dateGap = DateTimeUtils.getDaysDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,config.getHistoryRange());
|
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,config.getHistoryRange());
|
||||||
if (dateGap > config.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
if (dateGap > config.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
||||||
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
||||||
|
|
@ -291,7 +291,7 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
||||||
}
|
}
|
||||||
//开始生成
|
//开始生成
|
||||||
|
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
hisdataOrientwater.setReVision(0);
|
hisdataOrientwater.setReVision(0);
|
||||||
hisdataOrientwater.setCreatedBy("ftask");
|
hisdataOrientwater.setCreatedBy("ftask");
|
||||||
hisdataOrientwater.setCreateTime(nowTime);
|
hisdataOrientwater.setCreateTime(nowTime);
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,7 @@ import com.lanhai.o.iot.task.DataExamineRule;
|
||||||
import com.lanhai.service.ISurvHisdataSoilService;
|
import com.lanhai.service.ISurvHisdataSoilService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.lanhai.service.ISurvStationInfoService;
|
import com.lanhai.service.ISurvStationInfoService;
|
||||||
import com.lanhai.util.BigDecimalRandomAdjuster;
|
import com.lanhai.util.*;
|
||||||
import com.lanhai.util.DateTimeConverter;
|
|
||||||
import com.lanhai.util.DateUtils;
|
|
||||||
import com.lanhai.util.TUtil;
|
|
||||||
import com.xxl.job.core.context.XxlJobHelper;
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -55,7 +52,8 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
if (newestData != null) {
|
if (newestData != null) {
|
||||||
orgId = newestData.getId();
|
orgId = newestData.getId();
|
||||||
if (newestData.getDataDateTime() != null) {
|
if (newestData.getDataDateTime() != null) {
|
||||||
long secs = DateUtils.getSecondsDiff(newestData.getDataDateTime(), new Date());
|
log.error(newestData.getDataDateTime()+"====================时间检查=============="+new Date());
|
||||||
|
long secs = DateTimeUtils.getSecondsDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
if (secs < config.getExamineGap()) {//间隔不足时不生成
|
if (secs < config.getExamineGap()) {//间隔不足时不生成
|
||||||
log.warn("-------------设备:{}:{},土壤/水间隔为:{}秒,限制时间:{}秒,跳过--------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
log.warn("-------------设备:{}:{},土壤/水间隔为:{}秒,限制时间:{}秒,跳过--------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
||||||
XxlJobHelper.log("--------------设备:{}:{},土壤/水间隔为:{}秒,,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
XxlJobHelper.log("--------------设备:{}:{},土壤/水间隔为:{}秒,,限制时间:{}秒,跳过---------------", deploy.getDeployDes(),deploy.getDeployCode(),secs,config.getExamineGap());
|
||||||
|
|
@ -84,7 +82,7 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
saveEnt.setRuleType(IotConstants.RULE_PRE);
|
saveEnt.setRuleType(IotConstants.RULE_PRE);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
long dateGap = DateUtils.getDaysDiff(newestData.getDataDateTime(), new Date());
|
long dateGap = DateTimeUtils.getDaysDiff(newestData.getDataDateTime(), LocalDateTime.now());
|
||||||
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,config.getHistoryRange());
|
XxlJobHelper.log("======设备:{}-{}=====土壤/水数据间隔{}天===限制天数:{}====",deploy.getDeployDes(),deploy.getDeployCode(),dateGap,config.getHistoryRange());
|
||||||
if (dateGap > config.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
if (dateGap > config.getHistoryRange()) {//最新数据已经超过时限范围,则使用预设数据
|
||||||
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
XxlJobHelper.log("xxxx使用预设数据xxxxx");
|
||||||
|
|
@ -99,7 +97,7 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
|
||||||
saveEnt.setDeployId(deploy.getId());
|
saveEnt.setDeployId(deploy.getId());
|
||||||
saveEnt.setDeployType(deploy.getDeployType());
|
saveEnt.setDeployType(deploy.getDeployType());
|
||||||
|
|
@ -123,9 +121,9 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
saveEnt.setTenantId(deploy.getTenantId());
|
saveEnt.setTenantId(deploy.getTenantId());
|
||||||
saveEnt.setTransDate(nowTime);
|
saveEnt.setTransDate(nowTime);
|
||||||
saveEnt.setReVision(0);
|
saveEnt.setReVision(0);
|
||||||
saveEnt.setCreatedBy("ftask");
|
saveEnt.setCreatedBy("ftaskg");
|
||||||
saveEnt.setCreateTime(nowTime);
|
saveEnt.setCreateTime(nowTime);
|
||||||
saveEnt.setUpdatedBy("ftask");
|
saveEnt.setUpdatedBy("ftaskg");
|
||||||
saveEnt.setIsDel(0);
|
saveEnt.setIsDel(0);
|
||||||
saveEnt.setUpdatedTime(nowTime);
|
saveEnt.setUpdatedTime(nowTime);
|
||||||
|
|
||||||
|
|
@ -147,7 +145,6 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
XxlJobHelper.log("==========设备:{},编号:{}指标:{}配置错误==============,跳过", deploy.getDeployDes(), deploy.getDeployCode(), rule.getFields());
|
XxlJobHelper.log("==========设备:{},编号:{}指标:{}配置错误==============,跳过", deploy.getDeployDes(), deploy.getDeployCode(), rule.getFields());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save(saveEnt);
|
save(saveEnt);
|
||||||
BeanUtil.copyProperties(saveEnt, newestData);
|
BeanUtil.copyProperties(saveEnt, newestData);
|
||||||
newestData.setId(orgId);
|
newestData.setId(orgId);
|
||||||
|
|
@ -155,9 +152,7 @@ public class SurvHisdataSoilServiceImpl extends ServiceImpl<SurvHisdataSoilMappe
|
||||||
newestData.setDataDateTime(nowTime);
|
newestData.setDataDateTime(nowTime);
|
||||||
newestData.setRuleType(newestData.getRuleType());
|
newestData.setRuleType(newestData.getRuleType());
|
||||||
newestData.setDataGatherType(newestData.getDataGatherType());
|
newestData.setDataGatherType(newestData.getDataGatherType());
|
||||||
log.error("=====================更新五常数据1====================="+newestData.getDataDateTime());
|
|
||||||
soilService.saveOrUpdate(newestData);
|
soilService.saveOrUpdate(newestData);
|
||||||
log.error("=====================更新五常数据2====================="+newestData.getDataDateTime());
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
XxlJobHelper.log(e.getMessage());
|
XxlJobHelper.log(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -127,7 +128,7 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl<SurvIotVirtualD
|
||||||
|
|
||||||
orientwater.setDeployCode(deployCode);
|
orientwater.setDeployCode(deployCode);
|
||||||
orientwater.setDeviceId(deployId);
|
orientwater.setDeviceId(deployId);
|
||||||
orientwater.setDataDateTime(new Date());//采集时间
|
orientwater.setDataDateTime(LocalDateTime.now());//采集时间
|
||||||
orientwater.setDataGatherType("realTime");
|
orientwater.setDataGatherType("realTime");
|
||||||
orientwater.setStationCode(stationCode);
|
orientwater.setStationCode(stationCode);
|
||||||
orientwater.setDeviceName(deployName);
|
orientwater.setDeviceName(deployName);
|
||||||
|
|
@ -159,7 +160,7 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl<SurvIotVirtualD
|
||||||
|
|
||||||
livestockwater.setDeployCode(deployCode);
|
livestockwater.setDeployCode(deployCode);
|
||||||
livestockwater.setDeviceId(deployId);
|
livestockwater.setDeviceId(deployId);
|
||||||
livestockwater.setDataDateTime(new Date());//采集时间
|
livestockwater.setDataDateTime(LocalDateTime.now());//采集时间
|
||||||
livestockwater.setDataGatherType("realTime");
|
livestockwater.setDataGatherType("realTime");
|
||||||
livestockwater.setStationCode(stationCode);
|
livestockwater.setStationCode(stationCode);
|
||||||
livestockwater.setDeviceName(deployName);
|
livestockwater.setDeviceName(deployName);
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@ import com.lanhai.entity.SurvHisdataAir;
|
||||||
import com.lanhai.entity.SurvTransdataAir;
|
import com.lanhai.entity.SurvTransdataAir;
|
||||||
import com.lanhai.mapper.SurvTransdataAirMapper;
|
import com.lanhai.mapper.SurvTransdataAirMapper;
|
||||||
import com.lanhai.service.*;
|
import com.lanhai.service.*;
|
||||||
|
import com.lanhai.util.DateTimeUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -57,16 +59,16 @@ public class SurvTransdataAirServiceImpl extends ServiceImpl<SurvTransdataAirMap
|
||||||
|
|
||||||
String mn = baowenMap.get("mn");
|
String mn = baowenMap.get("mn");
|
||||||
String DataTime = baowenMap.get("DataTime");
|
String DataTime = baowenMap.get("DataTime");
|
||||||
Date kDateTime = null;
|
LocalDateTime kDateTime = null;
|
||||||
//保存或者更新实时表
|
//保存或者更新实时表
|
||||||
SurvTransdataAir air = getOneByDeviceCode(mn,null);
|
SurvTransdataAir air = getOneByDeviceCode(mn,null);
|
||||||
if(air == null){
|
if(air == null){
|
||||||
air = new SurvTransdataAir();
|
air = new SurvTransdataAir();
|
||||||
air.setCreatedBy("wb");//创建人
|
air.setCreatedBy("wb");//创建人
|
||||||
air.setCreateTime(new Date());//创建时间
|
air.setCreateTime(LocalDateTime.now());//创建时间
|
||||||
}else{
|
}else{
|
||||||
air.setUpdatedBy("wb");//创建人
|
air.setUpdatedBy("wb");//创建人
|
||||||
air.setUpdatedTime(new Date());//创建时间
|
air.setUpdatedTime(LocalDateTime.now());//创建时间
|
||||||
kDateTime = air.getDataDateTime();
|
kDateTime = air.getDataDateTime();
|
||||||
}
|
}
|
||||||
air.setDataAirTemp(baowenMap.get("e3"));//温度
|
air.setDataAirTemp(baowenMap.get("e3"));//温度
|
||||||
|
|
@ -78,7 +80,7 @@ public class SurvTransdataAirServiceImpl extends ServiceImpl<SurvTransdataAirMap
|
||||||
air.setDataSunFallout(baowenMap.get("e6"));//简易总辐射
|
air.setDataSunFallout(baowenMap.get("e6"));//简易总辐射
|
||||||
air.setDataRainTotal(baowenMap.get("e4"));//雨量累计
|
air.setDataRainTotal(baowenMap.get("e4"));//雨量累计
|
||||||
air.setDataSunTotal(baowenMap.get("e8"));//辐射累计
|
air.setDataSunTotal(baowenMap.get("e8"));//辐射累计
|
||||||
air.setDataDateTime(DateUtil.parse(DataTime));//数据时间
|
air.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
air.setDeployCode(mn);//设备编号
|
air.setDeployCode(mn);//设备编号
|
||||||
saveOrUpdate(air);
|
saveOrUpdate(air);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -69,7 +70,7 @@ public class SurvTransdataLivestockwaterServiceImpl extends ServiceImpl<SurvTran
|
||||||
// transdataLivestockwater.setId(id);
|
// transdataLivestockwater.setId(id);
|
||||||
}
|
}
|
||||||
transdataLivestockwater.setCreatedBy("wb");//创建人
|
transdataLivestockwater.setCreatedBy("wb");//创建人
|
||||||
transdataLivestockwater.setCreateTime(new Date());//创建时间
|
transdataLivestockwater.setCreateTime(LocalDateTime.now());//创建时间
|
||||||
|
|
||||||
transdataLivestockwater.setDeviceId(deploy.getId());
|
transdataLivestockwater.setDeviceId(deploy.getId());
|
||||||
transdataLivestockwater.setDeviceName(deploy.getDeployDes());
|
transdataLivestockwater.setDeviceName(deploy.getDeployDes());
|
||||||
|
|
@ -130,7 +131,7 @@ public class SurvTransdataLivestockwaterServiceImpl extends ServiceImpl<SurvTran
|
||||||
hisdataLivestockwaterService.save(hisdataLivestockwater);
|
hisdataLivestockwaterService.save(hisdataLivestockwater);
|
||||||
|
|
||||||
//处理报警
|
//处理报警
|
||||||
Date dataDateTime = transdataLivestockwater.getDataDateTime();
|
LocalDateTime dataDateTime = transdataLivestockwater.getDataDateTime();
|
||||||
String dataDateTimeStr = DateUtil.format(dataDateTime, "yyyy-MM-dd HH:mm:ss");
|
String dataDateTimeStr = DateUtil.format(dataDateTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
Map<String, String> baowenMap = new HashMap<String, String>();
|
Map<String, String> baowenMap = new HashMap<String, String>();
|
||||||
baowenMap.put("mn", transdataLivestockwater.getDeployCode());
|
baowenMap.put("mn", transdataLivestockwater.getDeployCode());
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -70,7 +71,7 @@ public class SurvTransdataOrientwaterServiceImpl extends ServiceImpl<SurvTransda
|
||||||
transdataOrientwater.setId(id);
|
transdataOrientwater.setId(id);
|
||||||
}
|
}
|
||||||
transdataOrientwater.setCreatedBy("wb");//创建人
|
transdataOrientwater.setCreatedBy("wb");//创建人
|
||||||
transdataOrientwater.setCreateTime(new Date());//创建时间
|
transdataOrientwater.setCreateTime(LocalDateTime.now());//创建时间
|
||||||
if(StringUtils.isNotBlank(deploy.getStationCode())){
|
if(StringUtils.isNotBlank(deploy.getStationCode())){
|
||||||
SurvStationInfo info = survStationInfoService.getByCode(deploy.getStationCode());
|
SurvStationInfo info = survStationInfoService.getByCode(deploy.getStationCode());
|
||||||
if(info!=null){
|
if(info!=null){
|
||||||
|
|
@ -128,7 +129,7 @@ public class SurvTransdataOrientwaterServiceImpl extends ServiceImpl<SurvTransda
|
||||||
hisdataOrientwaterService.save(hisdataOrientwater);
|
hisdataOrientwaterService.save(hisdataOrientwater);
|
||||||
|
|
||||||
//处理报警
|
//处理报警
|
||||||
Date dataDateTime = transdataOrientwater.getDataDateTime();
|
LocalDateTime dataDateTime = transdataOrientwater.getDataDateTime();
|
||||||
String dataDateTimeStr = DateUtil.format(dataDateTime, "yyyy-MM-dd HH:mm:ss");
|
String dataDateTimeStr = DateUtil.format(dataDateTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
Map<String, String> baowenMap = new HashMap<String, String>();
|
Map<String, String> baowenMap = new HashMap<String, String>();
|
||||||
baowenMap.put("mn", transdataOrientwater.getDeployCode());
|
baowenMap.put("mn", transdataOrientwater.getDeployCode());
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.lanhai.entity.*;
|
||||||
import com.lanhai.enums.DeviceDeployEnum;
|
import com.lanhai.enums.DeviceDeployEnum;
|
||||||
import com.lanhai.mapper.SurvTransdataSoilMapper;
|
import com.lanhai.mapper.SurvTransdataSoilMapper;
|
||||||
import com.lanhai.service.*;
|
import com.lanhai.service.*;
|
||||||
|
import com.lanhai.util.DateTimeUtils;
|
||||||
import com.lanhai.util.TUtil;
|
import com.lanhai.util.TUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -68,8 +70,8 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
// SurvDeviceDeploy deploy = deviceDeployService.getOneByCode(mn);
|
// SurvDeviceDeploy deploy = deviceDeployService.getOneByCode(mn);
|
||||||
//保存或者更新实时表
|
//保存或者更新实时表
|
||||||
SurvTransdataSoil soil = getOneByDeviceId(survDeviceDeploy.getId());
|
SurvTransdataSoil soil = getOneByDeviceId(survDeviceDeploy.getId());
|
||||||
Date kDateTime = null;
|
LocalDateTime kDateTime = null;
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
if(soil == null){
|
if(soil == null){
|
||||||
soil = new SurvTransdataSoil();
|
soil = new SurvTransdataSoil();
|
||||||
soil.setCreatedBy("task");//创建人
|
soil.setCreatedBy("task");//创建人
|
||||||
|
|
@ -106,7 +108,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
|
|
||||||
// System.out.println("nSoilCheck==============:"+soilCount);
|
// System.out.println("nSoilCheck==============:"+soilCount);
|
||||||
if(soilCount > 0){//只有数据有效时才入库
|
if(soilCount > 0){//只有数据有效时才入库
|
||||||
soil.setDataDateTime(DateUtil.parse(DataTime));//数据时间
|
soil.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
soil.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
soil.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
soil.setDeployCode(mn);//设备编号
|
soil.setDeployCode(mn);//设备编号
|
||||||
soil.setTenantId(survDeviceDeploy.getTenantId());
|
soil.setTenantId(survDeviceDeploy.getTenantId());
|
||||||
|
|
@ -128,7 +130,6 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
}
|
}
|
||||||
soil.setDeployType(survDeviceDeploy.getDeployType());
|
soil.setDeployType(survDeviceDeploy.getDeployType());
|
||||||
}
|
}
|
||||||
log.error("111111111111111保存中================"+soil.getTenantId()+"=========="+soil.getDeployId());
|
|
||||||
saveOrUpdate(soil);
|
saveOrUpdate(soil);
|
||||||
//更新设备的上次更新时间
|
//更新设备的上次更新时间
|
||||||
deviceDeployService.update(new LambdaUpdateWrapper<SurvDeviceDeploy>()
|
deviceDeployService.update(new LambdaUpdateWrapper<SurvDeviceDeploy>()
|
||||||
|
|
@ -153,7 +154,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
|
|
||||||
|
|
||||||
SurvTransdataAir air = transdataAirService.getOneByDeviceId(survDeviceDeploy.getId());
|
SurvTransdataAir air = transdataAirService.getOneByDeviceId(survDeviceDeploy.getId());
|
||||||
Date airkDateTime = null;
|
LocalDateTime airkDateTime = null;
|
||||||
if(air == null){
|
if(air == null){
|
||||||
air = new SurvTransdataAir();
|
air = new SurvTransdataAir();
|
||||||
air.setCreatedBy("task");//创建人
|
air.setCreatedBy("task");//创建人
|
||||||
|
|
@ -185,7 +186,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
}
|
}
|
||||||
// System.out.println("nairCheck==============:"+airCount);
|
// System.out.println("nairCheck==============:"+airCount);
|
||||||
if(airCount > 0) {//只有数据有效时才入库
|
if(airCount > 0) {//只有数据有效时才入库
|
||||||
air.setDataDateTime(DateUtil.parse(DataTime));//数据时间
|
air.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
air.setDeployCode(mn);//设备编号
|
air.setDeployCode(mn);//设备编号
|
||||||
air.setTenantId(survDeviceDeploy.getTenantId());
|
air.setTenantId(survDeviceDeploy.getTenantId());
|
||||||
|
|
@ -217,8 +218,9 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
SurvHisdataAir hisdataAir = new SurvHisdataAir();
|
SurvHisdataAir hisdataAir = new SurvHisdataAir();
|
||||||
BeanUtil.copyProperties(air,hisdataAir);
|
BeanUtil.copyProperties(air,hisdataAir);
|
||||||
hisdataAir.setId(IdUtil.getSnowflakeNextIdStr());
|
hisdataAir.setId(IdUtil.getSnowflakeNextIdStr());
|
||||||
hisdataAir.setCreateTime(new Date());
|
hisdataAir.setCreateTime(nowTime);
|
||||||
log.error("checkAirHis ============ "+hisdataAir.getId());
|
hisdataAir.setTransDate(nowTime);
|
||||||
|
hisdataAir.setDataDateTime(nowTime);
|
||||||
hisdataAirService.save(hisdataAir);
|
hisdataAirService.save(hisdataAir);
|
||||||
}else{
|
}else{
|
||||||
log.error("****** 跳过,数据日期为:{},已存在于空气历史表******",formatAirTime);
|
log.error("****** 跳过,数据日期为:{},已存在于空气历史表******",formatAirTime);
|
||||||
|
|
@ -239,8 +241,8 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
// SurvDeviceDeploy deploy = deviceDeployService.getOneByCode(mn);
|
// SurvDeviceDeploy deploy = deviceDeployService.getOneByCode(mn);
|
||||||
//保存或者更新实时表
|
//保存或者更新实时表
|
||||||
SurvTransdataSoil soil = getOneByDeviceId(deploy.getId());
|
SurvTransdataSoil soil = getOneByDeviceId(deploy.getId());
|
||||||
Date nowTime = new Date();
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
Date kDateTime = null;
|
LocalDateTime kDateTime = null;
|
||||||
if(soil == null){
|
if(soil == null){
|
||||||
soil = new SurvTransdataSoil();
|
soil = new SurvTransdataSoil();
|
||||||
soil.setCreatedBy("task");//创建人
|
soil.setCreatedBy("task");//创建人
|
||||||
|
|
@ -274,7 +276,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
}
|
}
|
||||||
// System.out.println("waterSoilCheck==============:"+waterCount);
|
// System.out.println("waterSoilCheck==============:"+waterCount);
|
||||||
if(waterCount >0 ){
|
if(waterCount >0 ){
|
||||||
soil.setDataDateTime(DateUtil.parse(DataTime));//数据时间
|
soil.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
soil.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
soil.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
soil.setDeployCode(mn);//设备编号
|
soil.setDeployCode(mn);//设备编号
|
||||||
soil.setTenantId(deploy.getTenantId());
|
soil.setTenantId(deploy.getTenantId());
|
||||||
|
|
@ -318,7 +320,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
|
|
||||||
|
|
||||||
SurvTransdataAir air = transdataAirService.getOneByDeviceId(deploy.getId());
|
SurvTransdataAir air = transdataAirService.getOneByDeviceId(deploy.getId());
|
||||||
Date airkDateTime = null;
|
LocalDateTime airkDateTime = null;
|
||||||
if(air == null){
|
if(air == null){
|
||||||
air = new SurvTransdataAir();
|
air = new SurvTransdataAir();
|
||||||
air.setCreatedBy("task");//创建人
|
air.setCreatedBy("task");//创建人
|
||||||
|
|
@ -351,7 +353,7 @@ public class SurvTransdataSoilServiceImpl extends ServiceImpl<SurvTransdataSoilM
|
||||||
|
|
||||||
// System.out.println("waterAirCheck==============:"+airCount);
|
// System.out.println("waterAirCheck==============:"+airCount);
|
||||||
if(airCount > 0) {
|
if(airCount > 0) {
|
||||||
air.setDataDateTime(DateUtil.parse(DataTime));//数据时间
|
air.setDataDateTime(DateTimeUtils.parse(DataTime));//数据时间
|
||||||
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
air.setDataGatherType("realTime");//数据类型-realTime=实时,dayTime=日数据,month=月数据,year=年数据
|
||||||
air.setDeployCode(mn);//设备编号
|
air.setDeployCode(mn);//设备编号
|
||||||
air.setTenantId(deploy.getTenantId());
|
air.setTenantId(deploy.getTenantId());
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -108,7 +109,7 @@ public class DataUtil{
|
||||||
public static SurvTransdataOrientwater strToOrientwater(String str) {
|
public static SurvTransdataOrientwater strToOrientwater(String str) {
|
||||||
|
|
||||||
SurvTransdataOrientwater orientwater = new SurvTransdataOrientwater();
|
SurvTransdataOrientwater orientwater = new SurvTransdataOrientwater();
|
||||||
orientwater.setDataDateTime(new Date());
|
orientwater.setDataDateTime(LocalDateTime.now());
|
||||||
orientwater.setDataGatherType("realTime");
|
orientwater.setDataGatherType("realTime");
|
||||||
orientwater.setDeployCode(CommonConstant.XZP_WATER +str.substring(2,4));//
|
orientwater.setDeployCode(CommonConstant.XZP_WATER +str.substring(2,4));//
|
||||||
|
|
||||||
|
|
@ -140,7 +141,7 @@ public class DataUtil{
|
||||||
public static SurvTransdataLivestockwater strToLivewater(String str) {
|
public static SurvTransdataLivestockwater strToLivewater(String str) {
|
||||||
|
|
||||||
SurvTransdataLivestockwater livestockwater = new SurvTransdataLivestockwater();
|
SurvTransdataLivestockwater livestockwater = new SurvTransdataLivestockwater();
|
||||||
livestockwater.setDataDateTime(new Date());
|
livestockwater.setDataDateTime(LocalDateTime.now());
|
||||||
livestockwater.setDataGatherType("realTime");
|
livestockwater.setDataGatherType("realTime");
|
||||||
livestockwater.setDeployCode(CommonConstant.XZP_WATER +str.substring(2,4));//
|
livestockwater.setDeployCode(CommonConstant.XZP_WATER +str.substring(2,4));//
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,318 @@
|
||||||
|
package com.lanhai.util;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Period;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期时间工具类 - 计算两个LocalDateTime之间的时间差
|
||||||
|
*/
|
||||||
|
public class DateTimeUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 基础用法:获取总秒数差
|
||||||
|
*/
|
||||||
|
public static long getSecondsDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return Duration.between(start, end).getSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 获取总毫秒数差
|
||||||
|
*/
|
||||||
|
public static long getMillisDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return Duration.between(start, end).toMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 获取总分钟数差
|
||||||
|
*/
|
||||||
|
public static long getMinutesDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return Duration.between(start, end).toMinutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 获取总小时数差
|
||||||
|
*/
|
||||||
|
public static long getHoursDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return Duration.between(start, end).toHours();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 获取总天数差
|
||||||
|
*/
|
||||||
|
public static long getDaysDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return Duration.between(start, end).toDays();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 使用ChronoUnit获取指定单位的时间差
|
||||||
|
*/
|
||||||
|
public static long getDiff(LocalDateTime start, LocalDateTime end, ChronoUnit unit) {
|
||||||
|
validateParams(start, end);
|
||||||
|
return unit.between(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 获取详细的时间差(天、小时、分钟、秒)
|
||||||
|
*/
|
||||||
|
public static TimeDiff getDetailedDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
validateParams(start, end);
|
||||||
|
|
||||||
|
Duration duration = Duration.between(start, end);
|
||||||
|
long absSeconds = Math.abs(duration.getSeconds());
|
||||||
|
|
||||||
|
long days = absSeconds / (24 * 3600);
|
||||||
|
long hours = (absSeconds % (24 * 3600)) / 3600;
|
||||||
|
long minutes = (absSeconds % 3600) / 60;
|
||||||
|
long seconds = absSeconds % 60;
|
||||||
|
long millis = Math.abs(duration.getNano()) / 1_000_000;
|
||||||
|
|
||||||
|
return new TimeDiff(days, hours, minutes, seconds, millis, duration.isNegative());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 获取可读的时间差字符串(如:2天3小时5分钟)
|
||||||
|
*/
|
||||||
|
public static String getReadableDiff(LocalDateTime start, LocalDateTime end) {
|
||||||
|
TimeDiff diff = getDetailedDiff(start, end);
|
||||||
|
|
||||||
|
List<String> parts = new ArrayList<>();
|
||||||
|
if (diff.getDays() > 0) {
|
||||||
|
parts.add(diff.getDays() + "天");
|
||||||
|
}
|
||||||
|
if (diff.getHours() > 0) {
|
||||||
|
parts.add(diff.getHours() + "小时");
|
||||||
|
}
|
||||||
|
if (diff.getMinutes() > 0) {
|
||||||
|
parts.add(diff.getMinutes() + "分钟");
|
||||||
|
}
|
||||||
|
if (diff.getSeconds() > 0 || parts.isEmpty()) {
|
||||||
|
parts.add(diff.getSeconds() + "秒");
|
||||||
|
}
|
||||||
|
if (diff.getMillis() > 0) {
|
||||||
|
parts.add(diff.getMillis() + "毫秒");
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = String.join("", parts);
|
||||||
|
return diff.isNegative() ? "-" + result : result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 判断两个时间是否在指定秒数内
|
||||||
|
*/
|
||||||
|
public static boolean isWithinSeconds(LocalDateTime start, LocalDateTime end, long seconds) {
|
||||||
|
return Math.abs(getSecondsDiff(start, end)) <= seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 计算年龄(基于生日)
|
||||||
|
*/
|
||||||
|
public static int getAge(LocalDateTime birthday) {
|
||||||
|
if (birthday == null) {
|
||||||
|
throw new IllegalArgumentException("生日不能为null");
|
||||||
|
}
|
||||||
|
return Period.between(birthday.toLocalDate(), LocalDateTime.now().toLocalDate()).getYears();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数校验
|
||||||
|
*/
|
||||||
|
private static void validateParams(LocalDateTime start, LocalDateTime end) {
|
||||||
|
if (start == null || end == null) {
|
||||||
|
throw new IllegalArgumentException("开始时间和结束时间不能为null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间差详情内部类
|
||||||
|
*/
|
||||||
|
public static class TimeDiff {
|
||||||
|
private final long days;
|
||||||
|
private final long hours;
|
||||||
|
private final long minutes;
|
||||||
|
private final long seconds;
|
||||||
|
private final long millis;
|
||||||
|
private final boolean negative;
|
||||||
|
|
||||||
|
public TimeDiff(long days, long hours, long minutes, long seconds, long millis, boolean negative) {
|
||||||
|
this.days = days;
|
||||||
|
this.hours = hours;
|
||||||
|
this.minutes = minutes;
|
||||||
|
this.seconds = seconds;
|
||||||
|
this.millis = millis;
|
||||||
|
this.negative = negative;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
public long getDays() { return days; }
|
||||||
|
public long getHours() { return hours; }
|
||||||
|
public long getMinutes() { return minutes; }
|
||||||
|
public long getSeconds() { return seconds; }
|
||||||
|
public long getMillis() { return millis; }
|
||||||
|
public boolean isNegative() { return negative; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%d天%d小时%d分钟%d秒%d毫秒%s",
|
||||||
|
days, hours, minutes, seconds, millis, negative ? " (负值)" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==================== 字符串解析方法 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.1 使用默认格式解析字符串为LocalDateTime
|
||||||
|
* 默认格式:yyyy-MM-dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parse(String dateTimeStr) {
|
||||||
|
return parse(dateTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.2 使用指定格式解析字符串为LocalDateTime
|
||||||
|
* @param dateTimeStr 日期时间字符串
|
||||||
|
* @param pattern 格式,如:yyyy/MM/dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parse(String dateTimeStr, String pattern) {
|
||||||
|
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("日期时间字符串不能为null或空");
|
||||||
|
}
|
||||||
|
if (pattern == null || pattern.trim().isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("日期格式不能为null或空");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return LocalDateTime.parse(dateTimeStr, formatter);
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
throw new IllegalArgumentException("字符串解析失败: " + dateTimeStr + ",格式: " + pattern, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.3 解析ISO格式字符串(默认被LocalDateTime.parse支持)
|
||||||
|
* 支持格式:2007-12-03T10:15:30
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseIso(String dateTimeStr) {
|
||||||
|
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("日期时间字符串不能为null或空");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return LocalDateTime.parse(dateTimeStr);
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
throw new IllegalArgumentException("ISO格式字符串解析失败: " + dateTimeStr, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.4 解析带时区的字符串(自动处理时区)
|
||||||
|
* 支持格式:2024-01-01T10:15:30+08:00
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseWithZone(String dateTimeStr) {
|
||||||
|
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("日期时间字符串不能为null或空");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 使用ISO带时区的格式解析,然后转换为LocalDateTime(去掉时区)
|
||||||
|
return java.time.ZonedDateTime.parse(dateTimeStr)
|
||||||
|
.toLocalDateTime();
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
throw new IllegalArgumentException("带时区字符串解析失败: " + dateTimeStr, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.5 解析常见格式(自动识别多种格式)
|
||||||
|
* 支持的格式:
|
||||||
|
* - yyyy-MM-dd HH:mm:ss
|
||||||
|
* - yyyy/MM/dd HH:mm:ss
|
||||||
|
* - yyyy-MM-dd HH:mm
|
||||||
|
* - yyyy/MM/dd HH:mm
|
||||||
|
* - yyyy-MM-dd
|
||||||
|
* - yyyy/MM/dd
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseAuto(String dateTimeStr) {
|
||||||
|
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("日期时间字符串不能为null或空");
|
||||||
|
}
|
||||||
|
|
||||||
|
String trimmed = dateTimeStr.trim();
|
||||||
|
|
||||||
|
// 尝试多种格式
|
||||||
|
String[] patterns = {
|
||||||
|
"yyyy-MM-dd HH:mm:ss",
|
||||||
|
"yyyy/MM/dd HH:mm:ss",
|
||||||
|
"yyyy-MM-dd HH:mm",
|
||||||
|
"yyyy/MM/dd HH:mm",
|
||||||
|
"yyyy-MM-dd",
|
||||||
|
"yyyy/MM/dd"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (String pattern : patterns) {
|
||||||
|
try {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
LocalDateTime result = LocalDateTime.parse(trimmed, formatter);
|
||||||
|
// 如果格式是日期(没有时间),默认加上00:00:00
|
||||||
|
if (!pattern.contains("HH")) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} catch (DateTimeParseException ignored) {
|
||||||
|
// 继续尝试下一种格式
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IllegalArgumentException("无法自动解析日期时间字符串: " + dateTimeStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.6 解析时间戳(毫秒)
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseTimestamp(long timestamp) {
|
||||||
|
return java.time.Instant.ofEpochMilli(timestamp)
|
||||||
|
.atZone(java.time.ZoneId.systemDefault())
|
||||||
|
.toLocalDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.7 解析时间戳(秒)
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseSeconds(long seconds) {
|
||||||
|
return java.time.Instant.ofEpochSecond(seconds)
|
||||||
|
.atZone(java.time.ZoneId.systemDefault())
|
||||||
|
.toLocalDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.8 安全解析(解析失败返回null)
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseQuietly(String dateTimeStr, String pattern) {
|
||||||
|
try {
|
||||||
|
return parse(dateTimeStr, pattern);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.9 安全解析(解析失败返回默认值)
|
||||||
|
*/
|
||||||
|
public static LocalDateTime parseOrDefault(String dateTimeStr, String pattern, LocalDateTime defaultValue) {
|
||||||
|
try {
|
||||||
|
return parse(dateTimeStr, pattern);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -77,6 +77,10 @@ public class SdrkUtils {
|
||||||
dataMap.put("mn",deploy.getDeployCode());
|
dataMap.put("mn",deploy.getDeployCode());
|
||||||
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
for (RenkeDataRealTimeDetail realTimeDetail : datas) {
|
for (RenkeDataRealTimeDetail realTimeDetail : datas) {
|
||||||
|
if(realTimeDetail.getTimeStamp() == null || realTimeDetail.getTimeStamp().equals(0L)){
|
||||||
|
log.error("=======跳过仁科无效数据,设备号:{}-{},时间戳为:{}==========",deploy.getId(),deploy.getDeployCode(),realTimeDetail.getTimeStamp());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
LocalDateTime dateTime = Instant.ofEpochMilli(realTimeDetail.getTimeStamp())
|
LocalDateTime dateTime = Instant.ofEpochMilli(realTimeDetail.getTimeStamp())
|
||||||
.atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
.atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
||||||
.toLocalDateTime();
|
.toLocalDateTime();
|
||||||
|
|
@ -92,9 +96,11 @@ public class SdrkUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(dataMap.size()>1){//不值包含mn
|
||||||
survTransdataSoilService.saveBaowen(dataMap, deploy,deviceDeployMap);
|
survTransdataSoilService.saveBaowen(dataMap, deploy,deviceDeployMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue