|
@@ -2,6 +2,7 @@ package com.zhonglai.luhui.admin.controller.data; |
|
@@ -2,6 +2,7 @@ package com.zhonglai.luhui.admin.controller.data; |
|
2
|
|
2
|
|
|
3
|
import com.ruoyi.common.core.domain.AjaxResult;
|
3
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
4
|
import com.zhonglai.luhui.dao.service.PublicService;
|
4
|
import com.zhonglai.luhui.dao.service.PublicService;
|
|
|
|
5
|
+import com.zhonglai.luhui.device.analysis.comm.util.StringUtils;
|
|
5
|
import com.zhonglai.luhui.device.analysis.comm.util.TableUtil;
|
6
|
import com.zhonglai.luhui.device.analysis.comm.util.TableUtil;
|
|
6
|
import io.swagger.annotations.Api;
|
7
|
import io.swagger.annotations.Api;
|
|
7
|
import io.swagger.annotations.ApiImplicitParam;
|
8
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.PathVariable; |
|
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.PathVariable; |
|
13
|
import org.springframework.web.bind.annotation.RequestMapping;
|
14
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
14
|
import org.springframework.web.bind.annotation.RestController;
|
15
|
import org.springframework.web.bind.annotation.RestController;
|
|
15
|
|
16
|
|
|
|
|
17
|
+import java.util.ArrayList;
|
|
16
|
import java.util.List;
|
18
|
import java.util.List;
|
|
17
|
import java.util.Map;
|
19
|
import java.util.Map;
|
|
18
|
|
20
|
|
|
@@ -32,11 +34,44 @@ public class AtlasTrajectoryController { |
|
@@ -32,11 +34,44 @@ public class AtlasTrajectoryController { |
|
32
|
@ApiImplicitParam(value = "开始时间(时间戳)",name = "startTime"),
|
34
|
@ApiImplicitParam(value = "开始时间(时间戳)",name = "startTime"),
|
|
33
|
@ApiImplicitParam(value = "结束时间(时间戳)",name = "endTime")
|
35
|
@ApiImplicitParam(value = "结束时间(时间戳)",name = "endTime")
|
|
34
|
})
|
36
|
})
|
|
35
|
- @GetMapping(value = "/oneDay/{deviceInfiId}/{day}")
|
|
|
|
36
|
- public AjaxResult oneDay(@PathVariable String deviceInfoId,@PathVariable String day,String latType,String lngType,Integer startTime,Integer endTime)
|
37
|
+ @GetMapping(value = "/oneDay")
|
|
|
|
38
|
+ public AjaxResult oneDay( String deviceInfoId, String day,String latType,String lngType,Integer startTime,Integer endTime)
|
|
37
|
{
|
39
|
{
|
|
38
|
String table = TableUtil.getTableName(day,"ly_sensor_data","device_sensor_data",3);
|
40
|
String table = TableUtil.getTableName(day,"ly_sensor_data","device_sensor_data",3);
|
|
39
|
- List<Map<String,Object>> list = publicService.getObjectListBySQL("select creat_time,data_value from `"+table+"` where device_info_id='"+deviceInfoId+"' and data_type='"+latType+"'");
|
41
|
+ StringBuffer sql = new StringBuffer("SELECT\n" +
|
|
|
|
42
|
+// " FROM_UNIXTIME(creat_time) tm,\n" +
|
|
|
|
43
|
+ " CONCAT_WS(',',\n" +
|
|
|
|
44
|
+ " MAX(CASE WHEN data_type = '"+latType+"' THEN data_value ELSE NULL END),\n" +
|
|
|
|
45
|
+ " MAX(CASE WHEN data_type = '"+lngType+"' THEN data_value ELSE NULL END)\n" +
|
|
|
|
46
|
+ " ) AS location\n" +
|
|
|
|
47
|
+ "FROM\n" +
|
|
|
|
48
|
+ " "+table+"\n" +
|
|
|
|
49
|
+ "WHERE\n" +
|
|
|
|
50
|
+ " device_info_id = '"+deviceInfoId+"' AND\n" +
|
|
|
|
51
|
+ " data_type IN ('lat', 'lng')\n" );
|
|
|
|
52
|
+ if(null != startTime && null != endTime)
|
|
|
|
53
|
+ {
|
|
|
|
54
|
+ sql.append(" and creat_time>="+startTime);
|
|
|
|
55
|
+ sql.append(" and creat_time<="+endTime);
|
|
|
|
56
|
+ }
|
|
|
|
57
|
+ sql.append(" GROUP BY\n" +
|
|
|
|
58
|
+ " creat_time\n" +
|
|
|
|
59
|
+ " ORDER BY creat_time ASC");
|
|
|
|
60
|
+ List<Map<String,Object>> list = publicService.getObjectListBySQL(sql.toString());
|
|
|
|
61
|
+ if (null != list && list.size() != 0)
|
|
|
|
62
|
+ {
|
|
|
|
63
|
+ List<Double[]> rlist = new ArrayList<>();
|
|
|
|
64
|
+ for (Map<String,Object> map:list)
|
|
|
|
65
|
+ {
|
|
|
|
66
|
+ Object object = map.get("location");
|
|
|
|
67
|
+ if(StringUtils.isNotNull(object))
|
|
|
|
68
|
+ {
|
|
|
|
69
|
+ String[] ss = String.valueOf(map.get("location")).split(",");
|
|
|
|
70
|
+ rlist.add(new Double[]{Double.valueOf(ss[0]),Double.valueOf(ss[1])});
|
|
|
|
71
|
+ }
|
|
|
|
72
|
+ }
|
|
|
|
73
|
+ return AjaxResult.success(rlist);
|
|
|
|
74
|
+ }
|
|
40
|
return AjaxResult.success(list);
|
75
|
return AjaxResult.success(list);
|
|
41
|
}
|
76
|
}
|
|
42
|
} |
77
|
} |