From c6665639b1c9bee40be06c1d75025ddeeb4e00da Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Jun 2022 15:10:58 +0800 Subject: [PATCH] =?UTF-8?q?/resi/mine/mygrid/latestgridinfo=3FappId=3DXX?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/redis/common/bean/GridInfoCache.java | 2 +- .../service/impl/ResiMineGridServiceImpl.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java index c55e61513e..17a55e8b17 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java @@ -115,7 +115,7 @@ public class GridInfoCache implements Serializable { private String coordinates; /** - * 弃用标记 + * 弃用标记 弃用:1;正常使用:0 */ private Integer abandonFlag; diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java index 78a32b482f..11f20c2f0c 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.modules.grid.service.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; @@ -107,7 +108,7 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { **/ @Override public LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO) { - logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(formDTO))); + // logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(formDTO))); // 查询注册网格的弃用状态 LatestGridInfoResultDTO result = new LatestGridInfoResultDTO(); @@ -160,6 +161,19 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { } result.setGridId(StringUtils.isNotBlank(userResult.getData().getGridId()) ? userResult.getData().getGridId() : ""); result.setCustomerId(StringUtils.isNotBlank(userResult.getData().getCustomerId()) ? userResult.getData().getCustomerId() : ""); + //判断下最后一次访问的网格是否已经被删除或者被弃用 + if (StringUtils.isNotBlank(userResult.getData().getGridId())) { + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(result.getGridId()); + if (null == gridInfoCache || (null != gridInfoCache.getAbandonFlag() && NumConstant.ONE == gridInfoCache.getAbandonFlag())) { + result.setGridId(StrConstant.EPMETY_STR); + result.setCustomerId(StrConstant.EPMETY_STR); + logger.error(String.format("获取用户最近访问网格异常,网格可能被删除或者被弃用,参数%s",JSON.toJSONString(formDTO))); + return result; + } + result.setGridId(userResult.getData().getGridId()); + } else { + result.setGridId(StrConstant.EPMETY_STR); + } return result; }