| | |
| | | existingArea.getFencePoints())) { |
| | | throw new ServiceException( |
| | | "运营区域{}与现有运营区域{}发生重叠", |
| | | I18nKeyConstant.EDIT_ELECTRONIC_ERROR, |
| | | I18nKeyConstant.AREA_OVERLAP_ERROR, |
| | | new Object[]{existingArea.getAreaName(), existingArea.getAreaName()} |
| | | ); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 围栏改为已停用(3)时:将围栏下启用中点位(operation_status=2)更新为已停用(operation_status=3) |
| | | if (newFenceStatus != null && newFenceStatus == 3) { |
| | | XpElectronicFenceArea operationAreaToDisable = xpElectronicFenceAreaService.lambdaQuery() |
| | | .eq(XpElectronicFenceArea::getElectronicId, dto.getId()) |
| | | .eq(XpElectronicFenceArea::getAreaType, 1) |
| | | .orderByDesc(XpElectronicFenceArea::getId) |
| | | .last("limit 1") |
| | | .one(); |
| | | if (operationAreaToDisable == null || operationAreaToDisable.getId() == null) { |
| | | log.warn("围栏停用同步停用点位跳过:未查询到运营区 fenceId={}", dto.getId()); |
| | | } else { |
| | | Long operationAreaIdToDisable = operationAreaToDisable.getId(); |
| | | boolean updated = xpPointService.lambdaUpdate() |
| | | .eq(XpPoint::getElectronicAreaId, operationAreaIdToDisable) |
| | | .eq(XpPoint::getPointType, 1) |
| | | .eq(XpPoint::getOperationStatus, 2) |
| | | .set(XpPoint::getOperationStatus, 3) |
| | | .update(); |
| | | log.info("围栏停用同步停用点位完成 fenceId={}, operationAreaId={}, updated={}", |
| | | dto.getId(), operationAreaIdToDisable, updated); |
| | | } |
| | | } |
| | | |
| | | OperationStrategyIndex oldIndex = OperationStrategyIndex.parse(oldOperationStrategy); |
| | | OperationStrategyIndex newIndex = OperationStrategyIndex.parse(newOperationStrategy); |
| | | // boolean needAutoDisableByUnion = !oldIndex.equalsNormalized(newIndex) && oldIndex.hasAnyShrinkComparedTo(newIndex); |
| | | boolean needAutoDisableByUnion = true; |
| | | |
| | | boolean needAutoDisableByUnion = !oldIndex.equalsNormalized(newIndex); |
| | | List<Long> addPointIds = normalizePointIds(dto.getAddPointIdList()); |
| | | List<Long> delPointIds = normalizePointIds(dto.getDelPointIdList()); |
| | | List<Long> disablePointIds = normalizePointIds(dto.getDisablePointIdList()); |
| | |
| | | } |
| | | |
| | | // 围栏运营时间缩短校验:若缩短后点位时间段不在新范围内,则更新为已停用(operation_status=3) |
| | | if (operationAreaId != null) { |
| | | if (needAutoDisableByUnion && operationAreaId != null) { |
| | | LambdaQueryWrapper<XpPoint> pointQuery = new LambdaQueryWrapper<>(); |
| | | pointQuery.eq(XpPoint::getElectronicAreaId, operationAreaId) |
| | | .eq(XpPoint::getPointType, 1) |