|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|