hasan 3 年之前
父節點
當前提交
4c0ebb5e1f

+ 0 - 1
pom.xml

@@ -40,7 +40,6 @@
40
             <artifactId>mybatis-plus-generator</artifactId>
40
             <artifactId>mybatis-plus-generator</artifactId>
41
             <version>3.5.1</version>
41
             <version>3.5.1</version>
42
         </dependency>
42
         </dependency>
43
-
44
         <dependency>
43
         <dependency>
45
             <groupId>org.springframework.boot</groupId>
44
             <groupId>org.springframework.boot</groupId>
46
             <artifactId>spring-boot-devtools</artifactId>
45
             <artifactId>spring-boot-devtools</artifactId>

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

@@ -22,6 +22,7 @@ public class DataController {
22
 
22
 
23
     /**
23
     /**
24
      * 检测后数据
24
      * 检测后数据
25
+     *
25
      * @param teData
26
      * @param teData
26
      * @return
27
      * @return
27
      */
28
      */
@@ -32,8 +33,8 @@ public class DataController {
32
         if (inum < 0) {
33
         if (inum < 0) {
33
             return "fail";
34
             return "fail";
34
         }
35
         }
35
-        if(inum == 0){ //打点两次完毕 计算体积
36
-        	teDataService.calculateVolume(teData.getTaskID());
36
+        if (inum == 0) { //打点两次完毕 计算体积
37
+            teDataService.calculateVolume(teData.getTaskID());
37
         }
38
         }
38
         return "success";
39
         return "success";
39
     }
40
     }
@@ -46,7 +47,7 @@ public class DataController {
46
     public void scanning(@RequestParam(value = "height", defaultValue = "35") double height,
47
     public void scanning(@RequestParam(value = "height", defaultValue = "35") double height,
47
                          @RequestParam(value = "diameter ", defaultValue = "12") double diameter) {
48
                          @RequestParam(value = "diameter ", defaultValue = "12") double diameter) {
48
 
49
 
49
-        logger.info("{},{}",height,diameter);
50
-        teDataService.scanTask(diameter,height);
50
+        logger.info("scanning height{},diameter{}", height, diameter);
51
+        teDataService.scanTask(diameter, height);
51
     }
52
     }
52
 }
53
 }

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

@@ -2,7 +2,6 @@ package com.szls.nstths.controller;
2
 
2
 
3
 
3
 
4
 import com.szls.nstths.mapper.UserMapper;
4
 import com.szls.nstths.mapper.UserMapper;
5
-import com.szls.nstths.service.TeDataService;
6
 import org.slf4j.Logger;
5
 import org.slf4j.Logger;
7
 import org.slf4j.LoggerFactory;
6
 import org.slf4j.LoggerFactory;
8
 import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +17,7 @@ public class UserController {
18
     private static final Logger logger = LoggerFactory.getLogger(UserController.class);
17
     private static final Logger logger = LoggerFactory.getLogger(UserController.class);
19
 
18
 
20
     private UserMapper userMapper;
19
     private UserMapper userMapper;
20
+
21
     @Autowired
21
     @Autowired
22
     public void setUserMapper(UserMapper userMapper) {
22
     public void setUserMapper(UserMapper userMapper) {
23
         this.userMapper = userMapper;
23
         this.userMapper = userMapper;

+ 2 - 2
src/main/java/com/szls/nstths/entity/ReMsg.java

@@ -9,8 +9,6 @@ import lombok.Data;
9
 @Data
9
 @Data
10
 @TableName("re_msg")
10
 @TableName("re_msg")
11
 public class ReMsg {
11
 public class ReMsg {
12
-    @TableId(type = IdType.AUTO, value = "id")
13
-    private Long id;
14
     /**
12
     /**
15
      * code=0, msg='操作成功'
13
      * code=0, msg='操作成功'
16
      * code=1, msg='设备正忙'
14
      * code=1, msg='设备正忙'
@@ -20,4 +18,6 @@ public class ReMsg {
20
     String code;
18
     String code;
21
     String msg;
19
     String msg;
22
     String data;
20
     String data;
21
+    @TableId(type = IdType.AUTO, value = "id")
22
+    private Long id;
23
 }
23
 }

+ 1 - 1
src/main/java/com/szls/nstths/entity/STask.java

@@ -13,7 +13,7 @@ import java.util.Date;
13
 public class STask {
13
 public class STask {
14
     @TableId(type = IdType.AUTO, value = "id")
14
     @TableId(type = IdType.AUTO, value = "id")
15
     private Long id;
15
     private Long id;
16
-    private String describe;
16
+    private String depict;
17
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
17
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
18
     private Date ctime;
18
     private Date ctime;
19
 }
19
 }

+ 10 - 0
src/main/java/com/szls/nstths/mapper/ReMsgMapper.java

@@ -0,0 +1,10 @@
1
+package com.szls.nstths.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.szls.nstths.entity.ReMsg;
5
+import org.springframework.stereotype.Component;
6
+
7
+@Component(value = "reMsgMapper")
8
+public interface ReMsgMapper extends BaseMapper<ReMsg> {
9
+
10
+}

+ 0 - 1
src/main/java/com/szls/nstths/mapper/STaskMapper.java

@@ -2,7 +2,6 @@ package com.szls.nstths.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.szls.nstths.entity.STask;
4
 import com.szls.nstths.entity.STask;
5
-import com.szls.nstths.entity.TeData;
6
 import org.springframework.stereotype.Component;
5
 import org.springframework.stereotype.Component;
7
 
6
 
8
 @Component(value = "sTaskMapper")
7
 @Component(value = "sTaskMapper")

+ 0 - 1
src/main/java/com/szls/nstths/mapper/TeDataMapper.java

@@ -2,7 +2,6 @@ package com.szls.nstths.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.szls.nstths.entity.TeData;
4
 import com.szls.nstths.entity.TeData;
5
-import com.szls.nstths.entity.User;
6
 import org.springframework.stereotype.Component;
5
 import org.springframework.stereotype.Component;
7
 
6
 
8
 @Component(value = "teDataMapper")
7
 @Component(value = "teDataMapper")

+ 11 - 10
src/main/java/com/szls/nstths/service/TeDataService.java

@@ -1,6 +1,5 @@
1
 package com.szls.nstths.service;
1
 package com.szls.nstths.service;
2
 
2
 
3
-import com.szls.nstths.entity.ReMsg;
4
 import com.szls.nstths.entity.TeData;
3
 import com.szls.nstths.entity.TeData;
5
 import org.springframework.stereotype.Service;
4
 import org.springframework.stereotype.Service;
6
 
5
 
@@ -11,35 +10,37 @@ import org.springframework.stereotype.Service;
11
  * 1. equipmentTestingIsReady
10
  * 1. equipmentTestingIsReady
12
  * 2. equipmentTestingStart
11
  * 2. equipmentTestingStart
13
  * 3. equipmentTestingEnd
12
  * 3. equipmentTestingEnd
14
- *
13
+ * <p>
15
  * equipmentTestingContinue
14
  * equipmentTestingContinue
16
  * equipmentTestingResult
15
  * equipmentTestingResult
17
  */
16
  */
18
 
17
 
19
-@Service(value = "teDataService")
20
-public interface TeDataService {
21
 
18
 
19
+public interface TeDataService {
22
 
20
 
23
 
21
 
24
     /**
22
     /**
25
      * 第一次待打点
23
      * 第一次待打点
26
-     * @param height 
27
-     * @param diameter 
24
+     *
25
+     * @param high
26
+     * @param diameter
28
      */
27
      */
29
-    public void scanTask(double diameter, double high);
28
+    void scanTask(double diameter, double high);
30
 
29
 
31
     /**
30
     /**
32
      * 第二次待打点
31
      * 第二次待打点
32
+     *
33
      * @param teData
33
      * @param teData
34
      * @return 数据库影响条数
34
      * @return 数据库影响条数
35
      */
35
      */
36
-    public int scanTask(TeData teData);
37
-    
36
+    int scanTask(TeData teData);
37
+
38
 
38
 
39
     /**
39
     /**
40
      * 计算体积
40
      * 计算体积
41
+     *
41
      * @param taskID
42
      * @param taskID
42
      */
43
      */
43
-	public void calculateVolume(String taskID);
44
+    void calculateVolume(String taskID);
44
 
45
 
45
 }
46
 }

+ 62 - 51
src/main/java/com/szls/nstths/service/impl/Algorithm.java

@@ -1,22 +1,22 @@
1
 package com.szls.nstths.service.impl;
1
 package com.szls.nstths.service.impl;
2
 
2
 
3
 import java.math.BigDecimal;
3
 import java.math.BigDecimal;
4
+import java.math.RoundingMode;
4
 import java.util.ArrayList;
5
 import java.util.ArrayList;
5
 import java.util.Collections;
6
 import java.util.Collections;
6
 import java.util.List;
7
 import java.util.List;
7
 
8
 
8
-import org.junit.jupiter.api.Test;
9
-
10
 public class Algorithm {
9
 public class Algorithm {
11
 
10
 
12
-	
13
-	/**
14
-	 * 打点要发送的角度
15
-	 * @param diameter
16
-	 * @param high
17
-	 * @return
18
-	 */
19
-	public static String getAveragePosition(double diameter, double high) {
11
+
12
+    /**
13
+     * 打点要发送的角度
14
+     *
15
+     * @param diameter
16
+     * @param high
17
+     * @return
18
+     */
19
+    public static String getAveragePosition(double diameter, double high) {
20
         StringBuffer sb = new StringBuffer();
20
         StringBuffer sb = new StringBuffer();
21
 
21
 
22
         double x1 = 0;
22
         double x1 = 0;
@@ -105,21 +105,22 @@ public class Algorithm {
105
         //System.out.println(sb);
105
         //System.out.println(sb);
106
         System.out.println(sb);
106
         System.out.println(sb);
107
         return sb.toString();
107
         return sb.toString();
108
-    
109
-	}
110
-	
111
-	
112
-	/**
113
-	 * 计算  以粮面为基准面的高
114
-	 * @param list
115
-	 * @return
116
-	 */
117
-	public static double zHeight(String rotationxy,double diameter, double high) {
118
-        
119
-		List<Double> zList = new ArrayList<Double>();
120
-		
108
+
109
+    }
110
+
111
+
112
+    /**
113
+     * 计算  以粮面为基准面的高
114
+     *
115
+     * @param rotationxy
116
+     * @return
117
+     */
118
+    public static double zHeight(String rotationxy, double diameter, double high) {
119
+
120
+        List<Double> zList = new ArrayList<Double>();
121
+
121
         // logger.info("zHeight - list",list);
122
         // logger.info("zHeight - list",list);
122
-		double AC = high;
123
+        double AC = high;
123
         double B1C = 0;//设备和粮面点之间的距离
124
         double B1C = 0;//设备和粮面点之间的距离
124
         double A1B1 = 0;//粮面到设备的水平距离
125
         double A1B1 = 0;//粮面到设备的水平距离
125
         double z = 0; //实际点的坐标的z轴
126
         double z = 0; //实际点的坐标的z轴
@@ -128,17 +129,17 @@ public class Algorithm {
128
         double verticalAngle = 0;//垂直角度
129
         double verticalAngle = 0;//垂直角度
129
         double levelAngle = 0;//水平角度
130
         double levelAngle = 0;//水平角度
130
         double realHypotenuse = 0;//返回的距离
131
         double realHypotenuse = 0;//返回的距离
131
-        
132
-		
133
-		//  "18,7,17.88 - 19,6,28.88 - 17,4,39.88"  水平角度,垂直角度,返回距离 - 
134
-		String[] split = rotationxy.split("-");
135
-		for (int i = 0; i < split.length; i++) {
136
-			String[] split1 = split[i].split(",");
137
-			levelAngle = Double.parseDouble(split1[0]);
138
-			verticalAngle = Double.parseDouble(split1[1]);
139
-			realHypotenuse = Double.parseDouble(split1[2]);
140
-			
141
-			//将垂直的角度转化为弧度
132
+
133
+
134
+        //  "18,7,17.88 - 19,6,28.88 - 17,4,39.88"  水平角度,垂直角度,返回距离 -
135
+        String[] split = rotationxy.split("-");
136
+        for (int i = 0; i < split.length; i++) {
137
+            String[] split1 = split[i].split(",");
138
+            levelAngle = Double.parseDouble(split1[0]);
139
+            verticalAngle = Double.parseDouble(split1[1]);
140
+            realHypotenuse = Double.parseDouble(split1[2]);
141
+
142
+            //将垂直的角度转化为弧度
142
             double verticalAngleRadians = Math.toRadians(verticalAngle);
143
             double verticalAngleRadians = Math.toRadians(verticalAngle);
143
             String verticalAngleS = String.format("%.2f%n", Math.sin(verticalAngleRadians));
144
             String verticalAngleS = String.format("%.2f%n", Math.sin(verticalAngleRadians));
144
             double sinc = new Double(verticalAngleS);
145
             double sinc = new Double(verticalAngleS);
@@ -149,14 +150,14 @@ public class Algorithm {
149
 
150
 
150
             String sinLevel = String.format("%.2f%n", Math.sin(Math.abs(levelAngle)));
151
             String sinLevel = String.format("%.2f%n", Math.sin(Math.abs(levelAngle)));
151
             double sinLevelc = new Double(sinLevel);
152
             double sinLevelc = new Double(sinLevel);
152
-            
153
+
153
             /*
154
             /*
154
              * 对比实际的A1B1与打到墙上时最大的这个边进行比较 如果A1B1小于这个最大边则可取
155
              * 对比实际的A1B1与打到墙上时最大的这个边进行比较 如果A1B1小于这个最大边则可取
155
              * 如果A1B1大于或等于这个最大的边 则打到了墙上 舍去
156
              * 如果A1B1大于或等于这个最大的边 则打到了墙上 舍去
156
              * */
157
              * */
157
-           //打到墙上 最大的边
158
+            //打到墙上 最大的边
158
             double maxLength = sinLevelc * diameter;
159
             double maxLength = sinLevelc * diameter;
159
-            
160
+
160
             if (A1B1 < maxLength) {
161
             if (A1B1 < maxLength) {
161
                 //实际打在粮面上的点的坐标
162
                 //实际打在粮面上的点的坐标
162
                 String verticalAngleC = String.format("%.2f%n", Math.cos(verticalAngleRadians));
163
                 String verticalAngleC = String.format("%.2f%n", Math.cos(verticalAngleRadians));
@@ -169,9 +170,9 @@ public class Algorithm {
169
 
170
 
170
                 zList.add(z);
171
                 zList.add(z);
171
             }
172
             }
172
-		}
173
-		
174
-		zMax = Collections.max(zList);
173
+        }
174
+
175
+        zMax = Collections.max(zList);
175
         zHigh = AC - zMax;
176
         zHigh = AC - zMax;
176
         return zHigh;
177
         return zHigh;
177
 		
178
 		
@@ -199,9 +200,9 @@ public class Algorithm {
199
             double sinLevelc = new Double(sinLevel);
200
             double sinLevelc = new Double(sinLevel);
200
 
201
 
201
             *//**
202
             *//**
202
-             * 对比实际的A1B1与打到墙上时最大的这个边进行比较 如果A1B1小于这个最大边则可取
203
-             * 如果A1B1大于或等于这个最大的边 则打到了墙上 舍去
204
-             *//*
203
+         * 对比实际的A1B1与打到墙上时最大的这个边进行比较 如果A1B1小于这个最大边则可取
204
+         * 如果A1B1大于或等于这个最大的边 则打到了墙上 舍去
205
+         *//*
205
             //打到墙上 最大的边
206
             //打到墙上 最大的边
206
             double maxLength = sinLevelc * diameter;
207
             double maxLength = sinLevelc * diameter;
207
 
208
 
@@ -223,15 +224,14 @@ public class Algorithm {
223
         return zHigh;
224
         return zHigh;
224
 */
225
 */
225
     }
226
     }
226
-	
227
-	
228
-	
229
-	/**
227
+
228
+
229
+    /**
230
      * 计算体积
230
      * 计算体积
231
      *
231
      *
232
      * @param zList 粮面高集合(z值的集合)
232
      * @param zList 粮面高集合(z值的集合)
233
      */
233
      */
234
-    public static double calculateVolume(List<Double> zList,double diameter,double h1,double h2) {
234
+    public static double calculateVolume(List<Double> zList, double diameter, double h1, double h2) {
235
 
235
 
236
         //17.1  18.3  19.2  18.3    20.1  16.4  19.8  16.7  19.0  18.9
236
         //17.1  18.3  19.2  18.3    20.1  16.4  19.8  16.7  19.0  18.9
237
         Double zMin = Collections.min(zList); //z的最小值
237
         Double zMin = Collections.min(zList); //z的最小值
@@ -257,8 +257,19 @@ public class Algorithm {
257
         double v2 = 3.14 * (diameter / 2) * (diameter / 2) * (zMin - h2 - h1);
257
         double v2 = 3.14 * (diameter / 2) * (diameter / 2) * (zMin - h2 - h1);
258
         double v3 = (3.14 * (diameter / 2) * (diameter / 2) * h1) / 3;
258
         double v3 = (3.14 * (diameter / 2) * (diameter / 2) * h1) / 3;
259
         double vv = v1 + v2 + v3;
259
         double vv = v1 + v2 + v3;
260
-        BigDecimal bdv = new BigDecimal(vv);
261
-        double v = bdv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
260
+        BigDecimal bdv = BigDecimal.valueOf(vv);
261
+        //double v = bdv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
262
+        double v = bdv.setScale(2, RoundingMode.HALF_UP).doubleValue();
262
         return v;
263
         return v;
263
     }
264
     }
265
+
266
+
267
+    public static void main(String[] args) {
268
+
269
+        BigDecimal bdv = BigDecimal.valueOf(12.125323);
270
+        //BigDecimal bdv = new BigDecimal(vv);
271
+        //double v = bdv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
272
+        double v = bdv.setScale(2, RoundingMode.HALF_UP).doubleValue();
273
+        System.out.println("v = " + v);
274
+    }
264
 }
275
 }

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

@@ -4,16 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.szls.nstths.entity.ReMsg;
4
 import com.szls.nstths.entity.ReMsg;
5
 import com.szls.nstths.entity.STask;
5
 import com.szls.nstths.entity.STask;
6
 import com.szls.nstths.entity.TeData;
6
 import com.szls.nstths.entity.TeData;
7
+import com.szls.nstths.mapper.ReMsgMapper;
7
 import com.szls.nstths.mapper.STaskMapper;
8
 import com.szls.nstths.mapper.STaskMapper;
8
 import com.szls.nstths.mapper.TeDataMapper;
9
 import com.szls.nstths.mapper.TeDataMapper;
9
 import com.szls.nstths.service.TeDataService;
10
 import com.szls.nstths.service.TeDataService;
10
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Service;
11
 import org.springframework.web.client.RestTemplate;
13
 import org.springframework.web.client.RestTemplate;
12
 
14
 
13
 import java.util.ArrayList;
15
 import java.util.ArrayList;
14
 import java.util.Date;
16
 import java.util.Date;
15
 import java.util.List;
17
 import java.util.List;
16
 
18
 
19
+@Service(value = "teDataService")
17
 public class TeDataServiceImpl implements TeDataService {
20
 public class TeDataServiceImpl implements TeDataService {
18
 
21
 
19
     static String base_url = "http://local.wxlxit.com:61001/";
22
     static String base_url = "http://local.wxlxit.com:61001/";
@@ -24,6 +27,13 @@ public class TeDataServiceImpl implements TeDataService {
24
     static double h2 = 3; //h2 水平地面到圆锥尖的高
27
     static double h2 = 3; //h2 水平地面到圆锥尖的高
25
     private STaskMapper sTaskMapper;
28
     private STaskMapper sTaskMapper;
26
     private TeDataMapper teDataMapper;
29
     private TeDataMapper teDataMapper;
30
+    private ReMsgMapper reMsgMapper;
31
+
32
+    public static void main(String[] args) {
33
+        String str = "18,7,17.88-19,6,28.88-17,4,39.88";
34
+
35
+        str.split("-");
36
+    }
27
 
37
 
28
     @Autowired
38
     @Autowired
29
     public void setsTaskMapper(STaskMapper sTaskMapper) {
39
     public void setsTaskMapper(STaskMapper sTaskMapper) {
@@ -35,6 +45,11 @@ public class TeDataServiceImpl implements TeDataService {
35
         this.teDataMapper = teDataMapper;
45
         this.teDataMapper = teDataMapper;
36
     }
46
     }
37
 
47
 
48
+    @Autowired
49
+    public void setReMsgMapper(ReMsgMapper reMsgMapper) {
50
+        this.reMsgMapper = reMsgMapper;
51
+    }
52
+
38
     /**
53
     /**
39
      * todo
54
      * todo
40
      * http://local.wxlxit.com:61001/
55
      * http://local.wxlxit.com:61001/
@@ -46,11 +61,11 @@ public class TeDataServiceImpl implements TeDataService {
46
     @Override
61
     @Override
47
     public void scanTask(double diameter, double high) {
62
     public void scanTask(double diameter, double high) {
48
 
63
 
49
-    	
64
+
50
         STask task = new STask();
65
         STask task = new STask();
51
         Date date = new Date();
66
         Date date = new Date();
52
         task.setCtime(date);
67
         task.setCtime(date);
53
-        task.setDescribe("test");
68
+        task.setDepict("test");
54
         sTaskMapper.insert(task);
69
         sTaskMapper.insert(task);
55
 
70
 
56
         TeData teData = new TeData();
71
         TeData teData = new TeData();
@@ -70,24 +85,24 @@ public class TeDataServiceImpl implements TeDataService {
70
 
85
 
71
     @Override
86
     @Override
72
     public int scanTask(TeData teData) {
87
     public int scanTask(TeData teData) {
73
-    	//只运行 发送一次。
88
+        //只运行 发送一次。
74
         if (flag) {
89
         if (flag) {
75
-	        teData.getEquipmentID();
76
-	        teData.getTaskID();
77
-	
78
-	        //todo 第二次待打点
79
-	        
80
-	        //计算以粮面为基准面的高
81
-	        double zHeight = Algorithm.zHeight(teData.getRotationxy(),diameter, high);
82
-	        //打点
83
-	        String rotationxy = Algorithm.getAveragePosition(diameter, zHeight);
84
-	        teData.setRotationxy(rotationxy);
85
-	        int inum = teDataMapper.insert(teData);
86
-	
87
-	        postHelper(teData);
88
-	        flag = false;
89
-	
90
-	        return inum;
90
+            teData.getEquipmentID();
91
+            teData.getTaskID();
92
+
93
+            //todo 第二次待打点
94
+
95
+            //计算以粮面为基准面的高
96
+            double zHeight = Algorithm.zHeight(teData.getRotationxy(), diameter, high);
97
+            //打点
98
+            String rotationxy = Algorithm.getAveragePosition(diameter, zHeight);
99
+            teData.setRotationxy(rotationxy);
100
+            int inum = teDataMapper.insert(teData);
101
+
102
+            postHelper(teData);
103
+            flag = false;
104
+
105
+            return inum;
91
         }
106
         }
92
         return 0;
107
         return 0;
93
     }
108
     }
@@ -95,43 +110,39 @@ public class TeDataServiceImpl implements TeDataService {
95
     public ReMsg postHelper(TeData teData) {
110
     public ReMsg postHelper(TeData teData) {
96
         RestTemplate restTemplate = new RestTemplate();
111
         RestTemplate restTemplate = new RestTemplate();
97
         ReMsg reMsg1 = restTemplate.postForObject(base_url + "equipmentTestingIsReady", teData, ReMsg.class);
112
         ReMsg reMsg1 = restTemplate.postForObject(base_url + "equipmentTestingIsReady", teData, ReMsg.class);
113
+        //reMsgMapper.insert(reMsg1);
114
+
98
         if (reMsg1 != null) {
115
         if (reMsg1 != null) {
99
-            if (reMsg1.getCode().equals("0")) {
116
+            if ("0".equals(reMsg1.getCode())) {
100
                 ReMsg reMsg2 = restTemplate.postForObject(base_url + "equipmentTestingStart", teData, ReMsg.class);
117
                 ReMsg reMsg2 = restTemplate.postForObject(base_url + "equipmentTestingStart", teData, ReMsg.class);
118
+                reMsgMapper.insert(reMsg2);
101
                 return reMsg2;
119
                 return reMsg2;
102
             }
120
             }
103
         }
121
         }
104
         return null;
122
         return null;
105
     }
123
     }
106
 
124
 
107
-    
108
     @Override
125
     @Override
109
-	public void calculateVolume(String taskID) {
110
-		// TODO Auto-generated method stub
111
-		List<Double> zList = new ArrayList<Double>();
112
-		String[] split = null;
113
-		
114
-		QueryWrapper<TeData> queryWrapper = new QueryWrapper<>();
126
+    public void calculateVolume(String taskID) {
127
+        // TODO Auto-generated method stub
128
+        List<Double> zList = new ArrayList<Double>();
129
+        String[] split = null;
130
+
131
+        QueryWrapper<TeData> queryWrapper = new QueryWrapper<>();
115
 
132
 
116
         List<TeData> teDataList = null;
133
         List<TeData> teDataList = null;
117
         queryWrapper.eq("taskID", taskID);
134
         queryWrapper.eq("taskID", taskID);
118
         teDataList = teDataMapper.selectList(queryWrapper);
135
         teDataList = teDataMapper.selectList(queryWrapper);
119
-		for (TeData teData : teDataList) {
120
-			split = teData.getRotationxy().split("-");
121
-			for (int i = 0; i < split.length; i++) {
122
-				String[] split1 = split[i].split(",");
123
-				//split1[2]  是返回的距离
124
-				zList.add(Double.parseDouble(split1[2]));
125
-			}
126
-		}
127
-		double v = Algorithm.calculateVolume(zList,diameter,h1,h2); //体积
128
-		
129
-	}
130
-    
131
-    public static void main(String[] args) {
132
-        String str = "18,7,17.88-19,6,28.88-17,4,39.88";
136
+        for (TeData teData : teDataList) {
137
+            split = teData.getRotationxy().split("-");
138
+            for (int i = 0; i < split.length; i++) {
139
+                String[] split1 = split[i].split(",");
140
+                //split1[2]  是返回的距离
141
+                zList.add(Double.parseDouble(split1[2]));
142
+            }
143
+        }
144
+        double v = Algorithm.calculateVolume(zList, diameter, h1, h2); //体积
133
 
145
 
134
-        str.split("-");
135
     }
146
     }
136
 
147
 
137
 }
148
 }

+ 12 - 0
src/main/resources/static/index.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <title>admin</title>
6
+</head>
7
+<body>
8
+<a href="http://127.0.0.1:7077/scanning">本地默认扫描</a>
9
+
10
+<a href="http://112.51.248.191:7077/scanning">远程默认扫描</a>
11
+</body>
12
+</html>

+ 0 - 1
src/test/java/com/szls/nstths/NstthsApplicationTests.java

@@ -3,7 +3,6 @@ package com.szls.nstths;
3
 import com.baomidou.mybatisplus.generator.FastAutoGenerator;
3
 import com.baomidou.mybatisplus.generator.FastAutoGenerator;
4
 import com.baomidou.mybatisplus.generator.config.OutputFile;
4
 import com.baomidou.mybatisplus.generator.config.OutputFile;
5
 import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
5
 import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
6
-import org.junit.jupiter.api.Test;
7
 import org.springframework.boot.test.context.SpringBootTest;
6
 import org.springframework.boot.test.context.SpringBootTest;
8
 
7
 
9
 import java.util.Collections;
8
 import java.util.Collections;

+ 0 - 1
src/test/java/com/szls/nstths/SampleTest.java

@@ -2,7 +2,6 @@ package com.szls.nstths;
2
 
2
 
3
 import com.szls.nstths.entity.User;
3
 import com.szls.nstths.entity.User;
4
 import com.szls.nstths.mapper.UserMapper;
4
 import com.szls.nstths.mapper.UserMapper;
5
-import org.junit.jupiter.api.Test;
6
 import org.springframework.boot.test.context.SpringBootTest;
5
 import org.springframework.boot.test.context.SpringBootTest;
7
 
6
 
8
 import javax.annotation.Resource;
7
 import javax.annotation.Resource;