mark
Этот коммит содержится в:
родитель
bf67380718
Коммит
53f0c58507
@ -84,7 +84,7 @@ public enum InfluxClient {
|
||||
public void insert(Event event, String measurement){
|
||||
|
||||
Point point = null;
|
||||
if(event.getBatchNum()==null){
|
||||
if(event.getSampleNumber()==null){
|
||||
point = Point.measurement(measurement)
|
||||
.addTag("transationId", event.getTransationId())
|
||||
.addTag("argName", event.getArgName())
|
||||
@ -96,7 +96,6 @@ public enum InfluxClient {
|
||||
|
||||
.addTag("inspectionSheetId", event.getInspectionSheetId())
|
||||
.addTag("sampleNumber", event.getSampleNumber())
|
||||
.addTag("batchNum", event.getBatchNum())
|
||||
|
||||
.addTag("argName", event.getArgName())
|
||||
.addField("argValue", event.getArgValue())
|
||||
@ -128,7 +127,7 @@ public enum InfluxClient {
|
||||
|
||||
// .addTag("batchNum", event.getBatchNum())
|
||||
.addTag("sampleNumber", event.getSampleNumber())
|
||||
.addField("batchNum", event.getBatchNum())
|
||||
//.addField("batchNum", event.getBatchNum())
|
||||
|
||||
.addTag("argName", event.getArgName())
|
||||
.addField("argValue", event.getArgValue())
|
||||
|
@ -52,7 +52,7 @@ public class Main {
|
||||
|
||||
event.setTime(new Date().toInstant());
|
||||
event.setTransationId("2344");
|
||||
event.setBatchNum("22");
|
||||
|
||||
event.setArgName("forUpdate");
|
||||
event.setArgValue("124.1");
|
||||
InfluxClient.Client.insert(event,"FORUPDATE");
|
||||
|
@ -2,6 +2,7 @@ package com.cnbm.influx.controller;
|
||||
|
||||
import com.cnbm.common.spc.util.DataUtils;
|
||||
import com.cnbm.influx.config.InfluxClient;
|
||||
import com.cnbm.influx.constant.Constant;
|
||||
import com.cnbm.influx.param.PageInfo;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.param.Range;
|
||||
@ -61,22 +62,41 @@ public class S7DemoController {
|
||||
Instant time = new Date().toInstant();
|
||||
Event event = new Event();
|
||||
event.setTime(time);
|
||||
event.setBatchNum("1");
|
||||
|
||||
event.setArgName("failDayDay");
|
||||
event.setArgValue("1");
|
||||
event.setSampleNumber("10001");
|
||||
list.add(event);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
Event event2 = new Event();
|
||||
event2.setTime(time);
|
||||
event.setBatchNum("2");
|
||||
|
||||
event2.setArgName("failDayDay");
|
||||
event2.setArgValue("2");
|
||||
event2.setSampleNumber("10001");
|
||||
list.add(event2);
|
||||
|
||||
InfluxClient.Client.batchInsert(list,"Weight");
|
||||
}
|
||||
@PostMapping("/readDemoOne")
|
||||
public void readDemoOne() throws InterruptedException {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
|
||||
QueryDataParam queryDataParam = new QueryDataParam();
|
||||
queryDataParam.setMeasurement(Constant.measurement);
|
||||
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
|
||||
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName","failDayDay"));
|
||||
queryDataParam.setBucket(Constant.bucket);
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
//for 常规计数型
|
||||
@ -93,7 +113,7 @@ public class S7DemoController {
|
||||
event.setArgName("LTWeight");
|
||||
Double d = r.nextDouble() * 2.5 + 66;
|
||||
event.setArgValue(d.toString());
|
||||
event.setBatchNum(4+"");
|
||||
|
||||
event.setInspectionSheetId(i+"");
|
||||
list.add(event);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ public class Event {
|
||||
|
||||
private String argValue;
|
||||
|
||||
//batchNumber(必填), 作为区分 手动录入 和 自动录入的区别
|
||||
private String batchNum;
|
||||
//batchNum 舍弃了,influxdb中不存批次号,存在mysql - inspection_sheet表 中批次号字段
|
||||
//private String batchNum;
|
||||
|
||||
private String inspectionSheetId;
|
||||
|
||||
@ -32,7 +32,7 @@ public class Event {
|
||||
|
||||
public Event() {
|
||||
//自动录入,给个默认值
|
||||
this.batchNum = "-1";
|
||||
// this.batchNum = "-1";
|
||||
this.inspectionSheetId = "-1";
|
||||
this.sampleNumber = "-1";
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user