1.电能质量代码调整
2.微服务-监测点数据完整性调用中心任务 3.分布式光伏部分接口移植
This commit is contained in:
56
pqs-job/job-executor/src/test/java/Test1.java
Normal file
56
pqs-job/job-executor/src/test/java/Test1.java
Normal file
@@ -0,0 +1,56 @@
|
||||
import com.njcn.executor.pojo.vo.DataFlicker;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.influxdb.querybuilder.SelectQueryImpl;
|
||||
import org.influxdb.querybuilder.WhereNested;
|
||||
import org.influxdb.querybuilder.WhereQueryImpl;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/7/4 19:04
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Test1.class)
|
||||
public class Test1 {
|
||||
|
||||
@Test
|
||||
public void testMethod(){
|
||||
InfluxDbUtils influxDBUtil = new InfluxDbUtils("admin", "njcnpqs", "http://192.168.1.18:8086", "pqsbase", "");
|
||||
SelectQueryImpl selectQuery = select().from("pqsbase","data_flicker").where(eq("fluc",0)).limit(1).tz("Asia/Shanghai");
|
||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||
QueryResult queryResult = influxDBUtil.query(selectQuery.getCommand());
|
||||
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
|
||||
List<DataFlicker> list = resultMapper.toPOJO(queryResult, DataFlicker.class);
|
||||
System.out.println("list===:" + list);
|
||||
}
|
||||
|
||||
private List<Clause> getClauses() {
|
||||
Clause c1 = eq("line_id", "5e467a40023b299070682eb21f2ec9a1");
|
||||
Clause c2 = eq("line_id", "183245996f303ebfd80eeb3377cecdc2");
|
||||
Clause c3 = eq("line_id", "0d46f54420246e999d5c68b3133f668c");
|
||||
return Arrays.asList(c1, c2, c3);
|
||||
}
|
||||
|
||||
private void whereAndNested(List<Clause> clauses, WhereQueryImpl<SelectQueryImpl> whereQuery) {
|
||||
WhereNested<WhereQueryImpl<SelectQueryImpl>> andNested = whereQuery.andNested();
|
||||
for (Clause clause : clauses) {
|
||||
andNested.or(clause);
|
||||
}
|
||||
andNested.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user