This commit is contained in:
caixiang
2023-06-21 14:12:07 +08:00
parent e149150b1d
commit fced72a94f
8 changed files with 41 additions and 20 deletions

View File

@@ -29,6 +29,27 @@ public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
//for 常规计量型
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> 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("forbatch"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d.toString());
event.setInspectionSheetId(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
//for 常规计数型
@PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException {
@@ -148,26 +169,7 @@ public class S7DemoController {
}
//for 常规计量型
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> 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.toString());
event.setInspectionSheetId(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
//
// @PostMapping("/insertBatchJYD")
// public void insertBatchJYD() throws InterruptedException {