电子围栏接口修改
正在显示
6 个修改的文件
包含
94 行增加
和
27 行删除
... | @@ -7,6 +7,7 @@ import com.jkdata.entity.SafeArea; | ... | @@ -7,6 +7,7 @@ import com.jkdata.entity.SafeArea; |
7 | import com.jkdata.entity.ThirdPosition; | 7 | import com.jkdata.entity.ThirdPosition; |
8 | import com.jkdata.service.IThirdService; | 8 | import com.jkdata.service.IThirdService; |
9 | import com.jkdata.tool.Result; | 9 | import com.jkdata.tool.Result; |
10 | import io.swagger.annotations.ApiOperation; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
12 | 13 | ||
... | @@ -24,6 +25,7 @@ public class ThirdController { | ... | @@ -24,6 +25,7 @@ public class ThirdController { |
24 | @Autowired | 25 | @Autowired |
25 | private IThirdService thirdService; | 26 | private IThirdService thirdService; |
26 | 27 | ||
28 | @ApiOperation(value="接收定位数据", notes="接收定位数据") | ||
27 | @PostMapping("/receivePosition") | 29 | @PostMapping("/receivePosition") |
28 | public Result<Map<String,Object>> save(HttpServletRequest request, HttpServletResponse response) { | 30 | public Result<Map<String,Object>> save(HttpServletRequest request, HttpServletResponse response) { |
29 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | 31 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); |
... | @@ -80,6 +82,7 @@ public class ThirdController { | ... | @@ -80,6 +82,7 @@ public class ThirdController { |
80 | * 获取人员实时定位 | 82 | * 获取人员实时定位 |
81 | * @return | 83 | * @return |
82 | */ | 84 | */ |
85 | @ApiOperation(value="获取人员实时定位", notes="获取人员实时定位") | ||
83 | @GetMapping("/realTimeLocation") | 86 | @GetMapping("/realTimeLocation") |
84 | public Result<ThirdPosition> getRealTimeLocation(String deviceId) { | 87 | public Result<ThirdPosition> getRealTimeLocation(String deviceId) { |
85 | Result<ThirdPosition> result = new Result<ThirdPosition>(); | 88 | Result<ThirdPosition> result = new Result<ThirdPosition>(); |
... | @@ -93,6 +96,7 @@ public class ThirdController { | ... | @@ -93,6 +96,7 @@ public class ThirdController { |
93 | * 获取静态资源信息 | 96 | * 获取静态资源信息 |
94 | * @return | 97 | * @return |
95 | */ | 98 | */ |
99 | @ApiOperation(value="获取静态资源信息", notes="获取静态资源信息") | ||
96 | @GetMapping("/buildingAllInfo") | 100 | @GetMapping("/buildingAllInfo") |
97 | public Result<JSONObject> getBuildingAllInfo() { | 101 | public Result<JSONObject> getBuildingAllInfo() { |
98 | Result<JSONObject> result = new Result<JSONObject>(); | 102 | Result<JSONObject> result = new Result<JSONObject>(); |
... | @@ -108,6 +112,7 @@ public class ThirdController { | ... | @@ -108,6 +112,7 @@ public class ThirdController { |
108 | * @param deviceId | 112 | * @param deviceId |
109 | * @return | 113 | * @return |
110 | */ | 114 | */ |
115 | @ApiOperation(value="获取历史轨迹", notes="获取历史轨迹") | ||
111 | @GetMapping("/positionByDeviceId") | 116 | @GetMapping("/positionByDeviceId") |
112 | public Result<List<HistoryPoint>> getPositionByDeviceId(String deviceId, String startTime, String endTime) { | 117 | public Result<List<HistoryPoint>> getPositionByDeviceId(String deviceId, String startTime, String endTime) { |
113 | Result<List<HistoryPoint>> result = new Result<List<HistoryPoint>>(); | 118 | Result<List<HistoryPoint>> result = new Result<List<HistoryPoint>>(); |
... | @@ -121,6 +126,7 @@ public class ThirdController { | ... | @@ -121,6 +126,7 @@ public class ThirdController { |
121 | * 获取告警信息-最新 n 条 | 126 | * 获取告警信息-最新 n 条 |
122 | * @return | 127 | * @return |
123 | */ | 128 | */ |
129 | @ApiOperation(value="获取告警信息", notes="获取告警信息") | ||
124 | @GetMapping("/alarmListByCount") | 130 | @GetMapping("/alarmListByCount") |
125 | public Result<Object> getAlarmListByCount() { | 131 | public Result<Object> getAlarmListByCount() { |
126 | Result<Object> result = new Result<Object>(); | 132 | Result<Object> result = new Result<Object>(); |
... | @@ -135,6 +141,7 @@ public class ThirdController { | ... | @@ -135,6 +141,7 @@ public class ThirdController { |
135 | * 获取最近7天的告警统计数据 | 141 | * 获取最近7天的告警统计数据 |
136 | * @return | 142 | * @return |
137 | */ | 143 | */ |
144 | @ApiOperation(value="获取最近7天的告警统计数据", notes="获取最近7天的告警统计数据") | ||
138 | @GetMapping("/weekAlarmState") | 145 | @GetMapping("/weekAlarmState") |
139 | public Result<Object> getWeekAlarmState() { | 146 | public Result<Object> getWeekAlarmState() { |
140 | Result<Object> result = new Result<Object>(); | 147 | Result<Object> result = new Result<Object>(); |
... | @@ -149,10 +156,11 @@ public class ThirdController { | ... | @@ -149,10 +156,11 @@ public class ThirdController { |
149 | * 获取安全区域 | 156 | * 获取安全区域 |
150 | * @return | 157 | * @return |
151 | */ | 158 | */ |
159 | @ApiOperation(value="获取安全区域", notes="获取安全区域") | ||
152 | @GetMapping("/safeArea") | 160 | @GetMapping("/safeArea") |
153 | public Result<List<SafeArea>> getSafeArea() { | 161 | public Result<List<SafeArea>> getSafeArea() { |
154 | Result<List<SafeArea>> result = new Result<List<SafeArea>>(); | 162 | Result<List<SafeArea>> result = new Result<List<SafeArea>>(); |
155 | List<SafeArea> list = thirdService.getSafeArea(); | 163 | List<SafeArea> list = thirdService.getSafeAreaNew(); |
156 | result.setSuccess(true); | 164 | result.setSuccess(true); |
157 | result.setResult(list); | 165 | result.setResult(list); |
158 | return result; | 166 | return result; | ... | ... |
... | @@ -8,33 +8,21 @@ public class SafeArea { | ... | @@ -8,33 +8,21 @@ public class SafeArea { |
8 | 8 | ||
9 | /**主键*/ | 9 | /**主键*/ |
10 | private Integer id; | 10 | private Integer id; |
11 | /**设备ID*/ | ||
12 | private String deviceIds; | ||
13 | /**区域坐标*/ | 11 | /**区域坐标*/ |
14 | private String areas; | 12 | private String areas; |
15 | /**区域名称*/ | 13 | /**区域名称*/ |
16 | private String name; | 14 | private String name; |
17 | /**区域简介*/ | ||
18 | private String comment; | ||
19 | /**构筑物描述*/ | ||
20 | private Integer threshold; | ||
21 | /**项目编码*/ | 15 | /**项目编码*/ |
22 | private Integer buildingId; | 16 | private Integer buildingId; |
23 | /**楼层编码*/ | 17 | /**楼层编码*/ |
24 | private Integer floorId; | 18 | private Integer floorId; |
25 | /**报警类型*/ | 19 | /**区域简介*/ |
26 | private String alarmType; | 20 | private String mTypeDefine; |
27 | /**创建时间*/ | 21 | /**状态*/ |
28 | private String createTime; | 22 | private String isShow; |
29 | /** */ | 23 | /**类型*/ |
30 | private Integer isSwitch; | 24 | private Integer mType; |
31 | /** */ | 25 | /**区域颜色*/ |
32 | private Integer areaType; | 26 | private String bgColor; |
33 | /** */ | ||
34 | private Integer typeId; | ||
35 | /** */ | ||
36 | private String startTime; | ||
37 | /** */ | ||
38 | private String endTime; | ||
39 | 27 | ||
40 | } | 28 | } | ... | ... |
1 | package com.jkdata.entity; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | @Data | ||
6 | public class SafeAreaNew { | ||
7 | |||
8 | /**主键*/ | ||
9 | private Integer id; | ||
10 | /**区域坐标*/ | ||
11 | private String areas; | ||
12 | /**区域名称*/ | ||
13 | private String mName; | ||
14 | /**区域简介*/ | ||
15 | private String mTypeDefine; | ||
16 | /**状态*/ | ||
17 | private String isShow; | ||
18 | /**类型*/ | ||
19 | private Integer mType; | ||
20 | /**楼层编码*/ | ||
21 | private Integer floorId; | ||
22 | /**项目编码*/ | ||
23 | private Integer buildingId; | ||
24 | /**区域颜色*/ | ||
25 | private String bgColor; | ||
26 | /**创建时间*/ | ||
27 | private String createTime; | ||
28 | |||
29 | } |
... | @@ -23,4 +23,6 @@ public interface IThirdService { | ... | @@ -23,4 +23,6 @@ public interface IThirdService { |
23 | ThirdPosition getRealTimeLocation(String deviceId); | 23 | ThirdPosition getRealTimeLocation(String deviceId); |
24 | 24 | ||
25 | List<SafeArea> getSafeArea(); | 25 | List<SafeArea> getSafeArea(); |
26 | |||
27 | List<SafeArea> getSafeAreaNew(); | ||
26 | } | 28 | } | ... | ... |
... | @@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil; | ... | @@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil; |
4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
5 | import com.jkdata.entity.HistoryPoint; | 5 | import com.jkdata.entity.HistoryPoint; |
6 | import com.jkdata.entity.SafeArea; | 6 | import com.jkdata.entity.SafeArea; |
7 | import com.jkdata.entity.SafeAreaNew; | ||
7 | import com.jkdata.tool.*; | 8 | import com.jkdata.tool.*; |
8 | import com.jkdata.entity.ThirdPosition; | 9 | import com.jkdata.entity.ThirdPosition; |
9 | import com.jkdata.mapper.ThirdMapper; | 10 | import com.jkdata.mapper.ThirdMapper; |
... | @@ -216,5 +217,44 @@ public class IThirdServiceImpl implements IThirdService { | ... | @@ -216,5 +217,44 @@ public class IThirdServiceImpl implements IThirdService { |
216 | return list; | 217 | return list; |
217 | } | 218 | } |
218 | 219 | ||
220 | @Override | ||
221 | public List<SafeArea> getSafeAreaNew() { | ||
222 | List<SafeArea> list = new ArrayList<>(); | ||
223 | String get = getBuildingAllInfo(); | ||
224 | JSONObject json = JSONObject.parseObject(get); | ||
225 | Map jsonToMap = JSONObject.parseObject(json.toJSONString()); | ||
226 | JSONObject dataJson = JSONObject.parseObject(jsonToMap.get("data").toString()); | ||
227 | Map safeMap = JSONObject.parseObject(dataJson.toJSONString()); | ||
228 | List<SafeAreaNew> dataList = JSONObject.parseArray(safeMap.get("monitoringArea").toString(), SafeAreaNew.class); | ||
229 | for (SafeAreaNew safeAreaNew : dataList) { | ||
230 | SafeArea safeArea = new SafeArea(); | ||
231 | String areas = safeAreaNew.getAreas();//66&363,100&348,108&367,74&381 | ||
232 | List<String> arealist = Arrays.asList(areas.split(",")); | ||
233 | StringBuffer data = new StringBuffer(); | ||
234 | for (String area:arealist) { | ||
235 | String x1 = area.split("&")[0]; | ||
236 | String y1 = area.split("&")[1]; | ||
237 | Map<String,Double> map = new HashMap<>();//初始化 | ||
238 | if(safeAreaNew.getFloorId()==26){ | ||
239 | map = CoordinateUtil.changCoordinate("B2",x1,y1); | ||
240 | }else{ | ||
241 | map = CoordinateUtil.changCoordinate("B1",x1,y1); | ||
242 | } | ||
243 | data.append(String.valueOf(map.get("x"))+"&"+String.valueOf(map.get("y"))).append(","); | ||
244 | } | ||
245 | safeArea.setAreas(data.toString().substring(0,data.toString().length()-1)); | ||
246 | safeArea.setBuildingId(safeAreaNew.getBuildingId()); | ||
247 | safeArea.setId(safeAreaNew.getId()); | ||
248 | safeArea.setName(safeAreaNew.getMName()); | ||
249 | safeArea.setMTypeDefine(safeAreaNew.getMTypeDefine()); | ||
250 | safeArea.setBgColor(safeAreaNew.getBgColor()); | ||
251 | safeArea.setFloorId(safeAreaNew.getFloorId()); | ||
252 | safeArea.setIsShow(safeAreaNew.getIsShow()); | ||
253 | safeArea.setMType(safeAreaNew.getMType()); | ||
254 | list.add(safeArea); | ||
255 | } | ||
256 | return list; | ||
257 | } | ||
258 | |||
219 | 259 | ||
220 | } | 260 | } | ... | ... |
... | @@ -7,12 +7,12 @@ spring: | ... | @@ -7,12 +7,12 @@ spring: |
7 | datasource: | 7 | datasource: |
8 | druid: | 8 | druid: |
9 | driver-class-name: com.mysql.jdbc.Driver | 9 | driver-class-name: com.mysql.jdbc.Driver |
10 | # url: jdbc:mysql://115.28.25.233:6630/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false | 10 | url: jdbc:mysql://115.28.25.233:6630/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
11 | # username: jk_test | 11 | username: jk_test |
12 | # password: Jk_test1211rw | 12 | password: Jk_test1211rw |
13 | url: jdbc:mysql://127.0.0.1:13306/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false | 13 | # url: jdbc:mysql://127.0.0.1:13306/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
14 | username: root | 14 | # username: root |
15 | password: bkyh925. | 15 | # password: bkyh925. |
16 | 16 | ||
17 | redis: | 17 | redis: |
18 | port: 6379 | 18 | port: 6379 | ... | ... |
-
请 注册 或 登录 后发表评论