This commit is contained in:
caixiang 2022-10-18 09:35:35 +08:00
parent 0dfff37b3d
commit 2cc12991b0
2 changed files with 24 additions and 7 deletions

View File

@ -76,12 +76,23 @@ public enum InfluxClient {
} }
public void insert(Event event, String measurement){ public void insert(Event event, String measurement){
Point point = Point.measurement(measurement) Point point = null;
.addTag("transationId", event.getTransationId()) if(event.getBatchNum()==null){
.addTag("inspectionSheetId", event.getInspectionSheetId()) point = Point.measurement(measurement)
.addTag("argName", event.getArgName()) .addTag("transationId", event.getTransationId())
.addField("argValue", event.getArgValue()) .addTag("inspectionSheetId", event.getInspectionSheetId())
.time(event.getTime().toEpochMilli(), WritePrecision.MS); .addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}else {
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
//.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("batchNum", event.getBatchNum().toString())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}
writeApi.writePoint(point); writeApi.writePoint(point);
} }
@ -114,7 +125,7 @@ public enum InfluxClient {
}else { }else {
point = Point.measurement(measurement) point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId()) .addTag("transationId", event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId()) //.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("batchNum", event.getBatchNum().toString()) .addTag("batchNum", event.getBatchNum().toString())
.addTag("argName", event.getArgName()) .addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue()) .addField("argValue", event.getArgValue())

View File

@ -19,4 +19,10 @@ public class Event {
private String argName; private String argName;
private String argValue; private String argValue;
private String BatchNum;
private String InspectionSheetId;
} }