I2代码遥信修改

master
liuguijing 2 years ago
parent 0c5533b137
commit 9431df1a75

@ -8,6 +8,7 @@ import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.constant.CommonStatus;
import com.shxy.i2.constant.Constant;
import com.shxy.i2.dao.*;
import com.shxy.i2.dto.Data_YxlDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.endpoint.Client;
import org.springframework.beans.factory.annotation.Autowired;
@ -64,6 +65,9 @@ public class AsyncMethod {
@Autowired
private Data_CnjDao data_cnjDao;
@Autowired
private Upload_checkDao upload_checkDao;
@Async(value = "asyncServiceExecutor")
public void sendData(Client client, List<BigInteger> idlist, String xml, String type) throws Exception {
@ -126,12 +130,51 @@ public class AsyncMethod {
}
// @Async(value = "asyncServiceExecutor")
// public void sendJBFDData(Client client, ArrayList<SendDataBean> idlist, String xml, String type) throws Exception {
// Object[] objects = client.invoke("uploadCACData", xml);
// String threadId = Thread.currentThread().getName();
// log.info("线程序号: " + threadId + "当前时间:" + new Date());
//// log.info("上传的数据: " + xml);
// if (objects != null && objects.length > 0) {
// String string = String.valueOf(objects[0]);
// log.info("返回的长度 " + objects.length + " 返回的对象 " + string);
// JSONObject jsonObject = XML.toJSONObject(string);
// if (jsonObject != null) {
// JSONObject response = (JSONObject) jsonObject.get("response");
// if (response != null) {
// JSONObject result = (JSONObject) response.get("result");
// if (result != null) {
// Integer code = (Integer) result.get("code");
// if (code != null && code.intValue() == 0) {
// log.info("上传成功");
// log.info("修改的id: " + idlist.toString());
// if (CollectionUtil.isNotEmpty(idlist)) {
// if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
// data_byq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// } else if (StrUtil.equals(type, Constant.DLQJBFD)) {
// data_dlq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// } else if (StrUtil.equals(type, Constant.YSP)) {
// data_yspDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// }
//
//
// }
// } else {
// log.info("上传失败");
// }
// }
// }
// }
// }
// }
@Async(value = "asyncServiceExecutor")
public void sendJBFDData(Client client, ArrayList<SendDataBean> idlist, String xml, String type) throws Exception {
public void sendJBFDData2(Client client, BigInteger maxid, ArrayList<Integer> list1, String xml, String type) throws Exception {
Object[] objects = client.invoke("uploadCACData", xml);
String threadId = Thread.currentThread().getName();
log.info("线程序号: " + threadId + "当前时间:" + new Date());
// log.info("上传的数据: " + xml);
// log.info("上传的油色谱数据: " + xml);
if (objects != null && objects.length > 0) {
String string = String.valueOf(objects[0]);
log.info("返回的长度 " + objects.length + " 返回的对象 " + string);
@ -144,14 +187,14 @@ public class AsyncMethod {
Integer code = (Integer) result.get("code");
if (code != null && code.intValue() == 0) {
log.info("上传成功");
log.info("修改的id: " + idlist.toString());
if (CollectionUtil.isNotEmpty(idlist)) {
log.info("修改的id: " + list1.toString());
if (CollectionUtil.isNotEmpty(list1)) {
if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
data_byq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
data_byq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
} else if (StrUtil.equals(type, Constant.DLQJBFD)) {
data_dlq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
data_dlq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
} else if (StrUtil.equals(type, Constant.YSP)) {
data_yspDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
data_yspDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
}
@ -166,11 +209,10 @@ public class AsyncMethod {
}
@Async(value = "asyncServiceExecutor")
public void sendJBFDData2(Client client, BigInteger maxid, ArrayList<Integer> list1, String xml, String type) throws Exception {
public void sendYxData(Client client, BigInteger maxid, String xml) throws Exception {
Object[] objects = client.invoke("uploadCACData", xml);
String threadId = Thread.currentThread().getName();
log.info("线程序号: " + threadId + "当前时间:" + new Date());
// log.info("上传的数据: " + xml);
// String threadId = Thread.currentThread().getName();
// log.info("线程序号: " + threadId + "当前时间:" + new Date());
if (objects != null && objects.length > 0) {
String string = String.valueOf(objects[0]);
log.info("返回的长度 " + objects.length + " 返回的对象 " + string);
@ -183,17 +225,8 @@ public class AsyncMethod {
Integer code = (Integer) result.get("code");
if (code != null && code.intValue() == 0) {
log.info("上传成功");
log.info("修改的id: " + list1.toString());
if (CollectionUtil.isNotEmpty(list1)) {
if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
data_byq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid,list1, new Date());
} else if (StrUtil.equals(type, Constant.DLQJBFD)) {
data_dlq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(),maxid, list1, new Date());
} else if (StrUtil.equals(type, Constant.YSP)) {
data_yspDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
}
if (maxid != null && maxid.longValue() > 0) {
upload_checkDao.updateByPrimaryKey(Constant.YXID, maxid, new Date());
}
} else {
log.info("上传失败");

@ -2,6 +2,7 @@ package com.shxy.i2.Tool;
import cn.hutool.core.util.StrUtil;
import com.shxy.i2.bean.AttrBean;
import com.shxy.i2.bean.YxAttrBean;
import com.shxy.i2.constant.Constant;
import java.util.ArrayList;
@ -40,4 +41,43 @@ public class GenerateI2Xml {
return cacxml;
}
public static String generateYxCacXml(YxAttrBean<Integer> attr) {
String cacdata = "";
String sensorid = attr.getSensorid();
String equipmentid = attr.getEquipmentid();
String devicetype = attr.getDevicetype();
String timestamp = attr.getTimestamp();
String key = attr.getKey();
Integer value = attr.getValue();
String phase = attr.getPhase();
String status = "FALSE";
if (value != null) {
if (value.intValue() == 0) {
status = "FALSE";
} else {
status = "TRUE";
}
if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid) && StrUtil.isNotEmpty(timestamp) && StrUtil.isNotEmpty(key)) {
cacdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?> ";
cacdata += "<request> ";
cacdata += "<monitordata cacid=\"" + Constant.Cacid + "\" datanodenum=\"" + 1 + "\"> ";
cacdata += "<datanode sensorid=\"" + sensorid + "\"> ";
cacdata += "<type>" + devicetype + "</type> ";
cacdata += "<equipmentid>" + equipmentid + "</equipmentid> ";
if (StrUtil.isNotEmpty(timestamp)) {
cacdata += "<timestamp>" + timestamp + "</timestamp> ";
}
cacdata += "<attrs> ";
cacdata += "<attr name=\"Phase\" value=\"" + phase + "\" alarm=\"" + status + "\" /> ";
cacdata += "<attr name=\"" + key + "\" value=\"" + value + "\" alarm=\"" + status + "\" /> ";
cacdata += "</attrs> ";
cacdata += "</datanode>";
cacdata += "</monitordata> ";
cacdata += "</request> ";
}
}
return cacdata;
}
}

@ -4,6 +4,11 @@ import lombok.Data;
@Data
public class YxAttrBean<T> {
private String devicetype;
private String sensorid;
private String equipmentid;
private String timestamp;
private String phase;
private String key;
private T value;
}

@ -22,7 +22,7 @@ public class ThreadPoolConfig {
public Executor asyncServiceExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//配置核心线程数
executor.setCorePoolSize(20);
executor.setCorePoolSize(50);
//配置最大线程数
executor.setMaxPoolSize(200);
//配置队列大小

@ -20,4 +20,20 @@ public class Constant {
public static String SF6_QTSF = "024005";
public static String CNJ = "024006";
public static String WQX = "025001";
public static String data_byq_jbfd = "data_byq_jbfd";
public static String data_cnj = "data_cnj";
public static String data_dcyw = "data_dcyw";
public static String data_dlq_jbfd = "data_dlq_jbfd";
public static String data_dr_jyjc = "data_dr_jyjc";
public static String data_fhdlbx = "data_fhdlbx";
public static String data_fhzxq = "data_fhzxq";
public static String data_jsyhw_jyjc = "data_jsyhw_jyjc";
public static String data_microclimate = "data_microclimate";
public static String data_sf6_qtsf = "data_sf6_qtsf";
public static String data_sf6_qtyl = "data_sf6_qtyl";
public static String data_tx = "data_tx";
public static String data_ws = "data_ws";
public static String data_ysp = "data_ysp";
}

@ -22,4 +22,5 @@ public interface Data_Byq_JbfdDao {
int updateDataList2(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") ArrayList<Integer> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Cnj;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_CnjDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Dcyw;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_DcywDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.entity.Data_Dlq_Jbfd;
import org.apache.ibatis.annotations.Param;
@ -21,4 +22,5 @@ public interface Data_Dlq_JbfdDao {
int updateDataList2(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") ArrayList<Integer> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Dr_Jyjc;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_Dr_JyjcDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Fhdlbx;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_FhdlbxDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Fhzxq;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_FhzxqDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Jsyhw_Jyjc;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_Jsyhw_JyjcDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Microclimate;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_MicroclimateDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_SF6_Qtsf;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_SF6_QtsfDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_SF6_Qtyl;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_SF6_QtylDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Tx;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_TxDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Ws;
import org.apache.ibatis.annotations.Param;
@ -15,4 +16,5 @@ public interface Data_WsDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,5 +1,6 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.entity.Data_Ysp;
import org.apache.ibatis.annotations.Param;
@ -21,4 +22,5 @@ public interface Data_YspDao {
int updateDataList2(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") ArrayList<Integer> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -5,13 +5,14 @@ import com.shxy.i2.entity.Data_Yx;
import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
public interface Data_YxDao {
List<Data_YxlDto> selectByPrimaryKey(@Param("maxid") BigInteger maxid);
int updateByPrimaryKey(Data_Yx record);
int deleteData(@Param("time") Date time);
}

@ -1,17 +1,15 @@
package com.shxy.i2.dao;
import com.shxy.i2.entity.Upload_check;
import org.apache.ibatis.annotations.Param;
public interface Upload_checkDao {
int deleteByPrimaryKey(String checkType);
int insert(Upload_check record);
import java.math.BigInteger;
import java.util.Date;
int insertSelective(Upload_check record);
public interface Upload_checkDao {
Upload_check selectByPrimaryKey(String checkType);
int updateByPrimaryKeySelective(Upload_check record);
int updateByPrimaryKey(Upload_check record);
int updateByPrimaryKey(@Param("checkType") String checkType, @Param("value") BigInteger value, @Param("updateTime") Date updateTime);
}

@ -2,12 +2,14 @@ package com.shxy.i2.dto;
import lombok.Data;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
@Data
public class Data_YxlDto {
BigInteger id;
Integer sadr;
Date dtime;
Integer ival;

@ -3,7 +3,9 @@ package com.shxy.i2.service;
public interface Webservcies {
void uploadData();
void uploadyspData();
void uploadyspData();
void uploadjfjcData();

@ -35,5 +35,7 @@ public interface XydlI2Service {
void upload_cnj(Client client, HashMap<Integer, Niec_Sensors> equipMap);
void upload_yx(Client client, HashMap<Integer, Niec_Sensors> equipMap);
void upload_yx(Client client);
void clear_history();
}

@ -70,10 +70,38 @@ public class WebServiceImpl implements Webservcies {
xydlI2Service.upload_jsyhw_jyjc(client, equipMap);
xydlI2Service.upload_microclimate(client, equipMap);
xydlI2Service.upload_cnj(client, equipMap);
xydlI2Service.upload_yx(client);
log.info("实时数据定时任务结束");
}
// /**
// * 上传cac数据
// */
// @Override
// public void uploadYxData() {
// log.info("实时数据遥信定时任务启动");
//// 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(60000);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(30000);
// conduit.setClient(policy);
// log.info("开始执行定时遥信任务-查询数据库");
// xydlI2Service.upload_yx(client);
//
// log.info("实时数据定时遥信任务结束");
//
// }
@Override
public void uploadyspData() {
log.info("油色谱数据定时任务启动");

@ -2,12 +2,14 @@ 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.DateUtil;
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.constant.CommonStatus;
import com.shxy.i2.constant.Constant;
import com.shxy.i2.dao.*;
@ -96,6 +98,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Byq_Jbfd item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -188,6 +193,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Cnj item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -304,6 +312,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Dlq_Jbfd item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -395,6 +406,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Dr_Jyjc item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -485,6 +499,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Fhdlbx item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -547,6 +564,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Fhzxq item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -609,6 +629,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Jsyhw_Jyjc item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -692,6 +715,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_SF6_Qtsf item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -754,6 +780,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_SF6_Qtyl item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -830,6 +859,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Tx item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -885,6 +917,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Ws item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -941,9 +976,14 @@ public class XydlI2ServiceImpl implements XydlI2Service {
ArrayList<Integer> eqmidlist = new ArrayList<>();
BigInteger maxid = BigInteger.valueOf(0);
log.info("测试断点1");
for (int index = 0; index < list.size(); index++) {
log.info("测试断点2");
Data_Ysp item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -1047,10 +1087,13 @@ public class XydlI2ServiceImpl implements XydlI2Service {
maxid = id;
}
}
log.info("测试断点3");
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
log.info("测试断点4");
ArrayList<BigInteger> list1 = new ArrayList<>();
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
log.info("ysp组装完成开始上传");
// asyncMethod.sendJBFDData(client, list2, xml, Constant.YSP);
asyncMethod.sendJBFDData2(client, maxid, eqmidlist, xml, Constant.YSP);
maxid = BigInteger.valueOf(0);
@ -1078,6 +1121,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
for (int index = 0; index < list.size(); index++) {
Data_Microclimate item = list.get(index);
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
@ -1159,9 +1205,12 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
@Override
public void upload_yx(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
public void upload_yx(Client client) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID);
BigInteger value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
List<Data_YxlDto> list = data_yxDao.selectByPrimaryKey(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询microclimate的数据量" + list.size());
@ -1175,78 +1224,88 @@ public class XydlI2ServiceImpl implements XydlI2Service {
Integer ival = data_yxlDto.getIval();
Integer sadr = data_yxlDto.getSadr();
String phase = data_yxlDto.getPhase();
BigInteger id = data_yxlDto.getId();
String data_byq_jbfd = "data_byq_jbfd";
String data_cnj = "data_cnj";
String data_dcyw = "data_dcyw";
String data_dlq_jbfd = "data_dlq_jbfd";
String data_dr_jyjc = "data_dr_jyjc";
String data_fhdlbx = "data_fhdlbx";
String data_fhzxq = "data_fhzxq";
String data_jsyhw_jyjc = "data_jsyhw_jyjc";
String data_microclimate = "data_microclimate";
String data_sf6_qtsf = "data_sf6_qtsf";
String data_sf6_qtyl = "data_sf6_qtyl";
String data_tx = "data_tx";
String data_ws = "data_ws";
String data_ysp = "data_ysp";
if (StrUtil.equals(tableName, data_byq_jbfd)) {
if (StrUtil.equals(field, "dischargeCapacity")) {
AttrBean<Integer> attr = new AttrBean<>();
attr.setKey("DischargeCapacity");
attr.setValue(ival);
}
if (StrUtil.equals(field, "dischargePosition")) {
AttrBean<Integer> attr = new AttrBean<>();
attr.setKey("DischargePosition");
attr.setValue(ival);
}
if (StrUtil.equals(field, "pulseCount")) {
AttrBean<Integer> attr = new AttrBean<>();
attr.setKey("PulseCount");
attr.setValue(ival);
}
YxAttrBean<Integer> attr = new YxAttrBean<>();
attr.setSensorid(sensorid);
attr.setEquipmentid(equipmentid);
if (StrUtil.equals(field, "dischargeWaveform")) {
AttrBean<Integer> attr = new AttrBean<>();
attr.setKey("DischargeWaveform");
attr.setValue(ival);
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 {
BigInteger maxid = BigInteger.valueOf(0);
String xml = GenerateI2Xml.generateYxCacXml(attr);
if (xml != null && !xml.equals("")) {
if (index == (list.size() - 1)) {
maxid = id;
asyncMethod.sendYxData(client, maxid, xml);
} else {
asyncMethod.sendYxData(client, maxid, xml);
}
}
} else if (StrUtil.equals(tableName, data_cnj)) {
} else if (StrUtil.equals(tableName, data_dcyw)) {
} else if (StrUtil.equals(tableName, data_dlq_jbfd)) {
} else if (StrUtil.equals(tableName, data_dr_jyjc)) {
} else if (StrUtil.equals(tableName, data_fhdlbx)) {
} else if (StrUtil.equals(tableName, data_fhzxq)) {
} else if (StrUtil.equals(tableName, data_jsyhw_jyjc)) {
} else if (StrUtil.equals(tableName, data_microclimate)) {
} else if (StrUtil.equals(tableName, data_sf6_qtsf)) {
} else if (StrUtil.equals(tableName, data_sf6_qtyl)) {
} else if (StrUtil.equals(tableName, data_tx)) {
} else if (StrUtil.equals(tableName, data_ws)) {
} else if (StrUtil.equals(tableName, data_ysp)) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
@Override
public void clear_history() {
DateTime dateTime = DateUtil.offsetDay(new Date(), -7);
data_byq_jbfdDao.deleteData(dateTime);
data_cnjDao.deleteData(dateTime);
data_dcywDao.deleteData(dateTime);
data_dlq_jbfdDao.deleteData(dateTime);
data_dr_jyjcDao.deleteData(dateTime);
data_fhdlbxDao.deleteData(dateTime);
data_fhzxqDao.deleteData(dateTime);
data_jsyhw_jyjcDao.deleteData(dateTime);
data_microclimateDao.deleteData(dateTime);
data_sf6_qtsfDao.deleteData(dateTime);
data_sf6_qtylDao.deleteData(dateTime);
data_txDao.deleteData(dateTime);
data_wsDao.deleteData(dateTime);
data_yspDao.deleteData(dateTime);
data_yxDao.deleteData(dateTime);
}
}

@ -24,6 +24,9 @@ public class ScheduledTask {
@Autowired
Webservcies webservcies;
@Autowired
XydlI2Service xydlI2Service;
@Async(value = "asyncServiceExecutor")
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void cacyspupload() {
@ -40,9 +43,21 @@ public class ScheduledTask {
@Scheduled(fixedDelay = 5 * 30 * 1000)
public void cacupload() {
webservcies.uploadData();
}
@Scheduled(cron = "15 11 * * * ?")
public void clear() {
xydlI2Service.clear_history();
}
// @Scheduled(cron = "0 0/1 * * * ?")
// @Scheduled(fixedDelay = 5 * 30 * 1000)
// public void cacyxupload() {
// webservcies.uploadYxData();
// String str = "aaaa";
// webservcies.test(str);
}
// }
//
// @Scheduled(cron = "0 * * * * ?")

@ -120,4 +120,10 @@
</foreach>
</if>
</update>
<delete id="deleteData" >
delete
from data_byq_jbfd
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -57,4 +57,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_cnj
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -56,4 +56,11 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_dcyw
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -121,4 +121,10 @@
</foreach>
</if>
</update>
<delete id="deleteData" >
delete
from data_dlq_jbfd
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -63,4 +63,10 @@
</foreach>
</update>
<delete id="deleteData" >
delete
from data_dr_jyjc
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -57,4 +57,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_fhdlbx
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -62,4 +62,11 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_jsyhw_jyjc
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -66,4 +66,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_microclimate
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -59,4 +59,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_sf6_qtsf
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -80,7 +80,13 @@
<foreach collection="idlist" item="id" index="index" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_sf6_qtyl
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -58,4 +58,11 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_tx
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -57,4 +57,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_ws
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -123,4 +123,10 @@
</foreach>
</if>
</update>
<delete id="deleteData" >
delete
from data_ysp
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -2,8 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shxy.i2.dao.Data_YxDao">
<resultMap id="BaseResultMap" type="com.shxy.i2.dto.Data_YxlDto">
<result column="id" jdbcType="BIGINT" property="id"/>
<result column="sadr" jdbcType="INTEGER" property="sadr"/>
<result column="d_time" jdbcType="TIMESTAMP" property="dTime"/>
<result column="d_time" jdbcType="TIMESTAMP" property="dtime"/>
<result column="ival" jdbcType="INTEGER" property="ival"/>
<result column="field" jdbcType="VARCHAR" property="field"/>
<result column="sensor_code" jdbcType="VARCHAR" property="sensorCode"/>
@ -15,6 +16,7 @@
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select
a.id as id,
a.sadr as sadr,
a.d_time as d_time,
a.ival as ival,
@ -24,6 +26,12 @@
c.table_name as table_name,
c.phase as phase
from data_yx a left join niec_points b on a.sadr = b.sadr left join niec_sensors c on b.sensor_id = c.id
where id <![CDATA[>]]> #{maxid}
where a.id <![CDATA[>]]> #{maxid}
</select>
<delete id="deleteData" >
delete
from data_yx
where d_time <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -15,10 +15,10 @@
from upload_check
where check_type = #{checkType,jdbcType=VARCHAR}
</select>
<update id="updateByPrimaryKey" >
<update id="updateByPrimaryKey">
update upload_check
set value = #{value,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where check_type = #{checkType,jdbcType=VARCHAR}
set value = #{value},
update_time = #{updateTime}
where check_type = #{checkType}
</update>
</mapper>

@ -58,4 +58,10 @@
#{id}
</foreach>
</update>
<delete id="deleteData" >
delete
from data_fhzxq
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>
Loading…
Cancel
Save