From 2e470c69d0230fb47a68ead64af5ed23c6312d63 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 08 一月 2025 14:08:41 +0800 Subject: [PATCH] 区域管理员查看区域下的锁的状态--区域管理员 --- src/main/java/com/whyc/service/AreaInfService.java | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/whyc/service/AreaInfService.java b/src/main/java/com/whyc/service/AreaInfService.java index e468bd0..19d3063 100644 --- a/src/main/java/com/whyc/service/AreaInfService.java +++ b/src/main/java/com/whyc/service/AreaInfService.java @@ -295,5 +295,45 @@ return new Response().setII(1,true,map,"鍖哄煙绠$悊鍛樼偣鍑绘煡鐪嬪紑閿佹搷浣滆褰�--鍖哄煙绠$悊鍛�"); } - + //鍖哄煙绠$悊鍛樻煡鐪嬪尯鍩熶笅鐨勯攣鐨勭姸鎬�--鍖哄煙绠$悊鍛� + public Response getAreaLockById(int id) { + Map<String,Object> map=new HashMap<>(); + map.put("sumLinf",0); + map.put("onlineNum",0); + map.put("offLineNum",0); + map.put("openNum",0); + map.put("closeNum",0); + List<LockInf> linfs=new ArrayList<>(); + map.put("allLinfs",linfs); + List areaList=new ArrayList(); + areaList.add(id); + getAllAreaId(id,areaList); + //鏌ョ湅鍖哄煙涓嬫墍鏈夌殑閿� + QueryWrapper linfWrapper=new QueryWrapper(); + linfWrapper.in("area_id",areaList); + linfs=linfMapper.selectList(linfWrapper); + if(linfs!=null&&linfs.size()>0){ + map.put("sumLinf",linfs.size()); + Map<Integer, List<LockInf>> onlinemap = linfs.stream().collect(Collectors.groupingBy(LockInf::getLockOnline)); + for (Integer state : onlinemap.keySet()) { + if(state==0){ + map.put("offLineNum", onlinemap.get(0).size());//绂荤嚎 + } + if(state==1){ + map.put("onlineNum", onlinemap.get(1).size());//鍦ㄧ嚎 + } + } + Map<Integer, List<LockInf>> openmap = linfs.stream().collect(Collectors.groupingBy(LockInf::getLockState)); + for (Integer open : openmap.keySet()) { + if(open==0){ + map.put("openNum", openmap.get(0).size());//闂攣 + } + if(open==1){ + map.put("closeNum", openmap.get(1).size());//寮�閿� + } + } + map.put("allLinfs",linfs); + } + return new Response().setII(1,true,map,"鍖哄煙绠$悊鍛樻煡鐪嬪尯鍩熶笅鐨勯攣鐨勭姸鎬�--鍖哄煙绠$悊鍛�"); + } } \ No newline at end of file -- Gitblit v1.9.1