Skip to content

Commit

Permalink
bug:研发商店组件审核发布时录入T_STORE_RELEASE表的首次发布人有误 TencentBlueKing#11366
Browse files Browse the repository at this point in the history
  • Loading branch information
Kzhou991 committed Jan 8, 2025
1 parent d37c587 commit 079a52f
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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-研发商店-发布者")
Expand All @@ -46,4 +51,25 @@ interface OpStorePublishersResource {
@PUT
@Path("/refresh/person")
fun refreshPersonPublisherGroup(): Result<Boolean>


@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<Boolean>


}
Original file line number Diff line number Diff line change
Expand Up @@ -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,

)
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -40,4 +41,13 @@ class OpStorePublishersResourceImpl constructor(
override fun refreshPersonPublisherGroup(): Result<Boolean> {
return Result(publishersDataService.refreshPersonPublisherGroup())
}

override fun updateComponentFirstPublisher(
userId: String,
storeCode: String,
storeType: StoreTypeEnum,
firstPublisher: String
): Result<Boolean> {
return Result(publishersDataService.updateComponentFirstPublisher(userId, storeCode, storeType, firstPublisher))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ interface PublishersDataService {
* 更新研发商店个人发布者组织架构信息
*/
fun refreshPersonPublisherGroup(): Boolean


/**
* 修改组件首个发布人
*/
fun updateComponentFirstPublisher(userId: String, storeCode: String, storeType: StoreTypeEnum, firstPublisher: String): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 079a52f

Please sign in to comment.