Bladeren bron

终端管理重构

konghl 4 jaren geleden
bovenliggende
commit
56ad369f6f

+ 12 - 0
location-rescue-service/pom.xml

@ -63,6 +63,18 @@
63 63
            <version>2.1-SNAPSHOT</version>
64 64
        </dependency>
65 65
66
        <dependency>
67
            <groupId>com.ai.bss</groupId>
68
            <artifactId>worker-service</artifactId>
69
            <version>2.1-SNAPSHOT</version>
70
        </dependency>
71
72
		<dependency>
73
            <groupId>com.ai.bss</groupId>
74
            <artifactId>characteristic-spec-service</artifactId>
75
            <version>2.1-SNAPSHOT</version>
76
        </dependency>
77
        
66 78
        <!-- <dependency>
67 79
            <groupId>com.ai.ipu</groupId>
68 80
            <artifactId>ipu-common</artifactId>

+ 150 - 120
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/DeviceManageController.java

@ -8,12 +8,16 @@ import org.slf4j.Logger;
8 8
import org.slf4j.LoggerFactory;
9 9
import org.springframework.beans.factory.annotation.Autowired;
10 10
import org.springframework.stereotype.Controller;
11
import org.springframework.web.bind.annotation.RequestBody;
11 12
import org.springframework.web.bind.annotation.RequestMapping;
12 13
import org.springframework.web.bind.annotation.ResponseBody;
13 14
15
import com.ai.abc.api.model.CommonRequest;
16
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
14 17
import com.ai.bss.location.rescue.service.interfaces.DeviceManageService;
15 18
import com.ai.bss.location.rescue.util.EbcConstant;
16 19
import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
20
import com.ai.bss.user.dto.UserDto;
17 21
18 22
/**
19 23
 * 终端管理
@ -21,45 +25,42 @@ import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
21 25
@Controller
22 26
@RequestMapping("/device")
23 27
public class DeviceManageController {
24
	Logger logger = LoggerFactory.getLogger(DeviceManageController.class);
25 28
26 29
	@Autowired
27 30
	DeviceManageService deviceManageService;
28 31
29 32
	/**
30
	 * 分页查询终端信息
33
	 *  分页查询终端信息
34
	 * @param request
35
	 * @return
36
	 * @throws Exception
31 37
	 */
32 38
	@ResponseBody
33 39
	@RequestMapping("/queryPageDeviceInfo")
34
	public Map<String, Object> queryPageDeviceInfo(Map<String, Object> params) throws Exception {
40
	public Map<String, Object> queryPageDeviceInfo(@RequestBody CommonRequest<Map<String, String>> request)
41
			throws Exception {
35 42
		// 当前页数
36
		int pageNum = Integer.parseInt(String.valueOf(params.get("pageNum")));
43
		int pageNumber = request.getPageNumber() < 1 ? 1 : request.getPageNumber();
37 44
		// 每页条数
38
		int pageSize = Integer.parseInt(String.valueOf(params.get("pageSize")));
45
		int pageSize = request.getPageSize() < 1 ? EbcConstant.DEFAULT_PAGE_SIZE : request.getPageSize();
46
47
		Map<String, Object> result = deviceManageService.queryPageDeviceInfo(request.getData(), pageNumber, pageSize);
39 48
40
		Map<String, Object> result = deviceManageService.queryPageDeviceInfo(params, pageNum, pageSize);
41 49
		return result;
42 50
	}
43 51
44 52
	/**
45
	 * 获取下拉列表的终端信息
46
	 * 
47
	 * @param params
53
	 * 获取终端类型下拉列表
48 54
	 * @return
49
	 * @throws Exception
50 55
	 */
51 56
	@ResponseBody
52
	@RequestMapping("/queryListDeviceInfo")
53
	public Map<String, Object> queryListDeviceInfo(Map<String, Object> params) throws Exception {
57
	@RequestMapping("/queryDeviceTypeList")
58
	public Map<String, Object> queryDeviceTypeList() {
54 59
		Map<String, Object> result = new HashMap<String, Object>();
60
		List<CharacteristicSpecValue> resultList = deviceManageService.queryDeviceTypeList();
55 61
56
		// 当前页数
57
		int pageNum = 1;
58
		// 每页条数
59
		int pageSize = EbcConstant.comboBox_maxNum;
60
61
		List<Map<String, String>> resultList = deviceManageService.queryListDeviceInfo(params, pageNum, pageSize);
62 62
		result.put("dataList", resultList);
63
63 64
		return result;
64 65
	}
65 66
@ -72,7 +73,7 @@ public class DeviceManageController {
72 73
	 */
73 74
	@ResponseBody
74 75
	@RequestMapping("/queryOneDeviceInfo")
75
	public Map<String, Object> queryOneDeviceInfo(Map<String, Object> params) throws Exception {
76
	public Map<String, Object> queryOneDeviceInfo(Map<String, String> params) throws Exception {
76 77
		Map<String, Object> result = new HashMap<String, Object>();
77 78
78 79
		if (params == null || params.get("deviceId") == null) {
@ -95,7 +96,7 @@ public class DeviceManageController {
95 96
	 */
96 97
	@ResponseBody
97 98
	@RequestMapping("/addDeviceInfo")
98
	public Map<String, Object> addDeviceInfo(Map<String, Object> params) throws Exception {
99
	public Map<String, Object> addDeviceInfo(Map<String, String> params) throws Exception {
99 100
		Map<String, Object> result = new HashMap<String, Object>();
100 101
101 102
		if (params == null || params.get("deviceNo") == null) {
@ -125,7 +126,7 @@ public class DeviceManageController {
125 126
	 */
126 127
	@ResponseBody
127 128
	@RequestMapping("/modifyDeviceInfo")
128
	public Map<String, Object> modifyDeviceInfo(Map<String, Object> params) throws Exception {
129
	public Map<String, Object> modifyDeviceInfo(Map<String, String> params) throws Exception {
129 130
		Map<String, Object> result = new HashMap<String, Object>();
130 131
131 132
		if (params == null || params.get("deviceId") == null) {
@ -155,7 +156,7 @@ public class DeviceManageController {
155 156
	 */
156 157
	@ResponseBody
157 158
	@RequestMapping("/deleteDeviceInfo")
158
	public Map<String, Object> deleteDeviceInfo(Map<String, Object> params) throws Exception {
159
	public Map<String, Object> deleteDeviceInfo(Map<String, String> params) throws Exception {
159 160
		Map<String, Object> result = new HashMap<String, Object>();
160 161
161 162
		if (params == null || params.get("deviceId") == null) {
@ -177,129 +178,158 @@ public class DeviceManageController {
177 178
	}
178 179
179 180
	/**
180
	 * 关联终端(关联用户或者船舶的保存功能)
181
	 *
181
	 * 获取下拉列表的终端信息
182
	 * 
183
	 * @param params
184
	 * @return
185
	 * @throws Exception
182 186
	 */
187
	/*
188
	@ResponseBody
189
	@RequestMapping("/queryListDeviceInfo")
190
	public Map<String, Object> queryListDeviceInfo(Map<String, Object> params) throws Exception {
191
	Map<String, Object> result = new HashMap<String, Object>();
192
	
193
	// 当前页数
194
	int pageNum = 1;
195
	// 每页条数
196
	int pageSize = EbcConstant.COMBOBOX_MAXNUM;
197
	
198
	List<Map<String, String>> resultList = deviceManageService.queryListDeviceInfo(params, pageNum, pageSize);
199
	result.put("dataList", resultList);
200
	return result;
201
	}
202
	
203
	*//**
204
		* 关联终端(关联用户或者船舶的保存功能)
205
		*
206
		*/
207
	/*
183 208
	@ResponseBody
184 209
	@RequestMapping("/bindDevice")
185 210
	public Map<String, Object> bindDevice(Map<String, Object> params) throws Exception {
186
		Map<String, Object> result = new HashMap<String, Object>(); // 返回值
187
		if (params.get("DEVICE_ID") != null && !"".equals(params.get("DEVICE_ID"))) {
188
			boolean flag = false;
189
			flag = deviceManageService.bindDevice(params);
190
			result.put("result", flag);
191
		} else {
192
			logger.error("关联终端失败:设备id为空");
193
			result.put("result", false);
194
			result.put("errMsg", "关联终端失败");
195
		}
196
		return result;
211
	Map<String, Object> result = new HashMap<String, Object>(); // 返回值
212
	if (params.get("DEVICE_ID") != null && !"".equals(params.get("DEVICE_ID"))) {
213
		boolean flag = false;
214
		flag = deviceManageService.bindDevice(params);
215
		result.put("result", flag);
216
	} else {
217
		logger.error("关联终端失败:设备id为空");
218
		result.put("result", false);
219
		result.put("errMsg", "关联终端失败");
197 220
	}
198
199
	/**
200
	 * 解绑终端
201
	 */
221
	return result;
222
	}
223
	
224
	*//**
225
		* 解绑终端
226
		*/
227
	/*
202 228
	@ResponseBody
203 229
	@RequestMapping("/unbindDevice")
204 230
	public Map<String, Object> unbindDevice(Map<String, Object> params) throws Exception {
205
		Map<String, Object> result = new HashMap<String, Object>(); // 返回值
206
		boolean flag = false;
207
		if (params.get("DEVICE_ID") != null && !"".equals(params.get("DEVICE_ID"))) {
208
			flag = deviceManageService.unbindDevice(params);
209
		} else {
210
			logger.error("解绑终端失败:设备id为空");
211
			result.put("result", false);
212
			result.put("errMsg", "解绑终端失败");
213
		}
214
		result.put("result", flag);
215
		return result;
231
	Map<String, Object> result = new HashMap<String, Object>(); // 返回值
232
	boolean flag = false;
233
	if (params.get("DEVICE_ID") != null && !"".equals(params.get("DEVICE_ID"))) {
234
		flag = deviceManageService.unbindDevice(params);
235
	} else {
236
		logger.error("解绑终端失败:设备id为空");
237
		result.put("result", false);
238
		result.put("errMsg", "解绑终端失败");
216 239
	}
217
218
	/**
219
	 * 关联列表信息查询
220
	 */
240
	result.put("result", flag);
241
	return result;
242
	}
243
	
244
	*//**
245
		* 关联列表信息查询
246
		*/
247
	/*
221 248
	@ResponseBody
222 249
	@RequestMapping("/queryAssociatInfo")
223 250
	public Map<String, Object> queryAssociatInfo(Map<String, Object> params) throws Exception {
224
		List<Map<String, Object>> userList = deviceManageService.queryAssociatInfo(params);
225
		Map<String, Object> result = new HashMap<String, Object>();
226
		result.put("result", userList);
227
		return result;
251
	List<Map<String, Object>> userList = deviceManageService.queryAssociatInfo(params);
252
	Map<String, Object> result = new HashMap<String, Object>();
253
	result.put("result", userList);
254
	return result;
228 255
	}
229
230
	/**
231
	 * 验证用户或者船舶是否有终端关联
232
	 */
256
	
257
	*//**
258
		* 验证用户或者船舶是否有终端关联
259
		*/
260
	/*
233 261
	@ResponseBody
234 262
	@RequestMapping("/verifyUserOrBoatAssociatInfo")
235 263
	public Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception {
236
		Map<String, Object> associatMap = deviceManageService.verifyUserOrBoatAssociatInfo(params);
237
		Map<String, Object> result = new HashMap<String, Object>();
238
		result.put("result", associatMap);
239
		return result;
264
	Map<String, Object> associatMap = deviceManageService.verifyUserOrBoatAssociatInfo(params);
265
	Map<String, Object> result = new HashMap<String, Object>();
266
	result.put("result", associatMap);
267
	return result;
240 268
	}
241
242
	/**
243
	 * 获取当前终端最新定位信息
244
	 * 
245
	 * @param params
246
	 * @return
247
	 * @throws Exception
248
	 */
269
	
270
	*//**
271
		* 获取当前终端最新定位信息
272
		* 
273
		* @param params
274
		* @return
275
		* @throws Exception
276
		*/
277
	/*
249 278
	@ResponseBody
250 279
	@RequestMapping("/queryCurrentDeviceLocationInfo")
251 280
	public Map<String, Object> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception {
252
		Map<String, Object> result = new HashMap<String, Object>();
253
254
		List<Map<String, String>> resultList = deviceManageService.queryCurrentDeviceLocationInfo(params);
255
		result.put("dataList", resultList);
256
		return result;
281
	Map<String, Object> result = new HashMap<String, Object>();
282
	
283
	List<Map<String, String>> resultList = deviceManageService.queryCurrentDeviceLocationInfo(params);
284
	result.put("dataList", resultList);
285
	return result;
257 286
	}
258
259
	/**
260
	 * 按时间段获取终端的定位信息(轨迹回放)
261
	 * 
262
	 * @param params
263
	 * @return
264
	 * @throws Exception
265
	 */
287
	
288
	*//**
289
		* 按时间段获取终端的定位信息(轨迹回放)
290
		* 
291
		* @param params
292
		* @return
293
		* @throws Exception
294
		*/
295
	/*
266 296
	@ResponseBody
267 297
	@RequestMapping("/queryOneDeviceLocationInfo")
268 298
	public Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params) throws Exception {
269
		Map<String, Object> result = new HashMap<String, Object>();
270
271
		if (params == null || params.get("deviceId") == null || params.get("timeType") == null) {
272
			result.put("result", false);
273
			result.put("errMsg", "查询失败");
274
			return result;
275
		}
276
277
		// 当前页数
278
		// int pageNum = Integer.parseInt(params.get("pageNum") < 1 ? 1 : Integer.parseInt(params.get("pageNum");
279
		// 每页条数
280
		// int pageSize = Integer.parseInt(params.get("pageSize") < 1 ? EbcConstant.default_page_size : Integer.parseInt(params.get("pageSize");
281
282
		// 当前页数
283
		int pageNum = Integer.parseInt(String.valueOf(params.get("pageNum")));
284
		// 每页条数
285
		int pageSize = Integer.parseInt(String.valueOf(params.get("pageSize")));
286
287
		result = deviceManageService.queryOneDeviceLocationInfo(params, pageNum, pageSize);
299
	Map<String, Object> result = new HashMap<String, Object>();
300
	
301
	if (params == null || params.get("deviceId") == null || params.get("timeType") == null) {
302
		result.put("result", false);
303
		result.put("errMsg", "查询失败");
288 304
		return result;
289 305
	}
290
291
	/**
292
	 * 导入终端信息
293
	 */
294
	@ResponseBody
295
	@RequestMapping("/importDeviceInfo")
296
	public Map<String, Object> importDeviceInfo(Map<String, Object> params) throws Exception {
297
		boolean flag = false;
298
		if (Integer.parseInt(String.valueOf(params.get("MAP_TAG_ID"))) != 0) {
299
			// flag= userManageService.importUserInfo(params);
300
		}
301
		Map<String, Object> result = new HashMap<String, Object>();
302
		result.put("result", flag);
303
		return result;
306
	
307
	// 当前页数
308
	// int pageNum = Integer.parseInt(params.get("pageNum") < 1 ? 1 : Integer.parseInt(params.get("pageNum");
309
	// 每页条数
310
	// int pageSize = Integer.parseInt(params.get("pageSize") < 1 ? EbcConstant.default_page_size : Integer.parseInt(params.get("pageSize");
311
	
312
	// 当前页数
313
	int pageNum = Integer.parseInt(String.valueOf(params.get("pageNum")));
314
	// 每页条数
315
	int pageSize = Integer.parseInt(String.valueOf(params.get("pageSize")));
316
	
317
	result = deviceManageService.queryOneDeviceLocationInfo(params, pageNum, pageSize);
318
	return result;
304 319
	}
320
	
321
	*//**
322
		* 导入终端信息
323
		*//*
324
			@ResponseBody
325
			@RequestMapping("/importDeviceInfo")
326
			public Map<String, Object> importDeviceInfo(Map<String, Object> params) throws Exception {
327
			boolean flag = false;
328
			if (Integer.parseInt(String.valueOf(params.get("MAP_TAG_ID"))) != 0) {
329
				// flag= userManageService.importUserInfo(params);
330
			}
331
			Map<String, Object> result = new HashMap<String, Object>();
332
			result.put("result", flag);
333
			return result;
334
			}*/
305 335
}

+ 4 - 4
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/ReceiveSubscribeController.java

@ -58,12 +58,12 @@ public class ReceiveSubscribeController {
58 58
		// 经度
59 59
		BigDecimal longitudeBigDecimal = detailInfo.getJSONObject("longitude").getBigDecimal("value");
60 60
		detailInfoMap.put("longitude",
61
				longitudeBigDecimal.setScale(EbcConstant.coord_scale, BigDecimal.ROUND_HALF_UP).toString());
61
				longitudeBigDecimal.setScale(EbcConstant.COORD_SCALE, BigDecimal.ROUND_HALF_UP).toString());
62 62
63 63
		// 纬度
64 64
		BigDecimal latitudeBigDecimal = detailInfo.getJSONObject("latitude").getBigDecimal("value");
65 65
		detailInfoMap.put("latitude",
66
				latitudeBigDecimal.setScale(EbcConstant.coord_scale, BigDecimal.ROUND_HALF_UP).toString());
66
				latitudeBigDecimal.setScale(EbcConstant.COORD_SCALE, BigDecimal.ROUND_HALF_UP).toString());
67 67
68 68
		// 解析并推送定位数据
69 69
		receiveSubscribeService.receiveIotLocationData(detailInfoMap);
@ -99,12 +99,12 @@ public class ReceiveSubscribeController {
99 99
		// 经度
100 100
		BigDecimal longitudeBigDecimal = detailInfo.getJSONObject("longitude").getBigDecimal("value");
101 101
		detailInfoMap.put("longitude",
102
				longitudeBigDecimal.setScale(EbcConstant.coord_scale, BigDecimal.ROUND_HALF_UP).toString());
102
				longitudeBigDecimal.setScale(EbcConstant.COORD_SCALE, BigDecimal.ROUND_HALF_UP).toString());
103 103
104 104
		// 纬度
105 105
		BigDecimal latitudeBigDecimal = detailInfo.getJSONObject("latitude").getBigDecimal("value");
106 106
		detailInfoMap.put("latitude",
107
				latitudeBigDecimal.setScale(EbcConstant.coord_scale, BigDecimal.ROUND_HALF_UP).toString());
107
				latitudeBigDecimal.setScale(EbcConstant.COORD_SCALE, BigDecimal.ROUND_HALF_UP).toString());
108 108
109 109
		// 报警类型
110 110
		detailInfoMap.put("alarmType", detailInfo.getJSONObject("alarmType").getIntValue("value"));

+ 1 - 1
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/RescueController.java

@ -54,7 +54,7 @@ public class RescueController {
54 54
		// 当前页数
55 55
		int pageNum = 1;
56 56
		// 每页条数
57
		int pageSize = EbcConstant.comboBox_maxNum;
57
		int pageSize = EbcConstant.COMBOBOX_MAXNUM;
58 58
59 59
		List<Map<String, Object>> resultList = rescueService.queryListRescuerInfo(params, pageNum, pageSize);
60 60
		result.put("dataList", resultList);

+ 234 - 103
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/DeviceManageServiceImpl.java

@ -1,6 +1,5 @@
1 1
package com.ai.bss.location.rescue.service.impl;
2 2
3
import java.text.SimpleDateFormat;
4 3
import java.util.ArrayList;
5 4
import java.util.HashMap;
6 5
import java.util.List;
@ -11,107 +10,259 @@ import org.slf4j.LoggerFactory;
11 10
import org.springframework.beans.factory.annotation.Autowired;
12 11
import org.springframework.stereotype.Service;
13 12
14
import com.ai.bss.location.rescue.dao.interfaces.AreaInOutRecordDao;
15
import com.ai.bss.location.rescue.dao.interfaces.DeviceManageDao;
16
import com.ai.bss.location.rescue.dao.interfaces.RescueDao;
17
import com.ai.bss.location.rescue.enums.UserEnums;
13
import com.ai.abc.api.model.CommonResponse;
14
import com.ai.bss.characteristic.spec.model.CharacteristicSpec;
15
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
16
import com.ai.bss.characteristic.spec.service.api.CharacteristicSpecService;
17
import com.ai.bss.components.common.model.PageInfo;
18 18
import com.ai.bss.location.rescue.service.interfaces.DeviceManageService;
19
import com.ai.bss.location.rescue.util.DateUtil;
20 19
import com.ai.bss.location.rescue.util.EbcConstant;
20
import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
21
import com.ai.bss.location.rescue.util.NorthboundInterfaceUtil;
22
import com.ai.bss.work.tool.service.api.ResourceToolQuery;
23
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
24
import com.ai.bss.worker.service.api.EmployeeTerminalRelaCommand;
25
import com.ai.bss.worker.service.api.EmployeeTerminalRelaQuery;
21 26
import com.alibaba.fastjson.JSON;
27
import com.alibaba.fastjson.JSONObject;
22 28
23 29
@Service
24 30
public class DeviceManageServiceImpl implements DeviceManageService {
25 31
	Logger logger = LoggerFactory.getLogger(DeviceManageServiceImpl.class);
26 32
27 33
	@Autowired
28
	DeviceManageDao deviceManageDao;
34
	private EmployeeTerminalRelaQuery employeeTerminalRelaQuery;
29 35
30 36
	@Autowired
31
	RescueDao rescueDao;
37
	private EmployeeTerminalRelaCommand employeeTerminalRelaCommand;
32 38
33 39
	@Autowired
34
	AreaInOutRecordDao areaInOutRecordDao;
40
	ResourceToolQuery resourceToolQuery;
41
42
	@Autowired
43
	CharacteristicSpecService characteristicSpecService;
44
45
	@Autowired
46
	NorthboundInterfaceUtil northboundInterfaceUtil;
35 47
36 48
	@Override
37
	public Map<String, Object> queryPageDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
49
	public Map<String, Object> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize)
38 50
			throws Exception {
39 51
		String isBindDevice = String.valueOf(params.get("IsBindDevice"));// 是否绑定终端
40
		boolean bindDeviceBoolean = EbcConstant.bind_device_ok.equals(isBindDevice);
41
		boolean unBindDeviceBoolean = EbcConstant.bind_device_no.equals(isBindDevice);
42
43
		// 获取已绑定的终端列表
44
		List<Map<String, Object>> allBindInfoList = deviceManageDao.queryAllBindShip();
45
		List<Map<String, Object>> bindUserList = deviceManageDao.queryAllBindUser();
46
		allBindInfoList.addAll(bindUserList);
52
		boolean bindDeviceBoolean = EbcConstant.BIND_DEVICE_OK.equals(isBindDevice);
53
		boolean unBindDeviceBoolean = EbcConstant.BIND_DEVICE_NO.equals(isBindDevice);
47 54
48 55
		// 查询条件
49
		Map<String, String> paramsMap = new HashMap<String, String>();
50
		paramsMap.put("specId", EbcConstant.beidouDevice_product_id); // 所属产品
51
		paramsMap.put("terminalSN", String.valueOf(params.get("deviceNo"))); // 终端序列号
56
		Map<String, Object> dataMap = new HashMap<String, Object>();
57
		dataMap.put("pageNumber", pageNumber);
58
		dataMap.put("pageSize", pageSize);
59
		Map<String, Object> paramsMap = new HashMap<String, Object>();
60
61
		// 终端编号
62
		if (null != params.get("deviceNo") &&!"".equals(params.get("deviceNo"))) {
63
			paramsMap.put("terminalSN", params.get("deviceNo"));
64
		}
52 65
53
		// 包含或不包含终端ID(用逗号隔开)
66
		// 终端类型
67
		if (null == params.get("deviceTypeId") || "".equals(params.get("deviceTypeId"))) {
68
			List<CharacteristicSpecValue> characteristicSpecValueList = queryDeviceTypeList();
69
			List<String> specIds = new ArrayList<String>();
70
			for (CharacteristicSpecValue characteristicSpecValue : characteristicSpecValueList) {
71
				specIds.add(characteristicSpecValue.getCode());
72
			}
73
			paramsMap.put("specId", specIds);
74
		}else {
75
			paramsMap.put("specId", params.get("deviceTypeId"));
76
		}
77
78
		// 是否绑定
79
		List<Map<String, Object>> bindToolInfoList = null;
80
		List<EmployeeTerminalRelaDto> bindEmployeeInfoList = null;
54 81
		if (bindDeviceBoolean || unBindDeviceBoolean) {
55
			StringBuilder deviceIds = new StringBuilder();
56
			for (int i = 0; i < allBindInfoList.size(); i++) {
57
				deviceIds.append(allBindInfoList.get(i).get("DEVICE_ID"));
58
				if (i < allBindInfoList.size() - 1) {
59
					deviceIds.append(",");
82
			// 终端与工具绑定
83
			CommonResponse<PageInfo<Map<String, Object>>> bindToolInfoCommon = resourceToolQuery
84
					.queryWorkToolsDevRela(null);
85
			bindToolInfoList = bindToolInfoCommon.getData().getData();
86
			// 终端与人员绑定
87
			CommonResponse<List<EmployeeTerminalRelaDto>> bindEmployeeInfoCommon = employeeTerminalRelaQuery
88
					.queryIndividualDevRela(null);
89
			bindEmployeeInfoList = bindEmployeeInfoCommon.getData();
90
91
			// 终端ID
92
			List<String> deviceIds = new ArrayList<String>();
93
			if (bindToolInfoList != null && !bindToolInfoList.isEmpty()) {
94
				for (Map<String, Object> bindToolInfoMap : bindToolInfoList) {
95
					deviceIds.add(String.valueOf(bindToolInfoMap.get("resourceToolId")));
96
				}
97
			}
98
			if (bindEmployeeInfoList != null && !bindEmployeeInfoList.isEmpty()) {
99
				for (EmployeeTerminalRelaDto bindEmployeeInfoMap : bindEmployeeInfoList) {
100
					deviceIds.add(bindEmployeeInfoMap.getWorkEmployeeId());
60 101
				}
61 102
			}
62 103
63 104
			if (bindDeviceBoolean) {
64 105
				// 只查询绑定的终端:包含
65
				paramsMap.put("resourceIdList", deviceIds.toString());
106
				paramsMap.put("resourceIdList", deviceIds);
66 107
			} else if (unBindDeviceBoolean) {
67 108
				// 只查询不绑定的终端:不包含
68
				paramsMap.put("notIn", deviceIds.toString());
109
				paramsMap.put("notIn", deviceIds);
69 110
			}
70 111
		}
71 112
72
		// 查询终端信息列表
73
		params.put("businessParams", paramsMap);
74
		Map<String, String> deviceInfoMap = deviceManageDao.queryPageDeviceInfo(paramsMap, pageNum, pageSize);
75
		List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoMap.get("result")), Map.class);
113
		dataMap.put("businessParams", paramsMap);
114
115
		// 调用北向接口
116
		String url = NorthboundInterfaceConstant.queryPageDevice;
117
		Map<String, String> deviceInfoListMap = northboundInterfaceUtil.iotPostCallUtil(url, dataMap);
118
		List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoListMap.get("result")), Map.class);
76 119
77 120
		// 整理返回数据信息
78
		List<Map> dataList = new ArrayList<Map>();
121
		List<Map> resultList = new ArrayList<Map>();
79 122
		if (deviceInfoList != null && deviceInfoList.size() > 0) {
80 123
			for (Map map : deviceInfoList) {
81
				Map dataMap = new HashMap();
124
				Map resultMap = new HashMap();
82 125
83 126
				// 终端编号
84 127
				String deviceId = String.valueOf(map.get("resourceId"));
85
				dataMap.put("deviceId", deviceId);
86
				dataMap.put("deviceNo", deviceId);
128
				resultMap.put("deviceId", deviceId);
129
				resultMap.put("deviceNo", deviceId);
87 130
88 131
				// 备注
89 132
				String remarks = String.valueOf(map.get("remarks"));
90 133
				remarks = (remarks == null || "".equals(remarks) || "null".equals(remarks)) ? "无" : remarks;
91
				dataMap.put("remarks", remarks);
134
				resultMap.put("remarks", remarks);
92 135
93 136
				// 绑定信息
94
				dataMap.put("bindName", "--");
137
				resultMap.put("bindName", "--");
95 138
				if (!unBindDeviceBoolean) {
96
					for (Map bindDeviceMap : allBindInfoList) {
97
						if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
98
							dataMap.put("bindName", bindDeviceMap.get("NAME"));
99
							break;
139
					if (bindToolInfoList != null) {
140
						for (Map<String, Object> bindToolInfoMap : bindToolInfoList) {
141
							if (deviceId.equals(String.valueOf(bindToolInfoMap.get("terminalId")))) {
142
								resultMap.put("bindCode", bindToolInfoMap.get("resourceToolCode"));
143
								resultMap.put("bindName", bindToolInfoMap.get("resourceToolName"));
144
								break;
145
							}
146
						}
147
					}
148
					if (bindEmployeeInfoList != null) {
149
						for (EmployeeTerminalRelaDto employeeTerminalRelaDto : bindEmployeeInfoList) {
150
							if (deviceId.equals(employeeTerminalRelaDto.getTerminalId())) {
151
								resultMap.put("bindCode", employeeTerminalRelaDto.getCode());
152
								resultMap.put("bindName", employeeTerminalRelaDto.getName());
153
								break;
154
							}
100 155
						}
101 156
					}
102 157
				}
103 158
104
				dataList.add(dataMap);
159
				resultList.add(resultMap);
105 160
			}
106 161
		}
107 162
108 163
		// 返回数据
109 164
		Map<String, Object> result = new HashMap<String, Object>();
165
		result.put("dataNum", deviceInfoListMap.get("totalResultNumber"));
166
		result.put("dataList", resultList);
167
		return result;
168
	}
169
170
	public List<CharacteristicSpecValue> queryDeviceTypeList() {
171
		CharacteristicSpec characteristicSpec = this.characteristicSpecService
172
				.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_PRODUCT_TYPE);
173
		List<CharacteristicSpecValue> resultList = characteristicSpec.getCharacteristicSpecValues();
174
		return resultList;
175
	}
176
177
	
178
	@Override
179
	public Map<String, Object> queryOneDeviceInfo(Map<String, String> params) throws Exception {
180
		//调用北向接口
181
		String url = NorthboundInterfaceConstant.queryOneDevice+ params.get("deviceId");
182
		Map<String, String> deviceInfoMap = northboundInterfaceUtil.iotGetCallUtil(url);
183
		Map resultMap = JSONObject.parseObject(deviceInfoMap.get("result"), Map.class);
184
		String remarks = deviceInfoMap.get("remarks") == null ? "" : deviceInfoMap.get("remarks");
185
		resultMap.put("remarks", remarks);
186
		return resultMap;
187
	}
188
	
189
190
	@Override
191
	public Map<String, String> addDeviceInfo(Map<String, String> params) throws Exception {
192
		Map<String, Object> paramsMap = new HashMap<String, Object>();
193
		String deviceId = params.get("deviceNo");
194
195
		paramsMap.put("deviceId", deviceId);// 终端id
196
		paramsMap.put("terminalSN", deviceId); // 终端编号
197
		paramsMap.put("productId", params.get("deviceTypeId")); // 终端类型
198
		paramsMap.put("deviceName", EbcConstant.BEIDOUDEVICE_NAME+params.get("deviceTypeName") + deviceId); // 名称
199
		paramsMap.put("remarks", params.get("remarks")); // 备注
200
201
		// 调用北向接口
202
		String url = NorthboundInterfaceConstant.addDevice;
203
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
204
		return map;
205
	}
206
	
207
208
	@Override
209
	public Map<String, String> modifyDeviceInfo(Map<String, String> params) throws Exception {
210
		Map<String, Object> paramsMap = new HashMap<String, Object>();
211
		String deviceId = params.get("deviceId");
212
213
		paramsMap.put("deviceId", deviceId);// 终端id
214
		paramsMap.put("terminalSN", deviceId); // 终端编号
215
		paramsMap.put("productId", params.get("deviceTypeId")); // 终端类型
216
		paramsMap.put("deviceName", EbcConstant.BEIDOUDEVICE_NAME+params.get("deviceTypeName") + deviceId); // 名称
217
		paramsMap.put("remarks", params.get("remarks")); // 备注
218
219
		// 调用北向接口
220
		String url = NorthboundInterfaceConstant.updateDevice;
221
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
222
		return map;
223
	}
224
	
225
226
	@Override
227
	public Map<String, String> deleteDeviceInfo(Map<String, String> params) throws Exception {
228
		// 调用北向接口
229
				String url = NorthboundInterfaceConstant.deleteDevice + params.get("deviceId");
230
				Map<String, String> map = northboundInterfaceUtil.iotGetCallUtil(url);
231
				
232
				
233
				// 根据终端id删除终端关联信息
234
				/*if (NorthboundInterfaceConstant.resultCode_succeed.equals(map.get("resultCode"))) {
235
					HashMap<String, Object> paramsHashMap = new HashMap<>();
236
					paramsHashMap.put("DEVICE_ID", params.get("deviceId"));
237
					int i = unbindDevice(paramsHashMap);
238
				}*/
239
				return map;
240
	}
241
242
	
243
	
244
	
245
	
246
	
247
	
248
	
249
	
250
	
251
	/*@Override
252
	public Map<String, Object> queryPageDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
253
			throws Exception {
254
		String isBindDevice = String.valueOf(params.get("IsBindDevice"));// 是否绑定终端
255
		boolean bindDeviceBoolean = EbcConstant.bind_device_ok.equals(isBindDevice);
256
		boolean unBindDeviceBoolean = EbcConstant.bind_device_no.equals(isBindDevice);
257
	
258
	
259
		// 返回数据
260
		Map<String, Object> result = new HashMap<String, Object>();
110 261
		result.put("dataNum", deviceInfoMap.get("totalResultNumber"));
111 262
		result.put("dataList", dataList);
112 263
		return result;
113 264
	}
114
265
	
115 266
	@Override
116 267
	public List<Map<String, String>> queryListDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
117 268
			throws Exception {
@ -119,10 +270,10 @@ public class DeviceManageServiceImpl implements DeviceManageService {
119 270
		Map<String, String> paramsMap = new HashMap<String, String>();
120 271
		paramsMap.put("specId", EbcConstant.beidouDevice_product_id); // 所属产品
121 272
		paramsMap.put("terminalSN", String.valueOf(params.get("deviceNo"))); // 终端序列号
122
273
	
123 274
		Map<String, String> deviceInfoMap = deviceManageDao.queryPageDeviceInfo(paramsMap, pageNum, pageSize);
124 275
		List<Map> deviceInfoList = JSON.parseArray(JSON.toJSONString(deviceInfoMap.get("result")), Map.class);
125
276
	
126 277
		// 整理返回数据信息
127 278
		List<Map<String, String>> dataList = new ArrayList<Map<String, String>>();
128 279
		if (deviceInfoList != null && deviceInfoList.size() > 0) {
@ -134,30 +285,10 @@ public class DeviceManageServiceImpl implements DeviceManageService {
134 285
				dataList.add(dataMap);
135 286
			}
136 287
		}
137
288
	
138 289
		return dataList;
139 290
	}
140
141
	@Override
142
	public Map<String, Object> queryOneDeviceInfo(Map<String, Object> params) throws Exception {
143
		return deviceManageDao.queryOneDeviceInfo(params);
144
	}
145
146
	@Override
147
	public Map<String, String> addDeviceInfo(Map<String, Object> params) throws Exception {
148
		return deviceManageDao.addDeviceInfo(params);
149
	}
150
151
	@Override
152
	public Map<String, String> modifyDeviceInfo(Map<String, Object> params) throws Exception {
153
		return deviceManageDao.modifyDeviceInfo(params);
154
	}
155
156
	@Override
157
	public Map<String, String> deleteDeviceInfo(Map<String, Object> params) throws Exception {
158
		return deviceManageDao.deleteDeviceInfo(params);
159
	}
160
291
	
161 292
	@Override
162 293
	public List<Map<String, Object>> queryAssociatInfo(Map<String, Object> params) throws Exception {
163 294
		if (EbcConstant.bind_device_type_user.equals(params.get("type"))) {
@ -170,7 +301,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
170 301
		}
171 302
		return new ArrayList<Map<String, Object>>();
172 303
	}
173
304
	
174 305
	@Override
175 306
	public Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception {
176 307
		// 查询用户与终端关联表,如果有数据返回,无数据返回空
@ -178,59 +309,59 @@ public class DeviceManageServiceImpl implements DeviceManageService {
178 309
				String.valueOf(params.get("PARTY_CODE")));
179 310
		return userAndDeviceMap;
180 311
	}
181
312
	
182 313
	@Override
183 314
	public boolean bindDevice(Map<String, Object> params) throws Exception {
184 315
		int num = deviceManageDao.bindDevice(params, String.valueOf(params.get("type")));
185 316
		return num > 0;
186 317
	}
187
318
	
188 319
	@Override
189 320
	public boolean unbindDevice(Map<String, Object> params) throws Exception {
190 321
		int num = deviceManageDao.unbindDevice(params);
191 322
		return num > 0;
192 323
	}
193
324
	
194 325
	@Override
195 326
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception {
196 327
		// 获取已绑定的终端列表
197 328
		List<Map<String, Object>> bindUserDeviceList = deviceManageDao.queryAllBindUser();
198
329
	
199 330
		if (bindUserDeviceList == null || bindUserDeviceList.isEmpty()) {
200 331
			return new ArrayList<Map<String, String>>();
201 332
		}
202
333
	
203 334
		List<String> deviceIdsList = new ArrayList<String>();
204 335
		for (int i = 0; i < bindUserDeviceList.size(); i++) {
205 336
			deviceIdsList.add(String.valueOf(bindUserDeviceList.get(i).get("DEVICE_ID")));
206 337
		}
207
338
	
208 339
		// 获取终端当前位置信息
209 340
		List<Map<String, String>> list = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
210
341
	
211 342
		if (list.isEmpty()) {
212 343
			logger.info("未查询到设备位置信息");
213 344
			return new ArrayList();
214 345
		}
215
346
	
216 347
		// 查询当前所有未关闭的求救信息
217 348
		List<Map<String, Object>> alarmMapList = rescueDao.queryNoCloseRescueLog(null);
218
349
	
219 350
		// 查询人员所在围栏信息
220 351
		List<String> mapTagTypeList = new ArrayList<String>();
221 352
		mapTagTypeList.add(EbcConstant.area_type_exclusion);
222 353
		mapTagTypeList.add(EbcConstant.area_type_temporariness);
223 354
		List<Map<String, Object>> areaViolationMapList = areaInOutRecordDao.getBeforeInAreaInfo(null, mapTagTypeList);
224
355
	
225 356
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.NORM_DATETIME_PATTERN);
226
357
	
227 358
		// 拼接返回数据
228 359
		for (Map<String, String> map : list) {
229 360
			String deviceId = map.get("deviceId");
230 361
			map.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
231
362
	
232 363
			boolean flag = true;
233
364
	
234 365
			// 人员名称
235 366
			for (Map<String, Object> bindDeviceMap : bindUserDeviceList) {
236 367
				if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
@ -239,7 +370,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
239 370
					break;
240 371
				}
241 372
			}
242
373
	
243 374
			// 离线信息
244 375
			if (map.get("alarmType") != null && EbcConstant.alarm_type_offline_beidou == Integer
245 376
					.parseInt(String.valueOf(map.get("alarmType")))) {
@ -247,23 +378,23 @@ public class DeviceManageServiceImpl implements DeviceManageService {
247 378
				map.put("alarmType", EbcConstant.alarm_type_offline_ZH);// 报警类型
248 379
				flag = false;
249 380
			}
250
381
	
251 382
			// 求救信息
252 383
			if (flag && alarmMapList != null && !alarmMapList.isEmpty()) {
253 384
				for (int i = 0; i < alarmMapList.size() && flag; i++) {
254 385
					Map<String, Object> alarmMap = alarmMapList.get(i);
255
386
	
256 387
					// 判断是救援者还是求救者
257 388
					if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
258 389
						// 求救者
259 390
						// 求救时间
260 391
						String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
261 392
						map.put("alarmDate", DateUtil.formatStrDate(alarmDate));
262
393
	
263 394
						// 计算求救时长
264 395
						int alarmLong = DateUtil.getDifferenceMinute(alarmDate, map.get("newDate"));
265 396
						map.put("alarmLong", String.valueOf(alarmLong));
266
397
	
267 398
						if (alarmMap.get("RESCUERS_ID") == null) {
268 399
							// 未指派救援人员
269 400
							map.put("isNewAlarm", EbcConstant.alarm_status_needassign);
@ -272,10 +403,10 @@ public class DeviceManageServiceImpl implements DeviceManageService {
272 403
							map.put("isNewAlarm", EbcConstant.alarm_status_needclose);
273 404
							// map.put("rescuerDeviceId", String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")));//救援者的设备ID
274 405
						}
275
406
	
276 407
						// 求救记录ID
277 408
						map.put("alarmLogId", String.valueOf(alarmMap.get("LOG_ID")));
278
409
	
279 410
						// 定位状态
280 411
						switch (String.valueOf(alarmMap.get("ALARM_TYPE"))) {
281 412
						case EbcConstant.alarm_type_autosos_ZH:
@ -291,9 +422,9 @@ public class DeviceManageServiceImpl implements DeviceManageService {
291 422
						default:
292 423
							break;
293 424
						}
294
425
	
295 426
						flag = false;
296
427
	
297 428
					} else if (deviceId.equals(String.valueOf(alarmMap.get("RESCUER_DEVICE_ID")))) {
298 429
						// 救援者
299 430
						map.put("locationStatus", EbcConstant.location_status_rescuer);// 定位状态
@ -302,13 +433,13 @@ public class DeviceManageServiceImpl implements DeviceManageService {
302 433
					}
303 434
				}
304 435
			}
305
436
	
306 437
			// 违规信息
307 438
			if (flag && areaViolationMapList != null && !areaViolationMapList.isEmpty()) {
308 439
				int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
309 440
				long minInAreaLong = System.currentTimeMillis();// 进入围栏最早的时间戳
310 441
				Map<String, Object> areaInfoMap = null;// 用于计算时间的围栏信息
311
442
	
312 443
				for (int i = 0; i < areaViolationMapList.size(); i++) {
313 444
					Map<String, Object> areaViolationMap = areaViolationMapList.get(i);
314 445
					if (deviceId.equals(String.valueOf(areaViolationMap.get("DEVICE_ID")))) {
@ -322,7 +453,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
322 453
							mapTagGrade = 3;
323 454
							break;
324 455
						}
325
456
	
326 457
						if (mapTagGrade == maxMapTagGrade) {
327 458
							// 比较进入时长时间
328 459
							long inAreaLong = simpleDateFormat.parse(String.valueOf(areaViolationMap.get("IN_DATE")))
@ -339,23 +470,23 @@ public class DeviceManageServiceImpl implements DeviceManageService {
339 470
						}
340 471
					}
341 472
				}
342
473
	
343 474
				// 判断是否违规
344 475
				if (maxMapTagGrade == 5) {
345 476
					// 进入电子围栏(禁区),需显示进入时间
346 477
					map.put("inDate", simpleDateFormat.format(areaInfoMap.get("IN_DATE"))); // 进入时间
347 478
					map.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
348
479
	
349 480
				} else if (maxMapTagGrade == 3) {
350 481
					// 进入定点(限时),需计算是否超时
351 482
					int fixedLong = DateUtil.getDifferenceMinute(String.valueOf(areaInfoMap.get("IN_DATE")),
352 483
							map.get("newDate"));
353
484
	
354 485
					if (fixedLong > 0) {
355 486
						// 围栏要求定点时间
356 487
						int residenceTimeLength = Integer
357 488
								.parseInt(String.valueOf(areaInfoMap.get("RESIDENCE_TIME_LENGTH")));
358
489
	
359 490
						if (residenceTimeLength <= fixedLong) {
360 491
							// 已超时
361 492
							map.put("locationStatus", EbcConstant.location_status_overtime);// 定位状态
@ -365,14 +496,14 @@ public class DeviceManageServiceImpl implements DeviceManageService {
365 496
				}
366 497
			}
367 498
		}
368
499
	
369 500
		return list;
370 501
	}
371
502
	
372 503
	@Override
373 504
	public Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params, int pageNum, int pageSize)
374 505
			throws Exception {
375
		/*Map<String,Object> resultMap<String,Object> = new HashMap<String,Object>();
506
		Map<String,Object> resultMap<String,Object> = new HashMap<String,Object>();
376 507
		String beginTime = null;// 开始时间
377 508
		String endTime = null;// 结束时间
378 509
		
@ -415,8 +546,8 @@ public class DeviceManageServiceImpl implements DeviceManageService {
415 546
		paramsMap.put("endTime", endTime);
416 547
		
417 548
		resultMap<String,Object> = deviceManageDao.queryOneDeviceLocationInfo(paramsMap, pageNum, pageSize);
418
		return resultMap<String,Object>;*/
549
		return resultMap<String,Object>;
419 550
		return null;
420
	}
551
	}*/
421 552
422 553
}

+ 10 - 9
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/EquipmentManageServiceImpl.java

@ -4,10 +4,11 @@ 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.PageInfo;
7
import com.ai.bss.location.rescue.dao.interfaces.DeviceManageDao;
8 7
import com.ai.bss.location.rescue.dao.interfaces.EquipmentManageDao;
9 8
import com.ai.bss.location.rescue.service.interfaces.EquipmentManageService;
10 9
10
import static org.junit.Assert.assertNotNull;
11
11 12
import java.util.*;
12 13
13 14
import com.ai.bss.work.tool.model.ResourceTool;
@ -29,9 +30,6 @@ public class EquipmentManageServiceImpl implements EquipmentManageService {
29 30
	EquipmentManageDao equipmentManageDao;
30 31
31 32
	@Autowired
32
	DeviceManageDao deviceManageDao;
33
34
	@Autowired
35 33
	ResourceToolCommand resourceToolCommand;
36 34
37 35
	@Autowired
@ -85,8 +83,9 @@ public class EquipmentManageServiceImpl implements EquipmentManageService {
85 83
		List<Map<String, Object>> allEquipmentList = equipmentManageDao.queryAllEquipmentInfo(params);
86 84
87 85
		// 获取已绑定船舶的信息
88
		List<Map<String, Object>> bindInfoList = deviceManageDao.queryAllBindShip();
89
86
		//List<Map<String, Object>> bindInfoList = deviceManageDao.queryAllBindShip();
87
		List<Map<String, Object>> bindInfoList = null;
88
		
90 89
		if (bindInfoList == null || bindInfoList.isEmpty()) {
91 90
			return allEquipmentList;
92 91
		}
@ -96,9 +95,11 @@ public class EquipmentManageServiceImpl implements EquipmentManageService {
96 95
		for (Map<String, Object> bindInfoMap : bindInfoList) {
97 96
			deviceIdsList.add(String.valueOf(bindInfoMap.get("DEVICE_ID")));
98 97
		}
99
		List<Map<String, String>> deviceLocationInfoList = deviceManageDao
100
				.queryCurrentDeviceLocationInfo(deviceIdsList);
101
98
		//List<Map<String, String>> deviceLocationInfoList = deviceManageDao
99
		//		.queryCurrentDeviceLocationInfo(deviceIdsList);
100
		List<Map<String, String>> deviceLocationInfoList = null;
101
		
102
		
102 103
		// 拼接船舶最新的位置信息
103 104
		for (Map<String, Object> bindInfoMap : bindInfoList) {
104 105
			String code = String.valueOf(bindInfoMap.get("CODE"));

+ 6 - 10
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/ReceiveSubscribeServiceImpl.java

@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
10 10
import org.springframework.beans.factory.annotation.Autowired;
11 11
import org.springframework.stereotype.Service;
12 12
13
import com.ai.bss.location.rescue.dao.interfaces.DeviceManageDao;
14 13
import com.ai.bss.location.rescue.dao.interfaces.MapTagManageDao;
15 14
import com.ai.bss.location.rescue.service.interfaces.ReceiveSubscribeService;
16 15
import com.ai.bss.location.rescue.service.iotdata.ManageIotInAreaData;
@ -41,9 +40,6 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
41 40
	@Autowired
42 41
	MapTagManageDao mapTagManageDao;
43 42
44
	@Autowired
45
	DeviceManageDao deviceManageDao;
46
47 43
	private ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
48 44
49 45
	@Override
@ -102,9 +98,9 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
102 98
	 */
103 99
	private void executeReceiveIotLocationData(Map<String, Object> params) throws Exception {
104 100
		// 获取人员信息
105
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(String.valueOf(params.get("deviceId")),
106
				null);
107
101
		//Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(String.valueOf(params.get("deviceId")),null);
102
		Map<String, Object> bindInfoMap = null;
103
				
108 104
		if (bindInfoMap == null) {
109 105
			// 1、设备与工具(船)绑定
110 106
			manageIotToolData.executeReceiveIotData(params);
@ -144,9 +140,9 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
144 140
	 */
145 141
	private void executeReceiveIotAlarmData(Map<String, Object> params) throws Exception {
146 142
		// 获取人员信息
147
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(String.valueOf(params.get("deviceId")),
148
				null);
149
143
		//Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(String.valueOf(params.get("deviceId")),null);
144
		Map<String, Object> bindInfoMap =null;
145
		
150 146
		if (bindInfoMap == null) {
151 147
			// 设备未与人员绑定
152 148
			logger.error("定位设备未与人员绑定");

+ 12 - 13
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/RescueServiceImpl.java

@ -1,21 +1,20 @@
1 1
package com.ai.bss.location.rescue.service.impl;
2 2
3 3
4
import com.ai.bss.location.rescue.dao.interfaces.DeviceManageDao;
5
import com.ai.bss.location.rescue.dao.interfaces.RescueDao;
6
import com.ai.bss.location.rescue.service.interfaces.RescueService;
7
import com.ai.bss.location.rescue.util.DateUtil;
8
import com.ai.bss.location.rescue.util.EbcConstant;
4
import java.util.ArrayList;
5
import java.util.HashMap;
6
import java.util.List;
9 7
import java.util.Map;
8
10 9
import org.slf4j.Logger;
11 10
import org.slf4j.LoggerFactory;
12 11
import org.springframework.beans.factory.annotation.Autowired;
13 12
import org.springframework.stereotype.Service;
14 13
15
import java.util.ArrayList;
16
import java.util.HashMap;
17
import java.util.List;
18
import java.util.Map;
14
import com.ai.bss.location.rescue.dao.interfaces.RescueDao;
15
import com.ai.bss.location.rescue.service.interfaces.RescueService;
16
import com.ai.bss.location.rescue.util.DateUtil;
17
import com.ai.bss.location.rescue.util.EbcConstant;
19 18
20 19
@Service
21 20
public class RescueServiceImpl implements RescueService {
@ -24,8 +23,6 @@ public class RescueServiceImpl implements RescueService {
24 23
	@Autowired
25 24
	RescueDao rescueDao;
26 25
27
	@Autowired
28
	DeviceManageDao deviceManageDao;
29 26
30 27
	@Override
31 28
	public List<Map<String, Object>> queryListRescuerInfo(Map<String,Object> params, int pageNum, int pageSize) throws Exception {
@ -81,8 +78,10 @@ public class RescueServiceImpl implements RescueService {
81 78
		}
82 79
83 80
		// 获取终端当前位置信息
84
		List<Map<String, String>> deviceList = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
85
81
		//List<Map<String, String>> deviceList = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
82
		List<Map<String, String>> deviceList =null;
83
		
84
		
86 85
		if (deviceList.isEmpty()) {
87 86
			logger.info("未查询到设备位置信息");
88 87
			return new ArrayList();

+ 106 - 70
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/DeviceManageService.java

@ -3,104 +3,140 @@ 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.bss.characteristic.spec.model.CharacteristicSpecValue;
7
6 8
public interface DeviceManageService {
7 9
8 10
	/**
9 11
	 * 分页查询终端信息
10 12
	 * @param params
11
	 * @param pageNum 当前页数
13
	 * @param pageNumber 当前页数
12 14
	 * @param pageSize 每页条数
13 15
	 * @return
14 16
	 * @throws Exception
15 17
	 */
16
	Map<String, Object> queryPageDeviceInfo(Map<String, Object> params, int pageNum, int pageSize) throws Exception;
18
	Map<String, Object> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
17 19
18 20
	/**
19
	 * 获取下拉列表的终端信息
20
	 * @param params
21
	 * @param pageNum 当前页数
22
	 * @param pageSize 每页条数
21
	 * 获取终端类型下拉列表
23 22
	 * @return
24
	 * @throws Exception
25 23
	 */
26
	List<Map<String, String>> queryListDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
27
			throws Exception;
28
29
	/**
30
	 * 获取单个终端信息
31
	 * @param params
32
	 * @return
33
	 * @throws Exception
34
	 */
35
	Map<String, Object> queryOneDeviceInfo(Map<String, Object> params) throws Exception;
36
24
	List<CharacteristicSpecValue> queryDeviceTypeList();
25
	
37 26
	/**
38
	 * 新增终端信息
39
	 * @param params
40
	 * @return
41
	 * @throws Exception
42
	 */
43
	Map<String, String> addDeviceInfo(Map<String, Object> params) throws Exception;
27
	* 获取单个终端信息
28
	* @param params
29
	* @return
30
	* @throws Exception
31
	*/
44 32
45
	/**
46
	 * 修改终端信息
47
	 * @param params
48
	 * @return
49
	 * @throws Exception
50
	 */
51
	Map<String, String> modifyDeviceInfo(Map<String, Object> params) throws Exception;
33
Map<String, Object> queryOneDeviceInfo(Map<String, String> params) throws Exception;
52 34
53
	/**
54
	 * 删除终端信息
55
	 * @param params
56
	 * @return
57
	 * @throws Exception
58
	 */
59
	Map<String, String> deleteDeviceInfo(Map<String, Object> params) throws Exception;
35
/**
36
	* 新增终端信息
37
	* @param params
38
	* @return
39
	* @throws Exception
40
	*/
60 41
61
	/**
62
	 * 绑定终端
63
	 * @param params
64
	 * @param type
65
	 * @return
66
	 * @throws Exception
67
	 */
68
	boolean bindDevice(Map<String, Object> params) throws Exception;
42
Map<String, String> addDeviceInfo(Map<String, String> params) throws Exception;
69 43
70
	/**
71
	 * 解绑终端
72
	 * @param params
73
	 * @return
74
	 * @throws Exception
75
	 */
76
	boolean unbindDevice(Map<String, Object> params) throws Exception;
44
/**
45
	* 修改终端信息
46
	* @param params
47
	* @return
48
	* @throws Exception
49
	*/
77 50
78
	/**
79
	 * 获取人员或船舶的下拉列表数据
80
	 * @param params
81
	 * @return
82
	 * @throws Exception
83
	 */
84
	List<Map<String, Object>> queryAssociatInfo(Map<String, Object> params) throws Exception;
51
Map<String, String> modifyDeviceInfo(Map<String, String> params) throws Exception;
85 52
86
	Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception;
53
/**
54
	* 删除终端信息
55
	* @param params
56
	* @return
57
	* @throws Exception
58
	*/
59
Map<String, String> deleteDeviceInfo(Map<String, String> params) throws Exception;
87 60
88
	/**
89
	 * 获取终端的最新事件
90
	 * @param params
91
	 * @return
92
	 * @throws Exception
93
	 */
94
	List<Map<String, String>> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception;
95 61
62
	
63
	
64
	
65
	
66
	
67
	
68
	
69
	
70
	
71
	
72
	
73
	
74
	
75
	
76
	
77
	
78
	
79
	
80
	
81
	
96 82
	/**
97
	 * 按时间段获取终端的定位信息
83
	 * 获取下拉列表的终端信息
98 84
	 * @param params
99 85
	 * @param pageNum 当前页数
100 86
	 * @param pageSize 每页条数
101 87
	 * @return
102 88
	 * @throws Exception
103 89
	 */
104
	Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params, int pageNum, int pageSize)
90
	/*List<Map<String, String>> queryListDeviceInfo(Map<String, Object> params, int pageNum, int pageSize)
105 91
			throws Exception;
92
	
93
	*//**
94
		* 绑定终端
95
		* @param params
96
		* @param type
97
		* @return
98
		* @throws Exception
99
		*/
100
	/*
101
	boolean bindDevice(Map<String, Object> params) throws Exception;
102
	
103
	*//**
104
		* 解绑终端
105
		* @param params
106
		* @return
107
		* @throws Exception
108
		*/
109
	/*
110
	boolean unbindDevice(Map<String, Object> params) throws Exception;
111
	
112
	*//**
113
		* 获取人员或船舶的下拉列表数据
114
		* @param params
115
		* @return
116
		* @throws Exception
117
		*/
118
	/*
119
	List<Map<String, Object>> queryAssociatInfo(Map<String, Object> params) throws Exception;
120
	
121
	Map<String, Object> verifyUserOrBoatAssociatInfo(Map<String, Object> params) throws Exception;
122
	
123
	*//**
124
		* 获取终端的最新事件
125
		* @param params
126
		* @return
127
		* @throws Exception
128
		*/
129
	/*
130
	List<Map<String, String>> queryCurrentDeviceLocationInfo(Map<String, Object> params) throws Exception;
131
	
132
	*//**
133
		* 按时间段获取终端的定位信息
134
		* @param params
135
		* @param pageNum 当前页数
136
		* @param pageSize 每页条数
137
		* @return
138
		* @throws Exception
139
		*//*
140
			Map<String, Object> queryOneDeviceLocationInfo(Map<String, Object> params, int pageNum, int pageSize)
141
				throws Exception;*/
106 142
}

+ 3 - 6
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/iotdata/ManageIotToolData.java

@ -5,22 +5,19 @@ import java.util.Map;
5 5
6 6
import org.slf4j.Logger;
7 7
import org.slf4j.LoggerFactory;
8
import org.springframework.beans.factory.annotation.Autowired;
9 8
import org.springframework.stereotype.Component;
10 9
11
import com.ai.bss.location.rescue.dao.interfaces.DeviceManageDao;
12 10
import com.ai.bss.location.rescue.util.MirrorSendDateUtil;
13 11
14 12
@Component
15 13
public class ManageIotToolData {
16 14
	private static final Logger logger = LoggerFactory.getLogger(ManageIotToolData.class);
17 15
18
	@Autowired
19
	DeviceManageDao deviceManageDao;
20 16
21 17
	public boolean executeReceiveIotData(Map<String,Object> params) throws Exception {
22
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindShip(String.valueOf(params.get("deviceId")), null);
23
18
		//Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindShip(String.valueOf(params.get("deviceId")), null);
19
		Map<String, Object> bindInfoMap = null;
20
				
24 21
		if (bindInfoMap == null) {
25 22
			// 设备未绑定
26 23
			logger.error("定位设备未绑定");

+ 26 - 13
location-rescue-service/src/main/java/com/ai/bss/location/rescue/util/EbcConstant.java

@ -7,38 +7,51 @@ package com.ai.bss.location.rescue.util;
7 7
 */
8 8
public class EbcConstant {
9 9
	// 下拉列表最大查询条数
10
	public static final int comboBox_maxNum = 20;
10
	public static final int COMBOBOX_MAXNUM = 30;
11 11
12 12
	// 每页默认查询条数
13
	public static final int default_page_size = 20;
13
	public static final int DEFAULT_PAGE_SIZE = 20;
14 14
	
15 15
	// 轨迹回放单次查询条数
16
	public static final int track_playback_size = 100;
16
	public static final int TRACK_PLAYBACK_SIZE = 100;
17 17
18 18
	// 经纬度的精度
19
	public static final int coord_scale = 7;
20
21
	// 终端的产品id
22
	public static final String beidouDevice_product_id = "57700004344";
19
	public static final int COORD_SCALE = 7;
23 20
24 21
	// 终端的名称前缀
25
	public static final String beidouDevice_name = "康派北斗定位器";
22
	public static final String BEIDOUDEVICE_NAME = "康派北斗 - ";
26 23
27 24
	// 全部终端(已关联和未关联)
28
	public static final String bind_device_all = "0";
25
	public static final String BIND_DEVICE_ALL = "0";
29 26
30 27
	// 已关联终端
31
	public static final String bind_device_ok = "1";
28
	public static final String BIND_DEVICE_OK = "1";
32 29
33 30
	// 未关联终端
34
	public static final String bind_device_no = "2";
31
	public static final String BIND_DEVICE_NO = "2";
35 32
36 33
	// 终端和人员绑定
37
	public static final String bind_device_type_user = "1";
34
	public static final String BIND_DEVICE_TYPE_USER = "1";
38 35
39 36
	// 终端和船舶绑定
40
	public static final String bind_device_type_ship = "2";
37
	public static final String BIND_DEVICE_TYPE_SHIP = "2";
41 38
39
	//静态常量: 设备类型
40
	public static final String BUSINESS_SPEC_PRODUCT_TYPE="PRODUCT_TYPE";
41
	
42
	//静态常量: 围栏类型
43
	public static final String BUSINESS_SPEC_MAP_AREA_TYPE="MAP_AREA_TYPE";
44
	
45
	
46
	
47
	
48
	
49
	
50
	
51
	
52
	
53
	
54
	
42 55
	// 围栏标记类型:考勤区域
43 56
	public static final String area_type_attendance = "1";
44 57