| | |
| | | .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, "0002")); |
| | | oldLightTaskStatusAndPoles.addAll(list); |
| | | } else { |
| | | oldLightTaskStatusAndPoles = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress())); |
| | | oldLightTaskStatusAndPoles = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress())); |
| | | } |
| | | |
| | | /** |
| | |
| | | } else { |
| | | if (CollectionUtil.isNotEmpty(oldPoleIdList)) { |
| | | oldRelation = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, oldPoleIdList) |
| | | .eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress())); |
| | | .ne(LightTaskPoleRelation::getTaskId, taskId).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress())); |
| | | } |
| | | } |
| | | |
| | |
| | | List<LightTaskPoleRelation> newPoleFail = new ArrayList<>(); |
| | | if (CollectionUtil.isNotEmpty(newPoleIdList)) { |
| | | //新灯杆下发新任务 |
| | | Map<String, List<LightTaskPoleRelation>> newPoleMap = sendControllerFrame(newPoleIdList, lightTask.getFramePayload(), param.getLightAddress()); |
| | | Map<String, List<LightTaskPoleRelation>> newPoleMap = sendControllerFrame(newPoleIdList, newLightTask.getFramePayload(), param.getLightAddress()); |
| | | |
| | | //newPoleAll集合后面用于存储关系表 |
| | | newPoleAll = newPoleMap.getOrDefault("all", new ArrayList<>()); |
| | |
| | | List<LightTaskPoleRelation> oldPoleSuccess = new ArrayList<>(); |
| | | if (CollectionUtil.isNotEmpty(oldPoleIdList)) { |
| | | //覆盖操作灯杆 |
| | | Map<String, List<LightTaskPoleRelation>> oldPoleMap = sendControllerFrame(oldPoleIdList, lightTask.getFramePayload(), param.getLightAddress()); |
| | | Map<String, List<LightTaskPoleRelation>> oldPoleMap = sendControllerFrame(oldPoleIdList, newLightTask.getFramePayload(), param.getLightAddress()); |
| | | oldPoleFail = oldPoleMap.getOrDefault("fail", new ArrayList<>()); |
| | | oldPoleSuccess = oldPoleMap.getOrDefault("success", new ArrayList<>()); |
| | | } |
| | |
| | | System.out.println(closeLight + "closeLight"); |
| | | if (CollectionUtil.isNotEmpty(closeLight) && closeLight != null && closeLight.get(0) != null) { |
| | | //关灯内帧 |
| | | String framePayloadClose = "7f0000007f173b00"; |
| | | String framePayloadClose = "7F0000007F173B00"; |
| | | //关灯操作灯杆 |
| | | Map<String, List<LightTaskPoleRelation>> closePoleMap = sendControllerFrame(closeLight, framePayloadClose, param.getLightAddress()); |
| | | closePoleFail = closePoleMap.getOrDefault("fail", new ArrayList<>()); |
| | |
| | | List<LightTaskPoleRelation> all = new ArrayList<>(); |
| | | all.addAll(newPoleSuccess); |
| | | all.addAll(oldPoleFail); |
| | | // all.addAll(closePoleFail); |
| | | all.addAll(oldPoleSuccess); |
| | | all.addAll(oldPoleFail); |
| | | all.addAll(closePoleFail); |
| | | |
| | | |
| | | List<Long> allPoleId = new ArrayList<>(); |
| | |
| | | * 下发路灯任务日志记录结束 |
| | | */ |
| | | |
| | | if (newPoleFail.isEmpty() && closePoleFail.isEmpty()) { |
| | | if (newPoleFail.isEmpty() && closePoleFail.isEmpty() && oldPoleFail.isEmpty()) { |
| | | return "编辑成功"; |
| | | } else if (newPoleSuccess.isEmpty() && closePoleSuccess.isEmpty()) { |
| | | } else if (newPoleSuccess.isEmpty() && closePoleSuccess.isEmpty() && oldPoleSuccess.isEmpty()) { |
| | | throw new BusinessException("编辑失败,请检查原有设备和编辑后的设备是否在线!"); |
| | | } else if (!closePoleFail.isEmpty() && !newPoleSuccess.isEmpty()) { |
| | | } else if (!closePoleFail.isEmpty() && !newPoleSuccess.isEmpty() && !oldPoleFail.isEmpty()) { |
| | | return "原任务中存在下发异常,原任务保留,创建新任务进行保存"; |
| | | } else if (!newPoleFail.isEmpty() && !newPoleSuccess.isEmpty()) { |
| | | return "新任务中存在下发异常,忽略异常操作的灯杆"; |
| | |
| | | WrapResponseCommonFrame<A5LightTimerRespInnerFrame> responseCommonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceCode, requestFrame, A5LightTimerRespInnerFrame.class); |
| | | System.out.println(responseCommonFrame + " -----------responseCommonFrame"); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(deviceCode, "单灯帧-控灯", requestFrame, responseCommonFrame); |
| | | |
| | | return Optional.ofNullable(responseCommonFrame).map(WrapResponseCommonFrame::getResponseInnerFrame).orElse(null); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | private Map<String, List<LightTaskPoleRelation>> sendControllerFrame(List<Long> poleIdList, String framePayload, String lightAddress) { |
| | | |
| | | System.out.println("framePayload:" + framePayload); |
| | | List<LightTaskPoleRelation> lightTaskPoleRelationList = new ArrayList<>(); |
| | | //成功 |
| | | List<LightTaskPoleRelation> success = new ArrayList<>(); |
| | |
| | | |
| | | |
| | | // rrpc 发生定时命令 |
| | | /* if ("FFFF".equals(lightAddress)) { |
| | | if ("FFFF".equals(lightAddress)) { |
| | | LightTaskPoleRelation lightTaskPoleRelation01 = new LightTaskPoleRelation(); |
| | | lightTaskPoleRelation01.setPoleId(pole.getId()); |
| | | lightTaskPoleRelation01.setLightAddress("0001"); |
| | |
| | | |
| | | lightTaskPoleRelationList.add(lightTaskPoleRelation01); |
| | | lightTaskPoleRelationList.add(lightTaskPoleRelation02); |
| | | } else */ |
| | | { |
| | | } else { |
| | | lightTaskPoleRelation.setLightAddress(lightAddress); |
| | | // rrpc 发生定时命令 |
| | | try { |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | public boolean clearLightTask(List<Long> poleIds) { |
| | | Map<String, List<LightTaskPoleRelation>> ffff = sendControllerFrame(poleIds, "", "FFFF"); |
| | | ffff.get("success").forEach(lightTaskPoleRelation -> { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaUpdate(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getPoleId, lightTaskPoleRelation.getPoleId()).eq(LightTaskPoleRelation::getTaskId, lightTaskPoleRelation.getTaskId())); |
| | | }); |
| | | return true; |
| | | } |
| | | } |