|
@ -6,8 +6,6 @@ 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.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
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; |
|
@ -121,50 +119,27 @@ 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")); |
|
|
mapToResult.setCode(((Integer) toResult.get("code")).intValue()); |
|
|
} |
|
|
} |
|
|
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 map = (Map) json.get("customer"); |
|
|
Map<String, Object> 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<List<LatestGridInfoResultDTO>> userResult = epmetUserOpenFeignClient.latestGridList(formDTO); |
|
|
Result<LatestGridInfoResultDTO> userResult = epmetUserOpenFeignClient.latestGridInfo(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 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())); |
|
|
Result<List<UserBaseInfoResultDTO>> userBaseInfo = epmetUserOpenFeignClient.queryUserBaseInfo(Arrays.asList(formDTO.getUserId())); |
|
|
if (!userBaseInfo.success()){ |
|
|
if (!userBaseInfo.success()){ |
|
|
throw new EpmetException("查询用户基本信息失败"); |
|
|
throw new EpmetException("查询用户基本信息失败"); |
|
|