gaodd 2 years ago
parent
commit
8638bfb78c

+ 5 - 1
src/main/java/com/szls/nstths/controller/DataController.java

@@ -2,6 +2,9 @@ package com.szls.nstths.controller;
2 2
 
3 3
 import com.szls.nstths.entity.TeData;
4 4
 import com.szls.nstths.service.TeDataService;
5
+
6
+import java.util.Date;
7
+
5 8
 import org.slf4j.Logger;
6 9
 import org.slf4j.LoggerFactory;
7 10
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +31,8 @@ public class DataController {
28 31
      */
29 32
     @PostMapping("/equipmentTestingEnd")
30 33
     public String equipmentTesting(@RequestBody TeData teData) {
31
-        logger.info("{}", teData);
34
+        logger.info("接收到的数据为{}", teData);
35
+        teData.setEtime(new Date());
32 36
         int inum = teDataService.saveTeData(teData);
33 37
         if (inum < 0) {
34 38
             return "fail";

+ 7 - 7
src/main/java/com/szls/nstths/service/impl/TeDataServiceImpl.java

@@ -28,8 +28,8 @@ public class TeDataServiceImpl implements TeDataService {
28 28
 
29 29
     static String base_url = "http://192.168.0.61:4017/";
30 30
     static boolean flag = true;
31
-    static double diameter = 8; //直径
32
-    static double high = 12; //圆筒仓的高(以地面为基准面)
31
+    static double diameter = 12; //直径
32
+    static double high = 35; //圆筒仓的高(以地面为基准面)
33 33
     static double h1 = 6; //h1 圆锥的高
34 34
     static double h2 = 3; //h2 水平地面到圆锥尖的高
35 35
     private STaskMapper sTaskMapper;
@@ -94,7 +94,7 @@ public class TeDataServiceImpl implements TeDataService {
94 94
     @Override
95 95
     public void scanTask(TeData teData) {
96 96
         try {
97
-            Thread.sleep(1000);
97
+            Thread.sleep(10000);
98 98
         } catch (InterruptedException e) {
99 99
             e.printStackTrace();
100 100
         }
@@ -112,8 +112,8 @@ public class TeDataServiceImpl implements TeDataService {
112 112
             //打点
113 113
             String rotationxy = Algorithm.getAveragePosition(diameter, zHeight);
114 114
             teData.setRotationxy(rotationxy);
115
-
116
-            postHelper(teData);
115
+            teData.setStime(new Date());//第二次开始的时间
116
+            //postHelper(teData);
117 117
 
118 118
             flag = false;
119 119
         } else { //打点两次完毕 计算体积
@@ -167,10 +167,10 @@ public class TeDataServiceImpl implements TeDataService {
167 167
             for (int i = 0; i < split.length; i++) {
168 168
                 String[] split1 = split[i].split(",");
169 169
                 //split1[2]  是返回的距离
170
-                zList.add(Double.parseDouble(split1[2]) / 1000); //距离转化为米
170
+                //zList.add(Double.parseDouble(split1[2]) / 1000); //距离转化为米
171 171
             }
172 172
         }
173
-        double v = Algorithm.calculateVolume(zList, diameter, h1, h2); //体积
173
+        //double v = Algorithm.calculateVolume(zList, diameter, h1, h2); //体积
174 174
 
175 175
     }
176 176