influxdb数据查询调整
This commit is contained in:
@@ -4,6 +4,7 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.*;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
@@ -117,7 +118,9 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
String targetName = dataArray.getAnotherName();
|
||||
String dataId = dataArray.getDataId();
|
||||
String classId = epdFeignClient.selectById(dataId).getData().getClassId();
|
||||
result.add(getLineRtData(item.getId(),item.getLineId().get(3),classId,targetTag,phasic,dataType,targetName));
|
||||
String tableName = dicDataFeignClient.getDicDataById(classId).getData().getCode();
|
||||
String clDid = getClDid(item.getLineId().get(3));
|
||||
result.add(getLineRtData(item.getId(),item.getLineId().get(3),tableName,targetTag,phasic,dataType,targetName,clDid));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
@@ -135,6 +138,26 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
return gson.fromJson(text, new TypeToken<ZuTaiDTO>(){}.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cldid
|
||||
*/
|
||||
public String getClDid(String line) {
|
||||
String position = csLineFeignClient.getPositionById(line).getData();
|
||||
if (Objects.isNull(position)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.POSITION_ERROR);
|
||||
}
|
||||
String clDid = null;
|
||||
String areaCode = dicDataFeignClient.getDicDataById(position).getData().getCode();
|
||||
if (Objects.equals(areaCode, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||
clDid = "0";
|
||||
} else if (Objects.equals(areaCode, DicDataEnum.LOAD_SIDE.getCode())){
|
||||
clDid = "1";
|
||||
} else if (Objects.equals(areaCode, DicDataEnum.GRID_SIDE.getCode())){
|
||||
clDid = "2";
|
||||
}
|
||||
return clDid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orm框架获取数据
|
||||
* @param id 图元Id
|
||||
@@ -144,11 +167,12 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
* @param phasic 相别
|
||||
* @param dataType 数据类型
|
||||
* @param target 数据名称
|
||||
* @param cldId 逻辑子设备标识
|
||||
* @return
|
||||
*/
|
||||
public CsRtDataVO getLineRtData(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target) {
|
||||
public CsRtDataVO getLineRtData(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target, String cldId) {
|
||||
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType);
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType,cldId);
|
||||
if(Objects.isNull(statisticalDataDTO)){
|
||||
statisticalDataDTO = new StatisticalDataDTO();
|
||||
statisticalDataDTO.setLineId(lineId);
|
||||
|
||||
Reference in New Issue
Block a user