ソースを参照

统一地图标记和终端管理的返回格式

konghl 4 年 前
コミット
8c6e6b34db
共有18 個のファイルを変更した340 個の追加1105 個の削除を含む
  1. 46 202
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/DeviceManageController.java
  2. 5 72
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/EquipmentManageController.java
  3. 10 17
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/LocationManagementController.java
  4. 32 73
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/MapTagManageController.java
  5. 80 78
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/WorkEmployeeController.java
  6. 0 65
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/dao/impl/EquipmentManageDaoImpl.java
  7. 0 32
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/dao/interfaces/EquipmentManageDao.java
  8. 21 327
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/DeviceManageServiceImpl.java
  9. 51 113
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/EquipmentManageServiceImpl.java
  10. 17 21
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/LocationManagementServiceImpl.java
  11. 13 27
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/MapTagManageServiceImpl.java
  12. 19 8
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/WorkEmployeeServiceImpl.java
  13. 7 43
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/DeviceManageService.java
  14. 2 10
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/EquipmentManageService.java
  15. 8 5
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/LocationManagementService.java
  16. 8 7
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/MapTagManageService.java
  17. 15 2
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/WorkEmployeeService.java
  18. 6 3
      location-rescue-service/src/main/java/com/ai/bss/location/rescue/util/EbcConstant.java

+ 46 - 202
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/DeviceManageController.java

@ -1,19 +1,20 @@
1 1
package com.ai.bss.location.rescue.controller;
2 2
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.model.PageInfo;
6
import com.ai.bss.location.rescue.service.interfaces.DeviceManageService;
7
import com.ai.bss.location.rescue.util.EbcConstant;
8
import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
7 9
import org.springframework.beans.factory.annotation.Autowired;
8 10
import org.springframework.stereotype.Controller;
9 11
import org.springframework.web.bind.annotation.RequestBody;
10 12
import org.springframework.web.bind.annotation.RequestMapping;
11 13
import org.springframework.web.bind.annotation.ResponseBody;
12 14
13
import com.ai.abc.api.model.CommonRequest;
14
import com.ai.bss.location.rescue.service.interfaces.DeviceManageService;
15
import com.ai.bss.location.rescue.util.EbcConstant;
16
import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
17 18
18 19
/**
19 20
 * 终端管理
@ -33,7 +34,7 @@ public class DeviceManageController {
33 34
	 */
34 35
	@ResponseBody
35 36
	@RequestMapping("/queryPageDeviceInfo")
36
	public Map<String, Object> queryPageDeviceInfo(@RequestBody CommonRequest<Map<String, String>> request)
37
	public CommonResponse<PageInfo<Map<String, Object>>> queryPageDeviceInfo(@RequestBody CommonRequest<Map<String, String>> request)
37 38
			throws Exception {
38 39
		// 当前页数
39 40
		int pageNumber = request.getPageNumber() < 1 ? 1 : request.getPageNumber();
@ -42,9 +43,11 @@ public class DeviceManageController {
42 43
43 44
		Map<String, String> params = request.getData() == null ? new HashMap<String, String>() : request.getData();
44 45
45
		Map<String, Object> result = deviceManageService.queryPageDeviceInfo(params, pageNumber, pageSize);
46
		PageInfo<Map<String, Object>> resultPage = deviceManageService.queryPageDeviceInfo(params, pageNumber, pageSize);
46 47
47
		return result;
48
		CommonResponse<PageInfo<Map<String, Object>>> commonResponse=CommonResponse.ok(resultPage);
49
50
		return commonResponse;
48 51
	}
49 52
50 53
	/**
@ -53,13 +56,10 @@ public class DeviceManageController {
53 56
	 */
54 57
	@ResponseBody
55 58
	@RequestMapping("/queryDeviceTypeList")
56
	public Map<String, Object> queryDeviceTypeList() {
57
		Map<String, Object> result = new HashMap<String, Object>();
59
	public CommonResponse<List<Map<String,String>>> queryDeviceTypeList() {
58 60
		List<Map<String,String>> resultList = deviceManageService.queryDeviceTypeList();
59 61
60
		result.put("dataList", resultList);
61
62
		return result;
62
		return CommonResponse.ok(resultList);
63 63
	}
64 64
65 65
	/**
@ -71,19 +71,16 @@ public class DeviceManageController {
71 71
	 */
72 72
	@ResponseBody
73 73
	@RequestMapping("/queryOneDeviceInfo")
74
	public Map<String, Object> queryOneDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
75
		Map<String, Object> result = new HashMap<String, Object>();
76
74
	public CommonResponse<Map<String,Object>> queryOneDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
77 75
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
78
			result.put("result", false);
79
			result.put("errMsg", "操作失败");
80
			return result;
76
			return CommonResponse.fail("500","操作失败");
81 77
		}
82 78
83 79
		Map<String, Object> resultMap = deviceManageService.queryOneDeviceInfo(params);
84
		result.put("resultData", resultMap);
85
		result.put("result", true);
86
		return result;
80
81
		CommonResponse<Map<String,Object>> commonResponse=CommonResponse.ok(resultMap);
82
83
		return commonResponse;
87 84
	}
88 85
89 86
	/**
@ -95,25 +92,18 @@ public class DeviceManageController {
95 92
	 */
96 93
	@ResponseBody
97 94
	@RequestMapping("/addDeviceInfo")
98
	public Map<String, Object> addDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
99
		Map<String, Object> result = new HashMap<String, Object>();
100
95
	public CommonResponse<Void> addDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
101 96
		if (params == null || params.get("deviceNo") == null||"".equals(params.get("deviceNo"))) {
102
			result.put("result", false);
103
			result.put("errMsg", "添加失败");
104
			return result;
97
			return CommonResponse.fail("500","添加失败");
105 98
		}
106 99
107 100
		Map<String, Object> resultMap = deviceManageService.addDeviceInfo(params);
108 101
109 102
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(String.valueOf(resultMap.get("resultCode")))) {
110
			result.put("result", true);
103
			return CommonResponse.ok(null);
111 104
		} else {
112
			result.put("result", false);
113
			result.put("errMsg", "添加失败:" + resultMap.get("resultMsg"));
105
			return CommonResponse.fail("505","添加失败:" + resultMap.get("resultMsg"));
114 106
		}
115
116
		return result;
117 107
	}
118 108
119 109
	/**
@ -125,25 +115,18 @@ public class DeviceManageController {
125 115
	 */
126 116
	@ResponseBody
127 117
	@RequestMapping("/modifyDeviceInfo")
128
	public Map<String, Object> modifyDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
129
		Map<String, Object> result = new HashMap<String, Object>();
130
118
	public CommonResponse<Void> modifyDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
131 119
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
132
			result.put("result", false);
133
			result.put("errMsg", "修改失败");
134
			return result;
120
			return CommonResponse.fail("500","修改失败");
135 121
		}
136 122
137 123
		Map<String, Object> resultMap = deviceManageService.modifyDeviceInfo(params);
138 124
139 125
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(String.valueOf(resultMap.get("resultCode")))) {
140
			result.put("result", true);
126
			return CommonResponse.ok(null);
141 127
		} else {
142
			result.put("result", false);
143
			result.put("errMsg", "修改失败:" + resultMap.get("resultMsg"));
128
			return CommonResponse.fail("505","修改失败:" + resultMap.get("resultMsg"));
144 129
		}
145
146
		return result;
147 130
	}
148 131
149 132
	/**
@ -155,30 +138,22 @@ public class DeviceManageController {
155 138
	 */
156 139
	@ResponseBody
157 140
	@RequestMapping("/deleteDeviceInfo")
158
	public Map<String, Object> deleteDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
159
		Map<String, Object> result = new HashMap<String, Object>();
141
	public CommonResponse<Void> deleteDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
160 142
161 143
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
162
			result.put("result", false);
163
			result.put("errMsg", "删除失败");
164
			return result;
144
			return CommonResponse.fail("500","删除失败");
165 145
		}
166 146
167 147
		Map<String, Object> resultMap = deviceManageService.deleteDeviceInfo(params);
168 148
169
		if (resultMap != null
170
				&& NorthboundInterfaceConstant.resultCode_succeed.equals(String.valueOf(resultMap.get("resultCode")))) {
171
			result.put("result", true);
149
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(String.valueOf(resultMap.get("resultCode")))) {
150
			return CommonResponse.ok(null);
172 151
		} else {
173
			result.put("result", false);
174 152
			if ("只有注册或停用状态的设备才能删除!".equals(String.valueOf(resultMap.get("resultMsg")))){
175 153
				resultMap.put("resultMsg","终端已上传数据");
176 154
			}
177
178
			result.put("errMsg", "删除失败:" + resultMap.get("resultMsg"));
155
			return CommonResponse.fail("505","删除失败:" + resultMap.get("resultMsg"));
179 156
		}
180
181
		return result;
182 157
	}
183 158
184 159
	/**
@ -189,20 +164,16 @@ public class DeviceManageController {
189 164
	 */
190 165
	@ResponseBody
191 166
	@RequestMapping("/queryBindDeviceInfo")
192
	public Map<String, Object> queryBindDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
193
		Map<String, Object> result = new HashMap<String, Object>();
194
167
	public CommonResponse<Map<String,Object>> queryBindDeviceInfo(@RequestBody Map<String, String> params) throws Exception {
195 168
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
196
			result.put("result", false);
197
			result.put("errMsg", "获取绑定关系失败");
198
			return result;
169
			return CommonResponse.fail("500","获取绑定关系失败");
199 170
		}
200 171
201 172
		Map<String, Object> resultMap  = deviceManageService.queryBindDeviceInfo(params);
202 173
203
		result.put("resultData", resultMap);
204
		result.put("result", true);
205
		return result;
174
		CommonResponse<Map<String,Object>> commonResponse=CommonResponse.ok(resultMap);
175
176
		return commonResponse;
206 177
	}
207 178
	
208 179
	/**
@ -228,25 +199,13 @@ public class DeviceManageController {
228 199
	 */
229 200
	@ResponseBody
230 201
	@RequestMapping("/bindDevice")
231
	public Map<String, Object> bindDevice(@RequestBody Map<String, String> params) throws Exception {
232
		Map<String, Object> result = new HashMap<String, Object>();
202
	public CommonResponse<Void> bindDevice(@RequestBody Map<String, String> params) throws Exception {
233 203
234 204
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
235
			result.put("result", false);
236
			result.put("errMsg", "关联终端失败");
237
			return result;
238
		}
239
240
		boolean resultFlag = deviceManageService.bindDevice(params);
241
242
		if (resultFlag) {
243
			result.put("result", true);
244
		} else {
245
			result.put("result", false);
246
			result.put("errMsg", "关联终端失败");
205
			return CommonResponse.fail("500","关联终端失败");
247 206
		}
248 207
249
		return result;
208
		return deviceManageService.bindDevice(params);
250 209
	}
251 210
	
252 211
	/**
@ -257,128 +216,13 @@ public class DeviceManageController {
257 216
	 */
258 217
	@ResponseBody
259 218
	@RequestMapping("/unbindDevice")
260
	public Map<String, Object> unbindDevice(@RequestBody Map<String, String> params) throws Exception {
261
		Map<String, Object> result = new HashMap<String, Object>();
219
	public CommonResponse<Void> unbindDevice(@RequestBody Map<String, String> params) throws Exception {
262 220
263 221
		if (params == null || params.get("deviceId") == null||"".equals(params.get("deviceId"))) {
264
			result.put("result", false);
265
			result.put("errMsg", "关联终端失败");
266
			return result;
267
		}
268
269
		boolean resultFlag = deviceManageService.unbindDevice(params);
270
271
		if (resultFlag) {
272
			result.put("result", true);
273
		} else {
274
			result.put("result", false);
275
			result.put("errMsg", "关联终端失败");
222
			return CommonResponse.fail("500","解绑终端失败");
276 223
		}
277 224
278
		return result;
225
		return deviceManageService.unbindDevice(params);
279 226
	}
280 227
281
	
282
283
	/**
284
	 * 获取下拉列表的终端信息
285
	 * 
286
	 * @param params
287
	 * @return
288
	 * @throws Exception
289
	 */
290
	/*
291
	@ResponseBody
292
	@RequestMapping("/queryListDeviceInfo")
293
	public Map<String, Object> queryListDeviceInfo(Map<String, Object> params) throws Exception {
294
	Map<String, Object> result = new HashMap<String, Object>();
295
	
296
	// 当前页数
297
	int pageNum = 1;
298
	// 每页条数
299
	int pageSize = EbcConstant.COMBOBOX_MAXNUM;
300
	
301
	List<Map<String, String>> resultList = deviceManageService.queryListDeviceInfo(params, pageNum, pageSize);
302
	result.put("dataList", resultList);
303
	return result;
304
	}
305
	
306
	*//**
307
		* 验证用户或者船舶是否有终端关联
308
		*/
309
	/*
310
	@ResponseBody
311
	@RequestMapping("/verifyUserOrBoatAssociatInfo")
312
	public Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception {
313
	Map<String, Object> associatMap = deviceManageService.verifyUserOrBoatAssociatInfo(params);
314
	Map<String, Object> result = new HashMap<String, Object>();
315
	result.put("result", associatMap);
316
	return result;
317
	}
318
	
319
	*//**
320
		* 获取当前终端最新定位信息
321
		* 
322
		* @param params
323
		* @return
324
		* @throws Exception
325
		*/
326
	/*
327
	@ResponseBody
328
	@RequestMapping("/queryCurrentDeviceLocationInfo")
329
	public Map<String, Object> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception {
330
	Map<String, Object> result = new HashMap<String, Object>();
331
	
332
	List<Map<String, String>> resultList = deviceManageService.queryCurrentDeviceLocationInfo(params);
333
	result.put("dataList", resultList);
334
	return result;
335
	}
336
	
337
	*//**
338
		* 按时间段获取终端的定位信息(轨迹回放)
339
		* 
340
		* @param params
341
		* @return
342
		* @throws Exception
343
		*/
344
	/*
345
	@ResponseBody
346
	@RequestMapping("/queryOneDeviceLocationInfo")
347
	public Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params) throws Exception {
348
	Map<String, Object> result = new HashMap<String, Object>();
349
	
350
	if (params == null || params.get("deviceId") == null || params.get("timeType") == null) {
351
		result.put("result", false);
352
		result.put("errMsg", "查询失败");
353
		return result;
354
	}
355
	
356
	// 当前页数
357
	// int pageNum = Integer.parseInt(params.get("pageNum") < 1 ? 1 : Integer.parseInt(params.get("pageNum");
358
	// 每页条数
359
	// int pageSize = Integer.parseInt(params.get("pageSize") < 1 ? EbcConstant.default_page_size : Integer.parseInt(params.get("pageSize");
360
	
361
	// 当前页数
362
	int pageNum = Integer.parseInt(String.valueOf(params.get("pageNum")));
363
	// 每页条数
364
	int pageSize = Integer.parseInt(String.valueOf(params.get("pageSize")));
365
	
366
	result = deviceManageService.queryOneDeviceLocationInfo(params, pageNum, pageSize);
367
	return result;
368
	}
369
	
370
	*//**
371
		* 导入终端信息
372
		*//*
373
			@ResponseBody
374
			@RequestMapping("/importDeviceInfo")
375
			public Map<String, Object> importDeviceInfo(Map<String, Object> params) throws Exception {
376
			boolean flag = false;
377
			if (Integer.parseInt(String.valueOf(params.get("MAP_TAG_ID"))) != 0) {
378
				// flag= userManageService.importUserInfo(params);
379
			}
380
			Map<String, Object> result = new HashMap<String, Object>();
381
			result.put("result", flag);
382
			return result;
383
			}*/
384 228
}

+ 5 - 72
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/EquipmentManageController.java

@ -52,45 +52,6 @@ public class EquipmentManageController {
52 52
	}
53 53
54 54
	/**
55
	 * 查询单个设备信息
56
	 * 
57
	 * @param params
58
	 * @return
59
	 * @throws Exception
60
	 */
61
	@ResponseBody
62
	@RequestMapping("/queryOneEquipmentInfo")
63
	public Map<String, Object> queryOneEquipmentInfo(Map<String, Object> params) throws Exception {
64
		Map<String, Object> result = new HashMap<String, Object>();
65
66
		if (params == null || params.get("FACILITY_ID") == null) {
67
			result.put("result", false);
68
			result.put("errMsg", "操作失败");
69
			return result;
70
		}
71
72
		Map<String, Object> resultMap = equipmentManageService.queryOneEquipmentInfo(params);
73
		result.put("resultData", resultMap);
74
		return result;
75
	}
76
77
	/**
78
	 * 查询设备信息增加时效验重复
79
	 */
80
	@ResponseBody
81
	@RequestMapping("/verifyEquipmentInfoRepetition")
82
	public Map<String, Object> verifyEquipmentInfoRepetition(Map<String, Object> params) throws Exception {
83
		Map<String, Object> equipmentMap = equipmentManageService.verifyEquipmentInfoRepetition(params);
84
		Map<String, Object> result = new HashMap<String, Object>();
85
		if (equipmentMap == null || equipmentMap.isEmpty()) {
86
			result.put("result", false);
87
		} else {
88
			result.put("result", true);
89
		}
90
		return result;
91
	}
92
93
	/**
94 55
	 * 编辑设备信息
95 56
	 */
96 57
	@ResponseBody
@ -132,46 +93,18 @@ public class EquipmentManageController {
132 93
	}
133 94
134 95
	/**
135
	 * 批量刪除删除设备信息
136
	 */
137
	@ResponseBody
138
	@RequestMapping("/deleteEquipmentsInfo")
139
	public Map<String, Object> deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception {
140
		boolean flag = false;
141
		if (!paramsList.isEmpty()) {
142
			flag = equipmentManageService.deleteEquipmentsInfo(paramsList);
143
		}
144
		Map<String, Object> result = new HashMap<String, Object>();
145
		result.put("result", flag);
146
		return result;
147
	}
148
149
	/**
150
	 * 获取所有设备信息(必须具有经纬度)
96
	 * 获取所有未绑定的设备
151 97
	 */
152 98
	@ResponseBody
153
	@RequestMapping("/queryAllEquipmentInfo")
154
	public Map<String, Object> queryAllEquipmentInfo(Map<String, Object> params) throws Exception {
99
	@RequestMapping("/queryAllEquipmentNotBind")
100
	public Map<String, Object> queryAllEquipmentNotBind() throws Exception {
155 101
		Map<String, Object> result = new HashMap<String, Object>();
156 102
157
		List<Map<String, Object>> resultList = equipmentManageService.queryCurrentEquipmentLocationInfo(params);
103
		List<Map<String, Object>> resultList = equipmentManageService.queryAllEquipmentNotBind();
158 104
		result.put("dataList", resultList);
159 105
		return result;
160 106
	}
161 107
162
	/**
163
	 * 导入设备信息
164
	 */
165
	@ResponseBody
166
	@RequestMapping("/importEquipmentsInfo")
167
	public Map<String, Object> importEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception {
168
		boolean flag = false;
169
		if (!paramsList.isEmpty()) {
170
			flag = equipmentManageService.importEquipmentInfo(paramsList);
171
		}
172
		Map<String, Object> result = new HashMap<String, Object>();
173
		result.put("result", flag);
174
		return result;
175
	}
108
176 109
177 110
}

+ 10 - 17
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/LocationManagementController.java

@ -1,9 +1,9 @@
1 1
package com.ai.bss.location.rescue.controller;
2 2
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
3
import com.ai.abc.api.model.CommonResponse;
4
import com.ai.bss.location.rescue.service.impl.LocationManagementServiceImpl;
5
import com.ai.bss.location.rescue.util.MirrorSendDateUtil;
6
import com.ai.bss.position.service.api.outparam.LoadMapViewParam;
7 7
import org.springframework.beans.factory.annotation.Autowired;
8 8
import org.springframework.stereotype.Controller;
9 9
import org.springframework.web.bind.annotation.RequestBody;
@ -11,10 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
11 11
import org.springframework.web.bind.annotation.RequestMethod;
12 12
import org.springframework.web.bind.annotation.ResponseBody;
13 13
14
import com.ai.bss.location.rescue.service.impl.LocationManagementServiceImpl;
15
import com.ai.bss.location.rescue.util.MirrorSendDateUtil;
16
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
17
18 14
/**
19 15
 * 人员定位管理
20 16
 * @author konghl@asiainfo.com
@ -41,19 +37,16 @@ public class LocationManagementController {
41 37
		return msg;
42 38
	}
43 39
40
44 41
	/**
45
	 * 获取已绑定终端的人员列表
42
	 * 初始化人员定位页面的数据
46 43
	 * @return
44
	 * @throws Exception
47 45
	 */
48 46
	@ResponseBody
49
	@RequestMapping("/queryEmployeeBindDeviceList")
50
	public Map<String, Object> queryEmployeeBindDeviceList() {
51
		Map<String, Object> result = new HashMap<String, Object>();
52
		List<EmployeeTerminalRelaDto> resultList = locationManagementServiceImpl.queryEmployeeBindDeviceList();
53
54
		result.put("dataList", resultList);
55
56
		return result;
47
	@RequestMapping("/loadMapLocationView")
48
	public CommonResponse<LoadMapViewParam> loadMapLocationView() throws Exception {
49
		return locationManagementServiceImpl.loadMapLocationView();
57 50
	}
58 51
59 52
}

+ 32 - 73
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/MapTagManageController.java

@ -1,23 +1,21 @@
1 1
package com.ai.bss.location.rescue.controller;
2 2
3
import java.util.ArrayList;
4
import java.util.HashMap;
5
import java.util.List;
6
import java.util.Map;
7
8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.model.PageBean;
6
import com.ai.bss.location.rescue.service.interfaces.MapTagManageService;
7
import com.ai.bss.location.rescue.util.EbcConstant;
8
import com.ai.bss.worker.model.MapTagInfoDto;
10 9
import org.springframework.beans.factory.annotation.Autowired;
11 10
import org.springframework.stereotype.Controller;
12 11
import org.springframework.web.bind.annotation.RequestBody;
13 12
import org.springframework.web.bind.annotation.RequestMapping;
14 13
import org.springframework.web.bind.annotation.ResponseBody;
15 14
16
import com.ai.abc.api.model.CommonRequest;
17
import com.ai.bss.components.common.model.PageBean;
18
import com.ai.bss.location.rescue.service.interfaces.MapTagManageService;
19
import com.ai.bss.location.rescue.util.EbcConstant;
20
import com.ai.bss.worker.model.MapTagInfoDto;
15
import java.util.ArrayList;
16
import java.util.HashMap;
17
import java.util.List;
18
import java.util.Map;
21 19
22 20
/**
23 21
 * 地图标记
@ -25,9 +23,6 @@ import com.ai.bss.worker.model.MapTagInfoDto;
25 23
@Controller
26 24
@RequestMapping("/mapTag")
27 25
public class MapTagManageController {
28
29
    Logger logger = LoggerFactory.getLogger(MapTagManageController.class);
30
31 26
    @Autowired
32 27
    MapTagManageService mapTagManageService;
33 28
@ -40,34 +35,26 @@ public class MapTagManageController {
40 35
     */
41 36
    @ResponseBody
42 37
    @RequestMapping("/queryPageMapTagInfo")
43
    public PageBean<Map<String, Object>> queryPageMapTagInfo(@RequestBody CommonRequest<Map<String, String>> request) throws Exception {
44
38
    public CommonResponse<PageBean<Map<String, Object>>> queryPageMapTagInfo(@RequestBody CommonRequest<Map<String, String>> request) throws Exception {
45 39
        // 当前页数
46 40
        int pageNumber = request.getPageNumber() < 1 ? 1 : request.getPageNumber();
47 41
        // 每页条数
48 42
        int pageSize = request.getPageSize() < 1 ? EbcConstant.DEFAULT_PAGE_SIZE : request.getPageSize();
49 43
50
        PageBean<Map<String, Object>> result = mapTagManageService.queryPageMapTagInfo(request.getData(), pageNumber, pageSize);
51
52
        return result;
44
        return mapTagManageService.queryPageMapTagInfo(request.getData(), pageNumber, pageSize);
53 45
    }
54 46
55 47
    /**
56
     * 获取所有围栏信息
48
     * 按部门查询所有围栏信息
57 49
     *
58 50
     * @param params
59 51
     * @return
60 52
     * @throws Exception
61 53
     */
62 54
    @ResponseBody
63
    @RequestMapping("/queryAllMapTagInfo")
64
    public Map<String, Object> queryAllMapTagInfo(@RequestBody Map<String, String> params) throws Exception {
65
        Map<String, Object> result = new HashMap<String, Object>();
66
67
        List<Map<String, Object>> resultList = mapTagManageService.queryListMapTagInfo(params);
68
        result.put("dataList", resultList);
69
        result.put("result", true);
70
        return result;
55
    @RequestMapping("/queryAllMapTagByOrg")
56
    public CommonResponse<List<Map<String, Object>>> queryAllMapTagByOrg(@RequestBody Map<String, String> params) throws Exception {
57
        return mapTagManageService.queryAllMapTagByOrg(params);
71 58
    }
72 59
73 60
    /**
@ -79,26 +66,14 @@ public class MapTagManageController {
79 66
     */
80 67
    @ResponseBody
81 68
    @RequestMapping("/queryOneMapTagInfo")
82
    public Map<String, Object> queryOneMapTagInfo(@RequestBody Map<String, String> params) throws Exception {
69
    public CommonResponse<List<Map<String, Object>>> queryOneMapTagInfo(@RequestBody Map<String, String> params) throws Exception {
83 70
        Map<String, Object> result = new HashMap<String, Object>();
84 71
85 72
        if (params == null || params.get("mapTagId") == null) {
86
            result.put("result", false);
87
            result.put("errMsg", "操作失败");
88
            return result;
73
            return CommonResponse.fail("500","操作失败");
89 74
        }
90 75
91
        Map<String, Object> resultMap = mapTagManageService.queryOneMapTagInfo(params);
92
93
        if (resultMap == null) {
94
            result.put("errMsg", "操作失败:标记不存在");
95
            result.put("result", false);
96
        } else {
97
            result.put("resultData", resultMap);
98
            result.put("result", true);
99
        }
100
101
        return result;
76
        return mapTagManageService.queryOneMapTagInfo(params);
102 77
    }
103 78
104 79
    /**
@ -108,13 +83,12 @@ public class MapTagManageController {
108 83
     */
109 84
    @ResponseBody
110 85
    @RequestMapping("/queryMapAreaTypeList")
111
    public Map<String, Object> queryMapAreaTypeList() {
112
        Map<String, Object> result = new HashMap<String, Object>();
86
    public CommonResponse<List<Map<String, String>>> queryMapAreaTypeList() {
113 87
        List<Map<String, String>> resultList = mapTagManageService.queryMapAreaTypeList();
114 88
115
        result.put("dataList", resultList);
89
        CommonResponse<List<Map<String,String>>> commonResponse=CommonResponse.ok(resultList);
116 90
117
        return result;
91
        return commonResponse;
118 92
    }
119 93
120 94
    /**
@ -126,19 +100,14 @@ public class MapTagManageController {
126 100
     */
127 101
    @ResponseBody
128 102
    @RequestMapping("/addMapTagInfo")
129
    public Map<String, Object> addMapTagInfo(@RequestBody MapTagInfoDto mapTagInfoDto) throws Exception {
103
    public CommonResponse<Void> addMapTagInfo(@RequestBody MapTagInfoDto mapTagInfoDto) throws Exception {
130 104
        Map<String, Object> result = new HashMap<String, Object>();
131 105
132 106
        if (mapTagInfoDto == null || mapTagInfoDto.getMapAreaName() == null || mapTagInfoDto.getMapAreaContent() == null) {
133
            result.put("result", false);
134
            result.put("errMsg", "添加失败");
135
            return result;
107
            return CommonResponse.fail("500","添加失败");
136 108
        }
137 109
138
        boolean resultFlag = mapTagManageService.addMapTagInfo(mapTagInfoDto);
139
        result.put("result", true);
140
        result.put("data", resultFlag);
141
        return result;
110
        return mapTagManageService.addMapTagInfo(mapTagInfoDto);
142 111
    }
143 112
144 113
    /**
@ -150,18 +119,14 @@ public class MapTagManageController {
150 119
     */
151 120
    @ResponseBody
152 121
    @RequestMapping("/modifyMapTagInfo")
153
    public Map<String, Object> modifyMapTagInfo(@RequestBody MapTagInfoDto mapTagInfoDto) throws Exception {
122
    public CommonResponse<Void> modifyMapTagInfo(@RequestBody MapTagInfoDto mapTagInfoDto) throws Exception {
154 123
        Map<String, Object> result = new HashMap<String, Object>();
155 124
156 125
        if (mapTagInfoDto == null || mapTagInfoDto.getMapAreaName() == null || mapTagInfoDto.getMapAreaId() == null || mapTagInfoDto.getMapAreaContent() == null) {
157
            result.put("result", false);
158
            result.put("errMsg", "修改失败");
159
            return result;
126
            return CommonResponse.fail("500","修改失败");
160 127
        }
161 128
162
        boolean resultFlag = mapTagManageService.modifyMapTagInfo(mapTagInfoDto);
163
        result.put("result", resultFlag);
164
        return result;
129
        return mapTagManageService.modifyMapTagInfo(mapTagInfoDto);
165 130
    }
166 131
167 132
    /**
@ -173,13 +138,11 @@ public class MapTagManageController {
173 138
     */
174 139
    @ResponseBody
175 140
    @RequestMapping("/deleteMapTagInfo")
176
    public Map<String, Object> deleteMapTagInfo(@RequestBody Map<String, Object> params) throws Exception {
141
    public CommonResponse<Void> deleteMapTagInfo(@RequestBody Map<String, Object> params) throws Exception {
177 142
        Map<String, Object> result = new HashMap<String, Object>();
178 143
179 144
        if (params == null || params.get("mapTagIds") == null) {
180
            result.put("result", false);
181
            result.put("errMsg", "删除失败:标记无效");
182
            return result;
145
            return CommonResponse.fail("500","删除失败");
183 146
        }
184 147
185 148
        List<String> mapTagIdsList = null;
@ -189,14 +152,10 @@ public class MapTagManageController {
189 152
            mapTagIdsList = new ArrayList<String>();
190 153
            mapTagIdsList.add((String) params.get("mapTagIds"));
191 154
        } else {
192
            result.put("result", false);
193
            result.put("errMsg", "删除失败:标记类型错误");
194
            return result;
155
            return CommonResponse.fail("501","删除失败:标记类型错误");
195 156
        }
196 157
197
        boolean resultFlag = mapTagManageService.deleteMapTagInfo(mapTagIdsList);
198
        result.put("result", resultFlag);
199
        return result;
158
        return  mapTagManageService.deleteMapTagInfo(mapTagIdsList);
200 159
    }
201 160
202 161
}

+ 80 - 78
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/WorkEmployeeController.java

@ -1,22 +1,22 @@
1 1
package com.ai.bss.location.rescue.controller;
2 2
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.RequestBody;
10
import org.springframework.web.bind.annotation.RequestMapping;
11
import org.springframework.web.bind.annotation.ResponseBody;
12
13 3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
14 5
import com.ai.bss.components.common.constant.CommonConstant;
15 6
import com.ai.bss.components.common.model.PageBean;
16 7
import com.ai.bss.location.rescue.service.interfaces.WorkEmployeeService;
17 8
import com.ai.bss.person.model.Organization;
18 9
import com.ai.bss.user.dto.EmployeeDto;
19 10
import com.ai.bss.user.dto.UserDto;
11
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.stereotype.Controller;
14
import org.springframework.web.bind.annotation.RequestBody;
15
import org.springframework.web.bind.annotation.RequestMapping;
16
import org.springframework.web.bind.annotation.ResponseBody;
17
18
import java.util.List;
19
import java.util.Map;
20 20
21 21
/**
22 22
 * 用户信息
@ -25,15 +25,15 @@ import com.ai.bss.user.dto.UserDto;
25 25
@RequestMapping("/workEmployee")
26 26
public class WorkEmployeeController {
27 27
28
	@Autowired
29
	WorkEmployeeService userManageService;
28
    @Autowired
29
    WorkEmployeeService userManageService;
30 30
31
	/**
32
	 * 分页查询用户信息
33
	 */
34
	@ResponseBody
35
	@RequestMapping("/queryWorkEmployee")
36
	public PageBean<UserDto> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request) throws Exception {
31
    /**
32
     * 分页查询用户信息
33
     */
34
    @ResponseBody
35
    @RequestMapping("/queryWorkEmployee")
36
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request) throws Exception {
37 37
		/*UserDto userDto = new UserDto();
38 38
		userDto.setOrgId(params.get("orgId"));
39 39
		userDto.setCode(params.get("code"));
@ -48,65 +48,67 @@ public class WorkEmployeeController {
48 48
49 49
		CommonRequest<UserDto> request=new CommonRequest<UserDto>(userDto, pageNumber, pageSize);
50 50
*/
51
		//CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
52
53
		// TODO 组织编码
54
		request.getData().setOrgCode("0000");
55
56
		PageBean<UserDto> userList = userManageService.queryWorkEmployee(request);
57
		return userList;
58
	}
59
60
	/**
61
	 * 查询部门列表
62
	 */
63
	@ResponseBody
64
	@RequestMapping("/queryAllOrganize")
65
	public List<Organization> queryAllOrganize() throws Exception {
66
		Organization organize = new Organization();
67
		//1:只查有效的;0:查全部的
68
		organize.setDataStatus(CommonConstant.STATUS_NORMAL_STR);
69
70
		CommonRequest<Organization> params = CommonRequest.<Organization>builder().data(organize).build();
71
72
		List<Organization> allOrgList=userManageService.queryAllOrganize(params);
73
74
		return allOrgList;
75
	}
76
77
	/**
78
	 * 获取职务下拉列表
79
	 * @return
80
	 */
81
	@ResponseBody
82
	@RequestMapping("/queryJobPositionList")
83
	public Map<String, Object> queryJobPositionList() throws Exception {
84
		Map<String, Object> result = new HashMap<String, Object>();
85
		List<Map<String,String>> resultList = userManageService.queryJobPositionList();
86
87
		result.put("dataList", resultList);
88
89
		return result;
90
	}
91
	
92
	/**
93
	 * 增加用户信息
94
	 */
95
	@ResponseBody
96
	@RequestMapping("/createWorkEmployee")
97
	public boolean createWorkEmployee(@RequestBody EmployeeDto employeeDto ) throws Exception {
98
		boolean result = userManageService.createWorkEmployee(employeeDto);
99
		return result;
100
	}
101
102
	/**
103
	 * 删除用户信息
104
	 */
105
	@ResponseBody
106
	@RequestMapping("/deleteWorkEmployee")
107
	public boolean deleteWorkEmployee(@RequestBody List<EmployeeDto> employeeDtoList) throws Exception {
108
		boolean result = userManageService.deleteWorkEmployee(employeeDtoList);
109
		return result;
110
	}
51
        //CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
52
53
        return userManageService.queryWorkEmployee(request);
54
    }
55
56
    /**
57
     * 查询部门列表
58
     */
59
    @ResponseBody
60
    @RequestMapping("/queryAllOrganize")
61
    public CommonResponse<List<Organization>> queryAllOrganize() throws Exception {
62
        Organization organize = new Organization();
63
        //1:只查有效的;0:查全部的
64
        organize.setDataStatus(CommonConstant.STATUS_NORMAL_STR);
65
66
        CommonRequest<Organization> params = CommonRequest.<Organization>builder().data(organize).build();
67
68
        return userManageService.queryAllOrganize(params);
69
    }
70
71
    /**
72
     * 获取职务下拉列表
73
     *
74
     * @return
75
     */
76
    @ResponseBody
77
    @RequestMapping("/queryJobPositionList")
78
    public CommonResponse<List<Map<String, String>>> queryJobPositionList() throws Exception {
79
        List<Map<String, String>> resultList = userManageService.queryJobPositionList();
80
        return CommonResponse.ok(resultList);
81
    }
82
83
    /**
84
     * 增加用户信息
85
     */
86
    @ResponseBody
87
    @RequestMapping("/createWorkEmployee")
88
    public boolean createWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
89
        boolean result = userManageService.createWorkEmployee(employeeDto);
90
        return result;
91
    }
92
93
    /**
94
     * 删除用户信息
95
     */
96
    @ResponseBody
97
    @RequestMapping("/deleteWorkEmployee")
98
    public boolean deleteWorkEmployee(@RequestBody List<EmployeeDto> employeeDtoList) throws Exception {
99
        boolean result = userManageService.deleteWorkEmployee(employeeDtoList);
100
        return result;
101
    }
102
103
    /**
104
     * 获取已绑定终端的人员列表
105
     *
106
     * @return
107
     */
108
    @ResponseBody
109
    @RequestMapping("/queryEmployeeBindDeviceList")
110
    public CommonResponse<List<EmployeeTerminalRelaDto>> queryEmployeeBindDeviceList() {
111
        return userManageService.queryEmployeeBindDeviceList();
112
    }
111 113
112 114
}

+ 0 - 65
location-rescue-service/src/main/java/com/ai/bss/location/rescue/dao/impl/EquipmentManageDaoImpl.java

@ -1,65 +0,0 @@
1
package com.ai.bss.location.rescue.dao.impl;
2
3
4
import java.util.List;
5
import java.util.Map;
6
7
import org.springframework.stereotype.Component;
8
9
import com.ai.bss.location.rescue.dao.interfaces.EquipmentManageDao;
10
import com.github.pagehelper.PageInfo;
11
12
@Component
13
public class EquipmentManageDaoImpl implements EquipmentManageDao {
14
15
    public static String connName = "ebc";
16
    private String equipmentTableName = "LR_FACILITY"; //设施表
17
18
19
    @Override
20
    public PageInfo queryEquipmentInfo(Map<String,Object> params) throws Exception {
21
        return null;
22
    }
23
24
    @Override
25
	public Map<String, Object> queryOneEquipmentInfo(Map<String,Object> params) throws Exception{
26
        return null;
27
	}
28
    
29
    @Override
30
    public int modifyEquipmentInfo (Map<String,Object> params) throws Exception {
31
        return 0;
32
    }
33
34
    @Override
35
    public int addEquipmentInfo(Map<String,Object> params) throws Exception {
36
        return 0;
37
    }
38
39
    @Override
40
    public boolean deleteEquipmentInfo(Map<String,Object> params) throws Exception {
41
42
        return false;
43
    }
44
45
    @Override
46
    public boolean deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception{
47
        return false;
48
    }
49
50
    @Override
51
    public boolean importEquipmentInfo(List<Map<String, Object>> paramsList) throws Exception{
52
        return false;
53
    }
54
55
    @Override
56
	public List<Map<String, Object>> queryAllEquipmentInfo(Map<String,Object> params) throws Exception {
57
        return null;
58
	}
59
    
60
    @Override
61
    public Map<String, Object> verifyEquipmentInfoRepetition(Map<String,Object> params) throws Exception {
62
        return null;
63
    }
64
65
}

+ 0 - 32
location-rescue-service/src/main/java/com/ai/bss/location/rescue/dao/interfaces/EquipmentManageDao.java

@ -1,32 +0,0 @@
1
package com.ai.bss.location.rescue.dao.interfaces;
2
3
import java.util.List;
4
import java.util.Map;
5
6
import com.ai.abc.api.model.CommonRequest;
7
import com.ai.abc.api.model.CommonResponse;
8
import com.ai.bss.work.tool.model.ResourceTool;
9
import com.github.pagehelper.PageInfo;
10
11
public interface EquipmentManageDao {
12
13
    PageInfo queryEquipmentInfo(Map<String,Object> params) throws Exception;
14
    
15
    Map<String, Object> queryOneEquipmentInfo(Map<String,Object> params) throws Exception;
16
17
    int modifyEquipmentInfo(Map<String,Object> params) throws Exception;
18
19
    int addEquipmentInfo(Map<String,Object> params) throws Exception;
20
21
    boolean deleteEquipmentInfo(Map<String,Object> params) throws Exception;
22
23
    boolean deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception;
24
25
    boolean importEquipmentInfo(List<Map<String, Object>> paramsList) throws Exception;
26
    
27
    List<Map<String, Object>> queryAllEquipmentInfo(Map<String,Object> params) throws Exception;
28
29
    Map<String, Object> verifyEquipmentInfoRepetition(Map<String,Object> params) throws Exception;
30
31
32
}

+ 21 - 327
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/DeviceManageServiceImpl.java

@ -1,16 +1,5 @@
1 1
package com.ai.bss.location.rescue.service.impl;
2 2
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.HashMap;
6
import java.util.List;
7
import java.util.Map;
8
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.stereotype.Service;
13
14 3
import com.ai.abc.api.model.CommonRequest;
15 4
import com.ai.abc.api.model.CommonResponse;
16 5
import com.ai.bss.characteristic.spec.model.CharacteristicSpec;
@ -32,6 +21,12 @@ import com.ai.bss.worker.service.api.EmployeeTerminalRelaCommand;
32 21
import com.ai.bss.worker.service.api.EmployeeTerminalRelaQuery;
33 22
import com.alibaba.fastjson.JSON;
34 23
import com.alibaba.fastjson.JSONObject;
24
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
26
import org.springframework.beans.factory.annotation.Autowired;
27
import org.springframework.stereotype.Service;
28
29
import java.util.*;
35 30
36 31
@Service
37 32
public class DeviceManageServiceImpl implements DeviceManageService {
@ -60,7 +55,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
60 55
61 56
62 57
    @Override
63
    public Map<String, Object> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize)
58
    public PageInfo<Map<String, Object>> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize)
64 59
            throws Exception {
65 60
        String isBindDevice = String.valueOf(params.get("IsBindDevice"));// 是否绑定终端
66 61
        boolean bindDeviceBoolean = EbcConstant.BIND_DEVICE_OK.equals(isBindDevice);
@ -83,7 +78,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
83 78
        if (null == params.get("deviceTypeId") || "".equals(params.get("deviceTypeId"))) {
84 79
            if (null == deviceTypeList || deviceTypeList.isEmpty()) {
85 80
                //如果没有终端类型,则返回为空
86
                return new HashMap<String, Object>();
81
                return new PageInfo<Map<String, Object>>();
87 82
            }
88 83
89 84
            for (Map<String, String> deviceTypeMap : deviceTypeList) {
@ -140,7 +135,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
140 135
        List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoListMap.get("result")), Map.class);
141 136
142 137
        // 整理返回数据信息
143
        List<Map> resultList = new ArrayList<Map>();
138
        List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
144 139
        if (deviceInfoList != null && deviceInfoList.size() > 0) {
145 140
            if (!bindDeviceBoolean && !unBindDeviceBoolean) {
146 141
                //绑定和不绑定都需要查询时:根据设备分页查询结果进行查询绑定关系
@ -212,9 +207,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
212 207
        }
213 208
214 209
        // 返回数据
215
        Map<String, Object> result = new HashMap<String, Object>();
216
        result.put("dataNum", deviceInfoListMap.get("totalResultNumber"));
217
        result.put("dataList", resultList);
210
        PageInfo<Map<String, Object>> result = new PageInfo<Map<String, Object>>(Integer.valueOf(String.valueOf(deviceInfoListMap.get("totalResultNumber"))), resultList);
218 211
        return result;
219 212
    }
220 213
@ -302,7 +295,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
302 295
    @Override
303 296
    public Map<String, Object> deleteDeviceInfo(Map<String, String> params) throws Exception {
304 297
        Map<String, Object> resultMap = null;
305
        if (unbindDevice(params)) {
298
        if (unbindDevice(params).isSuccess()) {
306 299
            // 调用北向接口
307 300
            String url = NorthboundInterfaceConstant.deleteDevice + params.get("deviceId");
308 301
            resultMap = northboundInterfaceUtil.iotGetCallUtil(url);
@ -312,9 +305,9 @@ public class DeviceManageServiceImpl implements DeviceManageService {
312 305
    }
313 306
314 307
    @Override
315
    public boolean bindDevice(Map<String, String> params) throws Exception {
308
    public CommonResponse<Void> bindDevice(Map<String, String> params) throws Exception {
316 309
        boolean result = false;
317
        if (unbindDevice(params)) {
310
        if (unbindDevice(params).isSuccess()) {
318 311
            if (EbcConstant.BIND_DEVICE_TYPE_USER.equals(params.get("bindType"))) {
319 312
                //与人员绑定
320 313
                EmployeeTerminalRela employeeTerminalRela = new EmployeeTerminalRela();
@ -336,7 +329,12 @@ public class DeviceManageServiceImpl implements DeviceManageService {
336 329
337 330
            }
338 331
        }
339
        return result;
332
333
        if (result){
334
            return CommonResponse.ok(null);
335
        }else{
336
            return CommonResponse.fail("401","绑定失败");
337
        }
340 338
    }
341 339
342 340
    @Override
@ -378,16 +376,14 @@ public class DeviceManageServiceImpl implements DeviceManageService {
378 376
    }
379 377
380 378
    @Override
381
    public boolean unbindDevice(Map<String, String> params) throws Exception {
379
    public CommonResponse<Void> unbindDevice(Map<String, String> params) throws Exception {
382 380
        List<String> deviceIdList = Arrays.asList(params.get("deviceId").split(","));
383 381
384 382
        // 根据终端id删除终端关联信息
385 383
        CommonResponse deleteRelaResult = resourceToolCommand
386 384
                .deleteWorkToolsDevRelaByTerminalId(new CommonRequest(deviceIdList));
387
        CommonResponse<Void> resopnse = employeeTerminalRelaCommand
385
         return employeeTerminalRelaCommand
388 386
                .deleteIndividualDevRela(new CommonRequest(deviceIdList));
389
390
        return deleteRelaResult.isSuccess() && resopnse.isSuccess();
391 387
    }
392 388
393 389
    @Override
@ -422,306 +418,4 @@ public class DeviceManageServiceImpl implements DeviceManageService {
422 418
        return null;
423 419
    }
424 420
425
	/*@Override
426
	public Map<String, Object> queryPageDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
427
			throws Exception {
428
		String isBindDevice = String.valueOf(params.get("IsBindDevice"));// 是否绑定终端
429
		boolean bindDeviceBoolean = EbcConstant.bind_device_ok.equals(isBindDevice);
430
		boolean unBindDeviceBoolean = EbcConstant.bind_device_no.equals(isBindDevice);
431
	
432
	
433
		// 返回数据
434
		Map<String, Object> result = new HashMap<String, Object>();
435
		result.put("dataNum", deviceInfoMap.get("totalResultNumber"));
436
		result.put("dataList", dataList);
437
		return result;
438
	}
439
	
440
	@Override
441
	public List<Map<String, String>> queryListDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
442
			throws Exception {
443
		// 查询条件
444
		Map<String, String> paramsMap = new HashMap<String, String>();
445
		paramsMap.put("specId", EbcConstant.beidouDevice_product_id); // 所属产品
446
		paramsMap.put("terminalSN", String.valueOf(params.get("deviceNo"))); // 终端序列号
447
	
448
		Map<String, String> deviceInfoMap = deviceManageDao.queryPageDeviceInfo(paramsMap, pageNum, pageSize);
449
		List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoMap.get("result")), Map.class);
450
	
451
		// 整理返回数据信息
452
		List<Map<String, String>> dataList = new ArrayList<Map<String, String>>();
453
		if (deviceInfoList != null && deviceInfoList.size() > 0) {
454
			for (Map map : deviceInfoList) {
455
				Map<String, String> dataMap = new HashMap<String, String>();
456
				String deviceId = String.valueOf(map.get("resourceId"));
457
				dataMap.put("deviceId", deviceId);
458
				dataMap.put("deviceNo", deviceId);
459
				dataList.add(dataMap);
460
			}
461
		}
462
	
463
		return dataList;
464
	}
465
	
466
	@Override
467
	public List<Map<String, Object>> queryAssociatInfo(Map<String, Object> params) throws Exception {
468
		if (EbcConstant.BIND_DEVICE_TYPE_USER.equals(params.get("type"))) {
469
			// 类型是用户,查询用户列表
470
			// TODO 调用uspa接口获取人员信息 暂时用枚举
471
			return UserEnums.getAllUserList();
472
		} else if (EbcConstant.BIND_DEVICE_TYPE_SHIP.equals(params.get("type"))) {
473
			// 类型是船舶,查询船舶列表
474
			return deviceManageDao.queryAssociatBoatInfo(params);
475
		}
476
		return new ArrayList<Map<String, Object>>();
477
	}
478
	
479
	@Override
480
	public Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception {
481
		// 查询用户与终端关联表,如果有数据返回,无数据返回空
482
		Map<String, Object> userAndDeviceMap = deviceManageDao.queryOneBindUser(null,
483
				String.valueOf(params.get("PARTY_CODE")));
484
		return userAndDeviceMap;
485
	}
486
	
487
	@Override
488
	public boolean bindDevice(Map<String, Object> params) throws Exception {
489
		int num = deviceManageDao.bindDevice(params, String.valueOf(params.get("type")));
490
		return num > 0;
491
	}
492
	
493
	@Override
494
	public boolean unbindDevice(Map<String, Object> params) throws Exception {
495
		int num = deviceManageDao.unbindDevice(params);
496
		return num > 0;
497
	}
498
	
499
	@Override
500
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception {
501
		// 获取已绑定的终端列表
502
		List<Map<String, Object>> bindUserDeviceList = deviceManageDao.queryAllBindUser();
503
	
504
		if (bindUserDeviceList == null || bindUserDeviceList.isEmpty()) {
505
			return new ArrayList<Map<String, String>>();
506
		}
507
	
508
		List<String> deviceIdsList = new ArrayList<String>();
509
		for (int i = 0; i < bindUserDeviceList.size(); i++) {
510
			deviceIdsList.add(String.valueOf(bindUserDeviceList.get(i).get("DEVICE_ID")));
511
		}
512
	
513
		// 获取终端当前位置信息
514
		List<Map<String, String>> list = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
515
	
516
		if (list.isEmpty()) {
517
			logger.info("未查询到设备位置信息");
518
			return new ArrayList();
519
		}
520
	
521
		// 查询当前所有未关闭的求救信息
522
		List<Map<String, Object>> alarmMapList = rescueDao.queryNoCloseRescueLog(null);
523
	
524
		// 查询人员所在围栏信息
525
		List<String> mapTagTypeList = new ArrayList<String>();
526
		mapTagTypeList.add(EbcConstant.area_type_exclusion);
527
		mapTagTypeList.add(EbcConstant.area_type_temporariness);
528
		List<Map<String, Object>> areaViolationMapList = areaInOutRecordDao.getBeforeInAreaInfo(null, mapTagTypeList);
529
	
530
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.NORM_DATETIME_PATTERN);
531
	
532
		// 拼接返回数据
533
		for (Map<String, String> map : list) {
534
			String deviceId = map.get("deviceId");
535
			map.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
536
	
537
			boolean flag = true;
538
	
539
			// 人员名称
540
			for (Map<String, Object> bindDeviceMap : bindUserDeviceList) {
541
				if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
542
					map.put("userName", String.valueOf(bindDeviceMap.get("NAME")));
543
					map.put("userCode", String.valueOf(bindDeviceMap.get("CODE")));
544
					break;
545
				}
546
			}
547
	
548
			// 离线信息
549
			if (map.get("alarmType") != null && EbcConstant.alarm_type_offline_beidou == Integer
550
					.parseInt(String.valueOf(map.get("alarmType")))) {
551
				map.put("locationStatus", EbcConstant.location_status_offline);// 定位状态
552
				map.put("alarmType", EbcConstant.alarm_type_offline_ZH);// 报警类型
553
				flag = false;
554
			}
555
	
556
			// 求救信息
557
			if (flag && alarmMapList != null && !alarmMapList.isEmpty()) {
558
				for (int i = 0; i < alarmMapList.size() && flag; i++) {
559
					Map<String, Object> alarmMap = alarmMapList.get(i);
560
	
561
					// 判断是救援者还是求救者
562
					if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
563
						// 求救者
564
						// 求救时间
565
						String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
566
						map.put("alarmDate", DateUtil.formatStrDate(alarmDate));
567
	
568
						// 计算求救时长
569
						int alarmLong = DateUtil.getDifferenceMinute(alarmDate, map.get("newDate"));
570
						map.put("alarmLong", String.valueOf(alarmLong));
571
	
572
						if (alarmMap.get("RESCUERS_ID") == null) {
573
							// 未指派救援人员
574
							map.put("isNewAlarm", EbcConstant.alarm_status_needassign);
575
						} else {
576
							// 已指派救援人员
577
							map.put("isNewAlarm", EbcConstant.alarm_status_needclose);
578
							// map.put("rescuerDeviceId", String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")));//救援者的设备ID
579
						}
580
	
581
						// 求救记录ID
582
						map.put("alarmLogId", String.valueOf(alarmMap.get("LOG_ID")));
583
	
584
						// 定位状态
585
						switch (String.valueOf(alarmMap.get("ALARM_TYPE"))) {
586
						case EbcConstant.alarm_type_autosos_ZH:
587
							// 自动报警
588
							map.put("locationStatus", EbcConstant.location_status_autosos);
589
							map.put("alarmType", EbcConstant.alarm_type_autosos_ZH);
590
							break;
591
						case EbcConstant.alarm_type_jogsos_ZH:
592
							// 手动报警
593
							map.put("locationStatus", EbcConstant.location_status_jogsos);
594
							map.put("alarmType", EbcConstant.alarm_type_jogsos_ZH);
595
							break;
596
						default:
597
							break;
598
						}
599
	
600
						flag = false;
601
	
602
					} else if (deviceId.equals(String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")))) {
603
						// 救援者
604
						map.put("locationStatus", EbcConstant.location_status_rescuer);// 定位状态
605
						// map.put("alarmDeviceId", String.valueOf(alarmMap.get("DEVICE_ID"))); // 求救者的设备ID
606
						flag = false;
607
					}
608
				}
609
			}
610
	
611
			// 违规信息
612
			if (flag && areaViolationMapList != null && !areaViolationMapList.isEmpty()) {
613
				int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
614
				long minInAreaLong = System.currentTimeMillis();// 进入围栏最早的时间戳
615
				Map<String, Object> areaInfoMap = null;// 用于计算时间的围栏信息
616
	
617
				for (int i = 0; i < areaViolationMapList.size(); i++) {
618
					Map<String, Object> areaViolationMap = areaViolationMapList.get(i);
619
					if (deviceId.equals(String.valueOf(areaViolationMap.get("DEVICE_ID")))) {
620
						// 比较优先级
621
						int mapTagGrade = 0;
622
						switch (String.valueOf(areaViolationMap.get("MAP_TAG_TYPE"))) {
623
						case EbcConstant.area_type_exclusion:
624
							mapTagGrade = 5;
625
							break;
626
						case EbcConstant.area_type_temporariness:
627
							mapTagGrade = 3;
628
							break;
629
						}
630
	
631
						if (mapTagGrade == maxMapTagGrade) {
632
							// 比较进入时长时间
633
							long inAreaLong = simpleDateFormat.parse(String.valueOf(areaViolationMap.get("IN_DATE")))
634
									.getTime();
635
							if (inAreaLong < minInAreaLong) {
636
								minInAreaLong = inAreaLong;
637
								areaInfoMap = areaViolationMap;
638
							}
639
						} else if (mapTagGrade > maxMapTagGrade) {
640
							maxMapTagGrade = mapTagGrade;
641
							minInAreaLong = simpleDateFormat.parse(String.valueOf(areaViolationMap.get("IN_DATE")))
642
									.getTime();
643
							areaInfoMap = areaViolationMap;
644
						}
645
					}
646
				}
647
	
648
				// 判断是否违规
649
				if (maxMapTagGrade == 5) {
650
					// 进入电子围栏(禁区),需显示进入时间
651
					map.put("inDate", simpleDateFormat.format(areaInfoMap.get("IN_DATE"))); // 进入时间
652
					map.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
653
	
654
				} else if (maxMapTagGrade == 3) {
655
					// 进入定点(限时),需计算是否超时
656
					int fixedLong = DateUtil.getDifferenceMinute(String.valueOf(areaInfoMap.get("IN_DATE")),
657
							map.get("newDate"));
658
	
659
					if (fixedLong > 0) {
660
						// 围栏要求定点时间
661
						int residenceTimeLength = Integer
662
								.parseInt(String.valueOf(areaInfoMap.get("RESIDENCE_TIME_LENGTH")));
663
	
664
						if (residenceTimeLength <= fixedLong) {
665
							// 已超时
666
							map.put("locationStatus", EbcConstant.location_status_overtime);// 定位状态
667
						}
668
					}
669
					map.put("fixedLong", String.valueOf(fixedLong));// 停留时长
670
				}
671
			}
672
		}
673
	
674
		return list;
675
	}
676
	
677
	@Override
678
	public Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params, int pageNum, int pageSize)
679
			throws Exception {
680
		Map<String,Object> resultMap<String,Object> = new HashMap<String,Object>();
681
		String beginTime = null;// 开始时间
682
		String endTime = null;// 结束时间
683
		
684
		// 时间段类型
685
		switch (String.valueOf(params.get("timeType")) {
686
		case EbcConstant.locus_time_interval_tenMinute:
687
			// 10分钟
688
			endTime = TimeUtil.getSysTime();
689
			beginTime = DateUtil.dateAddMinute(endTime, -10);
690
			break;
691
		case EbcConstant.locus_time_interval_oneHour:
692
			// 1小时
693
			endTime = TimeUtil.getSysTime();
694
			beginTime = DateUtil.dateAddHour(endTime, -1);
695
			break;
696
		case EbcConstant.locus_time_interval_oneDay:
697
			// 1天
698
			endTime = TimeUtil.getSysTime();
699
			beginTime = DateUtil.dateAddDay(endTime, -1);
700
			break;
701
		case EbcConstant.locus_time_interval_custom:
702
			// 自定义
703
			beginTime = String.valueOf(params.get("beginTime");
704
			endTime = String.valueOf(params.get("endTime");
705
			if (beginTime == null || "".equals(beginTime) || endTime == null || "".equals(endTime)) {
706
				resultMap<String,Object>.put("result", false);
707
				resultMap<String,Object>.put("errMsg", "日期不能为空");
708
				return resultMap<String,Object>;
709
			}
710
			break;
711
		default:
712
			resultMap<String,Object>.put("result", false);
713
			resultMap<String,Object>.put("errMsg", "时间段无效");
714
			return resultMap<String,Object>;
715
		}
716
		
717
		Map<String, String> paramsMap = new HashMap<String, String>();
718
		paramsMap.put("resourceId", String.valueOf(params.get("deviceId"));// 终端ID
719
		paramsMap.put("startTime", beginTime);
720
		paramsMap.put("endTime", endTime);
721
		
722
		resultMap<String,Object> = deviceManageDao.queryOneDeviceLocationInfo(paramsMap, pageNum, pageSize);
723
		return resultMap<String,Object>;
724
		return null;
725
	}*/
726
727 421
}

+ 51 - 113
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/EquipmentManageServiceImpl.java

@ -4,10 +4,9 @@ package com.ai.bss.location.rescue.service.impl;
4 4
import com.ai.abc.api.model.CommonRequest;
5 5
import com.ai.abc.api.model.CommonResponse;
6 6
import com.ai.bss.components.common.model.PageBean;
7
import com.ai.bss.location.rescue.dao.interfaces.EquipmentManageDao;
7
import com.ai.bss.components.common.model.PageInfo;
8 8
import com.ai.bss.location.rescue.service.interfaces.EquipmentManageService;
9
import java.util.*;
10
9
import com.ai.bss.location.rescue.util.EbcConstant;
11 10
import com.ai.bss.work.tool.model.ResourceTool;
12 11
import com.ai.bss.work.tool.model.ResourceToolType;
13 12
import com.ai.bss.work.tool.service.api.ResourceToolCommand;
@ -17,118 +16,57 @@ import org.slf4j.LoggerFactory;
17 16
import org.springframework.beans.factory.annotation.Autowired;
18 17
import org.springframework.stereotype.Service;
19 18
19
import java.util.HashMap;
20
import java.util.List;
20 21
import java.util.Map;
21 22
22 23
@Service
23
public class EquipmentManageServiceImpl implements EquipmentManageService {
24
	Logger logger = LoggerFactory.getLogger(EquipmentManageServiceImpl.class);
25
26
	@Autowired
27
	EquipmentManageDao equipmentManageDao;
28
29
	@Autowired
30
	ResourceToolCommand resourceToolCommand;
31
32
	@Autowired
33
	ResourceToolQuery resourceToolQuery;
34
35
	@Override
36
	public CommonResponse<PageBean<Map<String, Object>>> queryEquipmentInfo(CommonRequest<HashMap<String, Object>> conditionMap) throws Exception {
37
		return resourceToolQuery.queryWorkToolByConditions(conditionMap);
38
	}
39
40
	@Override
41
	public Map<String, Object> queryOneEquipmentInfo(Map<String,Object> params) throws Exception{
42
		return equipmentManageDao.queryOneEquipmentInfo(params);
43
	}
44
	
45
	@Override
46
	public CommonResponse<ResourceTool> modifyEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest) throws Exception {
47
		return resourceToolCommand.createWorkTool(resourceToolCommonRequest);
48
	}
49
50
	@Override
51
	public CommonResponse<ResourceTool> createEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest) {
52
		return resourceToolCommand.createWorkTool(resourceToolCommonRequest);
53
	}
54
55
	@Override
56
	public CommonResponse<List<ResourceToolType>> loadAllResourceToolType(CommonRequest commonRequest) {
57
		return resourceToolQuery.loadAllResourceToolType(commonRequest);
58
	}
59
60
	@Override
61
	public CommonResponse<ResourceTool> deleteEquipmentInfo(CommonRequest<List<String>> resourceToolCommonRequest) throws Exception {
62
		//删除绑定终端关系
63
		resourceToolCommand.deleteWorkToolsDevRelaByWorkToolId(resourceToolCommonRequest);
64
		//删除设备信息
65
		return resourceToolCommand.deleteWorkTool(resourceToolCommonRequest);
66
	}
67
68
	@Override
69
	public boolean deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception {
70
		return equipmentManageDao.deleteEquipmentsInfo(paramsList);
71
	}
72
73
	@Override
74
	public boolean importEquipmentInfo(List<Map<String, Object>> paramsList) throws Exception {
75
		return equipmentManageDao.importEquipmentInfo(paramsList);
76
	}
77
78
	@Override
79
	public List<Map<String, Object>> queryCurrentEquipmentLocationInfo(Map<String,Object> params) throws Exception {
80
		// 获取所有设备列表
81
		List<Map<String, Object>> allEquipmentList = equipmentManageDao.queryAllEquipmentInfo(params);
82
83
		// 获取已绑定船舶的信息
84
		//List<Map<String, Object>> bindInfoList = deviceManageDao.queryAllBindShip();
85
		List<Map<String, Object>> bindInfoList = null;
86
87
		if (bindInfoList == null || bindInfoList.isEmpty()) {
88
			return allEquipmentList;
89
		}
90
91
		// 获取定位信息
92
		List<String> deviceIdsList = new ArrayList<String>();
93
		for (Map<String, Object> bindInfoMap : bindInfoList) {
94
			deviceIdsList.add(String.valueOf(bindInfoMap.get("DEVICE_ID")));
95
		}
96
		//List<Map<String, String>> deviceLocationInfoList = deviceManageDao
97
		//		.queryCurrentDeviceLocationInfo(deviceIdsList);
98
		List<Map<String, String>> deviceLocationInfoList = null;
99
100
101
		// 拼接船舶最新的位置信息
102
		for (Map<String, Object> bindInfoMap : bindInfoList) {
103
			String code = String.valueOf(bindInfoMap.get("CODE"));
104
			String deviceId = String.valueOf(bindInfoMap.get("DEVICE_ID"));
105
106
			for (Map<String, Object> equipmentMap : allEquipmentList) {
107
				if (code.equals(String.valueOf(equipmentMap.get("FACILITY_CODE")))) {
108
					equipmentMap.put("DEVICE_ID", deviceId);// 设备ID
109
					equipmentMap.put("DEVICE_NO", deviceId);// 设备编码
110
111
					for (Map<String, String> deviceLocationInfoMap : deviceLocationInfoList) {
112
						if (deviceId.equals(deviceLocationInfoMap.get("deviceId"))) {
113
							equipmentMap.put("LONGITUDE", deviceLocationInfoMap.get("longitude"));// 经度
114
							equipmentMap.put("LATITUDE", deviceLocationInfoMap.get("latitude"));// 纬度
115
							equipmentMap.put("NEW_DATE", deviceLocationInfoMap.get("newDate"));// 最新定位时间
116
							break;
117
						}
118
					}
119
					break;
120
				}
121
			}
122
		}
123
124
		return allEquipmentList;
125
	}
126
127
	@Override
128
	public Map<String, Object> verifyEquipmentInfoRepetition(Map<String,Object> params) throws Exception {
129
		return equipmentManageDao.verifyEquipmentInfoRepetition(params);
130
	}
131
132
24
public class EquipmentManageServiceImpl<EquipmentManageDao> implements EquipmentManageService {
25
    Logger logger = LoggerFactory.getLogger(EquipmentManageServiceImpl.class);
26
27
    @Autowired
28
    ResourceToolCommand resourceToolCommand;
29
30
    @Autowired
31
    ResourceToolQuery resourceToolQuery;
32
33
    @Override
34
    public CommonResponse<PageBean<Map<String, Object>>> queryEquipmentInfo(CommonRequest<HashMap<String, Object>> conditionMap) throws Exception {
35
        return resourceToolQuery.queryWorkToolByConditions(conditionMap);
36
    }
37
38
39
    @Override
40
    public CommonResponse<ResourceTool> modifyEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest) throws Exception {
41
        return resourceToolCommand.createWorkTool(resourceToolCommonRequest);
42
    }
43
44
    @Override
45
    public CommonResponse<ResourceTool> createEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest) {
46
        return resourceToolCommand.createWorkTool(resourceToolCommonRequest);
47
    }
48
49
    @Override
50
    public CommonResponse<List<ResourceToolType>> loadAllResourceToolType(CommonRequest commonRequest) {
51
        return resourceToolQuery.loadAllResourceToolType(commonRequest);
52
    }
53
54
    @Override
55
    public CommonResponse<ResourceTool> deleteEquipmentInfo(CommonRequest<List<String>> resourceToolCommonRequest) throws Exception {
56
        //删除绑定终端关系
57
        resourceToolCommand.deleteWorkToolsDevRelaByWorkToolId(resourceToolCommonRequest);
58
        //删除设备信息
59
        return resourceToolCommand.deleteWorkTool(resourceToolCommonRequest);
60
    }
61
62
    @Override
63
    public List<Map<String, Object>> queryAllEquipmentNotBind() throws Exception {
64
        HashMap<String, Object> dataMap = new HashMap<>();
65
        dataMap.put("workOrgId", "0000");//TODO 组织ID
66
        dataMap.put("isAllowBindTerminal", EbcConstant.TOOL_BIND_REJECT);//是否可绑定
67
        CommonRequest<HashMap<String, Object>> commonRequest = new CommonRequest<HashMap<String, Object>>(dataMap);
68
        CommonResponse<PageInfo<Map<String, Object>>> commonResponse = resourceToolQuery.queryWorkToolByOrgAndBindFlag(commonRequest);
69
        return commonResponse.getData().getData();
70
    }
133 71
134 72
}

+ 17 - 21
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/LocationManagementServiceImpl.java

@ -1,34 +1,30 @@
1 1
package com.ai.bss.location.rescue.service.impl;
2 2
3
import java.util.List;
4
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.location.rescue.service.interfaces.LocationManagementService;
6
import com.ai.bss.position.service.api.MapAreaQuery;
7
import com.ai.bss.position.service.api.outparam.LoadMapViewParam;
8
import com.ai.bss.work.tool.model.ResourceTool;
5 9
import org.slf4j.Logger;
6 10
import org.slf4j.LoggerFactory;
7 11
import org.springframework.beans.factory.annotation.Autowired;
8 12
import org.springframework.stereotype.Service;
9 13
10
import com.ai.abc.api.model.CommonRequest;
11
import com.ai.abc.api.model.CommonResponse;
12
import com.ai.bss.location.rescue.service.interfaces.LocationManagementService;
13
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
14
import com.ai.bss.worker.service.api.EmployeeTerminalRelaQuery;
15
16 14
@Service
17 15
public class LocationManagementServiceImpl implements LocationManagementService {
18 16
	Logger logger = LoggerFactory.getLogger(LocationManagementServiceImpl.class);
19 17
20 18
	@Autowired
21
	EmployeeTerminalRelaQuery employeeTerminalRelaQuery;
22
	
23
	@Override
24
	public List<EmployeeTerminalRelaDto> queryEmployeeBindDeviceList() {
25
		  String entityId = "0000"; //TODO 组织id
26
		  //根据组织编码查询该组织下绑定了终端的人员信息, 组织编码为空查询所有人员
27
		  CommonRequest<String> param = CommonRequest.<String>builder().data(entityId).build();
28
		  
29
		  CommonResponse<List<EmployeeTerminalRelaDto>> commonResponse = employeeTerminalRelaQuery.queryIndividualDevRelaByOrgCode(param);
30
		
31
		return commonResponse.getData();
19
	MapAreaQuery mapAreaQuery;
20
21
	/**
22
	 * 初始化人员定位页面的数据
23
	 * @return
24
	 * @throws Exception
25
	 */
26
	public CommonResponse<LoadMapViewParam> loadMapLocationView() throws Exception {
27
		String data = "0";//指定地图集(默认0)
28
		return mapAreaQuery.loadMapView(new CommonRequest<>(data));
32 29
	}
33
	
34
}	
30
}

+ 13 - 27
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/MapTagManageServiceImpl.java

@ -37,7 +37,7 @@ public class MapTagManageServiceImpl implements MapTagManageService {
37 37
	CharacteristicSpecService characteristicSpecService;
38 38
39 39
	@Override
40
	public PageBean<Map<String, Object>> queryPageMapTagInfo(Map<String,String> params, int pageNumber, int pageSize) throws Exception {
40
	public CommonResponse<PageBean<Map<String, Object>>> queryPageMapTagInfo(Map<String,String> params, int pageNumber, int pageSize) throws Exception {
41 41
		Map<String, Object> data = new HashMap<String, Object>();
42 42
		if (params!=null) {
43 43
			data.put("mapAreaName", params.get("mapAreaName"));  //围栏名称模糊查询
@ -47,35 +47,25 @@ public class MapTagManageServiceImpl implements MapTagManageService {
47 47
48 48
		CommonRequest<Map<String, Object>> commonRequest = new CommonRequest<Map<String, Object>>(data, pageNumber, pageSize);
49 49
50
		CommonResponse<PageBean<Map<String, Object>>> result = mapAreaTagQuery.queryMapAreaTag(commonRequest);
51
		return result.getData();
50
		return mapAreaTagQuery.queryMapAreaTag(commonRequest);
52 51
	}
53 52
54 53
	@Override
55
	public List<Map<String, Object>> queryListMapTagInfo(Map<String, String> params) throws Exception {
54
	public CommonResponse<List<Map<String, Object>>> queryAllMapTagByOrg(Map<String, String> params) throws Exception {
56 55
		Map<String, Object> data = new HashMap<String, Object>();
57
56
		data.put("entityId",params.get("entityId"));
58 57
		CommonRequest<Map<String, Object>> commonRequest = new CommonRequest<Map<String, Object>>(data);
59 58
60
		CommonResponse<List<Map<String, Object>>> result = mapAreaTagQuery.queryAllMapAreaByConditions(commonRequest);
61
		return result.getData();
62
59
		 return mapAreaTagQuery.queryAllMapAreaByConditions(commonRequest);
63 60
	}
64 61
65 62
	@Override
66
	public Map<String, Object> queryOneMapTagInfo(Map<String,String> params) throws Exception {
63
	public CommonResponse<List<Map<String, Object>>> queryOneMapTagInfo(Map<String,String> params) throws Exception {
67 64
		Map<String, Object> data = new HashMap<String, Object>();
68 65
		data.put("mapAreaId", params.get("mapTagId")); //根据主键查询
69 66
70 67
		CommonRequest<Map<String, Object>> commonRequest = new CommonRequest<Map<String, Object>>(data);
71
72
		CommonResponse<List<Map<String, Object>>> result = mapAreaTagQuery.queryAllMapAreaByConditions(commonRequest);
73
74
		if (CollectionUtils.isEmpty(result.getData())){
75
			return null;
76
		}else{
77
			return result.getData().get(0);
78
		}
68
		return mapAreaTagQuery.queryAllMapAreaByConditions(commonRequest);
79 69
	}
80 70
81 71
	@Override
@ -98,7 +88,7 @@ public class MapTagManageServiceImpl implements MapTagManageService {
98 88
	}
99 89
100 90
	@Override
101
	public boolean addMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception {
91
	public CommonResponse<Void> addMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception {
102 92
		mapTagInfoDto.setMapAreaSetId("0"); //TODO 固定值 所属地图围栏集合标识
103 93
		mapTagInfoDto.setPriority("10");  //优先级
104 94
		mapTagInfoDto.setMapType(MapArea.MAP_TYPE_GEOMETRY);	//围栏形状,GEO多边形, RAD 圆形
@ -110,13 +100,11 @@ public class MapTagManageServiceImpl implements MapTagManageService {
110 100
		//data.setRadius("50");	//区域半径 针对 圆形围栏
111 101
112 102
		CommonRequest<MapTagInfoDto> param = new CommonRequest<MapTagInfoDto>(mapTagInfoDto);
113
		CommonResponse<Void> commonResponse = mapAreaTagCommand.createMapAreaTag(param);
114
115
		return commonResponse.isSuccess();
103
		return mapAreaTagCommand.createMapAreaTag(param);
116 104
	}
117 105
118 106
	@Override
119
	public boolean modifyMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception {
107
	public CommonResponse<Void> modifyMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception {
120 108
		mapTagInfoDto.setMapAreaSetId("0"); //TODO 固定值 所属地图围栏集合标识
121 109
		mapTagInfoDto.setPriority("10");  //优先级
122 110
		mapTagInfoDto.setMapType(MapArea.MAP_TYPE_GEOMETRY);	//围栏形状,GEO多边形, RAD 圆形
@ -129,16 +117,14 @@ public class MapTagManageServiceImpl implements MapTagManageService {
129 117
		//data.setRadius("50");
130 118
131 119
		CommonRequest<MapTagInfoDto> param = new CommonRequest<MapTagInfoDto>(mapTagInfoDto);
132
		CommonResponse<Void> commonResponse = mapAreaTagCommand.modifyMapAreaTag(param);
133 120
134
		return commonResponse.isSuccess();
121
		return mapAreaTagCommand.modifyMapAreaTag(param);
135 122
	}
136 123
137 124
	@Override
138
	public boolean deleteMapTagInfo(List<String> mapTagIdsList) throws Exception {
125
	public CommonResponse<Void> deleteMapTagInfo(List<String> mapTagIdsList) throws Exception {
139 126
		CommonRequest<List<String>> param = new CommonRequest<List<String>>(mapTagIdsList);
140
		CommonResponse<Void> commonResponse = mapAreaTagCommand.deleteMapArea(param);
141
		return commonResponse.isSuccess();
127
		return mapAreaTagCommand.deleteMapArea(param);
142 128
	}
143 129
144 130
}

+ 19 - 8
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/WorkEmployeeServiceImpl.java

@ -5,6 +5,8 @@ import java.util.HashMap;
5 5
import java.util.List;
6 6
import java.util.Map;
7 7
8
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
9
import com.ai.bss.worker.service.api.EmployeeTerminalRelaQuery;
8 10
import org.slf4j.Logger;
9 11
import org.slf4j.LoggerFactory;
10 12
import org.springframework.beans.factory.annotation.Autowired;
@ -41,18 +43,19 @@ public class WorkEmployeeServiceImpl implements WorkEmployeeService {
41 43
	@Autowired
42 44
	CharacteristicSpecService characteristicSpecService;
43 45
44
    @Override
45
    public PageBean<UserDto> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
46
47
        CommonResponse<PageBean<UserDto>> result = userDtoQuery.queryWorkEmployee(request);
46
    @Autowired
47
    EmployeeTerminalRelaQuery employeeTerminalRelaQuery;
48 48
49
        return result.getData();
49
    @Override
50
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
51
        // TODO 组织编码
52
        request.getData().setOrgCode("0000");
53
        return userDtoQuery.queryWorkEmployee(request);
50 54
    }
51 55
52 56
    @Override
53
    public List<Organization> queryAllOrganize(CommonRequest<Organization> params) throws Exception {
54
        CommonResponse<List<Organization>> result = organizationQuery.queryAllOrganize(params);
55
        return result.getData();
57
    public CommonResponse<List<Organization>> queryAllOrganize(CommonRequest<Organization> params) throws Exception {
58
        return organizationQuery.queryAllOrganize(params);
56 59
    }
57 60
58 61
    @Override
@ -96,4 +99,12 @@ public class WorkEmployeeServiceImpl implements WorkEmployeeService {
96 99
        return success;
97 100
    }
98 101
102
    @Override
103
    public CommonResponse<List<EmployeeTerminalRelaDto>> queryEmployeeBindDeviceList() {
104
        String entityId = "0000"; //TODO 组织id
105
        //根据组织编码查询该组织下绑定了终端的人员信息, 组织编码为空查询所有人员
106
        CommonRequest<String> param = CommonRequest.<String>builder().data(entityId).build();
107
108
        return employeeTerminalRelaQuery.queryIndividualDevRelaByOrgCode(param);
109
    }
99 110
}

+ 7 - 43
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/DeviceManageService.java

@ -1,13 +1,11 @@
1 1
package com.ai.bss.location.rescue.service.interfaces;
2 2
3
import com.ai.abc.api.model.CommonResponse;
4
import com.ai.bss.components.common.model.PageInfo;
5
3 6
import java.util.List;
4 7
import java.util.Map;
5 8
6
import com.sun.org.apache.xpath.internal.objects.XString;
7
import org.springframework.web.bind.annotation.RequestBody;
8
9
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
10
11 9
public interface DeviceManageService {
12 10
13 11
	/**
@ -18,7 +16,7 @@ public interface DeviceManageService {
18 16
	 * @return
19 17
	 * @throws Exception
20 18
	 */
21
	Map<String, Object> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
19
	PageInfo<Map<String, Object>> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
22 20
23 21
	/**
24 22
	 * 获取终端类型下拉列表
@ -64,11 +62,11 @@ public interface DeviceManageService {
64 62
	/**
65 63
	* 绑定终端
66 64
	* @param params
67
	* @param type
65
	* @param params
68 66
	* @return
69 67
	* @throws Exception
70 68
	*/
71
	boolean bindDevice(Map<String, String> params) throws Exception;
69
	CommonResponse<Void> bindDevice(Map<String, String> params) throws Exception;
72 70
73 71
	/**
74 72
	 * 查询绑定关系信息
@ -84,7 +82,7 @@ public interface DeviceManageService {
84 82
	* @return
85 83
	* @throws Exception
86 84
	*/
87
	boolean unbindDevice(Map<String, String> params) throws Exception;
85
	CommonResponse<Void> unbindDevice(Map<String, String> params) throws Exception;
88 86
89 87
	/**
90 88
	* 获取人员或船舶的下拉列表数据
@ -94,38 +92,4 @@ public interface DeviceManageService {
94 92
	*/
95 93
	List<? extends Object> queryAssociatInfo(Map<String, Object> params) throws Exception;
96 94
97
	/**
98
	 * 获取下拉列表的终端信息
99
	 * @param params
100
	 * @param pageNum 当前页数
101
	 * @param pageSize 每页条数
102
	 * @return
103
	 * @throws Exception
104
	 */
105
	/*List<Map<String, String>> queryListDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
106
			throws Exception;
107
	
108
	*/
109
	/*
110
	Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception;
111
	
112
	*//**
113
		* 获取终端的最新事件
114
		* @param params
115
		* @return
116
		* @throws Exception
117
		*/
118
	/*
119
	List<Map<String, String>> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception;
120
	
121
	*//**
122
		* 按时间段获取终端的定位信息
123
		* @param params
124
		* @param pageNum 当前页数
125
		* @param pageSize 每页条数
126
		* @return
127
		* @throws Exception
128
		*//*
129
			Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params, int pageNum, int pageSize)
130
				throws Exception;*/
131 95
}

+ 2 - 10
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/EquipmentManageService.java

@ -14,21 +14,13 @@ public interface EquipmentManageService {
14 14
15 15
    CommonResponse<PageBean<Map<String, Object>>> queryEquipmentInfo(CommonRequest<HashMap<String, Object>> conditionMap) throws Exception;
16 16
    
17
    Map<String, Object> queryOneEquipmentInfo(Map<String,Object> params) throws Exception;
18
19 17
    CommonResponse<ResourceTool> modifyEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest) throws Exception;
20 18
21 19
    CommonResponse<ResourceTool> deleteEquipmentInfo(CommonRequest<List<String>> resourceToolCommonRequest) throws Exception;
22 20
23
    boolean deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception;
24
25
    boolean importEquipmentInfo(List<Map<String, Object>> paramsList) throws Exception;
26
27
    List<Map<String, Object>> queryCurrentEquipmentLocationInfo(Map<String,Object> params) throws Exception;
28
    
29
    Map<String, Object> verifyEquipmentInfoRepetition(Map<String,Object> params) throws Exception;
30
31 21
    CommonResponse<ResourceTool> createEquipmentInfo(CommonRequest<ResourceTool> resourceToolCommonRequest);
32 22
33 23
    CommonResponse<List<ResourceToolType>> loadAllResourceToolType(CommonRequest commonRequest);
24
25
    List<Map<String, Object>> queryAllEquipmentNotBind() throws Exception;
34 26
}

+ 8 - 5
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/LocationManagementService.java

@ -2,6 +2,8 @@ package com.ai.bss.location.rescue.service.interfaces;
2 2
3 3
import java.util.List;
4 4
5
import com.ai.abc.api.model.CommonResponse;
6
import com.ai.bss.position.service.api.outparam.LoadMapViewParam;
5 7
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
6 8
7 9
/**
@ -11,10 +13,11 @@ import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
11 13
 */
12 14
public interface LocationManagementService {
13 15
14
	/**
15
	 * 获取已绑定终端的人员列表
16
	 * @return
17
	 */
18
	List<EmployeeTerminalRelaDto> queryEmployeeBindDeviceList();
16
    /**
17
     * 初始化人员定位页面的数据
18
     * @return
19
     * @throws Exception
20
     */
21
    CommonResponse<LoadMapViewParam> loadMapLocationView() throws Exception;
19 22
20 23
}

+ 8 - 7
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/MapTagManageService.java

@ -3,6 +3,7 @@ package com.ai.bss.location.rescue.service.interfaces;
3 3
import java.util.List;
4 4
import java.util.Map;
5 5
6
import com.ai.abc.api.model.CommonResponse;
6 7
import com.ai.bss.components.common.model.PageBean;
7 8
import com.ai.bss.worker.model.MapTagInfoDto;
8 9
@ -16,14 +17,14 @@ public interface MapTagManageService {
16 17
	 * @return
17 18
	 * @throws Exception
18 19
	 */
19
	PageBean<Map<String, Object>> queryPageMapTagInfo(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
20
	CommonResponse<PageBean<Map<String, Object>>> queryPageMapTagInfo(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
20 21
21 22
	/**
22
	 * 获取所有围栏信息
23
	 * 按部门查询所有围栏信息
23 24
	 * @return
24 25
	 * @throws Exception
25 26
	 */
26
	List<Map<String, Object>> queryListMapTagInfo(Map<String, String> params) throws Exception;
27
	CommonResponse<List<Map<String, Object>>> queryAllMapTagByOrg(Map<String, String> params) throws Exception;
27 28
28 29
	/**
29 30
	 * 获取单个围栏信息
@ -31,7 +32,7 @@ public interface MapTagManageService {
31 32
	 * @return
32 33
	 * @throws Exception
33 34
	 */
34
	Map<String, Object> queryOneMapTagInfo(Map<String, String> params) throws Exception;
35
	CommonResponse<List<Map<String, Object>>> queryOneMapTagInfo(Map<String, String> params) throws Exception;
35 36
36 37
	/**
37 38
	 * 获取围栏类型下拉列表
@ -45,7 +46,7 @@ public interface MapTagManageService {
45 46
	 * @return
46 47
	 * @throws Exception
47 48
	 */
48
	boolean addMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception;
49
	CommonResponse<Void> addMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception;
49 50
50 51
	/**
51 52
	 * 修改围栏信息
@ -53,7 +54,7 @@ public interface MapTagManageService {
53 54
	 * @return
54 55
	 * @throws Exception
55 56
	 */
56
	boolean modifyMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception;
57
	CommonResponse<Void> modifyMapTagInfo(MapTagInfoDto mapTagInfoDto) throws Exception;
57 58
58 59
	/**
59 60
	 * 删除围栏信息
@ -61,6 +62,6 @@ public interface MapTagManageService {
61 62
	 * @return
62 63
	 * @throws Exception
63 64
	 */
64
	boolean deleteMapTagInfo(List<String> mapTagIdsList) throws Exception;
65
	CommonResponse<Void> deleteMapTagInfo(List<String> mapTagIdsList) throws Exception;
65 66
66 67
}

+ 15 - 2
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/WorkEmployeeService.java

@ -10,14 +10,21 @@ import com.ai.bss.person.model.Individual;
10 10
import com.ai.bss.person.model.Organization;
11 11
import com.ai.bss.user.dto.EmployeeDto;
12 12
import com.ai.bss.user.dto.UserDto;
13
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
13 14
14 15
import java.util.List;
15 16
16 17
public interface WorkEmployeeService {
17 18
18
	PageBean<UserDto> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
19
	/**
20
	 * 人员列表分页查询
21
	 * @param request
22
	 * @return
23
	 * @throws Exception
24
	 */
25
	CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
19 26
20
	List<Organization> queryAllOrganize(CommonRequest<Organization> params) throws Exception;
27
	CommonResponse<List<Organization>> queryAllOrganize(CommonRequest<Organization> params) throws Exception;
21 28
22 29
	/**
23 30
	 * 获取职务下拉列表
@ -28,4 +35,10 @@ public interface WorkEmployeeService {
28 35
	boolean createWorkEmployee(EmployeeDto employeeDto) throws Exception;
29 36
30 37
	boolean deleteWorkEmployee(List<EmployeeDto> employeeDtoList);
38
39
	/**
40
	 * 获取已绑定终端的人员列表
41
	 * @return
42
	 */
43
	CommonResponse<List<EmployeeTerminalRelaDto>> queryEmployeeBindDeviceList();
31 44
}

+ 6 - 3
location-rescue-service/src/main/java/com/ai/bss/location/rescue/util/EbcConstant.java

@ -45,9 +45,12 @@ public class EbcConstant {
45 45
	//静态常量: 围栏类型
46 46
	public static final String BUSINESS_SPEC_EMPLOYEE_POSITION="mainJobPosition";
47 47
		
48
	
49
	
50
	
48
	//工具是否可绑定:不可绑定
49
	public static final String TOOL_BIND_REJECT="0";
50
51
	//工具是否可绑定:可绑定
52
	public static final String TOOL_BIND_ALLOW="1";
53
51 54
	
52 55
	
53 56