| | |
| | | @ApiOperation("根据权限获取设备列表") |
| | | @GetMapping("getEquipmentListByUser") |
| | | public Results getEquipmentListByUser(){ |
| | | //查询用户ID |
| | | String usersId = SecurityUtils.getUserId(); |
| | | //根据userId查询部门Id |
| | | SysUser sysUser = sysUserService.selectUserById(usersId); |
| | |
| | | return Results.succeed("没有设备信息"); |
| | | } |
| | | Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | //ancestors字段最长的数据 |
| | | String longest = ""; |
| | | //等级 |
| | | int count0 = 0,count1 = 0,count2 = 0; |
| | | //装数据 |
| | |
| | | String equipNumber = (String) listResult.get(i).get("EquipNumber"); |
| | | if(equipNumber!=null){ |
| | | for (int j = 0; j < list.size(); j++) { |
| | | String ancestors = list.get(j).getAncestors(); |
| | | if (ancestors.length() > longest.length()) { |
| | | longest = ancestors; |
| | | } |
| | | String wellId = list.get(j).getWellId(); |
| | | if(wellId!=null){ |
| | | if(wellId.equals(equipNumber)){ |
| | |
| | | String thisAncestors = healthVo.getAncestors(); |
| | | List<String> ancestorsA = Arrays.asList(thisAncestors.split(",")); |
| | | ancestorsA.removeAll(userParentId); |
| | | // for (int k = 0; k < userParentId.size(); k++) { |
| | | // String a = userParentId.get(k); |
| | | // for (int l = 0; l < ancestorsA.size(); l++) { |
| | | // String b = ancestorsA.get(l); |
| | | // if(a.equals(b)){ |
| | | // ancestorsA.remove(b); |
| | | // } |
| | | // } |
| | | // } |
| | | for (int k = 0; k < ancestorsA.size(); k++) { |
| | | Long ancestor = Long.parseLong(ancestorsA.get(k)); |
| | | //循环最终List判断是否有该数据的父级,如果没有就填进去 |