From 079a52f6320b5b93b67bd8d2124ff68a7b1ba103 Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Wed, 8 Jan 2025 17:31:33 +0800 Subject: [PATCH 1/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/common/OpStorePublishersResource.kt | 26 +++++++++++++++++++ .../store/pojo/atom/AtomReleaseRequest.kt | 7 +++-- .../service/impl/AtomReleaseServiceImpl.kt | 2 +- .../atom/service/impl/OpAtomServiceImpl.kt | 3 ++- .../store/common/dao/StoreReleaseDao.kt | 18 +++++++++++++ .../OpStorePublishersResourceImpl.kt | 10 +++++++ .../common/service/PublishersDataService.kt | 6 +++++ .../service/impl/PublishersDataServiceImpl.kt | 14 +++++++++- 8 files changed, 81 insertions(+), 5 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt index 0a8df1d9f3c..10b764fdb7e 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt @@ -27,13 +27,18 @@ package com.tencent.devops.store.api.common +import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID import com.tencent.devops.common.api.pojo.Result +import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.Parameter import io.swagger.v3.oas.annotations.tags.Tag import javax.ws.rs.Consumes +import javax.ws.rs.HeaderParam import javax.ws.rs.PUT import javax.ws.rs.Path import javax.ws.rs.Produces +import javax.ws.rs.QueryParam import javax.ws.rs.core.MediaType @Tag(name = "OP_STORE_PUBLISHERS", description = "OP-研发商店-发布者") @@ -46,4 +51,25 @@ interface OpStorePublishersResource { @PUT @Path("/refresh/person") fun refreshPersonPublisherGroup(): Result + + + @Operation(summary = "修改组件的首次发布人") + @PUT + @Path("/updateComponentFirstPublisher") + fun updateComponentFirstPublisher( + @Parameter(description = "userId", required = true) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @Parameter(description = "store组件代码", required = true) + @QueryParam("storeCode") + storeCode: String, + @Parameter(description = "组件类型", required = true) + @QueryParam("storeType") + storeType: StoreTypeEnum, + @Parameter(description = "首次发布人", required = true) + @QueryParam("firstPublisher") + firstPublisher: String + ): Result + + } diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt index bcdcea2fc28..75511f1c775 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt @@ -45,5 +45,8 @@ data class AtomReleaseRequest( @get:Schema(title = "代码库哈希ID") val repositoryHashId: String? = null, @get:Schema(title = "代码库分支") - val branch: String? = null -) + val branch: String? = null, + @get:Schema(title = "创建人") + val creator: String? = null, + + ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index f001714dd31..76fc7a045eb 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1060,7 +1060,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ storeReleaseCreateRequest = StoreReleaseCreateRequest( storeCode = atomCode, storeType = StoreTypeEnum.ATOM, - latestUpgrader = userId, + latestUpgrader =atomReleaseRequest.creator?:userId, latestUpgradeTime = pubTime ) ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt index 91708a5bcd8..a4dc45865db 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt @@ -348,7 +348,8 @@ class OpAtomServiceImpl @Autowired constructor( atomStatus = atomStatus, releaseType = releaseType, repositoryHashId = atom.repositoryHashId, - branch = atom.branch + branch = atom.branch, + creator = atom.creator ) ) } else { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt index 526336d78d8..9ce272abd18 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt @@ -91,4 +91,22 @@ class StoreReleaseDao { .execute() } } + + + fun updateComponentFirstPublisher( + dslContext: DSLContext, + userId: String, + storeCode: String, + storeType: Byte, + firstPublisher: String + ) { + with(TStoreRelease.T_STORE_RELEASE) { + dslContext.update(this) + .set(FIRST_PUB_CREATOR, firstPublisher) + .set(MODIFIER, userId) + .where(STORE_CODE.eq(storeCode)) + .and(STORE_TYPE.eq(storeType)) + .execute() + } + } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt index 165808fff3c..f31701c33df 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt @@ -31,6 +31,7 @@ import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.RestResource import com.tencent.devops.store.api.common.OpStorePublishersResource import com.tencent.devops.store.common.service.PublishersDataService +import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum @RestResource class OpStorePublishersResourceImpl constructor( @@ -40,4 +41,13 @@ class OpStorePublishersResourceImpl constructor( override fun refreshPersonPublisherGroup(): Result { return Result(publishersDataService.refreshPersonPublisherGroup()) } + + override fun updateComponentFirstPublisher( + userId: String, + storeCode: String, + storeType: StoreTypeEnum, + firstPublisher: String + ): Result { + return Result(publishersDataService.updateComponentFirstPublisher(userId, storeCode, storeType, firstPublisher)) + } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt index 2b479c6dc45..359075f7131 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt @@ -74,4 +74,10 @@ interface PublishersDataService { * 更新研发商店个人发布者组织架构信息 */ fun refreshPersonPublisherGroup(): Boolean + + + /** + * 修改组件首个发布人 + */ + fun updateComponentFirstPublisher(userId: String, storeCode: String, storeType: StoreTypeEnum, firstPublisher: String): Boolean } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt index b55c70007f1..b02bb1896ab 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt @@ -44,6 +44,7 @@ import com.tencent.devops.store.common.dao.PublishersDao import com.tencent.devops.store.common.dao.StoreDockingPlatformDao import com.tencent.devops.store.common.dao.StoreDockingPlatformErrorCodeDao import com.tencent.devops.store.common.dao.StoreMemberDao +import com.tencent.devops.store.common.dao.StoreReleaseDao import com.tencent.devops.store.common.service.PublishersDataService import com.tencent.devops.store.common.service.StoreUserService import com.tencent.devops.store.constant.StoreMessageCode.GET_INFO_NO_PERMISSION @@ -70,7 +71,8 @@ class PublishersDataServiceImpl @Autowired constructor( private val storeDockingPlatformDao: StoreDockingPlatformDao, private val storeMemberDao: StoreMemberDao, private val storeUserService: StoreUserService, - private val storeDockingPlatformErrorCodeDao: StoreDockingPlatformErrorCodeDao + private val storeDockingPlatformErrorCodeDao: StoreDockingPlatformErrorCodeDao, + private val storeReleaseDao: StoreReleaseDao ) : PublishersDataService { private val executorService = Executors.newSingleThreadExecutor() @@ -347,6 +349,16 @@ class PublishersDataServiceImpl @Autowired constructor( return true } + override fun updateComponentFirstPublisher( + userId: String, + storeCode: String, + storeType: StoreTypeEnum, + firstPublisher: String + ): Boolean { + storeReleaseDao.updateComponentFirstPublisher(dslContext, userId, storeCode, storeType.type.toByte(),firstPublisher) + return true + } + private fun getPublisherDeptInfo(userDeptDetail: UserDeptDetail): PublisherDeptInfo { userDeptDetail.let { val publisherDeptInfo = PublisherDeptInfo( From 7f87bc823d4f61032fcaf527d6ef61d0eb8c890b Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Fri, 10 Jan 2025 17:57:54 +0800 Subject: [PATCH 2/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt | 4 ++-- .../devops/store/atom/service/impl/AtomReleaseServiceImpl.kt | 2 +- .../devops/store/atom/service/impl/OpAtomServiceImpl.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt index 75511f1c775..b19af80bee8 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/AtomReleaseRequest.kt @@ -46,7 +46,7 @@ data class AtomReleaseRequest( val repositoryHashId: String? = null, @get:Schema(title = "代码库分支") val branch: String? = null, - @get:Schema(title = "创建人") - val creator: String? = null, + @get:Schema(title = "发布人") + val publisher: String? = null, ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index 76fc7a045eb..26863ccaa51 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1060,7 +1060,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ storeReleaseCreateRequest = StoreReleaseCreateRequest( storeCode = atomCode, storeType = StoreTypeEnum.ATOM, - latestUpgrader =atomReleaseRequest.creator?:userId, + latestUpgrader =atomReleaseRequest.publisher?:userId, latestUpgradeTime = pubTime ) ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt index a4dc45865db..81b4e714974 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt @@ -349,7 +349,7 @@ class OpAtomServiceImpl @Autowired constructor( releaseType = releaseType, repositoryHashId = atom.repositoryHashId, branch = atom.branch, - creator = atom.creator + publisher = atom.publisher ) ) } else { From c24e116ba4d7f4201a7656fa41bd2d9baf770cda Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Tue, 14 Jan 2025 15:56:28 +0800 Subject: [PATCH 3/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/impl/PublishersDataServiceImpl.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt index b02bb1896ab..f71fd2ffb9d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt @@ -355,7 +355,13 @@ class PublishersDataServiceImpl @Autowired constructor( storeType: StoreTypeEnum, firstPublisher: String ): Boolean { - storeReleaseDao.updateComponentFirstPublisher(dslContext, userId, storeCode, storeType.type.toByte(),firstPublisher) + storeReleaseDao.updateComponentFirstPublisher( + dslContext, + userId, + storeCode, + storeType.type.toByte(), + firstPublisher + ) return true } From 6fe98e7161267b6659e087c1c0990e5316de7a62 Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Tue, 14 Jan 2025 16:14:21 +0800 Subject: [PATCH 4/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/api/common/OpStorePublishersResource.kt | 1 - .../store/atom/service/impl/AtomReleaseServiceImpl.kt | 2 +- .../devops/store/common/service/PublishersDataService.kt | 8 ++++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt index 10b764fdb7e..16434251a30 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt @@ -71,5 +71,4 @@ interface OpStorePublishersResource { firstPublisher: String ): Result - } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index 26863ccaa51..63a173ba4b2 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1060,7 +1060,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ storeReleaseCreateRequest = StoreReleaseCreateRequest( storeCode = atomCode, storeType = StoreTypeEnum.ATOM, - latestUpgrader =atomReleaseRequest.publisher?:userId, + latestUpgrader = atomReleaseRequest.publisher ?: userId, latestUpgradeTime = pubTime ) ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt index 359075f7131..1a20956ee1a 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt @@ -75,9 +75,13 @@ interface PublishersDataService { */ fun refreshPersonPublisherGroup(): Boolean - /** * 修改组件首个发布人 */ - fun updateComponentFirstPublisher(userId: String, storeCode: String, storeType: StoreTypeEnum, firstPublisher: String): Boolean + fun updateComponentFirstPublisher( + userId: String, + storeCode: String, + storeType: StoreTypeEnum, + firstPublisher: String + ): Boolean } From a85817ef919ab703356eccea40f8a5288f4c5062 Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Tue, 14 Jan 2025 16:38:54 +0800 Subject: [PATCH 5/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/api/common/OpStorePublishersResource.kt | 2 -- .../com/tencent/devops/store/common/dao/StoreReleaseDao.kt | 1 - 2 files changed, 3 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt index 16434251a30..89418989001 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt @@ -52,7 +52,6 @@ interface OpStorePublishersResource { @Path("/refresh/person") fun refreshPersonPublisherGroup(): Result - @Operation(summary = "修改组件的首次发布人") @PUT @Path("/updateComponentFirstPublisher") @@ -70,5 +69,4 @@ interface OpStorePublishersResource { @QueryParam("firstPublisher") firstPublisher: String ): Result - } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt index 9ce272abd18..ba8f10909e5 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt @@ -92,7 +92,6 @@ class StoreReleaseDao { } } - fun updateComponentFirstPublisher( dslContext: DSLContext, userId: String, From 30c7599d152af957abd3803e10ed40ef10ca6a0c Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Wed, 15 Jan 2025 14:50:48 +0800 Subject: [PATCH 6/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/pojo/common/publication/StoreReleaseRequest.kt | 4 +++- .../store/common/service/impl/OpStoreComponentServiceImpl.kt | 3 ++- .../store/common/service/impl/StoreReleaseServiceImpl.kt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/publication/StoreReleaseRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/publication/StoreReleaseRequest.kt index d1a8ddfcb59..4cf1c66f0bf 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/publication/StoreReleaseRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/publication/StoreReleaseRequest.kt @@ -45,5 +45,7 @@ data class StoreReleaseRequest( @get:Schema(title = "组件状态") val status: StoreStatusEnum, @get:Schema(title = "发布类型") - val releaseType: ReleaseTypeEnum + val releaseType: ReleaseTypeEnum, + @get:Schema(title = "发布人") + val publisher: String? = null ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt index 6298deeb27e..89efcb1bd62 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt @@ -115,7 +115,8 @@ class OpStoreComponentServiceImpl @Autowired constructor( storeType = storeType, version = version, status = storeStatus, - releaseType = releaseType + releaseType = releaseType, + publisher = record.publisher ) ) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreReleaseServiceImpl.kt index 07401c0c5ce..5f810864db8 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreReleaseServiceImpl.kt @@ -363,7 +363,7 @@ class StoreReleaseServiceImpl @Autowired constructor( storeReleaseCreateRequest = StoreReleaseCreateRequest( storeCode = storeCode, storeType = storeType, - latestUpgrader = userId, + latestUpgrader = storeReleaseRequest.publisher ?: userId, latestUpgradeTime = pubTime ) ) From 52b0b5ff75fa4d98b79f65064bc7749597b30e5a Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Mon, 20 Jan 2025 16:56:25 +0800 Subject: [PATCH 7/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/atom/dao/MarketAtomDao.kt | 26 +++- .../store/common/dao/StoreReleaseDao.kt | 19 ++- .../StoreComponentDataCorrectionService.kt | 7 ++ ...eCoreComponentDataCorrectionServiceImpl.kt | 112 ++++++++++++++++++ .../devops/store/image/dao/MarketImageDao.kt | 20 ++++ .../store/template/dao/MarketTemplateDao.kt | 21 ++++ 6 files changed, 200 insertions(+), 5 deletions(-) create mode 100644 src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt create mode 100644 src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt index 4ebc8e16302..cd1e195ea68 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt @@ -39,6 +39,7 @@ import com.tencent.devops.model.store.tables.TLabel import com.tencent.devops.model.store.tables.TStoreMember import com.tencent.devops.model.store.tables.TStoreStatisticsTotal import com.tencent.devops.model.store.tables.records.TAtomRecord +import com.tencent.devops.store.common.utils.VersionUtils import com.tencent.devops.store.pojo.atom.ApproveReq import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest @@ -47,9 +48,6 @@ import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum import com.tencent.devops.store.pojo.atom.enums.AtomTypeEnum import com.tencent.devops.store.pojo.atom.enums.MarketAtomSortTypeEnum import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum -import com.tencent.devops.store.common.utils.VersionUtils -import java.math.BigDecimal -import java.time.LocalDateTime import org.jooq.Condition import org.jooq.DSLContext import org.jooq.Record @@ -57,7 +55,10 @@ import org.jooq.Result import org.jooq.SelectOnConditionStep import org.jooq.UpdateSetFirstStep import org.jooq.impl.DSL +import org.jooq.impl.DSL.min import org.springframework.stereotype.Repository +import java.math.BigDecimal +import java.time.LocalDateTime @Suppress("ALL") @Repository @@ -897,4 +898,23 @@ class MarketAtomDao : AtomBaseDao() { } } } + + fun listByAtomCode(dslContext: DSLContext): List? { + return with(TAtom.T_ATOM) { + dslContext + .selectFrom(this) + .where(ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte())) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(ATOM_CODE.eq(TAtom.T_ATOM.ATOM_CODE)) + .and(ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte())) + ) + ) + .fetch() + .into(TAtomRecord::class.java) + } + } + } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt index ba8f10909e5..228cecdc68d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt @@ -28,6 +28,7 @@ package com.tencent.devops.store.common.dao import com.tencent.devops.common.api.util.UUIDUtil import com.tencent.devops.model.store.tables.TStoreRelease +import com.tencent.devops.model.store.tables.records.TStoreReleaseRecord import com.tencent.devops.store.pojo.common.publication.StoreReleaseCreateRequest import org.jooq.DSLContext import org.springframework.stereotype.Repository @@ -94,7 +95,6 @@ class StoreReleaseDao { fun updateComponentFirstPublisher( dslContext: DSLContext, - userId: String, storeCode: String, storeType: Byte, firstPublisher: String @@ -102,10 +102,25 @@ class StoreReleaseDao { with(TStoreRelease.T_STORE_RELEASE) { dslContext.update(this) .set(FIRST_PUB_CREATOR, firstPublisher) - .set(MODIFIER, userId) + .set(UPDATE_TIME, LocalDateTime.now()) .where(STORE_CODE.eq(storeCode)) .and(STORE_TYPE.eq(storeType)) .execute() } } + + + fun selectStoreReleaseInfo( + dslContext: DSLContext, + storeCode: List, + storeType: Byte + ): List? { + return with(TStoreRelease.T_STORE_RELEASE) { + dslContext.selectFrom(this) + .where(STORE_CODE.`in`(storeCode)) + .and(STORE_TYPE.eq(storeType)) + .fetch() + } + + } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt new file mode 100644 index 00000000000..ec5c8bbb167 --- /dev/null +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt @@ -0,0 +1,7 @@ +package com.tencent.devops.store.common.service + +abstract class StoreComponentDataCorrectionService { + + abstract fun updateComponentFirstPublisher() + +} \ No newline at end of file diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt new file mode 100644 index 00000000000..b7c3d266ce4 --- /dev/null +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt @@ -0,0 +1,112 @@ +package com.tencent.devops.store.common.service.impl + +import com.tencent.devops.store.atom.dao.MarketAtomDao +import com.tencent.devops.store.common.dao.StoreReleaseDao +import com.tencent.devops.store.common.service.StoreComponentDataCorrectionService +import com.tencent.devops.store.image.dao.MarketImageDao +import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum +import com.tencent.devops.store.template.dao.MarketTemplateDao +import org.jooq.DSLContext +import org.jooq.impl.DSL +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.stereotype.Service + + +@Service +class StoreCoreComponentDataCorrectionServiceImpl : StoreComponentDataCorrectionService() { + @Autowired + lateinit var dslContext: DSLContext + + @Autowired + lateinit var atomDao: MarketAtomDao + + @Autowired + lateinit var templateDao: MarketTemplateDao + + @Autowired + lateinit var imageDao: MarketImageDao + + + @Autowired + lateinit var storeReleaseDao: StoreReleaseDao + + + + + + + + override fun updateComponentFirstPublisher() { + + try { + val atomList = atomDao.listByAtomCode(dslContext)?.map { Component(it.atomCode, it.modifier) } + updateFirstPublisherIfNecessary(StoreTypeEnum.ATOM, atomList, storeReleaseDao, dslContext) + + val templateList = templateDao.listByTemplateCode(dslContext)?.map { Component(it.templateCode, it.modifier) } + updateFirstPublisherIfNecessary(StoreTypeEnum.TEMPLATE, templateList, storeReleaseDao, dslContext) + + val imageList = imageDao.listByImageCode(dslContext)?.map { Component(it.imageCode, it.modifier) } + updateFirstPublisherIfNecessary(StoreTypeEnum.IMAGE, imageList, storeReleaseDao, dslContext) + }catch (e: Exception){ + logger.info("updateComponentFirstPublisher error:${e.message}") + throw RuntimeException("updateComponentFirstPublisher error") + } + + } + + + fun updateFirstPublisherIfNecessary( + storeTypeEnum: StoreTypeEnum, + list: List?, + dao: StoreReleaseDao, + dslContext: DSLContext + ) { + + if (!list.isNullOrEmpty()) { + val codes = list.map { it.code } + val storeReleaseList = storeReleaseDao.selectStoreReleaseInfo( + dslContext, + codes, + storeTypeEnum.type.toByte() + ) + + if (!storeReleaseList.isNullOrEmpty()) { + list.forEach { + val storeRelease = storeReleaseList.find { storeRelease -> storeRelease.storeCode == it.code && storeRelease.storeType == storeTypeEnum.type.toByte()} + if (storeRelease != null && it.modifier != storeRelease.firstPubCreator) { + dslContext.transaction { configuration -> + val transactionContext = DSL.using(configuration) + dao.updateComponentFirstPublisher( + dslContext = transactionContext, + storeCode = it.code, + storeType = storeTypeEnum.type.toByte(), + firstPublisher = it.modifier + ) + } + + } + } + + } + + } + + + } + + + class Component( + val code: String, + val modifier: String + ) + + + companion object { + private val logger = LoggerFactory.getLogger(StoreCoreComponentDataCorrectionServiceImpl::class.java) + } + +} + + + diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt index 39cc3c08f70..ab7c7e5bbe4 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt @@ -91,6 +91,7 @@ import org.jooq.Result import org.jooq.UpdateSetFirstStep import org.jooq.impl.DSL import org.jooq.impl.DSL.groupConcat +import org.jooq.impl.DSL.min import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Repository import java.math.BigDecimal @@ -1433,4 +1434,23 @@ class MarketImageDao @Autowired constructor() { .fetch() } } + + + fun listByImageCode(dslContext: DSLContext): List? { + return with(TImage.T_IMAGE) { + dslContext + .selectFrom(this) + .where(IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte())) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(IMAGE_CODE.eq(TImage.T_IMAGE.IMAGE_CODE)) + .and(IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte())) + ) + ) + .fetch() + .into(TImageRecord::class.java) + } + } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt index c315b189ac6..50795690b57 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt @@ -51,6 +51,7 @@ import org.jooq.Record import org.jooq.Result import org.jooq.SelectJoinStep import org.jooq.impl.DSL +import org.jooq.impl.DSL.min import org.springframework.stereotype.Repository import java.math.BigDecimal import java.time.LocalDateTime @@ -662,4 +663,24 @@ class MarketTemplateDao { .execute() } } + + + fun listByTemplateCode(dslContext: DSLContext): List? { + return with(TTemplate.T_TEMPLATE) { + dslContext + .selectFrom(this) + .where(TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte())) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(TEMPLATE_CODE.eq(TTemplate.T_TEMPLATE.TEMPLATE_CODE)) + .and(TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte())) + ) + ) + .fetch() + .into(TTemplateRecord::class.java) + } + } + } From 2937600f10ff0bab85ddb70c4e59ee2c376d5bb6 Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Tue, 21 Jan 2025 11:13:29 +0800 Subject: [PATCH 8/8] =?UTF-8?q?bug:=E7=A0=94=E5=8F=91=E5=95=86=E5=BA=97?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=A1=E6=A0=B8=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=BD=95=E5=85=A5T=5FSTORE=5FRELEASE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=8F=91=E5=B8=83=E4=BA=BA=E6=9C=89=E8=AF=AF?= =?UTF-8?q?=20#11366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/common/OpStorePublishersResource.kt | 11 +------- .../devops/store/atom/dao/MarketAtomDao.kt | 18 +++++++------ .../atom/service/impl/OpAtomServiceImpl.kt | 2 +- .../store/common/dao/StoreReleaseDao.kt | 15 ++++++++--- .../OpStorePublishersResourceImpl.kt | 7 ++---- .../common/service/PublishersDataService.kt | 7 +----- .../StoreComponentDataCorrectionService.kt | 2 +- .../impl/OpStoreComponentServiceImpl.kt | 2 +- .../service/impl/PublishersDataServiceImpl.kt | 25 +++++++------------ ...eCoreComponentDataCorrectionServiceImpl.kt | 14 ++++++----- .../devops/store/image/dao/MarketImageDao.kt | 18 +++++++------ .../store/template/dao/MarketTemplateDao.kt | 18 +++++++------ 12 files changed, 65 insertions(+), 74 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt index 89418989001..b0211068e0a 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/common/OpStorePublishersResource.kt @@ -58,15 +58,6 @@ interface OpStorePublishersResource { fun updateComponentFirstPublisher( @Parameter(description = "userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) - userId: String, - @Parameter(description = "store组件代码", required = true) - @QueryParam("storeCode") - storeCode: String, - @Parameter(description = "组件类型", required = true) - @QueryParam("storeType") - storeType: StoreTypeEnum, - @Parameter(description = "首次发布人", required = true) - @QueryParam("firstPublisher") - firstPublisher: String + userId: String ): Result } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt index fff26cae766..12405199782 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt @@ -917,14 +917,16 @@ class MarketAtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { dslContext .selectFrom(this) - .where(ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte())) - .and( - CREATE_TIME.eq( - DSL.select(min(CREATE_TIME)) - .from(this) - .where(ATOM_CODE.eq(TAtom.T_ATOM.ATOM_CODE)) - .and(ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte())) - ) + .where( + ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte()) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(ATOM_CODE.eq(TAtom.T_ATOM.ATOM_CODE)) + .and(ATOM_STATUS.eq(AtomStatusEnum.RELEASED.status.toByte())) + ) + ) ) .fetch() .into(TAtomRecord::class.java) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt index 81b4e714974..2b83c661eca 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/OpAtomServiceImpl.kt @@ -349,7 +349,7 @@ class OpAtomServiceImpl @Autowired constructor( releaseType = releaseType, repositoryHashId = atom.repositoryHashId, branch = atom.branch, - publisher = atom.publisher + publisher = atom.modifier ) ) } else { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt index 228cecdc68d..c7a4057dbdd 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/dao/StoreReleaseDao.kt @@ -97,15 +97,22 @@ class StoreReleaseDao { dslContext: DSLContext, storeCode: String, storeType: Byte, - firstPublisher: String + firstPublisher: String, + userId: String? ) { with(TStoreRelease.T_STORE_RELEASE) { - dslContext.update(this) + val updateQuery = dslContext.update(this) .set(FIRST_PUB_CREATOR, firstPublisher) .set(UPDATE_TIME, LocalDateTime.now()) - .where(STORE_CODE.eq(storeCode)) + + if (userId != null) { + updateQuery.set(MODIFIER, userId) + } + + updateQuery.where(STORE_CODE.eq(storeCode)) .and(STORE_TYPE.eq(storeType)) - .execute() + + updateQuery.execute() } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt index f31701c33df..24324e863ff 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/resources/OpStorePublishersResourceImpl.kt @@ -43,11 +43,8 @@ class OpStorePublishersResourceImpl constructor( } override fun updateComponentFirstPublisher( - userId: String, - storeCode: String, - storeType: StoreTypeEnum, - firstPublisher: String + userId: String ): Result { - return Result(publishersDataService.updateComponentFirstPublisher(userId, storeCode, storeType, firstPublisher)) + return Result(publishersDataService.updateComponentFirstPublisher(userId)) } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt index 1a20956ee1a..a2c3f01e9cd 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/PublishersDataService.kt @@ -78,10 +78,5 @@ interface PublishersDataService { /** * 修改组件首个发布人 */ - fun updateComponentFirstPublisher( - userId: String, - storeCode: String, - storeType: StoreTypeEnum, - firstPublisher: String - ): Boolean + fun updateComponentFirstPublisher(userId: String): Boolean } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt index ec5c8bbb167..5faaa9e7411 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/StoreComponentDataCorrectionService.kt @@ -2,6 +2,6 @@ package com.tencent.devops.store.common.service abstract class StoreComponentDataCorrectionService { - abstract fun updateComponentFirstPublisher() + abstract fun updateComponentFirstPublisher(userId:String?) } \ No newline at end of file diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt index 89efcb1bd62..af4f89b5acc 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/OpStoreComponentServiceImpl.kt @@ -116,7 +116,7 @@ class OpStoreComponentServiceImpl @Autowired constructor( version = version, status = storeStatus, releaseType = releaseType, - publisher = record.publisher + publisher = record.modifier ) ) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt index f71fd2ffb9d..f87ed720580 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/PublishersDataServiceImpl.kt @@ -46,21 +46,22 @@ import com.tencent.devops.store.common.dao.StoreDockingPlatformErrorCodeDao import com.tencent.devops.store.common.dao.StoreMemberDao import com.tencent.devops.store.common.dao.StoreReleaseDao import com.tencent.devops.store.common.service.PublishersDataService +import com.tencent.devops.store.common.service.StoreComponentDataCorrectionService import com.tencent.devops.store.common.service.StoreUserService import com.tencent.devops.store.constant.StoreMessageCode.GET_INFO_NO_PERMISSION +import com.tencent.devops.store.pojo.common.enums.PublisherType +import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum +import com.tencent.devops.store.pojo.common.platform.StoreDockingPlatformRequest import com.tencent.devops.store.pojo.common.publication.PublisherDeptInfo import com.tencent.devops.store.pojo.common.publication.PublisherInfo import com.tencent.devops.store.pojo.common.publication.PublishersRequest -import com.tencent.devops.store.pojo.common.platform.StoreDockingPlatformRequest -import com.tencent.devops.store.pojo.common.enums.PublisherType -import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum -import java.time.LocalDateTime -import java.util.concurrent.Executors import org.jooq.DSLContext import org.jooq.impl.DSL import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service +import java.time.LocalDateTime +import java.util.concurrent.Executors @Service class PublishersDataServiceImpl @Autowired constructor( @@ -72,7 +73,8 @@ class PublishersDataServiceImpl @Autowired constructor( private val storeMemberDao: StoreMemberDao, private val storeUserService: StoreUserService, private val storeDockingPlatformErrorCodeDao: StoreDockingPlatformErrorCodeDao, - private val storeReleaseDao: StoreReleaseDao + private val storeReleaseDao: StoreReleaseDao, + private val storeComponentDataCorrectionService: StoreComponentDataCorrectionService ) : PublishersDataService { private val executorService = Executors.newSingleThreadExecutor() @@ -351,17 +353,8 @@ class PublishersDataServiceImpl @Autowired constructor( override fun updateComponentFirstPublisher( userId: String, - storeCode: String, - storeType: StoreTypeEnum, - firstPublisher: String ): Boolean { - storeReleaseDao.updateComponentFirstPublisher( - dslContext, - userId, - storeCode, - storeType.type.toByte(), - firstPublisher - ) + storeComponentDataCorrectionService.updateComponentFirstPublisher(userId) return true } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt index b7c3d266ce4..d5852727990 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreCoreComponentDataCorrectionServiceImpl.kt @@ -37,17 +37,17 @@ class StoreCoreComponentDataCorrectionServiceImpl : StoreComponentDataCorrection - override fun updateComponentFirstPublisher() { + override fun updateComponentFirstPublisher(userId: String?) { try { val atomList = atomDao.listByAtomCode(dslContext)?.map { Component(it.atomCode, it.modifier) } - updateFirstPublisherIfNecessary(StoreTypeEnum.ATOM, atomList, storeReleaseDao, dslContext) + updateFirstPublisherIfNecessary(StoreTypeEnum.ATOM, atomList, storeReleaseDao, dslContext,userId) val templateList = templateDao.listByTemplateCode(dslContext)?.map { Component(it.templateCode, it.modifier) } - updateFirstPublisherIfNecessary(StoreTypeEnum.TEMPLATE, templateList, storeReleaseDao, dslContext) + updateFirstPublisherIfNecessary(StoreTypeEnum.TEMPLATE, templateList, storeReleaseDao, dslContext,userId) val imageList = imageDao.listByImageCode(dslContext)?.map { Component(it.imageCode, it.modifier) } - updateFirstPublisherIfNecessary(StoreTypeEnum.IMAGE, imageList, storeReleaseDao, dslContext) + updateFirstPublisherIfNecessary(StoreTypeEnum.IMAGE, imageList, storeReleaseDao, dslContext,userId) }catch (e: Exception){ logger.info("updateComponentFirstPublisher error:${e.message}") throw RuntimeException("updateComponentFirstPublisher error") @@ -60,7 +60,8 @@ class StoreCoreComponentDataCorrectionServiceImpl : StoreComponentDataCorrection storeTypeEnum: StoreTypeEnum, list: List?, dao: StoreReleaseDao, - dslContext: DSLContext + dslContext: DSLContext, + userId: String? ) { if (!list.isNullOrEmpty()) { @@ -81,7 +82,8 @@ class StoreCoreComponentDataCorrectionServiceImpl : StoreComponentDataCorrection dslContext = transactionContext, storeCode = it.code, storeType = storeTypeEnum.type.toByte(), - firstPublisher = it.modifier + firstPublisher = it.modifier, + userId = userId ) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt index ab7c7e5bbe4..410d5a8c6b0 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/dao/MarketImageDao.kt @@ -1440,14 +1440,16 @@ class MarketImageDao @Autowired constructor() { return with(TImage.T_IMAGE) { dslContext .selectFrom(this) - .where(IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte())) - .and( - CREATE_TIME.eq( - DSL.select(min(CREATE_TIME)) - .from(this) - .where(IMAGE_CODE.eq(TImage.T_IMAGE.IMAGE_CODE)) - .and(IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte())) - ) + .where( + IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte()) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(IMAGE_CODE.eq(TImage.T_IMAGE.IMAGE_CODE)) + .and(IMAGE_STATUS.eq(ImageStatusEnum.RELEASED.status.toByte())) + ) + ) ) .fetch() .into(TImageRecord::class.java) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt index 50795690b57..93c7dfef0d8 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/template/dao/MarketTemplateDao.kt @@ -669,14 +669,16 @@ class MarketTemplateDao { return with(TTemplate.T_TEMPLATE) { dslContext .selectFrom(this) - .where(TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte())) - .and( - CREATE_TIME.eq( - DSL.select(min(CREATE_TIME)) - .from(this) - .where(TEMPLATE_CODE.eq(TTemplate.T_TEMPLATE.TEMPLATE_CODE)) - .and(TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte())) - ) + .where( + TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte()) + .and( + CREATE_TIME.eq( + DSL.select(min(CREATE_TIME)) + .from(this) + .where(TEMPLATE_CODE.eq(TTemplate.T_TEMPLATE.TEMPLATE_CODE)) + .and(TEMPLATE_STATUS.eq(TemplateStatusEnum.RELEASED.status.toByte())) + ) + ) ) .fetch() .into(TTemplateRecord::class.java)