Commit b07390e9 authored by tangwei's avatar tangwei

去除influx

parent 36316fe9
......@@ -22,7 +22,7 @@
station_id = #{stationId}
</if>
</where>
order by sort desc limit #{current},#{size}
order by event_time desc
</select>
......
......@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -55,25 +54,25 @@ public class DeviceController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取历史告警数据")
@GetMapping("/historyNationwide")
public ResponseModel<ResultsData> getLSNationWideInfo(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size,@RequestParam(value = "stationBasicId") String stationBasicId,@RequestParam(value = "equipmentNumber" , required = false ) String equipmentNumber) {
ResultsData resultsData=monitorFanIndicatorImpl.getLsNationWideInfo( current, size, stationBasicId, equipmentNumber);
return ResponseHelper.buildResponse(resultsData);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "获取历史告警数据")
// @GetMapping("/historyNationwide")
// public ResponseModel<ResultsData> getLSNationWideInfo(@RequestParam(value = "current") int current,@RequestParam
// (value = "size") int size,@RequestParam(value = "stationBasicId") String stationBasicId,@RequestParam(value = "equipmentNumber" , required = false ) String equipmentNumber) {
// ResultsData resultsData=monitorFanIndicatorImpl.getLsNationWideInfo( current, size, stationBasicId, equipmentNumber);
// return ResponseHelper.buildResponse(resultsData);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘大屏 - 获取历史告警数据")
@GetMapping("/historyNationwideByPage")
public ResponseModel<Page<IndexDto>> historyNationwideByPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationBasicId") String stationBasicId) {
Page<IndexDto> resultsData = monitorFanIndicatorImpl.historyNationwideByPage( current, size, stationBasicId);
return ResponseHelper.buildResponse(resultsData);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "监盘大屏 - 获取历史告警数据")
// @GetMapping("/historyNationwideByPage")
// public ResponseModel<Page<IndexDto>> historyNationwideByPage(@RequestParam(value = "current") int current,
// @RequestParam(value = "size") int size,
// @RequestParam(value = "stationBasicId") String stationBasicId) {
// Page<IndexDto> resultsData = monitorFanIndicatorImpl.historyNationwideByPage( current, size, stationBasicId);
// return ResponseHelper.buildResponse(resultsData);
// }
......
......@@ -11,8 +11,8 @@ public interface AlarmEventMapper extends BaseMapper<AlarmEvent> {
String getLastDataBySort(String gatewayId);
List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId,int current, int size);
List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId);
List<String> getOldAlarmsBySort(String gatewayId, String sort);
......
......@@ -16,8 +16,8 @@ public interface IMonitorFanIndicator {
//批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list);
ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
Map<String, Object> partofWaring3D(String stationId, String equipNum);
// ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
// ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
//
// Map<String, Object> partofWaring3D(String stationId, String equipNum);
}
......@@ -16,8 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.initdata.StationCacheDataInit;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
......@@ -51,11 +50,11 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class CommonServiceImpl {
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
InfluxdbUtil influxdbUtil;
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
......@@ -96,13 +95,13 @@ public class CommonServiceImpl {
return Double.valueOf(String.format("%.2f", totalvalue));
}
public Double getNumByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_"+gatewayId+" where equipmentIndexName=~/"+indicator+"$/";
Double totalvalue = 0.0;
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",totalvalue));
}
// public Double getNumByIndicatior(String gatewayId,String indicator){
// String sql = "SELECT * FROM indicators_"+gatewayId+" where equipmentIndexName=~/"+indicator+"$/";
// Double totalvalue = 0.0;
// List<Map<String,Object>> mapList = influxdbUtil.query(sql);
// totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
// return Double.valueOf(String.format("%.2f",totalvalue));
// }
/**
* @deprecated 获取指标值平均值
......@@ -110,17 +109,17 @@ public class CommonServiceImpl {
* @param indicator 指标名称 查询条件-根据指标名称获取风速
* @return 指标值总和
*/
public Double getAvgvalueByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
Double avageValue = 0.00;
try {
List<Map<String, Object>> mapList = influxdbUtil.query(sql);
avageValue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).average().getAsDouble();
} catch (Exception e) {
return avageValue;
}
return Double.valueOf(String.format("%.2f", avageValue));
}
// public Double getAvgvalueByIndicatior(String gatewayId,String indicator){
// String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
// Double avageValue = 0.00;
// try {
// List<Map<String, Object>> mapList = influxdbUtil.query(sql);
// avageValue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).average().getAsDouble();
// } catch (Exception e) {
// return avageValue;
// }
// return Double.valueOf(String.format("%.2f", avageValue));
// }
public Double getTotalByIndicatior(List<Map<String,Object>> mapList,String indicator){
Double totalvalue = 0.0;
totalvalue =mapList.stream().filter(stringObjectMap ->stringObjectMap.get("equipmentIndexName").toString().contains(indicator)&&!ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
......@@ -136,6 +135,8 @@ public class CommonServiceImpl {
avageValue =mapList.stream().filter(stringObjectMap ->stringObjectMap.get("equipmentIndexName").toString().contains(indicator)&&!ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",avageValue));
}
public Double getStationCapactityByStationWerks(String WERKS){
return sjglZsjZsbtzMapper.getStationCapactityByStationWerks(WERKS);
}
......@@ -233,7 +234,48 @@ public class CommonServiceImpl {
return stationCacheInfoDtos;
}
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @param likeMap 模糊字段查询 key:不能带.keyWords
* @return
*/
public <T> List<T> getListDataByCondtionsAndLike(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass, Map<String, String> likeMap) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
if (!ObjectUtils.isEmpty(likeMap)) {
for (String key : likeMap.keySet()) {
MatchPhraseQueryBuilder queryBuilder1 = QueryBuilders.matchPhraseQuery(key, "*" + likeMap.get(key) + "*");
queryBuilder.must(queryBuilder1);
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return new ArrayList<>();
}
/*
*分组求和
......
......@@ -12,7 +12,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESDailyPowerGenerationR
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESMoonPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESYearPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
......@@ -32,8 +31,8 @@ import java.util.List;
@Service
public class PowerGenerationImpl {
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
......@@ -45,28 +44,28 @@ public class PowerGenerationImpl {
@Autowired(required=true)
IndicatorDataMapper indicatorDataMapper;
//获取指定指标,当天最后一条数据
public List<IndexDto> getlast(String gatewayId, String value,String daty){
IndexDto indexDto=null;
String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
return queryList;
}
public List<IndexDto> getlastgf(String gatewayId, String value,String daty){
IndexDto indexDto=null;
String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
queryList.forEach(item -> {
item.setValue(String.valueOf(Double.parseDouble(item.getValue()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
item.setValueLabel(String.valueOf(Double.parseDouble(item.getValueLabel()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
});
return queryList;
}
// //获取指定指标,当天最后一条数据
// public List<IndexDto> getlast(String gatewayId, String value,String daty){
// IndexDto indexDto=null;
//
// String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
//
// querySql = String.format(querySql, gatewayId, value,daty,daty);
// List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
// return queryList;
// }
// public List<IndexDto> getlastgf(String gatewayId, String value,String daty){
// IndexDto indexDto=null;
// String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
//
// querySql = String.format(querySql, gatewayId, value,daty,daty);
// List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
// queryList.forEach(item -> {
// item.setValue(String.valueOf(Double.parseDouble(item.getValue()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
// item.setValueLabel(String.valueOf(Double.parseDouble(item.getValueLabel()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
// });
// return queryList;
// }
//更新es 数据
//@Async("jxiopAsyncExecutor")
......
......@@ -4,13 +4,8 @@ import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -39,8 +34,8 @@ public class StationDataTaskImpl {
@Value("${station.isok}")
private boolean isok;
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
MonitorFanIndicatorAsync monitorFanIndicatorAsync;
......@@ -78,27 +73,27 @@ public class StationDataTaskImpl {
}
// @Async("jxiopAsyncExecutor")
public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
//每个分机的指标数据
List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
if(list!=null&&list.size()>0){
//对数据切片处理 默认创建
if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{
//进行分片处理
List<List<IndexDto>> listfp4= Lists.partition(list,stationSection);
for (List<IndexDto> indexDtos : listfp4) {
//每个分级信息处理
monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos);
}
}
}
return list;
}
// public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
// String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
// //每个分机的指标数据
// List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
// if(list!=null&&list.size()>0){
// //对数据切片处理 默认创建
// if(stationSection>list.size()||!isok){
// monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
// }else{
// //进行分片处理
//
// List<List<IndexDto>> listfp4= Lists.partition(list,stationSection);
// for (List<IndexDto> indexDtos : listfp4) {
// //每个分级信息处理
// monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos);
// }
// }
// }
//
// return list;
// }
......
......@@ -27,17 +27,17 @@ public class StationDataTask {
//定时获取场站指标最新数据
// @Scheduled(cron = "${station.task.cron}")
public void getStationDataTask(){
//获取所有场站信息
List<StationTaksDto> list=stationDataTask.getListStationBasic();
for (StationTaksDto stationTaksDto : list) {
//获取分机
List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
if(listDeviceDto!=null&&listDeviceDto.size()>0){
for (DeviceDto deviceDto : listDeviceDto) {
List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
}
}
}
}
// public void getStationDataTask(){
// //获取所有场站信息
// List<StationTaksDto> list=stationDataTask.getListStationBasic();
// for (StationTaksDto stationTaksDto : list) {
// //获取分机
// List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
// if(listDeviceDto!=null&&listDeviceDto.size()>0){
// for (DeviceDto deviceDto : listDeviceDto) {
// List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
// }
// }
// }
// }
}
package com.yeejoin.amos.boot.module.jxiop.biz.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.squareup.moshi.Json;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class InfluxDButils {
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
InfluxdbUtil influxdbUtil;
public <T> List<T> getListData(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
QueryResult query = influxDbConnection.query(sql);
List<QueryResult.Result> queryResults = query.getResults();
for (QueryResult.Result result : queryResults) {
List<QueryResult.Series> series = result.getSeries();
if (series == null) {
continue;
}
for (QueryResult.Series serie : series) {
List<List<Object>> values = serie.getValues();
List<String> columns = serie.getColumns();
for (int i = 0; i < values.size(); ++i) {
T object = clazz.newInstance();
BeanWrapperImpl bean = new BeanWrapperImpl(object);
for (int j = 0; j < columns.size(); ++j) {
String k = columns.get(j);
Object v = values.get(i).get(j);
if ("time".equals(k)) {
continue;
} else {
bean.setPropertyValue(k, v);
}
}
list.add(object);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public <T> List<T> getListData1(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
list=mapList.stream().map(stringObjectMap -> JSONObject.parseObject(JSON.toJSONString(stringObjectMap),clazz)).collect(Collectors.toList());
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public <T> List<T> getListDataAll(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
QueryResult query = influxDbConnection.query(sql);
List<QueryResult.Result> queryResults = query.getResults();
for (QueryResult.Result result : queryResults) {
List<QueryResult.Series> series = result.getSeries();
if (series == null) {
continue;
}
for (QueryResult.Series serie : series) {
List<List<Object>> values = serie.getValues();
List<String> columns = serie.getColumns();
for (int i = 0; i < values.size(); ++i) {
T object = clazz.newInstance();
BeanWrapperImpl bean = new BeanWrapperImpl(object);
for (int j = 0; j < columns.size(); ++j) {
String k = columns.get(j);
Object v = values.get(i).get(j);
bean.setPropertyValue(k, v);
}
list.add(object);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
}
//package com.yeejoin.amos.boot.module.jxiop.biz.utils;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.squareup.moshi.Json;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
//import org.influxdb.dto.QueryResult;
//import org.springframework.beans.BeanWrapperImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Component
//public class InfluxDButils {
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// InfluxdbUtil influxdbUtil;
// public <T> List<T> getListData(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// QueryResult query = influxDbConnection.query(sql);
// List<QueryResult.Result> queryResults = query.getResults();
// for (QueryResult.Result result : queryResults) {
// List<QueryResult.Series> series = result.getSeries();
// if (series == null) {
// continue;
// }
// for (QueryResult.Series serie : series) {
// List<List<Object>> values = serie.getValues();
// List<String> columns = serie.getColumns();
// for (int i = 0; i < values.size(); ++i) {
// T object = clazz.newInstance();
// BeanWrapperImpl bean = new BeanWrapperImpl(object);
// for (int j = 0; j < columns.size(); ++j) {
// String k = columns.get(j);
// Object v = values.get(i).get(j);
// if ("time".equals(k)) {
// continue;
// } else {
// bean.setPropertyValue(k, v);
// }
// }
// list.add(object);
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//
// public <T> List<T> getListData1(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// List<Map<String,Object>> mapList = influxdbUtil.query(sql);
// list=mapList.stream().map(stringObjectMap -> JSONObject.parseObject(JSON.toJSONString(stringObjectMap),clazz)).collect(Collectors.toList());
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//
// public <T> List<T> getListDataAll(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// QueryResult query = influxDbConnection.query(sql);
// List<QueryResult.Result> queryResults = query.getResults();
// for (QueryResult.Result result : queryResults) {
// List<QueryResult.Series> series = result.getSeries();
// if (series == null) {
// continue;
// }
// for (QueryResult.Series serie : series) {
// List<List<Object>> values = serie.getValues();
// List<String> columns = serie.getColumns();
// for (int i = 0; i < values.size(); ++i) {
// T object = clazz.newInstance();
// BeanWrapperImpl bean = new BeanWrapperImpl(object);
// for (int j = 0; j < columns.size(); ++j) {
// String k = columns.get(j);
// Object v = values.get(i).get(j);
//
// bean.setPropertyValue(k, v);
//
// }
// list.add(object);
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//}
......@@ -91,14 +91,14 @@ emqx.max-inflight=1000
#spring.influx.bufferLimit=20000
spring.influx.url=http://139.9.173.44:18086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=iot_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
#spring.influx.url=http://139.9.173.44:18086
#spring.influx.password=Yeejoin@2020
#spring.influx.user=root
#spring.influx.database=iot_platform
#spring.influx.retention_policy=default
#spring.influx.retention_policy_time=30d
#spring.influx.actions=10000
#spring.influx.bufferLimit=20000
knife4j.production=false
knife4j.enable=true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment