| | |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.sandu.ximon.admin.localMQTT.callback.StatusMqttCallBack.localMqttConnectStatusMap; |
| | | |
| | | /** |
| | | * 灯杆相关 |
| | | * |
| | |
| | | /** |
| | | * 删除灯杆 |
| | | */ |
| | | public boolean deletePole(Long poleId) { |
| | | Pole pole = getById(poleId); |
| | | if (pole == null) { |
| | | public boolean deletePole(List<Long> poleIds) { |
| | | List<Pole> poles = listByIds(poleIds); |
| | | if (poles.isEmpty()) { |
| | | throw new BusinessException("未找到该灯杆"); |
| | | } |
| | | // 删除灯杆绑定关系 |
| | | poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().eq(PoleBinding::getPoleId, poleId)); |
| | | poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().in(PoleBinding::getPoleId, poleIds)); |
| | | SpringContextHolder.getBean(LightTaskPoleRelationService.class) |
| | | .remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getPoleId, poleId)); |
| | | .remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIds)); |
| | | |
| | | /** |
| | | * 删除灯杆日志记录开始 |
| | | */ |
| | | String content = "{灯杆Code:" + pole.getDeviceCode() + ", 灯杆名称:" + pole.getPoleName() + " }"; |
| | | String content = "{灯杆id:" + poles + " }"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "删除灯杆", content); |
| | | /** |
| | | * 删除灯杆日志记录结束 |
| | | */ |
| | | return removeById(poleId); |
| | | return removeByIds(poleIds); |
| | | } |
| | | |
| | | |
| | |
| | | * @return 设备状态列表 |
| | | */ |
| | | public List<DeviceStatus> listStatusByDeviceCode(ArrayList<String> deviceCodeList) { |
| | | // 最大只能查50个 |
| | | // 最大只能查50个 |
| | | List<List<String>> split = CollectionUtil.split(deviceCodeList, 50); |
| | | List<DeviceStatus> statusList = new ArrayList<>(); |
| | | for (List<String> list : split) { |
| | |
| | | } |
| | | } |
| | | } |
| | | // List<DeviceStatus> statusList = new ArrayList<>(); |
| | | // |
| | | // deviceCodeList.forEach(l -> { |
| | | // DeviceStatus deviceStatus = new DeviceStatus(); |
| | | // deviceStatus.setDeviceCode(l); |
| | | // |
| | | // if (localMqttConnectStatusMap.get(l)!=null && |
| | | // localMqttConnectStatusMap.get(l)== 1){ |
| | | // deviceStatus.setStatus(1); |
| | | // }else { |
| | | // deviceStatus.setStatus(0); |
| | | // } |
| | | // statusList.add(deviceStatus); |
| | | // }); |
| | | |
| | | return statusList; |
| | | } |
| | | |
| | |
| | | //设置触发条件 存入Redis 15分钟超时 15分钟内再次调用直接返回 |
| | | redisUtils.set("redisStatusKeyTimeout", System.currentTimeMillis(), 60 * 15); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(7);//todo |
| | | CountDownLatch countDownLatch = new CountDownLatch(7);//todo 几个设备设置为几 |
| | | //获取一个7位随机数 |
| | | String str = RandomStringUtils.randomAlphanumeric(7); |
| | | countDownLatchUtil.push(str, countDownLatch); |
| | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |