From c121d83b086d9fc344a1d41858a79ae9b5f69dae Mon Sep 17 00:00:00 2001 From: erdanergou Date: Thu, 23 Mar 2023 13:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PageController.java | 22 +++++++++++++++++-- .../intercepter/UserInterceptor.java | 1 - 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index e607f100..0b512313 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -320,8 +320,26 @@ public class PageController { map.put("begin", 0); map.put("size", 6); - mv.addObject("depositoryCount", depositoryService.findAllCountByNoDelete()); - mv.addObject("allPrice", materialService.findAllPriceNoDelete()); + // 查询当前用户管理的仓库 + List depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId()); + // 查询当前用户部门拥有的仓库 + List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString()); + // 定义仓库编号列表 + List depositoryIdList = new ArrayList<>(); + + for (Depository depository : depositoryByAdminorg + ) { + depositoryIdList.add(depository.getId()); + } + for (RoleAndDepository rad : depositoryAndRole + ) { + if (!depositoryIdList.contains(rad.getDepositoryId())) { + depositoryIdList.add(rad.getDepositoryId()); + } + } + mv.addObject("depositoryCount", depositoryIdList.size()); + Integer inventoryCountByDepository = materialService.findInventoryCountByDepository(depositoryIdList); + mv.addObject("allPrice",(int)(inventoryCountByDepository / 100)); mv.addObject("allMaterial", materialService.findMaterialCount(new HashMap<>())); /** * 获取当天日期 diff --git a/src/main/java/com/dreamchaser/depository_manage/intercepter/UserInterceptor.java b/src/main/java/com/dreamchaser/depository_manage/intercepter/UserInterceptor.java index 8554874f..d81416e7 100644 --- a/src/main/java/com/dreamchaser/depository_manage/intercepter/UserInterceptor.java +++ b/src/main/java/com/dreamchaser/depository_manage/intercepter/UserInterceptor.java @@ -31,7 +31,6 @@ public class UserInterceptor extends HandlerInterceptorAdapter { { add("/getMaterialAll"); add("/getCaptchaid"); -// add("/QyWxLogin"); } }; private static RedisTemplate redisTemplate;