| | |
| | | ); |
| | | list = pole; |
| | | } |
| | | |
| | | if (param.getBingStates() != 2) {//是否绑定 |
| | | list = isBind(list, param);// 绑定/未绑定 |
| | | if (param.getIsTrue() != 2) {//已绑定的是否是真实灯杆 |
| | | //是否绑定 |
| | | if (param.getBingStates() != 2) { |
| | | // 绑定/未绑定 |
| | | list = isBind(list, param); |
| | | //已绑定的是否是真实灯杆 |
| | | if (param.getIsTrue() != 2) { |
| | | list = isTrue(list, param); |
| | | if (param.getOnLineStates() != 2) {//绑定的真实灯杆是否在线 |
| | | list = isOnLine(list, param); |
| | | } |
| | | } else {//全部灯杆 实体/虚拟 |
| | | if (param.getOnLineStates() != 2) { //查询全部灯杆是否在线 |
| | | //绑定的真实灯杆是否在线 |
| | | if (param.getOnLineStates() != 2) { |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | } else {//全部 绑定/未绑定 |
| | | if (param.getIsTrue() != 2) {// 判断灯杆类型 |
| | | list = isTrue(list, param);// 实体/虚拟 |
| | | if (param.getOnLineStates() != 2) {// 灯杆的在线判断 |
| | | list = isOnLine(list, param);//在线/离线 |
| | | //全部灯杆 实体/虚拟 |
| | | else { |
| | | //查询全部灯杆是否在线 |
| | | if (param.getOnLineStates() != 2) { |
| | | list = isOnLine(list, param); |
| | | } |
| | | } else {//全类型灯杆 |
| | | if (param.getOnLineStates() != 2) {//判断在线状态 |
| | | list = isOnLine(list, param);//在线/离线 |
| | | } |
| | | } |
| | | //全部 绑定/未绑定 |
| | | else { |
| | | // 判断灯杆类型 |
| | | if (param.getIsTrue() != 2) { |
| | | // 实体/虚拟 |
| | | list = isTrue(list, param); |
| | | // 灯杆的在线判断 |
| | | if (param.getOnLineStates() != 2) { |
| | | //在线/离线 |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | //全类型灯杆 |
| | | else { |
| | | //判断在线状态 |
| | | if (param.getOnLineStates() != 2) { |
| | | //在线/离线 |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public List<Pole> isTrue(List<Pole> list, PoleStatesParam param) { |
| | | List<Pole> isTrue = new ArrayList<>();//实体灯杆 |
| | | List<Pole> isFalse = new ArrayList<>();//虚拟灯杆 |
| | | //实体灯杆 |
| | | List<Pole> isTrue = new ArrayList<>(); |
| | | //虚拟灯杆 |
| | | List<Pole> isFalse = new ArrayList<>(); |
| | | list.forEach(bindwarpper -> { |
| | | // Long clientId = bindwarpper.getClientId(); |
| | | if (bindwarpper.getDeviceCode() == null) { |
| | | //判断是否绑定 |
| | | if (bindwarpper.getDeviceType() == -1) { |
| | | isFalse.add(bindwarpper); |
| | | } else { |
| | | isTrue.add(bindwarpper); |
| | |
| | | if (deviceStatuses != null) { |
| | | for (Pole post : list) { |
| | | for (BatchGetDeviceStateResponse.DeviceStatus deviceStatus : deviceStatuses) { |
| | | // System.out.println("DeviceCode:---------------------"+post.getDeviceCode()); |
| | | // System.out.println("DeviceName:---------------------"+deviceStatus.getDeviceName()); |
| | | |
| | | if (post.getDeviceCode() != null && post.getDeviceCode().equals(deviceStatus.getDeviceName())) { |
| | | post.setOnLineState(deviceStatus.getStatus()); |
| | | // int size = poleBindingService.list(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, post.getId())).size(); |
| | | //// System.out.println("size:----------------------"+size); |
| | | // post.setBindingCount(size); |
| | | |
| | | } |
| | | } |
| | | // MacCodes.add(post.getDeviceCode()); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public List<Pole> queryStatesAndList(Integer pageNo, Integer pageSize, String keyword, Long groupid) { |
| | | // List<LampPost> list = list(Wrappers.lambdaQuery(LampPost.class).eq(LampPost::getClientId, SecurityUtils.getUserId())); |
| | | //List<Pole> list = list(Wrappers.lambdaQuery(Pole.class)); |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | List<Pole> list = new ArrayList<>(); |
| | | LambdaQueryWrapper<Pole> wrapper = new LambdaQueryWrapper<>(); |
| | |
| | | List<BatchGetDeviceStateResponse.DeviceStatus> deviceStatuses = MainBoardInvokeSyncService.getInstance().batchGetDeviceState(MacCodes); |
| | | for (Pole post : list) { |
| | | for (BatchGetDeviceStateResponse.DeviceStatus deviceStatus : deviceStatuses) { |
| | | // System.out.println("DeviceCode:---------------------"+post.getDeviceCode()); |
| | | // System.out.println("DeviceName:---------------------"+deviceStatus.getDeviceName()); |
| | | if (post.getDeviceCode() != null && post.getDeviceCode().equals(deviceStatus.getDeviceName())) { |
| | | post.setOnLineState(deviceStatus.getStatus()); |
| | | int size = poleBindingService.list(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, post.getId())).size(); |
| | | // System.out.println("size:----------------------"+size); |
| | | post.setBindingCount(size); |
| | | } |
| | | } |
| | | // MacCodes.add(post.getDeviceCode()); |
| | | } |
| | | |
| | | |