diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index e92f1a608f..cd170a00d6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -1066,4 +1066,26 @@ public class RedisKeys { public static String getSdtAccessToken(String customerId) { return rootPrefix.concat("thirdplatform:sdt:accesstoken:").concat(customerId); }; + + /** + * @Description: 获取人房数据统计 人 + * @param agencyId: + * @Return java.lang.String + * @Author: lichao + * @Date: 2023/11/1 13:58 + */ + public static String getUserchart(String orgType,String agencyId) { + return rootPrefix.concat("resi:icresiuser:userchart:".concat(orgType).concat(StrConstant.COLON).concat(agencyId)); + } + + /** + * @Description: 获取人房数据统计 房 + * @param agencyId: + * @Return java.lang.String + * @Author: lichao + * @Date: 2023/11/1 13:58 + */ + public static String getHousechart(String orgType,String agencyId) { + return rootPrefix.concat("govorg:house:housechart:".concat(orgType).concat(StrConstant.COLON).concat(agencyId)); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index fcd33c9684..44a2e32c0e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -19,6 +19,8 @@ import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; @@ -55,6 +57,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -136,6 +139,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { @Autowired private EpmetUserRemoteService epmetUserRemoteService; + @Autowired + private RedisTemplate redisTemplate; + + /** * 房屋管理-新增房屋 * @@ -763,6 +770,13 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { formDTO.setOrgId(staffInfo.getAgencyId()); formDTO.setOrgType("agency"); } + + // redis LC 新增24小时失效的 + if (redisTemplate.opsForValue().get(RedisKeys.getHousechart(formDTO.getOrgType(),formDTO.getOrgId()))!=null){ + return (HouseChartResultDTO)redisTemplate.opsForValue().get(RedisKeys.getHousechart(formDTO.getOrgType(),formDTO.getOrgId())); + } + + //2.根据入参值查询对应的房屋统计数据 List list = icHouseDao.houseChart(formDTO.getOrgId(), formDTO.getOrgType()); //3.汇总数据 @@ -798,6 +812,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { resultDTO.setCzHouseTotalJSY(resultDTO.getCzHouseTotal() - lastMonthUserHouseStats.getCzHouseTotal()); resultDTO.setXzHouseTotalJSY(resultDTO.getXzHouseTotal() - lastMonthUserHouseStats.getXzHouseTotal()); resultDTO.setZzHouseTotalJSY(resultDTO.getZzHouseTotal() - lastMonthUserHouseStats.getZzHouseTotal());*/ + + // 24小时过期 + redisTemplate.opsForValue().set(RedisKeys.getHousechart(formDTO.getOrgType(),formDTO.getOrgId()), resultDTO, RedisUtils.DEFAULT_EXPIRE, TimeUnit.SECONDS); + return resultDTO; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 7003c42078..c4dad204cf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -2212,6 +2212,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl