Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug:研发商店组件审核发布时录入T_STORE_RELEASE表的首次发布人有误 #11366 #11408

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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,22 @@ interface OpStorePublishersResource {
@PUT
@Path("/refresh/person")
fun refreshPersonPublisherGroup(): Result<Boolean>

@Operation(summary = "修改组件的首次发布人")
@PUT
@Path("/updateComponentFirstPublisher")
fun updateComponentFirstPublisher(
@Parameter(description = "userId", required = true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要一键刷新所有历史数据的op接口,不是人工一个个改

@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 publisher: String? = null,

)
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
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.publisher ?: 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,
publisher = atom.publisher
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是首次发布人吗?publisher有可能是组织,这个需求应该取首个版本的创建人数据录入

)
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,21 @@ 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,14 @@ 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 @@ -115,7 +115,8 @@ class OpStoreComponentServiceImpl @Autowired constructor(
storeType = storeType,
version = version,
status = storeStatus,
releaseType = releaseType
releaseType = releaseType,
publisher = record.publisher
)
)
}
Expand Down
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,22 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class StoreReleaseServiceImpl @Autowired constructor(
storeReleaseCreateRequest = StoreReleaseCreateRequest(
storeCode = storeCode,
storeType = storeType,
latestUpgrader = userId,
latestUpgrader = storeReleaseRequest.publisher ?: userId,
latestUpgradeTime = pubTime
)
)
Expand Down