|  |  | @ -121,57 +121,34 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { | 
			
		
	
		
			
				
					|  |  |  | 		JSONObject toResult = JSON.parseObject(data); | 
			
		
	
		
			
				
					|  |  |  | 		Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); | 
			
		
	
		
			
				
					|  |  |  | 		if (null != toResult.get("code")) { | 
			
		
	
		
			
				
					|  |  |  | 			mapToResult.setCode((Integer) toResult.get("code")); | 
			
		
	
		
			
				
					|  |  |  | 			mapToResult.setCode(((Integer) toResult.get("code")).intValue()); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		if (!mapToResult.success()) { | 
			
		
	
		
			
				
					|  |  |  | 			logger.error(String.format("根据appId查询客户信息失败,对应appId->" + formDTO.getAppId())); | 
			
		
	
		
			
				
					|  |  |  | 			throw new RenException(mapToResult.getMsg()); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		Object publicCustomerResultDTO = mapToResult.getData(); | 
			
		
	
		
			
				
					|  |  |  | 		JSONObject json = JSON.parseObject(publicCustomerResultDTO.toString()); | 
			
		
	
		
			
				
					|  |  |  | 		Map map = (Map) json.get("customer"); | 
			
		
	
		
			
				
					|  |  |  | 		Object PublicCustomerResultDTO = mapToResult.getData(); | 
			
		
	
		
			
				
					|  |  |  | 		JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString()); | 
			
		
	
		
			
				
					|  |  |  | 		Map<String, Object> map = (Map) json.get("customer"); | 
			
		
	
		
			
				
					|  |  |  | 		PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); | 
			
		
	
		
			
				
					|  |  |  | 		logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		//2.调用epmet-user服务,根据客户Id和用户Id查询最后一次访问记录
 | 
			
		
	
		
			
				
					|  |  |  | 		LatestGridInfoResultDTO result = null; | 
			
		
	
		
			
				
					|  |  |  | 		formDTO.setCustomerId(customer.getId()); | 
			
		
	
		
			
				
					|  |  |  | 		Result<List<LatestGridInfoResultDTO>> userResult = epmetUserOpenFeignClient.latestGridList(formDTO); | 
			
		
	
		
			
				
					|  |  |  | 		Result<LatestGridInfoResultDTO> userResult = epmetUserOpenFeignClient.latestGridInfo(formDTO); | 
			
		
	
		
			
				
					|  |  |  | 		if (!userResult.success()) { | 
			
		
	
		
			
				
					|  |  |  | 			logger.error(String.format("居民端获取用户最近访问网格失败,接口入参客户Id->%s,appId->%s,调用epmet-user-server服务返回->%s", formDTO.getCustomerId(), formDTO.getAppId(), JSON.toJSONString(userResult))); | 
			
		
	
		
			
				
					|  |  |  | 			return result; | 
			
		
	
		
			
				
					|  |  |  | 			return null; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		for (LatestGridInfoResultDTO girdInfo : userResult.getData()) { | 
			
		
	
		
			
				
					|  |  |  | 			try { | 
			
		
	
		
			
				
					|  |  |  | 				GridInfoCache grid = CustomerOrgRedis.getGridInfo(girdInfo.getGridId()); | 
			
		
	
		
			
				
					|  |  |  | 				if (grid == null) { | 
			
		
	
		
			
				
					|  |  |  | 					logger.warn("latestGridInfo get gridInfo return null,gridId:{}", girdInfo.getGridId()); | 
			
		
	
		
			
				
					|  |  |  | 					continue; | 
			
		
	
		
			
				
					|  |  |  | 				} else { | 
			
		
	
		
			
				
					|  |  |  | 					Integer abandonFlag = grid.getAbandonFlag(); | 
			
		
	
		
			
				
					|  |  |  | 					if (NumConstant.ONE == abandonFlag) { | 
			
		
	
		
			
				
					|  |  |  | 						logger.warn("latestGridInfo gridId:{} has abandoned", girdInfo.getGridId()); | 
			
		
	
		
			
				
					|  |  |  | 						continue; | 
			
		
	
		
			
				
					|  |  |  | 					} else { | 
			
		
	
		
			
				
					|  |  |  | 						result = girdInfo; | 
			
		
	
		
			
				
					|  |  |  | 						//匹配到了未弃用的网格 跳出
 | 
			
		
	
		
			
				
					|  |  |  | 						break; | 
			
		
	
		
			
				
					|  |  |  | 					} | 
			
		
	
		
			
				
					|  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  | 			} catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  | 				logger.warn("latestGridInfo get gridInfo exception,gridId:{}", girdInfo.getGridId()); | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		// 查询注册网格的弃用状态
 | 
			
		
	
		
			
				
					|  |  |  | 		LatestGridInfoResultDTO result = userResult.getData(); | 
			
		
	
		
			
				
					|  |  |  | 		Result<List<UserBaseInfoResultDTO>> userBaseInfo = epmetUserOpenFeignClient.queryUserBaseInfo(Arrays.asList(formDTO.getUserId())); | 
			
		
	
		
			
				
					|  |  |  | 		if (!userBaseInfo.success()){ | 
			
		
	
		
			
				
					|  |  |  | 			throw new EpmetException("查询用户基本信息失败"); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		GridInfoCache grid = CustomerOrgRedis.getGridInfo(userBaseInfo.getData().get(NumConstant.ZERO).getRegisteredGridId()); | 
			
		
	
		
			
				
					|  |  |  | 		if (grid != null) { | 
			
		
	
		
			
				
					|  |  |  | 			result.setRegisterGridStatus(grid.getAbandonFlag().compareTo(NumConstant.ONE) == NumConstant.ZERO ? true : false); | 
			
		
	
		
			
				
					|  |  |  | 			result.setRegisterGridStatus(grid.getAbandonFlag()); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		return result; | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
	
		
			
				
					|  |  | 
 |