|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.xydl.cac.transform;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.util.StringUtils;
|
|
|
|
|
import com.xydl.cac.entity.I2syncField;
|
|
|
|
|
import com.xydl.cac.entity.I2syncRecord;
|
|
|
|
|
import com.xydl.cac.entity.NSensor;
|
|
|
|
@ -7,6 +8,7 @@ import com.xydl.cac.model.i2sync.Attr;
|
|
|
|
|
import com.xydl.cac.model.i2sync.Datanode;
|
|
|
|
|
import com.xydl.cac.model.i2sync.Monitordata;
|
|
|
|
|
import com.xydl.cac.model.i2sync.Request;
|
|
|
|
|
import com.xydl.cac.util.DataTable;
|
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@ -25,6 +27,11 @@ public class I2DataTransformer {
|
|
|
|
|
List<Datanode> nodeList = new ArrayList<>();
|
|
|
|
|
for (Map<String, Object> map : dataList) {
|
|
|
|
|
String date = (String) map.get("acquisitionTime");
|
|
|
|
|
Datanode node = new Datanode();
|
|
|
|
|
node.setSensorid(sensor.getSensorCode());
|
|
|
|
|
node.setEquipmentid(sensor.getEquipmentId());
|
|
|
|
|
node.setTimestamp(date);
|
|
|
|
|
|
|
|
|
|
List<Attr> attrs = new ArrayList<>();
|
|
|
|
|
for (I2syncField field : fieldList) {
|
|
|
|
|
Object value = map.get(field.getFieldName());
|
|
|
|
@ -32,20 +39,19 @@ public class I2DataTransformer {
|
|
|
|
|
attr.setName(field.getDestFieldName());
|
|
|
|
|
attr.setValue(String.valueOf(value));
|
|
|
|
|
attr.setAlarm("FALSE");
|
|
|
|
|
if (StringUtils.isBlank(node.getType())) {
|
|
|
|
|
node.setType(DataTable.getDevType(field.getTableName()));
|
|
|
|
|
}
|
|
|
|
|
attrs.add(attr);
|
|
|
|
|
}
|
|
|
|
|
Datanode node = new Datanode();
|
|
|
|
|
node.setSensorid(sensor.getEquipmentId());
|
|
|
|
|
node.setType("027002");
|
|
|
|
|
node.setEquipmentid(sensor.getEquipmentId());
|
|
|
|
|
node.setTimestamp(date);
|
|
|
|
|
node.setAttr(attrs);
|
|
|
|
|
|
|
|
|
|
nodeList.add(node);
|
|
|
|
|
record.setLastDTime(DateUtil.parse(date));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Monitordata monitordata = new Monitordata();
|
|
|
|
|
monitordata.setCacid(sensor.getEquipmentId());
|
|
|
|
|
monitordata.setCacid(sensor.getSensorCode());
|
|
|
|
|
monitordata.setDatanodenum(nodeList.size());
|
|
|
|
|
monitordata.setDatanode(nodeList);
|
|
|
|
|
Request request = new Request();
|
|
|
|
|