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 57630deaaf..970f72801a 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 @@ -630,10 +630,10 @@ public class RedisKeys { /** * desc:临时方案 - * @param userId + * @param agencyId * @return */ - public static String getOrgTreeCacheKey(String userId) { - return rootPrefix.concat("ic:temp:orgtree").concat("userId"); + public static String getOrgTreeCacheKey(String agencyId) { + return rootPrefix.concat("ic:temp:orgtree").concat(agencyId); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 43108f3706..64660eec85 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -20,8 +20,6 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; @@ -55,8 +53,6 @@ import java.util.Set; @RestController @RequestMapping("customeragency") public class CustomerAgencyController { - @Autowired - private RedisUtils redisUtils; @Autowired private CustomerAgencyService customerAgencyService; @@ -369,18 +365,9 @@ public class CustomerAgencyController { * @Date 2021/9/8 15:20 */ @PostMapping("agencygridtree") - public Result getOrgTreeData(/*@LoginUser */TokenDto tokenDTO) { - tokenDTO.setUserId("dffe71e021a61b900f9025f4f07f6955"); - String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(tokenDTO.getUserId()); - Object o = redisUtils.get(orgTreeCacheKey); - AgencyTreeResultDTO result = null; - if (o == null){ - result = customerAgencyService.getOrgTreeData(tokenDTO.getUserId()); - redisUtils.set(orgTreeCacheKey,result,RedisUtils.MINUTE_THIRTY_EXPIRE); - }else { - result = (AgencyTreeResultDTO) o; - } - return new Result().ok(result); + public Result getOrgTreeData(@LoginUser TokenDto tokenDTO) { + //tokenDTO.setUserId("dffe71e021a61b900f9025f4f07f6955"); + return new Result().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId())); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index f70fdd035a..5e0dc73b52 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -16,6 +16,7 @@ */ package com.epmet.service.impl; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -24,6 +25,8 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerAgencyConstant; @@ -81,6 +84,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -1122,8 +1127,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getStaffOrgListByStaffId(String staffId) { return baseDao.getStaffOrgListByStaffId(staffId); } -} \ No newline at end of file +}