| 
						
						
							
								
							
						
						
					 | 
					@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.AppClientConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.AppClientConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.HttpClientManager; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.HttpClientManager; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -116,26 +118,50 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							JSONObject toResult = JSON.parseObject(data); | 
					 | 
					 | 
							JSONObject toResult = JSON.parseObject(data); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); | 
					 | 
					 | 
							Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							if (null != toResult.get("code")) { | 
					 | 
					 | 
							if (null != toResult.get("code")) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
								mapToResult.setCode(((Integer) toResult.get("code")).intValue()); | 
					 | 
					 | 
								mapToResult.setCode((Integer) toResult.get("code")); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							if (!mapToResult.success()) { | 
					 | 
					 | 
							if (!mapToResult.success()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								logger.error(String.format("根据appId查询客户信息失败,对应appId->" + formDTO.getAppId())); | 
					 | 
					 | 
								logger.error(String.format("根据appId查询客户信息失败,对应appId->" + formDTO.getAppId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								throw new RenException(mapToResult.getMsg()); | 
					 | 
					 | 
								throw new RenException(mapToResult.getMsg()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							Object PublicCustomerResultDTO = mapToResult.getData(); | 
					 | 
					 | 
							Object publicCustomerResultDTO = mapToResult.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString()); | 
					 | 
					 | 
							JSONObject json = JSON.parseObject(publicCustomerResultDTO.toString()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							Map<String, Object> map = (Map) json.get("customer"); | 
					 | 
					 | 
							Map map = (Map) json.get("customer"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); | 
					 | 
					 | 
							PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer); | 
					 | 
					 | 
							logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//2.调用epmet-user服务,根据客户Id和用户Id查询最后一次访问记录
 | 
					 | 
					 | 
							//2.调用epmet-user服务,根据客户Id和用户Id查询最后一次访问记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							LatestGridInfoResultDTO result = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							formDTO.setCustomerId(customer.getId()); | 
					 | 
					 | 
							formDTO.setCustomerId(customer.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							Result<LatestGridInfoResultDTO> userResult = epmetUserOpenFeignClient.latestGridInfo(formDTO); | 
					 | 
					 | 
							Result<List<LatestGridInfoResultDTO>> userResult = epmetUserOpenFeignClient.latestGridList(formDTO); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							if (!userResult.success()) { | 
					 | 
					 | 
							if (!userResult.success()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								logger.error(String.format("居民端获取用户最近访问网格失败,接口入参客户Id->%s,appId->%s,调用epmet-user-server服务返回->%s", formDTO.getCustomerId(), formDTO.getAppId(), JSON.toJSONString(userResult))); | 
					 | 
					 | 
								logger.error(String.format("居民端获取用户最近访问网格失败,接口入参客户Id->%s,appId->%s,调用epmet-user-server服务返回->%s", formDTO.getCustomerId(), formDTO.getAppId(), JSON.toJSONString(userResult))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								return result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							return userResult.getData(); | 
					 | 
					 | 
							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()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							return result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						} | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						/** | 
					 | 
					 | 
						/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |