diff --git a/src/main/java/com/njcn/influx/service/CommonService.java b/src/main/java/com/njcn/influx/service/CommonService.java index 4a17065..97e5f52 100644 --- a/src/main/java/com/njcn/influx/service/CommonService.java +++ b/src/main/java/com/njcn/influx/service/CommonService.java @@ -33,7 +33,7 @@ public interface CommonService { List getDeviceRtData(List commonQueryParams); /** - + * 此方法和getDeviceRtDataByTime方法逻辑一致,只是允许部分查询参数为空,也即可以不带入查询 * @Description: getDeviceRtDataByTime * @return: java.util.List * @Author: clam @@ -41,6 +41,15 @@ public interface CommonService { */ List getDeviceRtDataByTime(List commonQueryParams); + /** + + * @Description: getNewDeviceRtDataByTime + * @return: java.util.List + * @Author: guofeihu + * @Date: 2024/8/27 + */ + List getNewDeviceRtDataByTime(List commonQueryParams); + /** * 根据条件获取监测点时间范围内的最大最小值 * diff --git a/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java b/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java index a2bb794..31f3fa5 100644 --- a/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java +++ b/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java @@ -80,6 +80,37 @@ public class CommonServiceImpl implements CommonService { return resultList; } + @Override + public List getNewDeviceRtDataByTime(List commonQueryParams) { + List 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 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);