|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.unissoft.interaction.service.impl;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSONArray;
|
3
|
4
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
5
|
import com.unissoft.interaction.algorithm.SquareAlg;
|
5
|
6
|
import com.unissoft.interaction.entity.ReMsg;
|
|
@@ -12,7 +13,9 @@ import com.unissoft.interaction.service.SquareService;
|
12
|
13
|
import com.unissoft.parameter.mapper.HardwareParameterMapper;
|
13
|
14
|
import com.unissoft.parameter.model.HardwareParameter;
|
14
|
15
|
import com.unissoft.systemManage.mapper.OrgInfoMapper;
|
|
16
|
+import com.unissoft.systemManage.mapper.PointDataMapper;
|
15
|
17
|
import com.unissoft.systemManage.model.OrgInfo;
|
|
18
|
+import com.unissoft.systemManage.model.PointData;
|
16
|
19
|
|
17
|
20
|
import org.slf4j.Logger;
|
18
|
21
|
import org.slf4j.LoggerFactory;
|
|
@@ -21,6 +24,7 @@ import org.springframework.scheduling.annotation.Async;
|
21
|
24
|
import org.springframework.stereotype.Service;
|
22
|
25
|
import org.springframework.web.client.RestTemplate;
|
23
|
26
|
|
|
27
|
+import java.util.ArrayList;
|
24
|
28
|
import java.util.Collections;
|
25
|
29
|
import java.util.Date;
|
26
|
30
|
import java.util.List;
|
|
@@ -66,6 +70,9 @@ public class SquareServiceImpl implements SquareService {
|
66
|
70
|
@Resource
|
67
|
71
|
private TeDataServiceImpl teDataServiceImpl;
|
68
|
72
|
|
|
73
|
+ @Resource
|
|
74
|
+ private PointDataMapper pointDataMapper;
|
|
75
|
+
|
69
|
76
|
|
70
|
77
|
|
71
|
78
|
/**
|
|
@@ -135,16 +142,23 @@ public class SquareServiceImpl implements SquareService {
|
135
|
142
|
if(hardList.size()>0){
|
136
|
143
|
OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));//--------------------待完
|
137
|
144
|
|
138
|
|
- double houseWideOn = 0;
|
|
145
|
+ /*double houseWideOn = 0;
|
139
|
146
|
double houseWideUnder = 0;
|
140
|
147
|
double houseLengthLeft = 0;
|
141
|
148
|
double houseLengthRight = 0;
|
142
|
|
- double houseHight = 0;
|
|
149
|
+ double houseHight = 0;*/
|
|
150
|
+
|
|
151
|
+ double houseWideOn = orgInfoHouse.getHouseWideOn().doubleValue();
|
|
152
|
+ double houseWideUnder = orgInfoHouse.getHouseWideUnder().doubleValue();
|
|
153
|
+ double houseLengthLeft = orgInfoHouse.getHouseLengthLeft().doubleValue();
|
|
154
|
+ double houseLengthRight = orgInfoHouse.getHouseLengthRight().doubleValue();
|
|
155
|
+ double houseHight = Double.valueOf(orgInfoHouse.getHigh());
|
143
|
156
|
|
144
|
157
|
|
145
|
158
|
//计算以粮面为基准面的高
|
146
|
|
- List<Double> zlist = SquareAlg.zHeight(teData.getRotationxy(),houseWideOn,houseWideUnder,houseLengthLeft,houseLengthRight,houseHight);
|
147
|
|
- double zHeight = Collections.max(zlist);//纵坐标的最大值
|
|
159
|
+ List<Double> zList = SquareAlg.zHeight(teData.getRotationxy(),houseWideOn,houseWideUnder,houseLengthLeft,houseLengthRight,houseHight);
|
|
160
|
+ //double zHeight = Collections.max(zList);//纵坐标的最大值
|
|
161
|
+ double zHeight = Collections.min(zList);//纵坐标的最小值
|
148
|
162
|
double secondH = houseHight - zHeight;//仓房的高-点的纵坐标
|
149
|
163
|
logger.info("以粮面为基准面的高secondH {}",secondH);
|
150
|
164
|
|
|
@@ -170,6 +184,7 @@ public class SquareServiceImpl implements SquareService {
|
170
|
184
|
//Te.addNBasicEdge(v,teData.getTaskID());
|
171
|
185
|
teDataServiceImpl.addNBasicEdge(v, teData.getTaskID());
|
172
|
186
|
//计算实际的点的坐标(用于三维展示)-------------todo
|
|
187
|
+ this.addPoint(teData.getTaskID());
|
173
|
188
|
|
174
|
189
|
}
|
175
|
190
|
|
|
@@ -230,21 +245,93 @@ public class SquareServiceImpl implements SquareService {
|
230
|
245
|
|
231
|
246
|
//根据仓房id查询其信息
|
232
|
247
|
String houseId = taskID.split(",")[0];//仓房id
|
233
|
|
- OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));//--------------------待完
|
|
248
|
+ OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));//--------------------
|
234
|
249
|
|
235
|
|
- double houseWideOn = 0;
|
|
250
|
+ /*double houseWideOn = 0;
|
236
|
251
|
double houseWideUnder = 0;
|
237
|
252
|
double houseLengthLeft = 0;
|
238
|
253
|
double houseLengthRight = 0;
|
239
|
|
- double houseHight = 0;
|
|
254
|
+ double houseHight = 0;*/
|
|
255
|
+
|
|
256
|
+ double houseWideOn = orgInfoHouse.getHouseWideOn().doubleValue();
|
|
257
|
+ double houseWideUnder = orgInfoHouse.getHouseWideUnder().doubleValue();
|
|
258
|
+ double houseLengthLeft = orgInfoHouse.getHouseLengthLeft().doubleValue();
|
|
259
|
+ double houseLengthRight = orgInfoHouse.getHouseLengthRight().doubleValue();
|
|
260
|
+ double houseLength = orgInfoHouse.getChang().doubleValue();
|
|
261
|
+ double houseWide = orgInfoHouse.getKuan().doubleValue();
|
|
262
|
+ double houseHight = Double.valueOf(orgInfoHouse.getHigh());
|
240
|
263
|
|
241
|
264
|
|
242
|
265
|
//去除打在墙上的点 得到的集合是有效的点的纵坐标
|
243
|
266
|
List<Double> zList = SquareAlg.zHeight(xyStr,houseWideOn,houseWideUnder,houseLengthLeft,houseLengthRight,houseHight);
|
244
|
267
|
//体积
|
245
|
|
- double v =SquareAlg.calculateVolume(zList,houseWideOn,houseWideUnder,houseLengthLeft,houseLengthRight,houseHight);
|
|
268
|
+ double v =SquareAlg.calculateVolume(zList,houseLength,houseWide,houseHight);
|
246
|
269
|
return v;
|
247
|
270
|
|
248
|
271
|
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+ /**
|
|
275
|
+ * 实际打点的坐标
|
|
276
|
+ * @param taskId
|
|
277
|
+ */
|
|
278
|
+ public void addPoint(String taskId){
|
|
279
|
+ PointData ponitData = new PointData();
|
|
280
|
+
|
|
281
|
+ String houseId = taskId.split(",")[0];//仓房id
|
|
282
|
+ //获取仓房信息
|
|
283
|
+ OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));
|
|
284
|
+ String high = orgInfoHouse.getHigh();//高
|
|
285
|
+ Double h = Double.parseDouble(high);
|
|
286
|
+ double houseWideOn = orgInfoHouse.getHouseWideOn().doubleValue();
|
|
287
|
+ double houseWideUnder = orgInfoHouse.getHouseWideUnder().doubleValue();
|
|
288
|
+ double houseLengthLeft = orgInfoHouse.getHouseLengthLeft().doubleValue();
|
|
289
|
+ double houseLengthRight = orgInfoHouse.getHouseLengthRight().doubleValue();
|
|
290
|
+ double length = orgInfoHouse.getChang().doubleValue();
|
|
291
|
+ double wide = orgInfoHouse.getKuan().doubleValue();
|
|
292
|
+ //查询打点返回的数据
|
|
293
|
+ StringBuffer sb = new StringBuffer();
|
|
294
|
+ QueryWrapper<TeData> queryWrapper = new QueryWrapper<>();
|
|
295
|
+ List<TeData> teDataList = null;
|
|
296
|
+ queryWrapper.eq("taskID", taskId);
|
|
297
|
+ teDataList = teDataMapper.selectList(queryWrapper);
|
|
298
|
+ if(teDataList.size()>0){
|
|
299
|
+ for (TeData teData : teDataList) {
|
|
300
|
+ sb.append(teData.getRotationxy()+";");
|
|
301
|
+
|
|
302
|
+ }
|
|
303
|
+ String rotationxy = sb.substring(0, sb.length()-1).toString();//发送的角度和返回的距离 150,50,90;200,-100,90;50,-50,90
|
|
304
|
+
|
|
305
|
+ //计算实际的坐标
|
|
306
|
+ String xyz = SquareAlg.getCoordinates(rotationxy,houseWideOn,houseWideUnder,houseLengthLeft,houseLengthRight , h);
|
|
307
|
+
|
|
308
|
+ ponitData.setHouseId(orgInfoHouse.getId());
|
|
309
|
+ ponitData.setCreateTime(new Date());
|
|
310
|
+ ponitData.setLkHeight(high);//保存高
|
|
311
|
+ ponitData.setPoints(xyz);//保存坐标
|
|
312
|
+ ponitData.setLength(length+"");//仓房的长
|
|
313
|
+ ponitData.setWide(wide+"");//仓房的宽
|
|
314
|
+
|
|
315
|
+ //String jsonString = "[[1,2,3],[4,5,62.33],[1,5,2.3]]";
|
|
316
|
+ JSONArray jsonArray=JSONArray.parseArray(xyz);
|
|
317
|
+ List<Double> list = new ArrayList<>();
|
|
318
|
+
|
|
319
|
+ for(int i=0;i<jsonArray.size();i++){
|
|
320
|
+ double z = Double.parseDouble(jsonArray.get(i).toString().split(",")[2].split("]")[0]);
|
|
321
|
+ list.add(z);
|
|
322
|
+ //System.out.println(z);
|
|
323
|
+ }
|
|
324
|
+ Double max = Collections.max(list);
|
|
325
|
+ max = (double) (Math.round(max*100)/100);
|
|
326
|
+ Double min = Collections.min(list);
|
|
327
|
+ min = (double) (Math.round(min*100)/100);
|
|
328
|
+ Double minHeigth = (max+min)/2;
|
|
329
|
+ ponitData.setVerticalMaxHeigth(max+"");//垂直最大高度
|
|
330
|
+ ponitData.setVerticalMinHeigth(min+"");//垂直最小高度
|
|
331
|
+ ponitData.setMinHeigth(minHeigth+"");//----------------待确定
|
|
332
|
+ pointDataMapper.insert(ponitData);
|
|
333
|
+
|
|
334
|
+ }
|
|
335
|
+ }
|
249
|
336
|
|
250
|
337
|
}
|