From fced72a94fe058de0a37dc227cb40d261d23e298 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Wed, 21 Jun 2023 14:12:07 +0800 Subject: [PATCH] mark --- ym-gateway/src/main/resources/application.yml | 2 +- .../influx/controller/S7DemoController.java | 40 ++++++++++--------- .../graphAnalyzed/forCount/c/CGraph.java | 3 ++ .../graphAnalyzed/forCount/np/NPGraph.java | 3 ++ .../graphAnalyzed/forCount/p/PGraph.java | 3 ++ .../graphAnalyzed/forCount/u/UGraph.java | 3 ++ .../ms/MeanStandardDeviationGraph.java | 4 ++ .../forMeterage/xmr/XMRGraph.java | 3 ++ 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml index d4c978f..795bc1c 100644 --- a/ym-gateway/src/main/resources/application.yml +++ b/ym-gateway/src/main/resources/application.yml @@ -5,7 +5,7 @@ server: threads: max: 1000 min-spare: 30 - port: 8080 + port: 8999 servlet: context-path: /ym-spc session: diff --git a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java index d3eaa00..f339198 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java +++ b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java @@ -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 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 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 { diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/c/CGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/c/CGraph.java index 2ec47a9..4fa6d72 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/c/CGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/c/CGraph.java @@ -110,6 +110,9 @@ public class CGraph { queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); List query = InfluxClient.Client.queryGroupByTime(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 //计算p bar this.cbar = computeCbar(query); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java index 2390815..bac535a 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java @@ -104,6 +104,9 @@ public class NPGraph { queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); List query = InfluxClient.Client.queryGroupByTime(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 List originData = new ArrayList<>(); //计算p bar diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/p/PGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/p/PGraph.java index 2ba3a5d..e96883c 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/p/PGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/p/PGraph.java @@ -115,6 +115,9 @@ public class PGraph { queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); List query = InfluxClient.Client.queryGroupByTime(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 //计算p bar this.pbar = computePbar(query); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/u/UGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/u/UGraph.java index a7d8c4d..318000c 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/u/UGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/u/UGraph.java @@ -114,6 +114,9 @@ public class UGraph { queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); List query = InfluxClient.Client.queryGroupByTime(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 //计算p bar this.ubar = computeUbar(query); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/ms/MeanStandardDeviationGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/ms/MeanStandardDeviationGraph.java index 9070ac8..c440324 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/ms/MeanStandardDeviationGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/ms/MeanStandardDeviationGraph.java @@ -103,8 +103,12 @@ public class MeanStandardDeviationGraph { queryDataParam.setTags(Arrays.asList(new Tag("argName",argName))); List query = InfluxClient.Client.query(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 List originData = new ArrayList<>(); + for (FluxTable fluxTable : query) { List records = fluxTable.getRecords(); for (FluxRecord fluxRecord : records) { diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/xmr/XMRGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/xmr/XMRGraph.java index 4e0db93..1b0889e 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/xmr/XMRGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/xmr/XMRGraph.java @@ -100,6 +100,9 @@ public class XMRGraph { List query = InfluxClient.Client.query(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 List originData = new ArrayList<>(); for (FluxTable fluxTable : query) {