From 35641d4d57268fafb1f1349c0ae483fee5ff1c0b Mon Sep 17 00:00:00 2001 From: carlyin Date: Mon, 14 Oct 2024 14:27:22 +0800 Subject: [PATCH] =?UTF-8?q?pref=EF=BC=9A=E7=A0=94=E5=8F=91=E5=95=86?= =?UTF-8?q?=E5=BA=97=E9=80=9A=E7=94=A8=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=B0=81?= =?UTF-8?q?=E8=A3=85=E4=BC=98=E5=8C=96=20#11049?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/StoreUpdatePreBusHandler.kt | 48 +++++++++++++++++++ .../common/service/StoreBaseUpdateService.kt | 8 ++++ .../service/StoreReleaseSpecBusService.kt | 8 ++++ .../impl/StoreBaseUpdateServiceImpl.kt | 6 +++ 4 files changed, 70 insertions(+) create mode 100644 src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/handler/StoreUpdatePreBusHandler.kt diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/handler/StoreUpdatePreBusHandler.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/handler/StoreUpdatePreBusHandler.kt new file mode 100644 index 00000000000..42e8c99c0d8 --- /dev/null +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/handler/StoreUpdatePreBusHandler.kt @@ -0,0 +1,48 @@ +/* + * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. + * + * A copy of the MIT License is included in this file. + * + * + * Terms of the MIT License: + * --------------------------------------------------- + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.tencent.devops.store.common.handler + +import com.tencent.devops.store.common.service.StoreBaseUpdateService +import com.tencent.devops.store.pojo.common.handler.Handler +import com.tencent.devops.store.pojo.common.publication.StoreUpdateRequest +import org.springframework.stereotype.Service + +@Service +class StoreUpdatePreBusHandler( + private val storeBaseUpdateService: StoreBaseUpdateService +) : Handler { + + override fun canExecute(handlerRequest: StoreUpdateRequest): Boolean { + return true + } + + override fun execute(handlerRequest: StoreUpdateRequest) { + // 执行前置业务 + storeBaseUpdateService.doStoreUpdatePreBus(handlerRequest) + } +} diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreBaseUpdateService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreBaseUpdateService.kt index c3c33ffd8b7..53c79114118 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreBaseUpdateService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreBaseUpdateService.kt @@ -47,6 +47,14 @@ interface StoreBaseUpdateService { storeUpdateRequest: StoreUpdateRequest ) + /** + * 执行更新组件请求前置业务 + * @param storeUpdateRequest 更新组件请求报文 + */ + fun doStoreUpdatePreBus( + storeUpdateRequest: StoreUpdateRequest + ) + /** * 持久化更新组件数据 * @param storeUpdateRequest 更新组件请求报文 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreReleaseSpecBusService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreReleaseSpecBusService.kt index 5b655e550ff..da60ba80c34 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreReleaseSpecBusService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreReleaseSpecBusService.kt @@ -45,6 +45,14 @@ interface StoreReleaseSpecBusService { storeCreateRequest: StoreCreateRequest ) + /** + * 执行更新组件请求前置业务 + * @param storeUpdateRequest 更新组件请求报文 + */ + fun doStoreUpdatePreBus( + storeUpdateRequest: StoreUpdateRequest + ) + /** * 对更新组件请求参数进行国际化转换个性化逻辑 * @param storeUpdateRequest 更新组件请求报文 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreBaseUpdateServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreBaseUpdateServiceImpl.kt index bed885432fb..d1d1f6c1a15 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreBaseUpdateServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreBaseUpdateServiceImpl.kt @@ -115,6 +115,12 @@ class StoreBaseUpdateServiceImpl @Autowired constructor( getStoreSpecBusService(storeType).doCheckStoreUpdateParamSpecBus(storeUpdateRequest) } + override fun doStoreUpdatePreBus(storeUpdateRequest: StoreUpdateRequest) { + val storeBaseUpdateRequest = storeUpdateRequest.baseInfo + val storeType = storeBaseUpdateRequest.storeType + getStoreSpecBusService(storeType).doStoreUpdatePreBus(storeUpdateRequest) + } + override fun doStoreUpdateDataPersistent(storeUpdateRequest: StoreUpdateRequest) { val storeBaseUpdateRequest = storeUpdateRequest.baseInfo val storeType = storeBaseUpdateRequest.storeType