Bladeren bron

解绑查询关联关系

wangchao 4 jaren geleden
bovenliggende
commit
7b5bd7fc8f

+ 2 - 5
location-rescue-service/src/main/java/com/ai/bss/location/rescue/controller/DeviceManageController.java

@ -4,8 +4,6 @@ import java.util.HashMap;
4 4
import java.util.List;
5 5
import java.util.Map;
6 6
7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9 7
import org.springframework.beans.factory.annotation.Autowired;
10 8
import org.springframework.stereotype.Controller;
11 9
import org.springframework.web.bind.annotation.RequestBody;
@ -17,7 +15,6 @@ import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
17 15
import com.ai.bss.location.rescue.service.interfaces.DeviceManageService;
18 16
import com.ai.bss.location.rescue.util.EbcConstant;
19 17
import com.ai.bss.location.rescue.util.NorthboundInterfaceConstant;
20
import com.ai.bss.user.dto.UserDto;
21 18
22 19
/**
23 20
 * 终端管理
@ -213,8 +210,8 @@ public class DeviceManageController {
213 210
	 */
214 211
	@ResponseBody
215 212
	@RequestMapping("/queryAssociatInfo")
216
	public Map<String, Object> queryAssociatInfo(@RequestBody Map<String, String> params) throws Exception {
217
		List<Map<String, Object>> userList = deviceManageService.queryAssociatInfo(params);
213
	public Map<String, Object> queryAssociatInfo(@RequestBody Map<String, Object> params) throws Exception {
214
		List<? extends Object> userList =  deviceManageService.queryAssociatInfo(params);
218 215
		Map<String, Object> result = new HashMap<String, Object>();
219 216
		result.put("result", userList);
220 217
		return result;

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

@ -98,7 +98,8 @@ public class EquipmentManageController {
98 98
	@ResponseBody
99 99
	@RequestMapping("/modifyEquipmentInfo")
100 100
	public CommonResponse<ResourceTool> modifyEquipmentInfo(@RequestBody CommonRequest<ResourceTool> resourceToolCommonRequest) throws Exception {
101
			return equipmentManageService.modifyEquipmentInfo(resourceToolCommonRequest);
101
		resourceToolCommonRequest.getData().setWorkOrgId("0000");
102
		return equipmentManageService.modifyEquipmentInfo(resourceToolCommonRequest);
102 103
	}
103 104
104 105
	/**

+ 57 - 23
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/impl/DeviceManageServiceImpl.java

@ -5,6 +5,10 @@ import java.util.HashMap;
5 5
import java.util.List;
6 6
import java.util.Map;
7 7
8
import com.ai.bss.components.common.model.PageBean;
9
import com.ai.bss.user.dto.UserDto;
10
import com.ai.bss.user.service.api.UserDtoQuery;
11
import com.sun.org.apache.xpath.internal.objects.XString;
8 12
import org.slf4j.Logger;
9 13
import org.slf4j.LoggerFactory;
10 14
import org.springframework.beans.factory.annotation.Autowired;
@ -54,6 +58,11 @@ public class DeviceManageServiceImpl implements DeviceManageService {
54 58
	@Autowired
55 59
	ResourceToolCommand resourceToolCommand;
56 60
61
	@Autowired
62
	UserDtoQuery userDtoQuery;
63
64
65
57 66
	@Override
58 67
	public Map<String, Object> queryPageDeviceInfo(Map<String, String> params, int pageNumber, int pageSize)
59 68
			throws Exception {
@ -308,29 +317,40 @@ public class DeviceManageServiceImpl implements DeviceManageService {
308 317
309 318
	@Override
310 319
	public Map<String, Object> queryBindDeviceInfo(Map<String, String> params) throws Exception {
320
		//组合中台需要的终端id list参数集合
311 321
		List<String> deviceIdList=new ArrayList<String>();
312 322
		deviceIdList.add(params.get("deviceId"));
313 323
		HashMap<String, Object> deviceIdListMap=new HashMap<String, Object>();
314 324
		deviceIdListMap.put("deviceIdList", deviceIdList);
315
		
316
		
317
		
325
		//定义返回参数map
326
		Map<String, Object> returnMap= new HashMap<>();
318 327
		// 终端与人员绑定
319 328
		CommonResponse<List<EmployeeTerminalRelaDto>> bindEmployeeInfoCommon = employeeTerminalRelaQuery
320 329
				.queryIndividualDevRela(new CommonRequest<List<String>>(deviceIdList));
321 330
		List<EmployeeTerminalRelaDto> bindEmployeeInfoList = bindEmployeeInfoCommon.getData();
322
		
323
		
324
		
325
		// 终端与工具绑定
326
		CommonResponse<PageInfo<Map<String, Object>>> bindToolInfoCommon = resourceToolQuery
327
				.queryWorkToolsDevRela(new CommonRequest<HashMap<String, Object>>(deviceIdListMap));
328
		List<Map<String, Object>> bindToolInfoList = bindToolInfoCommon.getData().getData();
329
			
330
			
331
			
332
		
333
		return null;
331
332
		if(!bindEmployeeInfoList.isEmpty()){
333
			EmployeeTerminalRelaDto employeeTerminalRelaDto = bindEmployeeInfoList.get(0);
334
			returnMap.put("deviceId",params.get("deviceId"));
335
			returnMap.put("name",employeeTerminalRelaDto.getName());
336
			returnMap.put("relaType",employeeTerminalRelaDto.getRelaType());
337
			returnMap.put("employeeTerminalRelaId",employeeTerminalRelaDto.getEmployeeTerminalRelaId());
338
			returnMap.put("code",employeeTerminalRelaDto.getCode());
339
			returnMap.put("workEmployeeId",employeeTerminalRelaDto.getWorkEmployeeId());
340
			returnMap.put("bindType",EbcConstant.BIND_DEVICE_TYPE_USER);
341
			return returnMap;
342
		}else{
343
			// 终端与工具绑定
344
			CommonResponse<PageInfo<Map<String, Object>>> bindToolInfoCommon = resourceToolQuery
345
					.queryWorkToolsDevRela(new CommonRequest<HashMap<String, Object>>(deviceIdListMap));
346
			List<Map<String, Object>> bindToolInfoList = bindToolInfoCommon.getData().getData();
347
			if(!bindToolInfoList.isEmpty()){
348
				Map<String, Object> stringObjectMap = bindToolInfoList.get(0);
349
				returnMap.put("bindType",EbcConstant.BIND_DEVICE_TYPE_SHIP);
350
				return stringObjectMap;
351
			}
352
			return null;
353
		}
334 354
	}
335 355
336 356
	@Override
@ -351,14 +371,28 @@ public class DeviceManageServiceImpl implements DeviceManageService {
351 371
	}
352 372
353 373
	@Override
354
	public List<Map<String, Object>> queryAssociatInfo(Map<String, String> params) throws Exception {
355
		if (EbcConstant.BIND_DEVICE_TYPE_USER.equals(params.get("type"))) {
356
			// 类型是用户,查询用户列表
357
			
358
			
359
		} else if (EbcConstant.BIND_DEVICE_TYPE_SHIP.equals(params.get("type"))) {
360
			// 类型是船舶,查询船舶列表
361
			
374
	public List<? extends Object> queryAssociatInfo(Map<String, Object> params) throws Exception {
375
		if (EbcConstant.BIND_DEVICE_TYPE_USER.equals(params.get("bindType"))) {
376
377
			// 类型是用户,查询用户列表,模糊查询
378
			UserDto userDto=new UserDto();
379
			String username=(params.get("name")!=null||!"".equals(params.get("name")))?(String) params.get("name"):null;
380
			userDto.setName(username);
381
			userDto.setOrgCode("0000");
382
			CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(1).pageSize(15).build();
383
			CommonResponse<List<UserDto>> listCommonResponse = userDtoQuery.queryWorkEmployeeByOrg(request);
384
			List<UserDto> userDtoList = listCommonResponse.getData();
385
			return  userDtoList;
386
		} else if (EbcConstant.BIND_DEVICE_TYPE_SHIP.equals(params.get("bindType"))) {
387
			// 类型是船舶,查询船舶列表,模糊查询
388
			// "workOrgId" : 组织ID
389
			//  "isAllowBindTerminal" : 该工具是否可绑定,'0'--不可绑定,'1' -- 可绑定
390
			params.put("workOrgId", "0000");
391
			params.put("isAllowBindTerminal", "0");
392
			CommonRequest<HashMap<String, Object>> conditionMap = new CommonRequest<>((HashMap<String, Object>) params);
393
			CommonResponse<PageInfo<Map<String, Object>>> pageInfoCommonResponse = resourceToolQuery.queryWorkToolByOrgAndBindFlag(conditionMap);
394
			List<Map<String, Object>> shipList = pageInfoCommonResponse.getData().getData();
395
			return shipList;
362 396
		}
363 397
		return null;
364 398
	}

+ 2 - 1
location-rescue-service/src/main/java/com/ai/bss/location/rescue/service/interfaces/DeviceManageService.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.sun.org.apache.xpath.internal.objects.XString;
6 7
import org.springframework.web.bind.annotation.RequestBody;
7 8
8 9
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
@ -91,7 +92,7 @@ public interface DeviceManageService {
91 92
	* @return
92 93
	* @throws Exception
93 94
	*/
94
	List<Map<String, Object>> queryAssociatInfo(Map<String, String> params) throws Exception;
95
	List<? extends Object> queryAssociatInfo(Map<String, Object> params) throws Exception;
95 96
96 97
	/**
97 98
	 * 获取下拉列表的终端信息