Conflicts:
	src/main/java/com/qgs/dc/influx/Main.java
	src/main/java/com/qgs/dc/influx/controller/InfluxDemoController.java
	src/main/java/com/qgs/dc/influx/template/Event.java
This commit is contained in:
于连琛 2022-10-18 09:18:49 +08:00
commit 89f6ccac9a
2 changed files with 16 additions and 11 deletions

View File

@ -21,7 +21,7 @@ public enum InfluxClient {
/** /**
* influxdb 读写客户端如果write比较繁忙后续可以考虑维护 client一个线程池 * influxdb 读写客户端如果write比较繁忙后续可以考虑维护 client一个线程池
* */ * */
Client("http://192.168.0.170:8086","lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw==","qgs","qgs-bucket"), Client("http://192.168.0.170:8086","lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw==","qgs","qgs-bucket2"),
; ;
private String url; private String url;
@ -88,6 +88,18 @@ public enum InfluxClient {
//异步 批量写入数据 //异步 批量写入数据
//如果要批量插入的话一次也只能写入 //如果要批量插入的话一次也只能写入
// public void batchInsert(List<Event> events, String measurement){
// List<Point> list = new ArrayList<>();
// for(Event event:events){
// Point point = Point.measurement(measurement)
// .addTag("transationId", event.getTransationId())
// .addTag("argName", event.getArgName())
// .addField("argValue", event.getArgValue())
// .time(event.getTime().toEpochMilli(), WritePrecision.MS);
// list.add(point);
// }
// writeApi.writePoints(list);
// }
public void batchInsert(List<Event> events, String measurement){ public void batchInsert(List<Event> events, String measurement){
List<Point> list = new ArrayList<>(); List<Point> list = new ArrayList<>();
for(Event event:events){ for(Event event:events){
@ -115,7 +127,6 @@ public enum InfluxClient {
writeApi.writePoints(list); writeApi.writePoints(list);
} }
public List<FluxTable> query(QueryDataParam param){ public List<FluxTable> query(QueryDataParam param){
String measurement = param.getMeasurement(); String measurement = param.getMeasurement();
List<String> dropedTagNames = param.getDropedTagNames(); List<String> dropedTagNames = param.getDropedTagNames();

View File

@ -5,7 +5,7 @@ import lombok.Data;
import java.time.Instant; import java.time.Instant;
/** /**
* @Desc: "常规计量值 - entity" * @Desc: ""
* @Author: caixiang * @Author: caixiang
* @DATE: 2022/6/25 11:13 * @DATE: 2022/6/25 11:13
*/ */
@ -14,15 +14,9 @@ public class Event {
private Instant time; private Instant time;
private String inspectionSheetId;
private String transationId; private String transationId;
private String argName; private String argName;
private Double argValue; private String argValue;
//批次号可选的
private Integer batchNum;
} }