CommonService新增getNewDeviceRtDataByTime方法

This commit is contained in:
guofeihu
2024-08-27 14:49:22 +08:00
parent 41758c929a
commit d99292fad1
2 changed files with 41 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ public interface CommonService {
List<StatisticalDataDTO> getDeviceRtData(List<CommonQueryParam> commonQueryParams);
/**
* 此方法和getDeviceRtDataByTime方法逻辑一致,只是允许部分查询参数为空,也即可以不带入查询
* @Description: getDeviceRtDataByTime
* @return: java.util.List<com.njcn.influx.pojo.dto.StatisticalDataDTO>
* @Author: clam
@@ -41,6 +41,15 @@ public interface CommonService {
*/
List<StatisticalDataDTO> getDeviceRtDataByTime(List<CommonQueryParam> commonQueryParams);
/**
* @Description: getNewDeviceRtDataByTime
* @return: java.util.List<com.njcn.influx.pojo.dto.StatisticalDataDTO>
* @Author: guofeihu
* @Date: 2024/8/27
*/
List<StatisticalDataDTO> getNewDeviceRtDataByTime(List<CommonQueryParam> commonQueryParams);
/**
* 根据条件获取监测点时间范围内的最大最小值
*

View File

@@ -80,6 +80,37 @@ public class CommonServiceImpl implements CommonService {
return resultList;
}
@Override
public List<StatisticalDataDTO> getNewDeviceRtDataByTime(List<CommonQueryParam> commonQueryParams) {
List<StatisticalDataDTO> resultList = new ArrayList<>();
for (CommonQueryParam commonQueryParam: commonQueryParams) {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(commonQueryParam.getTableName(), StatisticalDataDTO.class);
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
.select(StatisticalDataDTO::getPhaseType)
.select(StatisticalDataDTO::getValueType)
.select(commonQueryParam.getColumnName(), InfluxDBTableConstant.VALUE)
.eq(InfluxDBTableConstant.LINE_ID, commonQueryParam.getLineId())
.between(InfluxDBTableConstant.TIME, commonQueryParam.getStartTime(), commonQueryParam.getEndTime());
//此方法和getDeviceRtDataByTime方法逻辑一致,只是在以下条件判断中允许部分查询参数为空,也即可以不带入查询
if(commonQueryParam.getPhasic() != null) {
influxQueryWrapper.eq(InfluxDBTableConstant.PHASIC_TYPE, commonQueryParam.getPhasic());
}
if(commonQueryParam.getProcess() != null) {
influxQueryWrapper.eq(InfluxDBTableConstant.PROCESS, commonQueryParam.getProcess());
}
if(commonQueryParam.getDataType() != null) {
influxQueryWrapper.eq(InfluxDBTableConstant.VALUE_TYPE, commonQueryParam.getDataType());
}
if(commonQueryParam.getClDid() != null) {
influxQueryWrapper.eq(InfluxDBTableConstant.CL_DID, commonQueryParam.getClDid());
}
List<StatisticalDataDTO> deviceRtData = commonMapper.getDeviceRtDataByTime(influxQueryWrapper);
resultList.addAll(deviceRtData);
}
return resultList;
}
@Override
public StatisticalDataDTO getLineHistoryData(String lineId, String tableName, String columnName, String startTime, String endTime, String clDid) {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);