diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bigscreen/ResourceBigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bigscreen/ResourceBigController.java index a9d4a7a..69af0aa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bigscreen/ResourceBigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bigscreen/ResourceBigController.java @@ -1,6 +1,5 @@ package com.ruoyi.web.controller.bigscreen; -import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -18,7 +17,9 @@ import com.ruoyi.resource.service.ITResourceLandService; import com.ruoyi.system.service.ISysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.text.DecimalFormat; @@ -60,13 +61,12 @@ public class ResourceBigController extends BaseController { * 查询地块属性列表 ,用于空间字段专属查询,避免敏感泄露 */ @GetMapping("/query") - public TableDataInfo query(TResourceLand tResourceLand) - { - if(StringUtils.isNull(tResourceLand.getDeptId())){ + public TableDataInfo query(TResourceLand tResourceLand) { + if (StringUtils.isNull(tResourceLand.getDeptId())) { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); SysDept dept = sysDeptService.selectDeptById(loginUser.getUser().getDeptId()); tResourceLand.setImportCode(dept.getImportCode()); - }else{ + } else { SysDept dept = sysDeptService.selectDeptById(tResourceLand.getDeptId()); tResourceLand.setImportCode(dept.getImportCode()); } @@ -81,20 +81,22 @@ public class ResourceBigController extends BaseController { @GetMapping("/homepageStatistics") public AjaxResult homepageStatistics() { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); - Object statisticVOMap = redisCache.getCacheObject(CacheConstants.BIG_DATA_RESOURCE_KEY+"homepageStatistics" + loginUser.getUser().getUserName()); + Object statisticVOMap = redisCache.getCacheObject(CacheConstants.BIG_DATA_RESOURCE_KEY + "home_" + loginUser.getUser().getUserId()); if (Objects.nonNull(statisticVOMap)) { return AjaxResult.success(statisticVOMap); } List list = tResourceLandService.progressResourceInvestigationStatistics(loginUser.getUser().getDeptId());//资源调查进度统计 TBigDataScreen tBigDataScreen = tResourceLandService.homepageDownStatistics(loginUser.getUser().getDeptId());//首页下面统计 Map map = new HashMap(); - map.put("progressResourceInvestigation",list); - map.put("homepageStatistics",tBigDataScreen); - redisCache.setCacheObject(CacheConstants.BIG_DATA_RESOURCE_KEY+"homepageStatistics" + loginUser.getUser().getUserName(), map, expireTime, TimeUnit.MINUTES); + map.put("progressResourceInvestigation", list); + map.put("homepageStatistics", tBigDataScreen); + redisCache.setCacheObject(CacheConstants.BIG_DATA_RESOURCE_KEY + "home_" + loginUser.getUser().getUserId(), map, expireTime, TimeUnit.MINUTES); return AjaxResult.success(map); } - /**元转万元且保留两位小数并四舍五入*/ + /** + * 元转万元且保留两位小数并四舍五入 + */ public static String getNumberWanTwo(BigDecimal bigDecimal) { // 转换为万元(除以10000) BigDecimal decimal = bigDecimal.divide(new BigDecimal("10000"));