| | |
| | | for (DevInf actm:actmList) { |
| | | QueryWrapper actmwrapper= Wrappers.query(); |
| | | actmwrapper.eq("dev_id",actm.getDevId()); |
| | | actmwrapper.last("limit 1"); |
| | | ActmRealstate actmstate=actmMapper.selectOne(actmwrapper); |
| | | List<ActmRealstate> actmstates=actmMapper.selectList(actmwrapper); |
| | | //actm.setActmsTate(actmstate); |
| | | actm.setState(actmstate!=null?actmstate:null); |
| | | actm.setActmstates(actmstates!=null?actmstates:null); |
| | | } |
| | | allMap.put("a200List",a200List); |
| | | allMap.put("actmList",actmList); |
| | |
| | | public Response getDinf() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.orderByAsc("dev_id"); |
| | | List<UserInf> list=mapper.selectList(wrapper); |
| | | List<DevInf> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"获取设备信息(不分页用于包机组)"); |
| | | } |
| | | |
| | | //根据设备id获取设备信息 |
| | | public Response getDinfById(Integer devId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=mapper.selectOne(wrapper); |
| | | return new Response().setII(1,dinf!=null,dinf,"根据设备id获取设备信息"); |
| | | } |
| | | //删除设备(同时删除实时和包机组信息) |
| | | @Transactional |
| | |
| | | } |
| | | return new Response().set(1,true,"强制移除批量设备"); |
| | | } |
| | | //设备分类总数统计 |
| | | public Map<String,Object> getDevStaticByType(int userId) { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | Map<Integer,Integer> staticTypeMap=new HashMap<>(); |
| | | staticTypeMap.put(1,0); |
| | | staticTypeMap.put(2,0); |
| | | |
| | | Map<Integer,Integer> a200staticStateMap=new HashMap<>(); |
| | | a200staticStateMap.put(0,0); |
| | | a200staticStateMap.put(1,0); |
| | | Map<Integer,Integer> actmstaticStateMap=new HashMap<>(); |
| | | actmstaticStateMap.put(0,0); |
| | | actmstaticStateMap.put(1,0); |
| | | Map<String,Object> typestateMap=new HashMap<>(); |
| | | typestateMap.put("a200",a200staticStateMap); |
| | | typestateMap.put("actm",actmstaticStateMap); |
| | | List<DevInf> list=mapper.getDevStaticByType(userId); |
| | | Map<Integer, List<DevInf>> typeMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevType)); |
| | | for (Integer type : typeMap.keySet()) { |
| | | staticTypeMap.put(type, typeMap.get(type).size()); |
| | | List<DevInf> typeList= typeMap.get(type); |
| | | Map<Integer, List<DevInf>> stateMap = typeList.stream().collect(Collectors.groupingBy(DevInf::getDevOnline)); |
| | | if(type==1){ |
| | | for (Integer state : stateMap.keySet()) { |
| | | a200staticStateMap.put(state, stateMap.get(state).size()); |
| | | } |
| | | typestateMap.put("a200", a200staticStateMap); |
| | | } |
| | | if(type==2){ |
| | | for (Integer state : stateMap.keySet()) { |
| | | actmstaticStateMap.put(state, stateMap.get(state).size()); |
| | | } |
| | | typestateMap.put("actm", actmstaticStateMap); |
| | | } |
| | | } |
| | | map.put("dinf",list!=null?list:null); |
| | | map.put("type",staticTypeMap); |
| | | map.put("state",typestateMap); |
| | | return map; |
| | | } |
| | | |
| | | //根据devId获取设备信息 |
| | | public DevInf getDinfByDevId(int devId){ |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=mapper.selectOne(wrapper); |
| | | return dinf; |
| | | } |
| | | |
| | | } |