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

@ -5,7 +5,7 @@ server:
threads: threads:
max: 1000 max: 1000
min-spare: 30 min-spare: 30
port: 8080 port: 8999
servlet: servlet:
context-path: /ym-spc context-path: /ym-spc
session: session:

View File

@ -29,6 +29,27 @@ public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class); 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 常规计数型 //for 常规计数型
@PostMapping("/insertDemoDataForCount") @PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException { 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") // @PostMapping("/insertBatchJYD")
// public void insertBatchJYD() throws InterruptedException { // public void insertBatchJYD() throws InterruptedException {

View File

@ -110,6 +110,9 @@ public class CGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam); List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
//计算p bar //计算p bar
this.cbar = computeCbar(query); this.cbar = computeCbar(query);

View File

@ -104,6 +104,9 @@ public class NPGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam); List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>(); List<Double> originData = new ArrayList<>();
//计算p bar //计算p bar

View File

@ -115,6 +115,9 @@ public class PGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam); List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
//计算p bar //计算p bar
this.pbar = computePbar(query); this.pbar = computePbar(query);

View File

@ -114,6 +114,9 @@ public class UGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam); List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
//计算p bar //计算p bar
this.ubar = computeUbar(query); this.ubar = computeUbar(query);

View File

@ -103,8 +103,12 @@ public class MeanStandardDeviationGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam); List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>(); List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) { for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords(); List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) { for (FluxRecord fluxRecord : records) {

View File

@ -100,6 +100,9 @@ public class XMRGraph {
List<FluxTable> query = InfluxClient.Client.query(queryDataParam); List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>(); List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) { for (FluxTable fluxTable : query) {