diff --git a/pom.xml b/pom.xml index 4ae64de..01afa40 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,22 @@ pom + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + ch.qos.logback + logback-classic + + + + org.springframework.boot diff --git a/src/main/java/com/shxy/i2/bean/IErrorCode.java b/src/main/java/com/shxy/i2/bean/IErrorCode.java new file mode 100644 index 0000000..ca94c4b --- /dev/null +++ b/src/main/java/com/shxy/i2/bean/IErrorCode.java @@ -0,0 +1,17 @@ +package com.shxy.i2.bean; + +/** + * 常用API返回对象接口 + * + */ +public interface IErrorCode { + /** + * 返回码 + */ + int getCode(); + + /** + * 返回信息 + */ + String getMessage(); +} diff --git a/src/main/java/com/shxy/i2/bean/ListModel.java b/src/main/java/com/shxy/i2/bean/ListModel.java new file mode 100644 index 0000000..ff9a8b8 --- /dev/null +++ b/src/main/java/com/shxy/i2/bean/ListModel.java @@ -0,0 +1,34 @@ +package com.shxy.i2.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +/** + * 电压线路树状图列表 + */ +@Data +public class ListModel implements Serializable { + + private List list = new ArrayList<>(); + + @Data + public static class Beans { + + private String name; + + private BigInteger history;//历史数据量 + + private BigInteger uploadnum;//已上传数据量 + + private BigInteger nownum;//今日数据量 + + private BigInteger nowuploadnum;//今日上传数据量 + } + + + +} diff --git a/src/main/java/com/shxy/i2/bean/ResponseReult.java b/src/main/java/com/shxy/i2/bean/ResponseReult.java new file mode 100644 index 0000000..a232db6 --- /dev/null +++ b/src/main/java/com/shxy/i2/bean/ResponseReult.java @@ -0,0 +1,121 @@ +package com.shxy.i2.bean; + + +import cn.hutool.http.HttpStatus; + +import java.io.Serializable; + +public class ResponseReult implements Serializable { + /** + * 返回对象 + */ + private T data; + /** + * 返回状态码 + */ + private int code; + /** + * 返回描述 + */ + private String msg; + + + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public void setCode(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static ResponseReult success(T obj) { + ResponseReult success = ResponseReult.success(); + if (obj != null) { + success.setData(obj); + } + return success; + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static ResponseReult success() { + ResponseReult response = new ResponseReult<>(); + response.setCode(HttpStatus.HTTP_OK, "操作成功"); + return response; + } + + + /** + * 失败返回结果 + * + * @param message 错误信息 + */ + public static ResponseReult fail(String message) { + return ResponseReult.error(HttpStatus.HTTP_BAD_REQUEST, message); + } + + public static ResponseReult fail(int code, String msg) { + ResponseReult response = new ResponseReult<>(); + response.setCode(code, msg); + return response; + } + /** + * 返回失败消息 + * + * @return 失败消息 + */ + public static ResponseReult error(int code, String msg) { + ResponseReult response = new ResponseReult<>(); + response.setCode(code, msg); + return response; + } + + /** + * 失败返回结果 + * + * @param errorCode 错误码 + */ + public static ResponseReult error(IErrorCode errorCode) { + return ResponseReult.error(errorCode.getCode(), errorCode.getMessage()); + } + + /** + * 失败返回结果 + * + * @param message 错误信息 + */ + public static ResponseReult error(String message) { + return ResponseReult.error(HttpStatus.HTTP_INTERNAL_ERROR, message); + } + +} diff --git a/src/main/java/com/shxy/i2/bean/ServiceBody.java b/src/main/java/com/shxy/i2/bean/ServiceBody.java new file mode 100644 index 0000000..f7cf011 --- /dev/null +++ b/src/main/java/com/shxy/i2/bean/ServiceBody.java @@ -0,0 +1,25 @@ +package com.shxy.i2.bean; + +import lombok.Data; + +/** + * service服务请求返回 + * + * @author 晶晶 + */ +@Data +public class ServiceBody { + + /** + * 返回体 + */ + private T data; + /** + * 返回状态码 + */ + private int code; + /** + * 错误描述 + */ + private String msg; +} diff --git a/src/main/java/com/shxy/i2/bean/ServiceStatus.java b/src/main/java/com/shxy/i2/bean/ServiceStatus.java new file mode 100644 index 0000000..5953d8c --- /dev/null +++ b/src/main/java/com/shxy/i2/bean/ServiceStatus.java @@ -0,0 +1,17 @@ +package com.shxy.i2.bean; + +/** + * 返回状态码 + * + * @author xzg + */ +public class ServiceStatus { + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + /** + * 操作失败 + */ + public static final int ERROR = 400; +} diff --git a/src/main/java/com/shxy/i2/controller/CheckController.java b/src/main/java/com/shxy/i2/controller/CheckController.java new file mode 100644 index 0000000..aefe9fe --- /dev/null +++ b/src/main/java/com/shxy/i2/controller/CheckController.java @@ -0,0 +1,32 @@ +package com.shxy.i2.controller; + +import com.shxy.i2.bean.ListModel; +import com.shxy.i2.bean.ResponseReult; +import com.shxy.i2.bean.ServiceBody; +import com.shxy.i2.bean.ServiceStatus; +import com.shxy.i2.service.XydlI2Service; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +@Slf4j +public class CheckController { + + @Autowired + XydlI2Service xydlI2Service; + + @RequestMapping("/list") + public ResponseReult list() { + ServiceBody serviceBody = xydlI2Service.list(); + if (serviceBody.getCode() == ServiceStatus.SUCCESS) { + return ResponseReult.success(serviceBody.getData()); + } else { + return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg()); + } + } + +} diff --git a/src/main/java/com/shxy/i2/dao/Data_Byq_JbfdDao.java b/src/main/java/com/shxy/i2/dao/Data_Byq_JbfdDao.java index ee8db62..a21a24d 100644 --- a/src/main/java/com/shxy/i2/dao/Data_Byq_JbfdDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_Byq_JbfdDao.java @@ -15,6 +15,10 @@ public interface Data_Byq_JbfdDao { List selectUpload(@Param("isupload") Integer isupload); + Data_Byq_Jbfd selectMaxId(); + + Data_Byq_Jbfd selectNowId(@Param("date") Date date); + int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); int updateList(@Param("isupload") Integer isupload, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_CnjDao.java b/src/main/java/com/shxy/i2/dao/Data_CnjDao.java index 5a62b91..46e015f 100644 --- a/src/main/java/com/shxy/i2/dao/Data_CnjDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_CnjDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Byq_Jbfd; import com.shxy.i2.entity.Data_Cnj; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_CnjDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Cnj selectMaxId(); + + Data_Cnj selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_DcywDao.java b/src/main/java/com/shxy/i2/dao/Data_DcywDao.java index a857c8d..02ea35d 100644 --- a/src/main/java/com/shxy/i2/dao/Data_DcywDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_DcywDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Cnj; import com.shxy.i2.entity.Data_Dcyw; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_DcywDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Dcyw selectMaxId(); + + Data_Dcyw selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_Dlq_JbfdDao.java b/src/main/java/com/shxy/i2/dao/Data_Dlq_JbfdDao.java index 3d056b5..0530aa1 100644 --- a/src/main/java/com/shxy/i2/dao/Data_Dlq_JbfdDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_Dlq_JbfdDao.java @@ -1,6 +1,7 @@ package com.shxy.i2.dao; import com.shxy.i2.bean.SendDataBean; +import com.shxy.i2.entity.Data_Dcyw; import com.shxy.i2.entity.Data_Dlq_Jbfd; import org.apache.ibatis.annotations.Param; @@ -13,6 +14,10 @@ public interface Data_Dlq_JbfdDao { List selectUpload(@Param("isupload") Integer isupload); + Data_Dlq_Jbfd selectMaxId(); + + Data_Dlq_Jbfd selectNowId(@Param("date") Date date); + List selectUploadById(@Param("maxid") BigInteger maxid); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_Dr_JyjcDao.java b/src/main/java/com/shxy/i2/dao/Data_Dr_JyjcDao.java index 8c0ab69..aa6f55e 100644 --- a/src/main/java/com/shxy/i2/dao/Data_Dr_JyjcDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_Dr_JyjcDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Dlq_Jbfd; import com.shxy.i2.entity.Data_Dr_Jyjc; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_Dr_JyjcDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Dr_Jyjc selectMaxId(); + + Data_Dr_Jyjc selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_FhdlbxDao.java b/src/main/java/com/shxy/i2/dao/Data_FhdlbxDao.java index ad41867..4185154 100644 --- a/src/main/java/com/shxy/i2/dao/Data_FhdlbxDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_FhdlbxDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Dr_Jyjc; import com.shxy.i2.entity.Data_Fhdlbx; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,11 @@ public interface Data_FhdlbxDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Fhdlbx selectMaxId(); + + Data_Fhdlbx selectNowId(@Param("date") Date date); + + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_FhzxqDao.java b/src/main/java/com/shxy/i2/dao/Data_FhzxqDao.java index 76c2cad..aae6c10 100644 --- a/src/main/java/com/shxy/i2/dao/Data_FhzxqDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_FhzxqDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Fhdlbx; import com.shxy.i2.entity.Data_Fhzxq; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_FhzxqDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Fhzxq selectMaxId(); + + Data_Fhzxq selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_Jsyhw_JyjcDao.java b/src/main/java/com/shxy/i2/dao/Data_Jsyhw_JyjcDao.java index d337a97..9462244 100644 --- a/src/main/java/com/shxy/i2/dao/Data_Jsyhw_JyjcDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_Jsyhw_JyjcDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Fhzxq; import com.shxy.i2.entity.Data_Jsyhw_Jyjc; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_Jsyhw_JyjcDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Jsyhw_Jyjc selectMaxId(); + + Data_Jsyhw_Jyjc selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_MicroclimateDao.java b/src/main/java/com/shxy/i2/dao/Data_MicroclimateDao.java index 89b4401..5543033 100644 --- a/src/main/java/com/shxy/i2/dao/Data_MicroclimateDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_MicroclimateDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Jsyhw_Jyjc; import com.shxy.i2.entity.Data_Microclimate; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_MicroclimateDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Microclimate selectMaxId(); + + Data_Microclimate selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_SF6_QtsfDao.java b/src/main/java/com/shxy/i2/dao/Data_SF6_QtsfDao.java index d50d2e8..4fa1191 100644 --- a/src/main/java/com/shxy/i2/dao/Data_SF6_QtsfDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_SF6_QtsfDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Microclimate; import com.shxy.i2.entity.Data_SF6_Qtsf; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_SF6_QtsfDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_SF6_Qtsf selectMaxId(); + + Data_SF6_Qtsf selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_SF6_QtylDao.java b/src/main/java/com/shxy/i2/dao/Data_SF6_QtylDao.java index 54d9f19..f2cc4b2 100644 --- a/src/main/java/com/shxy/i2/dao/Data_SF6_QtylDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_SF6_QtylDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_SF6_Qtsf; import com.shxy.i2.entity.Data_SF6_Qtyl; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,11 @@ public interface Data_SF6_QtylDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_SF6_Qtyl selectMaxId(); + + Data_SF6_Qtyl selectNowId(@Param("date") Date date); + + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_TxDao.java b/src/main/java/com/shxy/i2/dao/Data_TxDao.java index 6440e80..b092408 100644 --- a/src/main/java/com/shxy/i2/dao/Data_TxDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_TxDao.java @@ -1,6 +1,8 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_SF6_Qtyl; import com.shxy.i2.entity.Data_Tx; +import com.shxy.i2.entity.Data_Ysp; import org.apache.ibatis.annotations.Param; import java.math.BigInteger; @@ -11,6 +13,10 @@ public interface Data_TxDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Tx selectMaxId(); + + Data_Tx selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); @@ -18,4 +24,5 @@ public interface Data_TxDao { int updateList(@Param("isupload") Integer isupload, @Param("idlist") List id, @Param("updateTime") Date updateTime); int deleteData(@Param("time") Date time); + } \ No newline at end of file diff --git a/src/main/java/com/shxy/i2/dao/Data_WsDao.java b/src/main/java/com/shxy/i2/dao/Data_WsDao.java index 64ffd9e..93c9c75 100644 --- a/src/main/java/com/shxy/i2/dao/Data_WsDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_WsDao.java @@ -1,5 +1,6 @@ package com.shxy.i2.dao; +import com.shxy.i2.entity.Data_Tx; import com.shxy.i2.entity.Data_Ws; import org.apache.ibatis.annotations.Param; @@ -11,6 +12,10 @@ public interface Data_WsDao { List selectUploadById(@Param("maxid") BigInteger maxid); + Data_Ws selectMaxId(); + + Data_Ws selectNowId(@Param("date") Date date); + List selectUpload(@Param("isupload") Integer isupload); int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List id, @Param("updateTime") Date updateTime); diff --git a/src/main/java/com/shxy/i2/dao/Data_YspDao.java b/src/main/java/com/shxy/i2/dao/Data_YspDao.java index b42be2e..69581b9 100644 --- a/src/main/java/com/shxy/i2/dao/Data_YspDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_YspDao.java @@ -1,6 +1,8 @@ package com.shxy.i2.dao; +import cn.hutool.core.date.DateTime; import com.shxy.i2.bean.SendDataBean; +import com.shxy.i2.entity.Data_Byq_Jbfd; import com.shxy.i2.entity.Data_Ysp; import org.apache.ibatis.annotations.Param; @@ -24,4 +26,8 @@ public interface Data_YspDao { int updateDataList2(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") ArrayList id, @Param("updateTime") Date updateTime); int deleteData(@Param("time") Date time); + + Data_Ysp selectMaxId(); + + Data_Ysp selectNowId(@Param("date") Date time); } \ No newline at end of file diff --git a/src/main/java/com/shxy/i2/dao/Data_YxDao.java b/src/main/java/com/shxy/i2/dao/Data_YxDao.java index e15a95f..c3fbc76 100644 --- a/src/main/java/com/shxy/i2/dao/Data_YxDao.java +++ b/src/main/java/com/shxy/i2/dao/Data_YxDao.java @@ -1,6 +1,7 @@ package com.shxy.i2.dao; import com.shxy.i2.dto.Data_YxlDto; +import com.shxy.i2.entity.Data_Ws; import org.apache.ibatis.annotations.Param; import java.math.BigInteger; @@ -11,5 +12,9 @@ public interface Data_YxDao { List selectByPrimaryKey(@Param("maxid") BigInteger maxid); + Data_YxlDto selectMaxId(); + + Data_YxlDto selectNowId(@Param("date") Date date); + int deleteData(@Param("time") Date time); } \ No newline at end of file diff --git a/src/main/java/com/shxy/i2/dao/Upload_checkDao.java b/src/main/java/com/shxy/i2/dao/Upload_checkDao.java index c1bcca3..04c1eb6 100644 --- a/src/main/java/com/shxy/i2/dao/Upload_checkDao.java +++ b/src/main/java/com/shxy/i2/dao/Upload_checkDao.java @@ -5,11 +5,14 @@ import org.apache.ibatis.annotations.Param; import java.math.BigInteger; import java.util.Date; +import java.util.List; public interface Upload_checkDao { Upload_check selectByPrimaryKey(String checkType); + List selectAll(); + int updateByPrimaryKey(@Param("checkType") String checkType, @Param("value") BigInteger value, @Param("updateTime") Date updateTime); } \ No newline at end of file diff --git a/src/main/java/com/shxy/i2/dto/Data_YxlDto.java b/src/main/java/com/shxy/i2/dto/Data_YxlDto.java index 7e435d3..f56612e 100644 --- a/src/main/java/com/shxy/i2/dto/Data_YxlDto.java +++ b/src/main/java/com/shxy/i2/dto/Data_YxlDto.java @@ -10,6 +10,8 @@ import java.util.List; public class Data_YxlDto { BigInteger id; + BigInteger maxid; + BigInteger minid; Integer sadr; Date dtime; Integer ival; diff --git a/src/main/java/com/shxy/i2/entity/Data_Byq_Jbfd.java b/src/main/java/com/shxy/i2/entity/Data_Byq_Jbfd.java index faa6736..5079376 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Byq_Jbfd.java +++ b/src/main/java/com/shxy/i2/entity/Data_Byq_Jbfd.java @@ -9,6 +9,8 @@ import java.util.Date; @Data public class Data_Byq_Jbfd implements Serializable { private BigInteger id; + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; diff --git a/src/main/java/com/shxy/i2/entity/Data_Cnj.java b/src/main/java/com/shxy/i2/entity/Data_Cnj.java index dc1faf3..08391b9 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Cnj.java +++ b/src/main/java/com/shxy/i2/entity/Data_Cnj.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Cnj implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Dcyw.java b/src/main/java/com/shxy/i2/entity/Data_Dcyw.java index e272096..24c284d 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Dcyw.java +++ b/src/main/java/com/shxy/i2/entity/Data_Dcyw.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Dcyw implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Dlq_Jbfd.java b/src/main/java/com/shxy/i2/entity/Data_Dlq_Jbfd.java index bb6f598..06fc516 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Dlq_Jbfd.java +++ b/src/main/java/com/shxy/i2/entity/Data_Dlq_Jbfd.java @@ -8,7 +8,8 @@ import java.util.Date; @Data public class Data_Dlq_Jbfd implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Dr_Jyjc.java b/src/main/java/com/shxy/i2/entity/Data_Dr_Jyjc.java index dd4ff0f..916c7c8 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Dr_Jyjc.java +++ b/src/main/java/com/shxy/i2/entity/Data_Dr_Jyjc.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Dr_Jyjc implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Fhdlbx.java b/src/main/java/com/shxy/i2/entity/Data_Fhdlbx.java index 5b5c1af..500ddbc 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Fhdlbx.java +++ b/src/main/java/com/shxy/i2/entity/Data_Fhdlbx.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Fhdlbx implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Fhzxq.java b/src/main/java/com/shxy/i2/entity/Data_Fhzxq.java index 55d2fcc..48bb263 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Fhzxq.java +++ b/src/main/java/com/shxy/i2/entity/Data_Fhzxq.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Fhzxq implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Jsyhw_Jyjc.java b/src/main/java/com/shxy/i2/entity/Data_Jsyhw_Jyjc.java index 7c703a3..5e93d7e 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Jsyhw_Jyjc.java +++ b/src/main/java/com/shxy/i2/entity/Data_Jsyhw_Jyjc.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Jsyhw_Jyjc implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Microclimate.java b/src/main/java/com/shxy/i2/entity/Data_Microclimate.java index d42f97a..09cb473 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Microclimate.java +++ b/src/main/java/com/shxy/i2/entity/Data_Microclimate.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_Microclimate implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_SF6_Qtsf.java b/src/main/java/com/shxy/i2/entity/Data_SF6_Qtsf.java index dc8526e..ee74bf4 100644 --- a/src/main/java/com/shxy/i2/entity/Data_SF6_Qtsf.java +++ b/src/main/java/com/shxy/i2/entity/Data_SF6_Qtsf.java @@ -9,7 +9,8 @@ import java.util.Date; @Data public class Data_SF6_Qtsf implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_SF6_Qtyl.java b/src/main/java/com/shxy/i2/entity/Data_SF6_Qtyl.java index 29dcdbf..92313bb 100644 --- a/src/main/java/com/shxy/i2/entity/Data_SF6_Qtyl.java +++ b/src/main/java/com/shxy/i2/entity/Data_SF6_Qtyl.java @@ -10,7 +10,8 @@ import java.util.Date; public class Data_SF6_Qtyl implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Tx.java b/src/main/java/com/shxy/i2/entity/Data_Tx.java index 625f0a5..5491a97 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Tx.java +++ b/src/main/java/com/shxy/i2/entity/Data_Tx.java @@ -9,6 +9,8 @@ import java.util.Date; @Data public class Data_Tx implements Serializable { private BigInteger id; + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; diff --git a/src/main/java/com/shxy/i2/entity/Data_Ws.java b/src/main/java/com/shxy/i2/entity/Data_Ws.java index b795866..c296754 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Ws.java +++ b/src/main/java/com/shxy/i2/entity/Data_Ws.java @@ -8,7 +8,8 @@ import java.util.Date; @Data public class Data_Ws implements Serializable { private BigInteger id; - + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; private Date acquisitiontime; diff --git a/src/main/java/com/shxy/i2/entity/Data_Ysp.java b/src/main/java/com/shxy/i2/entity/Data_Ysp.java index 6038233..2216bf1 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Ysp.java +++ b/src/main/java/com/shxy/i2/entity/Data_Ysp.java @@ -9,6 +9,8 @@ import java.util.Date; @Data public class Data_Ysp implements Serializable { private BigInteger id; + private BigInteger maxid; + private BigInteger minid; private Integer eqmid; diff --git a/src/main/java/com/shxy/i2/entity/Data_Yx.java b/src/main/java/com/shxy/i2/entity/Data_Yx.java index 4459f63..aa377e0 100644 --- a/src/main/java/com/shxy/i2/entity/Data_Yx.java +++ b/src/main/java/com/shxy/i2/entity/Data_Yx.java @@ -3,12 +3,14 @@ package com.shxy.i2.entity; import lombok.Data; import java.io.Serializable; +import java.math.BigInteger; import java.util.Date; @Data public class Data_Yx implements Serializable { private Long id; - + private BigInteger maxid; + private BigInteger minid; private Integer sadr; private Date dTime; diff --git a/src/main/java/com/shxy/i2/service/XydlI2Service.java b/src/main/java/com/shxy/i2/service/XydlI2Service.java index 3ede48b..ec5eb80 100644 --- a/src/main/java/com/shxy/i2/service/XydlI2Service.java +++ b/src/main/java/com/shxy/i2/service/XydlI2Service.java @@ -1,5 +1,7 @@ package com.shxy.i2.service; +import com.shxy.i2.bean.ListModel; +import com.shxy.i2.bean.ServiceBody; import com.shxy.i2.entity.Niec_Sensors; import org.apache.cxf.endpoint.Client; @@ -38,4 +40,6 @@ public interface XydlI2Service { void upload_yx(Client client); void clear_history(); + + ServiceBody list(); } diff --git a/src/main/java/com/shxy/i2/serviceimpl/WebServiceImpl.java b/src/main/java/com/shxy/i2/serviceimpl/WebServiceImpl.java index 951c9e3..675e442 100644 --- a/src/main/java/com/shxy/i2/serviceimpl/WebServiceImpl.java +++ b/src/main/java/com/shxy/i2/serviceimpl/WebServiceImpl.java @@ -6,13 +6,8 @@ import com.shxy.i2.entity.*; import com.shxy.i2.service.Webservcies; import com.shxy.i2.service.XydlI2Service; import lombok.extern.slf4j.Slf4j; -import org.apache.cxf.endpoint.Client; -import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; -import org.apache.cxf.transport.http.HTTPConduit; -import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Service; import java.util.HashMap; diff --git a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java index 96f81bf..a67c42d 100644 --- a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java +++ b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java @@ -3,14 +3,13 @@ package com.shxy.i2.serviceimpl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.shxy.i2.Tool.AsyncMethod; import com.shxy.i2.Tool.GenerateI2Xml; -import com.shxy.i2.bean.AttrBean; -import com.shxy.i2.bean.SendDataBean; -import com.shxy.i2.bean.YxAttrBean; +import com.shxy.i2.bean.*; import com.shxy.i2.constant.Constant; import com.shxy.i2.dao.*; import com.shxy.i2.dto.Data_YxlDto; @@ -19,9 +18,8 @@ import com.shxy.i2.service.XydlI2Service; import lombok.extern.slf4j.Slf4j; import org.apache.cxf.endpoint.Client; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Service; +import org.springframework.util.Assert; import java.math.BigDecimal; import java.math.BigInteger; @@ -105,1458 +103,1356 @@ public class XydlI2ServiceImpl implements XydlI2Service { value = BigInteger.valueOf(0); } } -// Boolean iscontiue = true; -// while (iscontiue) { - List data_byq_jbfdlist = data_byq_jbfdDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(data_byq_jbfdlist)) { - log.info("查询byq_jbfd的数据量:" + data_byq_jbfdlist.size()); - log.info("查询byq_jbfd的数据量 sendlimit :" + sendlimit); -// if (data_byq_jbfdlist.size() < 1000) { -// iscontiue = false; -// } -// BigDecimal add = NumberUtil.add(value, data_byq_jbfdlist.size()); -// value = add.toBigInteger(); - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; + List data_byq_jbfdlist = data_byq_jbfdDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(data_byq_jbfdlist)) { + log.info("查询byq_jbfd的数据量:" + data_byq_jbfdlist.size()); + log.info("查询byq_jbfd的数据量 sendlimit :" + sendlimit); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; - for (int index = 0; index < data_byq_jbfdlist.size(); index++) { - Data_Byq_Jbfd item = data_byq_jbfdlist.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + for (int index = 0; index < data_byq_jbfdlist.size(); index++) { + Data_Byq_Jbfd item = data_byq_jbfdlist.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float dischargecapacity = item.getDischargecapacity(); - if (dischargecapacity != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargeCapacity"); - attr.setValue(dischargecapacity); - attrlist.add(attr); - } - Float dischargeposition = item.getDischargeposition(); - if (dischargeposition != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargePosition"); - attr.setValue(dischargeposition); - attrlist.add(attr); - } - Float pulsecount = item.getPulsecount(); - if (pulsecount != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("PulseCount"); - attr.setValue(pulsecount); - attrlist.add(attr); - } - byte[] dischargewaveform = item.getDischargewaveform(); - if (dischargewaveform != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargeWaveform"); - attr.setValue(dischargewaveform); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.BYQ_JBFD, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - BigInteger id = item.getId(); - SendDataBean sendDataBean = new SendDataBean(); - sendDataBean.setEqmid(item.getEqmid()); - sendDataBean.setMaxid(id); - if ((index != 0 && index % sendlimit == 0) || index == (data_byq_jbfdlist.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float dischargecapacity = item.getDischargecapacity(); + if (dischargecapacity != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargeCapacity"); + attr.setValue(dischargecapacity); + attrlist.add(attr); + } + Float dischargeposition = item.getDischargeposition(); + if (dischargeposition != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargePosition"); + attr.setValue(dischargeposition); + attrlist.add(attr); + } + Float pulsecount = item.getPulsecount(); + if (pulsecount != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("PulseCount"); + attr.setValue(pulsecount); + attrlist.add(attr); + } + byte[] dischargewaveform = item.getDischargewaveform(); + if (dischargewaveform != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargeWaveform"); + attr.setValue(dischargewaveform); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.BYQ_JBFD, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + BigInteger id = item.getId(); + SendDataBean sendDataBean = new SendDataBean(); + sendDataBean.setEqmid(item.getEqmid()); + sendDataBean.setMaxid(id); + if ((index != 0 && index % sendlimit == 0) || index == (data_byq_jbfdlist.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.BYQJBFDID); - } else { -// iscontiue = false; - log.info("没有查询byq_jbfd的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.BYQJBFDID); + } else { + log.info("没有查询byq_jbfd的数据量"); + } } @Override public void upload_cnj(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.CNJID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.CNJID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_cnjDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询cnj的数据量:" + list.size()); - log.info("查询cnj的数据量 sendlimit :" + sendlimit); -// if (list.size() < 1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Cnj item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_cnjDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询cnj的数据量:" + list.size()); + log.info("查询cnj的数据量 sendlimit :" + sendlimit); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Cnj item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float chargetime = item.getChargetime(); - if (chargetime != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("ChargeTime"); - attr.setValue(chargetime); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.CNJ, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float chargetime = item.getChargetime(); + if (chargetime != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("ChargeTime"); + attr.setValue(chargetime); + attrlist.add(attr); } + String cacdata = GenerateI2Xml.generateCacXml(Constant.CNJ, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.CNJID); - } else { -// iscontiue = false; - log.info("没有查询cnj的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.CNJID); + } else { + log.info("没有查询cnj的数据量"); + } } @Override public void upload_dcyw(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DCYWID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DCYWID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_dcywDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询dcyw的数据量:" + list.size()); -// if (list.size() < 1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Dcyw item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_dcywDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询dcyw的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Dcyw item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float oiltemperature = item.getOiltemperature(); - if (oiltemperature != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("OilTemperature"); - attr.setValue(oiltemperature); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.DCYW, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float oiltemperature = item.getOiltemperature(); + if (oiltemperature != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("OilTemperature"); + attr.setValue(oiltemperature); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.DCYW, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.DCYWID); - } else { -// iscontiue = false; - log.info("没有查询dcyw的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.DCYWID); + } else { + log.info("没有查询dcyw的数据量"); + } } @Override public void upload_dlq_jbfd(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DLQJBFDID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DLQJBFDID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_dlq_jbfdDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询dlq_jbfd的数据量:" + list.size()); - log.info("查询dlq_jbfd的数据量 sendlimit :" + sendlimit); -// if (list.size() < 1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Dlq_Jbfd item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_dlq_jbfdDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询dlq_jbfd的数据量:" + list.size()); + log.info("查询dlq_jbfd的数据量 sendlimit :" + sendlimit); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Dlq_Jbfd item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float dischargecapacity = item.getDischargecapacity(); - if (dischargecapacity != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargeCapacity"); - attr.setValue(dischargecapacity); - attrlist.add(attr); - } - Float dischargeposition = item.getDischargeposition(); - if (dischargeposition != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargePosition"); - attr.setValue(dischargeposition); - attrlist.add(attr); - } - Float pulsecount = item.getPulsecount(); - if (pulsecount != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("PulseCount"); - attr.setValue(pulsecount); - attrlist.add(attr); - } - byte[] dischargewaveform = item.getDischargewaveform(); - if (dischargewaveform != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("DischargeWaveform"); - attr.setValue(dischargewaveform); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.DLQJBFD, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float dischargecapacity = item.getDischargecapacity(); + if (dischargecapacity != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargeCapacity"); + attr.setValue(dischargecapacity); + attrlist.add(attr); + } + Float dischargeposition = item.getDischargeposition(); + if (dischargeposition != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargePosition"); + attr.setValue(dischargeposition); + attrlist.add(attr); + } + Float pulsecount = item.getPulsecount(); + if (pulsecount != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("PulseCount"); + attr.setValue(pulsecount); + attrlist.add(attr); + } + byte[] dischargewaveform = item.getDischargewaveform(); + if (dischargewaveform != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("DischargeWaveform"); + attr.setValue(dischargewaveform); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.DLQJBFD, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.DLQJBFDID); - } else { -// iscontiue = false; - log.info("没有查询到dlq的数据"); } -// } + asyncMethod.updateRecordId(maxid, Constant.DLQJBFDID); + } else { + log.info("没有查询到dlq的数据"); + } } @Override public void upload_dr_jyjc(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DRJYJCID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DRJYJCID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_dr_jyjcDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询dr_jyjc的数据量:" + list.size()); -// if (list.size() < 1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; + } + List list = data_dr_jyjcDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询dr_jyjc的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Dr_Jyjc item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } + for (int index = 0; index < list.size(); index++) { + Data_Dr_Jyjc item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; - } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float capacitance = item.getCapacitance(); - if (capacitance != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Capacitance"); - attr.setValue(capacitance); - attrlist.add(attr); - } - Float lossfactor = item.getLossfactor(); - if (lossfactor != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("LossFactor"); - attr.setValue(lossfactor); - attrlist.add(attr); - } - Float unbalancecurrent = item.getUnbalancecurrent(); - if (unbalancecurrent != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("UnbalanceCurrent"); - attr.setValue(unbalancecurrent); - attrlist.add(attr); - } - Float unbalancevoltage = item.getUnbalancevoltage(); - if (unbalancevoltage != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("UnbalanceVoltage"); - attr.setValue(unbalancevoltage); - attrlist.add(attr); - } - Float totalcurrent = item.getTotalcurrent(); - if (totalcurrent != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("TotalCurrent"); - attr.setValue(totalcurrent); - attrlist.add(attr); - } - Float systemvoltage = item.getSystemvoltage(); - if (systemvoltage != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("SystemVoltage"); - attr.setValue(systemvoltage); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.DRJYJC, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float capacitance = item.getCapacitance(); + if (capacitance != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Capacitance"); + attr.setValue(capacitance); + attrlist.add(attr); + } + Float lossfactor = item.getLossfactor(); + if (lossfactor != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("LossFactor"); + attr.setValue(lossfactor); + attrlist.add(attr); + } + Float unbalancecurrent = item.getUnbalancecurrent(); + if (unbalancecurrent != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("UnbalanceCurrent"); + attr.setValue(unbalancecurrent); + attrlist.add(attr); + } + Float unbalancevoltage = item.getUnbalancevoltage(); + if (unbalancevoltage != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("UnbalanceVoltage"); + attr.setValue(unbalancevoltage); + attrlist.add(attr); } + Float totalcurrent = item.getTotalcurrent(); + if (totalcurrent != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("TotalCurrent"); + attr.setValue(totalcurrent); + attrlist.add(attr); + } + Float systemvoltage = item.getSystemvoltage(); + if (systemvoltage != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("SystemVoltage"); + attr.setValue(systemvoltage); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.DRJYJC, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.DRJYJCID); - } else { -// iscontiue = false; - log.info("没有查询dr_jyjc的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.DRJYJCID); + } else { + log.info("没有查询dr_jyjc的数据量"); + } } @Override public void upload_fhdlbx(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHDLBXID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHDLBXID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_fhdlbxDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询fhdlbx的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Fhdlbx item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_fhdlbxDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询fhdlbx的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Fhdlbx item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Integer action = item.getAction(); - if (action != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Action"); - attr.setValue(action); - attrlist.add(attr); - } - byte[] loadwaveform = item.getLoadwaveform(); - if (loadwaveform != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("LoadWaveform"); - attr.setValue(loadwaveform); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.FHDLBX, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Integer action = item.getAction(); + if (action != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Action"); + attr.setValue(action); + attrlist.add(attr); } + byte[] loadwaveform = item.getLoadwaveform(); + if (loadwaveform != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("LoadWaveform"); + attr.setValue(loadwaveform); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.FHDLBX, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.FHDLBXID); - } else { -// iscontiue = false; - log.info("没有查询fhdlbx的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.FHDLBXID); + } else { + log.info("没有查询fhdlbx的数据量"); + } } @Override public void upload_fhzxq(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHZXQID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHZXQID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_fhzxqDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询fhzxq的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Fhzxq item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_fhzxqDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询fhzxq的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Fhzxq item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Integer action = item.getAction(); - if (action != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Action"); - attr.setValue(action); - attrlist.add(attr); - } - byte[] coilwaveform = item.getCoilwaveform(); - if (coilwaveform != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("CoilWaveform"); - attr.setValue(coilwaveform); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.FHZXQ, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Integer action = item.getAction(); + if (action != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Action"); + attr.setValue(action); + attrlist.add(attr); } + byte[] coilwaveform = item.getCoilwaveform(); + if (coilwaveform != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("CoilWaveform"); + attr.setValue(coilwaveform); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.FHZXQ, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.FHZXQID); - } else { -// iscontiue = false; - log.info("没有查询fhzxq的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.FHZXQID); + } else { + log.info("没有查询fhzxq的数据量"); + } } @Override public void upload_jsyhw_jyjc(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.JSYHWJYJCID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.JSYHWJYJCID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_jsyhw_jyjcDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询jsyhw_jyjc的数据量:" + list.size()); - log.info("查询jsyhw_jyjc的数据量 sendlimit :" + sendlimit); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Jsyhw_Jyjc item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_jsyhw_jyjcDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询jsyhw_jyjc的数据量:" + list.size()); + log.info("查询jsyhw_jyjc的数据量 sendlimit :" + sendlimit); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Jsyhw_Jyjc item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float systemvoltage = item.getSystemvoltage(); - if (systemvoltage != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("SystemVoltage"); - attr.setValue(systemvoltage); - attrlist.add(attr); - } - Float totalcurrent = item.getTotalcurrent(); - if (totalcurrent != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("TotalCurrent"); - attr.setValue(totalcurrent); - attrlist.add(attr); - } - Float resistivecurrent = item.getResistivecurrent(); - if (resistivecurrent != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("ResistiveCurrent"); - attr.setValue(resistivecurrent); - attrlist.add(attr); - } - Float actioncount = item.getActioncount(); - if (actioncount != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("ActionCount"); - attr.setValue(actioncount); - attrlist.add(attr); - } - Date lastactiontime = item.getLastactiontime(); - if (lastactiontime != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("LastActionTime"); - attr.setValue(DateUtil.format(lastactiontime, DatePattern.NORM_DATETIME_PATTERN)); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.JSYHW, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float systemvoltage = item.getSystemvoltage(); + if (systemvoltage != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("SystemVoltage"); + attr.setValue(systemvoltage); + attrlist.add(attr); } + Float totalcurrent = item.getTotalcurrent(); + if (totalcurrent != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("TotalCurrent"); + attr.setValue(totalcurrent); + attrlist.add(attr); + } + Float resistivecurrent = item.getResistivecurrent(); + if (resistivecurrent != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("ResistiveCurrent"); + attr.setValue(resistivecurrent); + attrlist.add(attr); + } + Float actioncount = item.getActioncount(); + if (actioncount != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("ActionCount"); + attr.setValue(actioncount); + attrlist.add(attr); + } + Date lastactiontime = item.getLastactiontime(); + if (lastactiontime != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("LastActionTime"); + attr.setValue(DateUtil.format(lastactiontime, DatePattern.NORM_DATETIME_PATTERN)); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.JSYHW, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.JSYHWJYJCID); - } else { -// iscontiue = false; - log.info("没有查询jsyhw_jyjc的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.JSYHWJYJCID); + } else { + log.info("没有查询jsyhw_jyjc的数据量"); + } } @Override public void upload_sf6_qtsf(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTSFID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTSFID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_sf6_qtsfDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询sf6_qtsf的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_SF6_Qtsf item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_sf6_qtsfDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询sf6_qtsf的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_SF6_Qtsf item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float temperature = item.getTemperature(); - if (temperature != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Temperature"); - attr.setValue(temperature); - attrlist.add(attr); - } - Float moisture = item.getMoisture(); - if (moisture != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Moisture"); - attr.setValue(moisture); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTSF, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float temperature = item.getTemperature(); + if (temperature != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Temperature"); + attr.setValue(temperature); + attrlist.add(attr); + } + Float moisture = item.getMoisture(); + if (moisture != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Moisture"); + attr.setValue(moisture); + attrlist.add(attr); } + String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTSF, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.SF6QTSFID); - } else { -// iscontiue = false; - log.info("没有查询sf6_qtsf的数据量"); } -// } + asyncMethod.updateRecordId(maxid, Constant.SF6QTSFID); + } else { + log.info("没有查询sf6_qtsf的数据量"); + } } @Override public void upload_sf6_qtyl(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTYLID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTYLID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - }else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_sf6_qtylDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询sf6_qtyl的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_SF6_Qtyl item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_sf6_qtylDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询sf6_qtyl的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_SF6_Qtyl item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float temperature = item.getTemperature(); - if (temperature != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Temperature"); - attr.setValue(temperature); - attrlist.add(attr); - } - Float absolutepressure = item.getAbsolutepressure(); - if (absolutepressure != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("AbsolutePressure"); - attr.setValue(absolutepressure); - attrlist.add(attr); - } - Float density = item.getDensity(); - if (density != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Density"); - attr.setValue(density); - attrlist.add(attr); - } - Float pressure20c = item.getPressure20c(); - if (pressure20c != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Pressure20C"); - attr.setValue(pressure20c); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTYL, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - log.info("开始传输"); - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float temperature = item.getTemperature(); + if (temperature != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Temperature"); + attr.setValue(temperature); + attrlist.add(attr); + } + Float absolutepressure = item.getAbsolutepressure(); + if (absolutepressure != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("AbsolutePressure"); + attr.setValue(absolutepressure); + attrlist.add(attr); + } + Float density = item.getDensity(); + if (density != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Density"); + attr.setValue(density); + attrlist.add(attr); + } + Float pressure20c = item.getPressure20c(); + if (pressure20c != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Pressure20C"); + attr.setValue(pressure20c); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTYL, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + log.info("开始传输"); + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.SF6QTYLID); - } else { -// iscontiue = false; - log.info("没有查询到sf6_qtyl的数据"); } -// } + asyncMethod.updateRecordId(maxid, Constant.SF6QTYLID); + } else { + log.info("没有查询到sf6_qtyl的数据"); + } } @Override public void upload_tx(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.TXID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.TXID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_txDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询tx的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Tx item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_txDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询tx的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Tx item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float totalcorecurrent = item.getTotalcorecurrent(); - if (totalcorecurrent != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("TotalCoreCurrent"); - attr.setValue(totalcorecurrent); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.TX, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float totalcorecurrent = item.getTotalcorecurrent(); + if (totalcorecurrent != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("TotalCoreCurrent"); + attr.setValue(totalcorecurrent); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.TX, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.TXID); - } else { -// iscontiue = false; - log.info("没有查询到tx的数据"); } + asyncMethod.updateRecordId(maxid, Constant.TXID); + } else { +// iscontiue = false; + log.info("没有查询到tx的数据"); + } // } } @Override public void upload_ws(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.WSID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.WSID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_wsDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询ws的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Ws item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_wsDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询ws的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Ws item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float moisture = item.getMoisture(); - if (moisture != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Moisture"); - attr.setValue(moisture); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.WS, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float moisture = item.getMoisture(); + if (moisture != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Moisture"); + attr.setValue(moisture); + attrlist.add(attr); } + String cacdata = GenerateI2Xml.generateCacXml(Constant.WS, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.WSID); - } else { -// iscontiue = false; - log.info("没有查询到ws的数据"); } -// } + asyncMethod.updateRecordId(maxid, Constant.WSID); + } else { + log.info("没有查询到ws的数据"); + } } @Override public void upload_ysp(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - //查询目前上传的油色谱的id 记录油色谱上传的id大小 - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YSPID); - BigInteger value = null; - if (upload_check == null) { + //查询目前上传的油色谱的id 记录油色谱上传的id大小 + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YSPID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_yspDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询ysp的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Ysp item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_yspDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询ysp的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Ysp item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float h2 = item.getH2(); - if (h2 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("H2"); - attr.setValue(h2); - attrlist.add(attr); - } - Float ch4 = item.getCh4(); - if (ch4 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("CH4"); - attr.setValue(ch4); - attrlist.add(attr); - } - Float c2h6 = item.getC2h6(); - if (c2h6 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("C2H6"); - attr.setValue(c2h6); - attrlist.add(attr); - } - Float c2h4 = item.getC2h4(); - if (c2h4 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("C2H4"); - attr.setValue(c2h4); - attrlist.add(attr); - } - Float c2h2 = item.getC2h2(); - if (c2h2 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("C2H2"); - attr.setValue(c2h2); - attrlist.add(attr); - } - Float co = item.getCo(); - if (co != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("CO"); - attr.setValue(co); - attrlist.add(attr); - } - Float co2 = item.getCo2(); - if (co2 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("CO2"); - attr.setValue(co2); - attrlist.add(attr); - } - Float o2 = item.getO2(); - if (o2 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("O2"); - attr.setValue(o2); - attrlist.add(attr); - } - Float n2 = item.getN2(); - if (n2 != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("N2"); - attr.setValue(n2); - attrlist.add(attr); - } - Float totalhydrocarbon = item.getTotalhydrocarbon(); - if (totalhydrocarbon != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("TotalHydrocarbon"); - attr.setValue(totalhydrocarbon); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.YSP, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - log.info("测试断点3"); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - log.info("测试断点4"); - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - log.info("ysp组装完成,开始上传"); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float h2 = item.getH2(); + if (h2 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("H2"); + attr.setValue(h2); + attrlist.add(attr); + } + Float ch4 = item.getCh4(); + if (ch4 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("CH4"); + attr.setValue(ch4); + attrlist.add(attr); + } + Float c2h6 = item.getC2h6(); + if (c2h6 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("C2H6"); + attr.setValue(c2h6); + attrlist.add(attr); + } + Float c2h4 = item.getC2h4(); + if (c2h4 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("C2H4"); + attr.setValue(c2h4); + attrlist.add(attr); + } + Float c2h2 = item.getC2h2(); + if (c2h2 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("C2H2"); + attr.setValue(c2h2); + attrlist.add(attr); + } + Float co = item.getCo(); + if (co != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("CO"); + attr.setValue(co); + attrlist.add(attr); + } + Float co2 = item.getCo2(); + if (co2 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("CO2"); + attr.setValue(co2); + attrlist.add(attr); + } + Float o2 = item.getO2(); + if (o2 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("O2"); + attr.setValue(o2); + attrlist.add(attr); + } + Float n2 = item.getN2(); + if (n2 != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("N2"); + attr.setValue(n2); + attrlist.add(attr); + } + Float totalhydrocarbon = item.getTotalhydrocarbon(); + if (totalhydrocarbon != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("TotalHydrocarbon"); + attr.setValue(totalhydrocarbon); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.YSP, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + log.info("测试断点3"); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + log.info("测试断点4"); + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + log.info("ysp组装完成,开始上传"); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.YSPID); - } else { -// iscontiue = false; - log.info("没有查询到ysp的数据"); } + asyncMethod.updateRecordId(maxid, Constant.YSPID); + } else { + log.info("没有查询到ysp的数据"); + } // } } @Override public void upload_microclimate(Client client, HashMap equipMap) { -// Boolean iscontiue = true; -// while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.MICROCLIMATEID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.MICROCLIMATEID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_microclimateDao.selectUploadById(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询microclimate的数据量:" + list.size()); -// if (list.size()<1000) { -// iscontiue = false; -// } - ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_Microclimate item = list.get(index); - BigInteger ids = item.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } - } - Niec_Sensors sensors = equipMap.get(item.getEqmid()); - if (sensors == null) { - continue; + } + List list = data_microclimateDao.selectUploadById(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询microclimate的数据量:" + list.size()); + ArrayList cacdatalist = new ArrayList<>(); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_Microclimate item = list.get(index); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - String sensorid = sensors.getSensorCode(); - String equipmentid = sensors.getEquipmentId(); - String phase = sensors.getPhase(); - if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { - ArrayList attrlist = new ArrayList<>(); - try { - String timestamp = ""; - Date acquisitiontime = item.getAcquisitiontime(); - if (acquisitiontime != null) { - timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); - } - if (phase != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Phase"); - attr.setValue(phase); - attrlist.add(attr); - } - Float airtemperature = item.getAirtemperature(); - if (airtemperature != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("AirTemperature"); - attr.setValue(airtemperature); - attrlist.add(attr); - } - Float airpressure = item.getAirpressure(); - if (airpressure != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("AirPressure"); - attr.setValue(airpressure); - attrlist.add(attr); - } - Float humidity = item.getHumidity(); - if (humidity != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Humidity"); - attr.setValue(humidity); - attrlist.add(attr); - } - Float precipitation = item.getPrecipitation(); - if (precipitation != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("Precipitation"); - attr.setValue(precipitation); - attrlist.add(attr); - } - Float precipitationintensity = item.getPrecipitationintensity(); - if (precipitationintensity != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("PrecipitationIntensity"); - attr.setValue(precipitationintensity); - attrlist.add(attr); - } - Float radiationintensity = item.getRadiationintensity(); - if (radiationintensity != null) { - AttrBean attr = new AttrBean<>(); - attr.setKey("RadiationIntensity"); - attr.setValue(radiationintensity); - attrlist.add(attr); - } - String cacdata = GenerateI2Xml.generateCacXml(Constant.WQX, sensorid, equipmentid, timestamp, attrlist); - cacdatalist.add(cacdata); - if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { - String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); - asyncMethod.sendData2(client, xml); - cacdatalist = new ArrayList<>(); - } - } catch (Exception e) { - log.error("抛出了异常:{}" + e.getMessage()); + } + Niec_Sensors sensors = equipMap.get(item.getEqmid()); + if (sensors == null) { + continue; + } + String sensorid = sensors.getSensorCode(); + String equipmentid = sensors.getEquipmentId(); + String phase = sensors.getPhase(); + if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) { + ArrayList attrlist = new ArrayList<>(); + try { + String timestamp = ""; + Date acquisitiontime = item.getAcquisitiontime(); + if (acquisitiontime != null) { + timestamp = DateUtil.format(acquisitiontime, DatePattern.NORM_DATETIME_PATTERN); + } + if (phase != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Phase"); + attr.setValue(phase); + attrlist.add(attr); + } + Float airtemperature = item.getAirtemperature(); + if (airtemperature != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("AirTemperature"); + attr.setValue(airtemperature); + attrlist.add(attr); + } + Float airpressure = item.getAirpressure(); + if (airpressure != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("AirPressure"); + attr.setValue(airpressure); + attrlist.add(attr); + } + Float humidity = item.getHumidity(); + if (humidity != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Humidity"); + attr.setValue(humidity); + attrlist.add(attr); + } + Float precipitation = item.getPrecipitation(); + if (precipitation != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("Precipitation"); + attr.setValue(precipitation); + attrlist.add(attr); + } + Float precipitationintensity = item.getPrecipitationintensity(); + if (precipitationintensity != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("PrecipitationIntensity"); + attr.setValue(precipitationintensity); + attrlist.add(attr); } + Float radiationintensity = item.getRadiationintensity(); + if (radiationintensity != null) { + AttrBean attr = new AttrBean<>(); + attr.setKey("RadiationIntensity"); + attr.setValue(radiationintensity); + attrlist.add(attr); + } + String cacdata = GenerateI2Xml.generateCacXml(Constant.WQX, sensorid, equipmentid, timestamp, attrlist); + cacdatalist.add(cacdata); + if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { + String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); + asyncMethod.sendData2(client, xml); + cacdatalist = new ArrayList<>(); + } + } catch (Exception e) { + log.error("抛出了异常:{}" + e.getMessage()); } } - asyncMethod.updateRecordId(maxid, Constant.MICROCLIMATEID); - } else { -// iscontiue = false; - log.info("没有查询到microcimate的数据"); } -// } + asyncMethod.updateRecordId(maxid, Constant.MICROCLIMATEID); + } else { + log.info("没有查询到microcimate的数据"); + } } @Override public void upload_yx(Client client) { // Boolean iscontiue = true; // while (iscontiue) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID); - BigInteger value = null; - if (upload_check == null) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } - List list = data_yxDao.selectByPrimaryKey(value); - if (CollectionUtil.isNotEmpty(list)) { - log.info("查询yx的数据量:" + list.size()); -// if (list.size() < 1000) { -// iscontiue = false; -// } - BigInteger maxid = value; - for (int index = 0; index < list.size(); index++) { - Data_YxlDto data_yxlDto = list.get(index); - Date dtime = data_yxlDto.getDtime(); - String equipmentid = data_yxlDto.getEquipmentId(); - String sensorid = data_yxlDto.getSensorCode(); - String tableName = data_yxlDto.getTableName(); - String field = data_yxlDto.getField(); - Integer ival = data_yxlDto.getIval(); - Integer sadr = data_yxlDto.getSadr(); - String phase = data_yxlDto.getPhase(); - BigInteger ids = data_yxlDto.getId(); - if (ids != null) { - int i = ids.compareTo(maxid); - if (i == 1) { - maxid = ids; - } + } + List list = data_yxDao.selectByPrimaryKey(value); + if (CollectionUtil.isNotEmpty(list)) { + log.info("查询yx的数据量:" + list.size()); + BigInteger maxid = value; + for (int index = 0; index < list.size(); index++) { + Data_YxlDto data_yxlDto = list.get(index); + Date dtime = data_yxlDto.getDtime(); + String equipmentid = data_yxlDto.getEquipmentId(); + String sensorid = data_yxlDto.getSensorCode(); + String tableName = data_yxlDto.getTableName(); + String field = data_yxlDto.getField(); + Integer ival = data_yxlDto.getIval(); + Integer sadr = data_yxlDto.getSadr(); + String phase = data_yxlDto.getPhase(); + BigInteger ids = data_yxlDto.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; } - YxAttrBean attr = new YxAttrBean<>(); - attr.setSensorid(sensorid); - attr.setEquipmentid(equipmentid); + } + YxAttrBean attr = new YxAttrBean<>(); + attr.setSensorid(sensorid); + attr.setEquipmentid(equipmentid); - String timestamp = ""; - if (dtime != null) { - timestamp = DateUtil.format(dtime, DatePattern.NORM_DATETIME_PATTERN); - attr.setTimestamp(timestamp); - } - attr.setPhase(phase); - attr.setKey(field); - attr.setValue(ival); - if (StrUtil.equals(tableName, Constant.data_byq_jbfd)) { - attr.setDevicetype(Constant.BYQ_JBFD); - } else if (StrUtil.equals(tableName, Constant.data_cnj)) { - attr.setDevicetype(Constant.CNJ); - } else if (StrUtil.equals(tableName, Constant.data_dcyw)) { - attr.setDevicetype(Constant.DCYW); - } else if (StrUtil.equals(tableName, Constant.data_dlq_jbfd)) { - attr.setDevicetype(Constant.DLQJBFD); - } else if (StrUtil.equals(tableName, Constant.data_dr_jyjc)) { - attr.setDevicetype(Constant.DRJYJC); - } else if (StrUtil.equals(tableName, Constant.data_fhdlbx)) { - attr.setDevicetype(Constant.FHDLBX); - } else if (StrUtil.equals(tableName, Constant.data_fhzxq)) { - attr.setDevicetype(Constant.FHZXQ); - } else if (StrUtil.equals(tableName, Constant.data_jsyhw_jyjc)) { - attr.setDevicetype(Constant.JSYHW); - } else if (StrUtil.equals(tableName, Constant.data_microclimate)) { - attr.setDevicetype(Constant.WQX); - } else if (StrUtil.equals(tableName, Constant.data_sf6_qtsf)) { - attr.setDevicetype(Constant.SF6_QTSF); - } else if (StrUtil.equals(tableName, Constant.data_sf6_qtyl)) { - attr.setDevicetype(Constant.SF6_QTYL); - } else if (StrUtil.equals(tableName, Constant.data_tx)) { - attr.setDevicetype(Constant.TX); - } else if (StrUtil.equals(tableName, Constant.data_ws)) { - attr.setDevicetype(Constant.WS); - } else if (StrUtil.equals(tableName, Constant.data_ysp)) { - attr.setDevicetype(Constant.YSP); - } - try { - String xml = GenerateI2Xml.generateYxCacXml(attr); - if (xml != null && !xml.equals("")) { - asyncMethod.sendData2(client, xml); - } - } catch (Exception e) { - e.printStackTrace(); + String timestamp = ""; + if (dtime != null) { + timestamp = DateUtil.format(dtime, DatePattern.NORM_DATETIME_PATTERN); + attr.setTimestamp(timestamp); + } + attr.setPhase(phase); + attr.setKey(field); + attr.setValue(ival); + if (StrUtil.equals(tableName, Constant.data_byq_jbfd)) { + attr.setDevicetype(Constant.BYQ_JBFD); + } else if (StrUtil.equals(tableName, Constant.data_cnj)) { + attr.setDevicetype(Constant.CNJ); + } else if (StrUtil.equals(tableName, Constant.data_dcyw)) { + attr.setDevicetype(Constant.DCYW); + } else if (StrUtil.equals(tableName, Constant.data_dlq_jbfd)) { + attr.setDevicetype(Constant.DLQJBFD); + } else if (StrUtil.equals(tableName, Constant.data_dr_jyjc)) { + attr.setDevicetype(Constant.DRJYJC); + } else if (StrUtil.equals(tableName, Constant.data_fhdlbx)) { + attr.setDevicetype(Constant.FHDLBX); + } else if (StrUtil.equals(tableName, Constant.data_fhzxq)) { + attr.setDevicetype(Constant.FHZXQ); + } else if (StrUtil.equals(tableName, Constant.data_jsyhw_jyjc)) { + attr.setDevicetype(Constant.JSYHW); + } else if (StrUtil.equals(tableName, Constant.data_microclimate)) { + attr.setDevicetype(Constant.WQX); + } else if (StrUtil.equals(tableName, Constant.data_sf6_qtsf)) { + attr.setDevicetype(Constant.SF6_QTSF); + } else if (StrUtil.equals(tableName, Constant.data_sf6_qtyl)) { + attr.setDevicetype(Constant.SF6_QTYL); + } else if (StrUtil.equals(tableName, Constant.data_tx)) { + attr.setDevicetype(Constant.TX); + } else if (StrUtil.equals(tableName, Constant.data_ws)) { + attr.setDevicetype(Constant.WS); + } else if (StrUtil.equals(tableName, Constant.data_ysp)) { + attr.setDevicetype(Constant.YSP); + } + try { + String xml = GenerateI2Xml.generateYxCacXml(attr); + if (xml != null && !xml.equals("")) { + asyncMethod.sendData2(client, xml); } - + } catch (Exception e) { + e.printStackTrace(); } - asyncMethod.updateRecordId(maxid, Constant.YXID); - } else { -// iscontiue = false; - log.info("没有查询到yx的数据"); + } -// } + asyncMethod.updateRecordId(maxid, Constant.YXID); + } else { + log.info("没有查询到yx的数据"); + } } @Override @@ -1580,5 +1476,125 @@ public class XydlI2ServiceImpl implements XydlI2Service { data_yxDao.deleteData(dateTime); } + @Override + public ServiceBody list() { + ListModel listModel = new ListModel(); + HashMap map = new HashMap(); + List upload_checks = upload_checkDao.selectAll(); + for (Upload_check item:upload_checks) { + map.put(item.getCheckType(), item.getValue()); + } + +// String today = DateUtil.today(); + String today = "2024-02-01"; + + ListModel.Beans yspbeans = new ListModel.Beans(); + yspbeans.setName("油色谱"); + Data_Ysp data_ysp1 = data_yspDao.selectMaxId(); + Data_Ysp data_ysp2 = data_yspDao.selectNowId(DateUtil.parseDate(today)); + BigInteger yspmaxid = data_ysp1.getMaxid(); + BigInteger yspuploadnum = map.get(Constant.YSPID); + BigInteger ysptodaymaxid = data_ysp2.getMaxid(); + BigInteger ysptodayminid = data_ysp2.getMinid(); + BigDecimal ysptodaymul = NumberUtil.sub(ysptodaymaxid, ysptodayminid); + BigDecimal ysptodayupload = NumberUtil.sub(yspuploadnum, ysptodayminid); + yspbeans.setHistory(yspmaxid); + yspbeans.setUploadnum(yspuploadnum); + yspbeans.setNownum(BigInteger.valueOf(ysptodaymul.longValue())); + yspbeans.setNowuploadnum(BigInteger.valueOf(ysptodayupload.longValue())); + listModel.getList().add(yspbeans); + + + ListModel.Beans txbeans = new ListModel.Beans(); + txbeans.setName("铁芯夹件"); + Data_Tx data_tx1 = data_txDao.selectMaxId(); + Data_Tx data_tx2 = data_txDao.selectNowId(DateUtil.parseDate(today)); + BigInteger txmaxid = data_tx1.getMaxid(); + BigInteger txuploadnum = map.get(Constant.TXID); + BigInteger txtodaymaxid = data_tx2.getMaxid(); + BigInteger txtodayminid = data_tx2.getMinid(); + BigDecimal txtodaymul = NumberUtil.sub(txtodaymaxid, txtodayminid); + BigDecimal txtodayupload = NumberUtil.sub(txuploadnum, txtodayminid); + txbeans.setHistory(txmaxid); + txbeans.setUploadnum(txuploadnum); + txbeans.setNownum(BigInteger.valueOf(txtodaymul.longValue())); + txbeans.setNowuploadnum(BigInteger.valueOf(txtodayupload.longValue())); + listModel.getList().add(txbeans); + + + ListModel.Beans dlqbeans = new ListModel.Beans(); + dlqbeans.setName("断路器局放"); + Data_Dlq_Jbfd data_dlq_jbfd1 = data_dlq_jbfdDao.selectMaxId(); + Data_Dlq_Jbfd data_dlq_jbfd2 = data_dlq_jbfdDao.selectNowId(DateUtil.parseDate(today)); + BigInteger dlqmaxid = data_dlq_jbfd1.getMaxid(); + BigInteger dlquploadnum = map.get(Constant.DLQJBFDID); + BigInteger dlqtodaymaxid = data_dlq_jbfd2.getMaxid(); + BigInteger dlqtodayminid = data_dlq_jbfd2.getMinid(); + BigDecimal dlqtodaymul = NumberUtil.sub(dlqtodaymaxid, dlqtodayminid); + BigDecimal dlqtodayupload = NumberUtil.sub(dlquploadnum, dlqtodayminid); + dlqbeans.setHistory(dlqmaxid); + dlqbeans.setUploadnum(dlquploadnum); + dlqbeans.setNownum(BigInteger.valueOf(dlqtodaymul.longValue())); + dlqbeans.setNowuploadnum(BigInteger.valueOf(dlqtodayupload.longValue())); + listModel.getList().add(dlqbeans); + + + + ListModel.Beans sf6beans = new ListModel.Beans(); + sf6beans.setName("SF6气体压力"); + Data_SF6_Qtyl data_sf6_qtyl1 = data_sf6_qtylDao.selectMaxId(); + Data_SF6_Qtyl data_sf6_qtyl2 = data_sf6_qtylDao.selectNowId(DateUtil.parseDate(today)); + BigInteger sf6maxid = data_sf6_qtyl1.getMaxid(); + BigInteger sf6uploadnum = map.get(Constant.SF6QTYLID); + BigInteger sf6todaymaxid = data_sf6_qtyl2.getMaxid(); + BigInteger sf6todayminid = data_sf6_qtyl2.getMinid(); + BigDecimal sf6todaymul = NumberUtil.sub(sf6todaymaxid, sf6todayminid); + BigDecimal sf6todayupload = NumberUtil.sub(sf6uploadnum, sf6todayminid); + sf6beans.setHistory(sf6maxid); + sf6beans.setUploadnum(sf6uploadnum); + sf6beans.setNownum(BigInteger.valueOf(sf6todaymul.longValue())); + sf6beans.setNowuploadnum(BigInteger.valueOf(sf6todayupload.longValue())); + listModel.getList().add(sf6beans); + + + ListModel.Beans jsybeans = new ListModel.Beans(); + jsybeans.setName("避雷器"); + Data_Jsyhw_Jyjc data_jsyhw_jyjc1 = data_jsyhw_jyjcDao.selectMaxId(); + Data_Jsyhw_Jyjc data_jsyhw_jyjc2 = data_jsyhw_jyjcDao.selectNowId(DateUtil.parseDate(today)); + BigInteger jsymaxid = data_jsyhw_jyjc1.getMaxid(); + BigInteger jsyuploadnum = map.get(Constant.JSYHWJYJCID); + BigInteger jsytodaymaxid = data_jsyhw_jyjc2.getMaxid(); + BigInteger jsytodayminid = data_jsyhw_jyjc2.getMinid(); + BigDecimal jsytodaymul = NumberUtil.sub(jsytodaymaxid, jsytodayminid); + BigDecimal jsytodayupload = NumberUtil.sub(jsyuploadnum, jsytodayminid); + jsybeans.setHistory(jsymaxid); + jsybeans.setUploadnum(jsyuploadnum); + jsybeans.setNownum(BigInteger.valueOf(jsytodaymul.longValue())); + jsybeans.setNowuploadnum(BigInteger.valueOf(jsytodayupload.longValue())); + listModel.getList().add(jsybeans); + + ListModel.Beans yxbeans = new ListModel.Beans(); + yxbeans.setName("遥信"); + Data_YxlDto data_yxlDto1 = data_yxDao.selectMaxId(); + Data_YxlDto data_yxlDto2 = data_yxDao.selectNowId(DateUtil.parseDate(today)); + BigInteger yxmaxid = data_yxlDto1.getMaxid(); + BigInteger yxuploadnum = map.get(Constant.YXID); + BigInteger yxtodaymaxid = data_yxlDto2.getMaxid(); + BigInteger yxtodayminid = data_yxlDto2.getMinid(); + BigDecimal yxtodaymul = NumberUtil.sub(yxtodaymaxid, yxtodayminid); + BigDecimal yxtodayupload = NumberUtil.sub(yxuploadnum, yxtodayminid); + yxbeans.setHistory(yxmaxid); + yxbeans.setUploadnum(yxuploadnum); + yxbeans.setNownum(BigInteger.valueOf(yxtodaymul.longValue())); + yxbeans.setNowuploadnum(BigInteger.valueOf(yxtodayupload.longValue())); + listModel.getList().add(yxbeans); + + ServiceBody serviceBody = new ServiceBody(); + serviceBody.setCode(ServiceStatus.SUCCESS); + serviceBody.setData(listModel); + return serviceBody; + + } + } diff --git a/src/main/java/com/shxy/i2/timeTask/ScheduledTask.java b/src/main/java/com/shxy/i2/timeTask/ScheduledTask.java index 1a49c33..ecda235 100644 --- a/src/main/java/com/shxy/i2/timeTask/ScheduledTask.java +++ b/src/main/java/com/shxy/i2/timeTask/ScheduledTask.java @@ -1,80 +1,76 @@ -package com.shxy.i2.timeTask; - -import com.shxy.i2.bean.AttrBean; -import com.shxy.i2.service.Webservcies; -import com.shxy.i2.service.XydlI2Service; -import lombok.extern.slf4j.Slf4j; -import org.apache.cxf.endpoint.Client; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * @author jingjing - * @date 2023-11-16 15:06 - */ -@Component -@EnableScheduling -@Slf4j -//@EnableAsync -public class ScheduledTask { - - @Autowired - Webservcies webservcies; - - @Autowired - XydlI2Service xydlI2Service; - - @Scheduled(fixedDelay = 60 * 60 * 1000) - public void cacyspupload() { - log.info("cacyspupload执行" ); - webservcies.uploadyspData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cacjfjcupload() { - log.info("cacjfjcupload执行" ); - webservcies.uploadjfjcData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cacupload() { - log.info("cacupload执行" ); - webservcies.uploadData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cactxupload() { - log.info("cactxupload执行" ); - webservcies.uploadtxData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cacyxupload() { - log.info("cacyxupload执行" ); - webservcies.uploadyxData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cacdcywupload() { - log.info("cacdcywupload执行" ); - webservcies.uploaddcywData(); - } - - @Scheduled(fixedDelay = 1 * 30 * 1000) - public void cacjsyhwjyjcupload() { - log.info("cacjsyhwjyjcupload执行" ); - webservcies.uploadjsyhwjyjcData(); - } - - - @Scheduled(cron = "0 0 13 * * ?") - public void clear() { - log.info("clear" ); - xydlI2Service.clear_history(); - } - -} +//package com.shxy.i2.timeTask; +// +//import com.shxy.i2.service.Webservcies; +//import com.shxy.i2.service.XydlI2Service; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.scheduling.annotation.EnableScheduling; +//import org.springframework.scheduling.annotation.Scheduled; +//import org.springframework.stereotype.Component; +// +///** +// * @author jingjing +// * @date 2023-11-16 15:06 +// */ +//@Component +//@EnableScheduling +//@Slf4j +////@EnableAsync +//public class ScheduledTask { +// +// @Autowired +// Webservcies webservcies; +// +// @Autowired +// XydlI2Service xydlI2Service; +// +// @Scheduled(fixedDelay = 60 * 60 * 1000) +// public void cacyspupload() { +// log.info("cacyspupload执行" ); +// webservcies.uploadyspData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cacjfjcupload() { +// log.info("cacjfjcupload执行" ); +// webservcies.uploadjfjcData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cacupload() { +// log.info("cacupload执行" ); +// webservcies.uploadData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cactxupload() { +// log.info("cactxupload执行" ); +// webservcies.uploadtxData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cacyxupload() { +// log.info("cacyxupload执行" ); +// webservcies.uploadyxData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cacdcywupload() { +// log.info("cacdcywupload执行" ); +// webservcies.uploaddcywData(); +// } +// +// @Scheduled(fixedDelay = 1 * 30 * 1000) +// public void cacjsyhwjyjcupload() { +// log.info("cacjsyhwjyjcupload执行" ); +// webservcies.uploadjsyhwjyjcData(); +// } +// +// +// @Scheduled(cron = "0 0 13 * * ?") +// public void clear() { +// log.info("clear" ); +// xydlI2Service.clear_history(); +// } +// +//} diff --git a/src/main/resources/mappers/Data_Byq_JbfdDao.xml b/src/main/resources/mappers/Data_Byq_JbfdDao.xml index a76fcc1..c4e810a 100644 --- a/src/main/resources/mappers/Data_Byq_JbfdDao.xml +++ b/src/main/resources/mappers/Data_Byq_JbfdDao.xml @@ -3,6 +3,8 @@ + + @@ -23,9 +25,28 @@ t1.id, t1.eqmid, t1.acquisitionTime, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount, t1.isupload, t1.dischargeWaveform,t1.create_time, t1.update_time FROM - data_byq_jbfd t1 where t1.id ]]> #{maxid} + data_byq_jbfd t1 where t1.id ]]> #{maxid} limit 10000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update data_jsyhw_jyjc diff --git a/src/main/resources/mappers/Data_MicroclimateDao.xml b/src/main/resources/mappers/Data_MicroclimateDao.xml index 190694d..6e482c3 100644 --- a/src/main/resources/mappers/Data_MicroclimateDao.xml +++ b/src/main/resources/mappers/Data_MicroclimateDao.xml @@ -3,6 +3,8 @@ + + @@ -26,9 +28,25 @@ select from data_microclimate - where id ]]> #{maxid} + where id ]]> #{maxid} limit 10000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT MAX( id ) AS maxid FROM data_tx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT MAX( id ) AS maxid FROM data_ysp + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mappers/Upload_checkDao.xml b/src/main/resources/mappers/Upload_checkDao.xml index cd39127..e4892b0 100644 --- a/src/main/resources/mappers/Upload_checkDao.xml +++ b/src/main/resources/mappers/Upload_checkDao.xml @@ -7,18 +7,28 @@ - check_type, value, update_time - + check_type, value, update_time + + + - update upload_check - set value = #{value}, - update_time = #{updateTime} - where check_type = #{checkType} - + + update upload_check + set value = #{value}, + update_time = #{updateTime} + where check_type = #{checkType} + + \ No newline at end of file diff --git a/src/main/resources/mappers/data_FhzxqDao.xml b/src/main/resources/mappers/data_FhzxqDao.xml index b079a63..9970d5e 100644 --- a/src/main/resources/mappers/data_FhzxqDao.xml +++ b/src/main/resources/mappers/data_FhzxqDao.xml @@ -3,6 +3,8 @@ + + @@ -18,9 +20,29 @@ select from data_fhzxq - where id ]]> #{maxid} + where id ]]> #{maxid} limit 10000 + + + + + + + + + + + + + + + +