数据模板解析调整

This commit is contained in:
2023-09-12 15:50:24 +08:00
parent f91670786f
commit 1beaa4992f
13 changed files with 104 additions and 131 deletions

View File

@@ -63,7 +63,7 @@ public class StatServiceImpl implements IStatService {
//1.根据设备网络识别码获取设备id查询到所用的模板用来判断模板的类型(治理模板还是电能质量模板)
//2.解析appAutoDataMessage的Did来判断当前数据是治理数据还是电能质量数据
//3-1.治理数据则获取治理的dataArray并且查询治理的监测点
//3-2.电能质量数据则还需要判断Cldid的值在dataSet里面筛选正确的数据集查询dataArray(默认Cldid=1为负载侧监测点、Cldid=2为电网侧监测点)
//3-2.电能质量数据则还需要判断Cldid的值在dataSet里面筛选正确的数据集查询dataArray
//4.查询dataArray数据查询对应的字典数据然后将数据组装录入influxDB
DataArrayParam dataArrayParam = new DataArrayParam();
dataArrayParam.setId(appAutoDataMessage.getId());
@@ -142,9 +142,9 @@ public class StatServiceImpl implements IStatService {
}
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
map.put(0,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(2,item.getLineId());
}
}
@@ -210,7 +210,7 @@ public class StatServiceImpl implements IStatService {
fields.put(dataArrayList.get(i).getName(),floats.get(i));
fields.put(InfluxDBTableConstant.IS_ABNORMAL,item.getDataTag());
//fixme 这边前置传递的应该是UTC时间,但是前置说是传递的北京时间,讨论了一下没太理解。这边暂时先这样处理,influx入库处理成北京时间,减去8小时。
Point point = influxDbUtils.pointBuilder(tableName, item.getDataTimeSec()-8*3600, TimeUnit.SECONDS, tags, fields);
Point point = influxDbUtils.pointBuilder(tableName, item.getDataTimeSec(), TimeUnit.SECONDS, tags, fields);
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
batchPoints.point(point);
records.add(batchPoints.lineProtocol());

View File

@@ -148,9 +148,9 @@ public class CsWaveServiceImpl implements ICsWaveService {
}
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
map.put(0,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(2,item.getLineId());
}
}

View File

@@ -105,6 +105,7 @@ public class EventServiceImpl implements IEventService {
csEvent.setStartTime(timeFormat(item.getDataTimeSec(),item.getDataTimeUSec()));
csEvent.setTag(item.getName());
csEvent.setType(0);
csEvent.setClDid(appEventMessage.getMsg().getClDid());
list1.add(csEvent);
//参数入库
Map<String,String> map = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.ELE_EPD_PQD)), Map.class);
@@ -156,9 +157,9 @@ public class EventServiceImpl implements IEventService {
}
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
map.put(0,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
map.put(1,item.getLineId());
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
map.put(2,item.getLineId());
}
}