将终端台账拆分为pq&pms两类
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import feign.Util;
|
||||
import org.influxdb.InfluxDB.ConsistencyLevel;
|
||||
import org.influxdb.dto.BatchPoints;
|
||||
import org.influxdb.dto.Point;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -59,19 +63,27 @@ public class DataTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
InfluxDbUtils influxDBUtil = new InfluxDbUtils("admin", "123456", "http://192.168.1.18:8086", "pqsbase", "");
|
||||
insert(influxDBUtil);
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
long time = Long.parseLong("1657959227000");
|
||||
tags.put("line_id","656da093bdb523b6ac619067a4045624");
|
||||
Map<String, Object> fields = new HashMap<>();
|
||||
fields.put("statis_value",1024000000.00);
|
||||
influxDBUtil.insert("cld_month_flow", tags, fields, time, TimeUnit.MILLISECONDS);
|
||||
InfluxDbUtils influxDBUtil = new InfluxDbUtils("admin", "njcnpqs", "http://192.168.1.18:8086", "PQSBASE", "");
|
||||
String sql = "select * from pqs_eventdetail limit 10";
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDBUtil.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
String bodyStr = PubUtils.obj2json(eventDetailList.get(0));
|
||||
//对结果进行转换
|
||||
EventDetail o = PubUtils.json2obj(bodyStr, EventDetail.class);
|
||||
Instant timeId = o.getTimeId();
|
||||
System.out.println(timeId);
|
||||
|
||||
|
||||
System.out.println(1);
|
||||
//select(influxDBUtil);
|
||||
}
|
||||
|
||||
public static void deleteDB(InfluxDbUtils influxDBUtil) {
|
||||
influxDBUtil.deleteDB("LIMIT_RATE");
|
||||
}
|
||||
|
||||
//单条数据插入
|
||||
public static void insert(InfluxDbUtils influxDBUtil) {
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
@@ -80,8 +92,8 @@ public class DataTest {
|
||||
Map<String, Object> fields = new HashMap<>();
|
||||
// fields.put("due",1440);
|
||||
// fields.put("real",1200);
|
||||
fields.put("onlinemin",1123);
|
||||
fields.put("offlinemin",377);
|
||||
fields.put("onlinemin", 1123);
|
||||
fields.put("offlinemin", 377);
|
||||
influxDBUtil.insert("pqs_onlinerate", tags, fields, time, TimeUnit.MILLISECONDS);
|
||||
// long time = Long.parseLong("1655135328135");
|
||||
// Map<String, String> tags = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user