diff --git a/src/main/java/com/qgs/dc/influx/controller/InfluxController.java b/src/main/java/com/qgs/dc/influx/controller/InfluxController.java index d8dbaf0..9ca5863 100644 --- a/src/main/java/com/qgs/dc/influx/controller/InfluxController.java +++ b/src/main/java/com/qgs/dc/influx/controller/InfluxController.java @@ -33,98 +33,98 @@ public class InfluxController { private static final Logger logger = LoggerFactory.getLogger(InfluxController.class); - - - @PostMapping("/insertBatch") - public void insertBatch() throws InterruptedException { - List list = new ArrayList<>(); - Random r = new Random(); - - for(int i=0;i<999;i++){ - Thread.sleep(10); - Event event = new Event(); - event.setTime(Instant.now()); - event.setTransationId("asas"+i); - event.setArgName("LTWeight"); - Double d = r.nextDouble() * 2.5 + 66; - event.setArgValue(d); - - list.add(event); - } - InfluxClient.Client.batchInsert(list,"Weight"); - } - - @PostMapping("/forTestInsertBatch") - public void forTestInsertBatch() throws InterruptedException { - List list = new ArrayList<>(); - Random r = new Random(); - for(int i=0;i<99;i++){ - Thread.sleep(10); - Event event = new Event(); - event.setTime(Instant.now()); - event.setTransationId("forbatch"+i); - event.setArgName("LTWeight"); - Double d = r.nextDouble() * 2.5 + 66; - event.setArgValue(d); - event.setBatchNum(4); - event.setInspectionSheetId(i+""); - list.add(event); - } - InfluxClient.Client.batchInsert(list,"Weight"); - } - - - - - @PostMapping("/insertBatchJYD") - public void insertBatchJYD() throws InterruptedException { - List list = new ArrayList<>(); - Random r = new Random(); - Instant instant = DataUtils.getBeforeDate(400).toInstant(); - - for(int j=0;j<10;j++){ - for(int i=0;i<99;i++){ - Thread.sleep(10); - Event event = new Event(); - event.setTime(instant); - event.setTransationId("asas"+i); - event.setArgName("LTWeight"); - Double d = r.nextDouble() * 2.5 + 66; - event.setInspectionSheetId(j+""); - event.setArgValue(d); - event.setBatchNum(i); - list.add(event); - } - } - InfluxClient.Client.batchInsert(list,"WeightHei"); - } - - - - @PostMapping("/insertBatchJYDForTest") - public void insertBatchJYDForTest() throws InterruptedException { - List list = new ArrayList<>(); - Random r = new Random(); - - for(int i=0;i<999;i++){ - Thread.sleep(10); - Event event = new Event(); - event.setTime(DataUtils.getAfterDate(i).toInstant()); - event.setTransationId("asas"+i); - event.setArgName("LostDays"); - int i1 = r.nextInt(10); -// if(i1<4){ -// event.setArgValue(new Double(0)); -// }else { -// event.setArgValue(new Double(1)); +// +// +// @PostMapping("/insertBatch") +// public void insertBatch() throws InterruptedException { +// List list = new ArrayList<>(); +// Random r = new Random(); +// +// for(int i=0;i<999;i++){ +// Thread.sleep(10); +// Event event = new Event(); +// event.setTime(Instant.now()); +// event.setTransationId("asas"+i); +// event.setArgName("LTWeight"); +// Double d = r.nextDouble() * 2.5 + 66; +// event.setArgValue(d); +// +// list.add(event); +// } +// InfluxClient.Client.batchInsert(list,"Weight"); +// } +// +// @PostMapping("/forTestInsertBatch") +// public void forTestInsertBatch() throws InterruptedException { +// List list = new ArrayList<>(); +// Random r = new Random(); +// for(int i=0;i<99;i++){ +// Thread.sleep(10); +// Event event = new Event(); +// event.setTime(Instant.now()); +// event.setTransationId("forbatch"+i); +// event.setArgName("LTWeight"); +// Double d = r.nextDouble() * 2.5 + 66; +// event.setArgValue(d); +// event.setBatchNum(4); +// event.setInspectionSheetId(i+""); +// list.add(event); +// } +// InfluxClient.Client.batchInsert(list,"Weight"); +// } +// +// +// +// +// @PostMapping("/insertBatchJYD") +// public void insertBatchJYD() throws InterruptedException { +// List list = new ArrayList<>(); +// Random r = new Random(); +// Instant instant = DataUtils.getBeforeDate(400).toInstant(); +// +// for(int j=0;j<10;j++){ +// for(int i=0;i<99;i++){ +// Thread.sleep(10); +// Event event = new Event(); +// event.setTime(instant); +// event.setTransationId("asas"+i); +// event.setArgName("LTWeight"); +// Double d = r.nextDouble() * 2.5 + 66; +// event.setInspectionSheetId(j+""); +// event.setArgValue(d); +// event.setBatchNum(i); +// list.add(event); // } - event.setInspectionSheetId(i+""); - - event.setBatchNum(i); - list.add(event); - } - InfluxClient.Client.batchInsert(list,"WeightHeiHei"); - } +// } +// InfluxClient.Client.batchInsert(list,"WeightHei"); +// } +// +// +// +// @PostMapping("/insertBatchJYDForTest") +// public void insertBatchJYDForTest() throws InterruptedException { +// List list = new ArrayList<>(); +// Random r = new Random(); +// +// for(int i=0;i<999;i++){ +// Thread.sleep(10); +// Event event = new Event(); +// event.setTime(DataUtils.getAfterDate(i).toInstant()); +// event.setTransationId("asas"+i); +// event.setArgName("LostDays"); +// int i1 = r.nextInt(10); +//// if(i1<4){ +//// event.setArgValue(new Double(0)); +//// }else { +//// event.setArgValue(new Double(1)); +//// } +// event.setInspectionSheetId(i+""); +// +// event.setBatchNum(i); +// list.add(event); +// } +// InfluxClient.Client.batchInsert(list,"WeightHeiHei"); +// } /** * 测试连接是否正常 @@ -207,7 +207,7 @@ public class InfluxController { event.setTime(Instant.now()); event.setTransationId("asasd11"); event.setArgName("argName11"); - event.setArgValue(900001d); + event.setArgValue("900001"); Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent"); InfluxClient.Client.insert(event,"ASProcessCompleteEvent"); }