mark for pull
This commit is contained in:
parent
183dcf7d48
commit
f00b1fe530
@ -80,20 +80,28 @@ public enum InfluxClient {
|
|||||||
return isConnected;
|
return isConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc: 异步批量 写入数据/更新数据
|
||||||
|
* notes: 如果是更新数据,要保证time字段不能改变
|
||||||
|
* auth: caixaing
|
||||||
|
* */
|
||||||
public void insert(Event event, String measurement){
|
public void insert(Event event, String measurement){
|
||||||
|
|
||||||
Point point = null;
|
Point point = null;
|
||||||
if(event.getBatchNum()==null){
|
if(event.getBatchNum()==null){
|
||||||
point = Point.measurement(measurement)
|
point = Point.measurement(measurement)
|
||||||
.addTag("transationId", event.getTransationId())
|
.addTag("transationId", event.getTransationId())
|
||||||
.addTag("inspectionSheetId", event.getInspectionSheetId())
|
|
||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
}else {
|
}else {
|
||||||
point = Point.measurement(measurement)
|
point = Point.measurement(measurement)
|
||||||
.addTag("transationId", event.getTransationId())
|
.addTag("transationId", event.getTransationId())
|
||||||
//.addTag("inspectionSheetId", event.getInspectionSheetId())
|
|
||||||
.addTag("batchNum", event.getBatchNum().toString())
|
.addTag("inspectionSheetId", event.getInspectionSheetId())
|
||||||
|
.addTag("sampleNumber", event.getSampleNumber())
|
||||||
|
.addTag("batchNum", event.getBatchNum())
|
||||||
|
|
||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
@ -102,20 +110,11 @@ public enum InfluxClient {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//异步 批量写入数据
|
/**
|
||||||
//如果要批量插入的话,一次也只能写入
|
* desc: 异步批量 写入数据/更新数据
|
||||||
// public void batchInsert(List<Event> events, String measurement){
|
* notes: 如果是更新数据,要保证time字段不能改变
|
||||||
// List<Point> list = new ArrayList<>();
|
* auth: caixaing
|
||||||
// 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){
|
||||||
@ -123,15 +122,17 @@ public enum InfluxClient {
|
|||||||
if(event.getBatchNum()==null){
|
if(event.getBatchNum()==null){
|
||||||
point = Point.measurement(measurement)
|
point = Point.measurement(measurement)
|
||||||
.addTag("transationId", event.getTransationId())
|
.addTag("transationId", event.getTransationId())
|
||||||
.addTag("inspectionSheetId", event.getInspectionSheetId())
|
|
||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
}else {
|
}else {
|
||||||
point = Point.measurement(measurement)
|
point = Point.measurement(measurement)
|
||||||
.addTag("transationId", event.getTransationId())
|
.addTag("transationId", event.getTransationId())
|
||||||
//.addTag("inspectionSheetId", event.getInspectionSheetId())
|
|
||||||
.addTag("batchNum", event.getBatchNum().toString())
|
.addTag("inspectionSheetId", event.getInspectionSheetId())
|
||||||
|
.addTag("sampleNumber", event.getSampleNumber())
|
||||||
|
.addTag("batchNum", event.getBatchNum())
|
||||||
|
|
||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
|
@ -20,9 +20,19 @@ public class Event {
|
|||||||
|
|
||||||
private String argValue;
|
private String argValue;
|
||||||
|
|
||||||
private String BatchNum;
|
//batchNumber(必填), 作为区分 手动录入 和 自动录入的区别
|
||||||
|
private String batchNum;
|
||||||
|
|
||||||
private String InspectionSheetId;
|
private String inspectionSheetId;
|
||||||
|
|
||||||
|
private String sampleNumber;
|
||||||
|
|
||||||
|
public Event() {
|
||||||
|
//自动录入,给个默认值
|
||||||
|
this.batchNum = "-1";
|
||||||
|
this.inspectionSheetId = "-1";
|
||||||
|
this.sampleNumber = "-1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user