diff --git a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/constant/AuthI18nConstants.kt b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/constant/AuthI18nConstants.kt index 5603b834aa7..98e60fc1eb8 100644 --- a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/constant/AuthI18nConstants.kt +++ b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/constant/AuthI18nConstants.kt @@ -28,6 +28,7 @@ object AuthI18nConstants { const val BK_PROJECT_ID = "bkProjectId" // 项目ID const val BK_PROJECT_DESC = "bkProjectDesc" // 项目描述 const val BK_ORGANIZATION = "bkOrganization" // 所属组织 + const val BK_PROJECT_PRODUCT = "bkProjectProduct" // 项目所属运营产品 const val BK_AUTH_SECRECY = "bkAuthSecrecy" // 项目性质 const val BK_SUBJECT_SCOPES = "bkSubjectScopes" // 最大可授权人员范围 const val BK_RESOURCE_TYPE_NAME = "bkResourceTypeName" // 资源类型名称 @@ -35,6 +36,7 @@ object AuthI18nConstants { const val BK_GROUP_NAME = "bkGroupName" // 用户组名称 const val BK_VALIDITY_PERIOD = "bkValidityPeriod" // 申请期限 const val BK_CREATE_PROJECT_APPROVAL = "bkCreateProjectApproval" // 创建项目{0}审批 + const val BK_UPDATE_PROJECT_APPROVAL = "bkUpdateProjectApproval" // 修改项目{0}审批 const val BK_APPLY_TO_JOIN_PROJECT = "bkApplyToJoinProject" // 申请加入项目 const val BK_APPLY_TO_JOIN_GROUP = "bkApplyToJoinGroup" // 申请加入用户组 const val BK_DAY = "bkDay" // days diff --git a/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/ItsmService.kt b/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/ItsmService.kt index 7473d0f562e..88ef12d0efa 100644 --- a/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/ItsmService.kt +++ b/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/ItsmService.kt @@ -1,7 +1,7 @@ package com.tencent.devops.auth.service +import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.module.kotlin.readValue import com.tencent.bk.sdk.iam.dto.itsm.ItsmAttrs import com.tencent.bk.sdk.iam.dto.itsm.ItsmColumn import com.tencent.bk.sdk.iam.dto.itsm.ItsmContentDTO @@ -39,7 +39,7 @@ class ItsmService @Autowired constructor( private val itsmUrlPrefix: String = "" fun cancelItsmApplication(itsmCancelApplicationInfo: ItsmCancelApplicationInfo): Boolean { - val itsmResponseDTO = executeHttpPost( + val itsmResponseDTO: ResponseDTO> = executeHttpPost( urlSuffix = ITSM_APPLICATION_CANCEL_URL_SUFFIX, body = itsmCancelApplicationInfo ) @@ -56,7 +56,7 @@ class ItsmService @Autowired constructor( fun verifyItsmToken(token: String) { val param = mapOf("token" to token) - val itsmResponseDTO = executeHttpPost(ITSM_TOKEN_VERITY_URL_SUFFIX, param) + val itsmResponseDTO: ResponseDTO> = executeHttpPost(ITSM_TOKEN_VERITY_URL_SUFFIX, param) val itsmApiResData = itsmResponseDTO.data logger.info("itsmApiResData:$itsmApiResData") @@ -70,11 +70,12 @@ class ItsmService @Autowired constructor( } fun getItsmTicketStatus(sn: String): String { - val itsmResponseDTO = executeHttpGet(String.format(ITSM_TICKET_STATUS_URL_SUFFIX, sn)) + val itsmResponseDTO: ResponseDTO> = + executeHttpGet(String.format(ITSM_TICKET_STATUS_URL_SUFFIX, sn)) return itsmResponseDTO.data?.get("current_status").toString() } - private fun executeHttpPost(urlSuffix: String, body: Any): ResponseDTO> { + private fun executeHttpPost(urlSuffix: String, body: Any): ResponseDTO { val headerStr = objectMapper.writeValueAsString(mapOf("bk_app_code" to appCode, "bk_app_secret" to appSecret)) .replace("\\s".toRegex(), "") val requestBody = objectMapper.writeValueAsString(body) @@ -89,7 +90,7 @@ class ItsmService @Autowired constructor( return executeHttpRequest(url, request) } - private fun executeHttpGet(urlSuffix: String): ResponseDTO> { + private fun executeHttpGet(urlSuffix: String): ResponseDTO { val headerStr = objectMapper.writeValueAsString(mapOf("bk_app_code" to appCode, "bk_app_secret" to appSecret)) .replace("\\s".toRegex(), "") val url = itsmUrlPrefix + urlSuffix @@ -101,14 +102,15 @@ class ItsmService @Autowired constructor( return executeHttpRequest(url, request) } - private fun executeHttpRequest(url: String, request: Request): ResponseDTO> { + private fun executeHttpRequest(url: String, request: Request): ResponseDTO { OkhttpUtils.doHttp(request).use { if (!it.isSuccessful) { logger.warn("request failed, uri:($url)|response: ($it)") throw RemoteServiceException("request failed, response:($it)") } val responseStr = it.body!!.string() - val responseDTO = objectMapper.readValue>>(responseStr) + val responseDTO: ResponseDTO = + objectMapper.readValue(responseStr, object : TypeReference>() {}) if (responseDTO.code != 0L || !responseDTO.result) { // 请求错误 logger.warn("request failed, url:($url)|response:($it)") @@ -126,8 +128,11 @@ class ItsmService @Autowired constructor( desc: String, organization: String, authSecrecy: Int, - subjectScopes: List + subjectScopes: List, + productName: String, + isCreateProject: Boolean = true ): ItsmContentDTO { + logger.info("build grade manager itsm content:$projectName|$projectId|$organization|$productName") val itsmColumns = listOf( ItsmColumn.builder().key("projectName") .name(I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_PROJECT_NAME)).type(TEXT_TYPE).build(), @@ -142,7 +147,9 @@ class ItsmService @Autowired constructor( ItsmColumn.builder().key("authSecrecy") .name(I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_AUTH_SECRECY)).type(TEXT_TYPE).build(), ItsmColumn.builder().key("subjectScopes") - .name(I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_SUBJECT_SCOPES)).type(TEXT_TYPE).build() + .name(I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_SUBJECT_SCOPES)).type(TEXT_TYPE).build(), + ItsmColumn.builder().key("productName") + .name(I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_PROJECT_PRODUCT)).type(TEXT_TYPE).build() ) val itsmAttrs = ItsmAttrs.builder().column(itsmColumns).build() val itsmScheme = ItsmScheme.builder().attrs(itsmAttrs).type("table").build() @@ -153,13 +160,19 @@ class ItsmService @Autowired constructor( value["projectId"] = ItsmStyle.builder().value(projectId).build() value["desc"] = ItsmStyle.builder().value(desc).build() value["organization"] = ItsmStyle.builder().value(organization).build() + value["productName"] = ItsmStyle.builder().value(productName).build() value["authSecrecy"] = ItsmStyle.builder().value(ProjectAuthSecrecyStatus.getStatus(authSecrecy)?.desc ?: "").build() value["subjectScopes"] = ItsmStyle.builder().value(subjectScopes.joinToString(",") { it.name }).build() val itsmValue = ItsmValue.builder() .scheme("content_table") .label( - I18nUtil.getCodeLanMessage(AuthI18nConstants.BK_CREATE_PROJECT_APPROVAL) + I18nUtil.getCodeLanMessage( + if (isCreateProject) + AuthI18nConstants.BK_CREATE_PROJECT_APPROVAL + else + AuthI18nConstants.BK_UPDATE_PROJECT_APPROVAL + ) ) .value(listOf(value)) .build() diff --git a/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/PermissionGradeManagerService.kt b/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/PermissionGradeManagerService.kt index fbb7f6a8c42..423713a6181 100644 --- a/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/PermissionGradeManagerService.kt +++ b/src/backend/ci/core/auth/biz-auth-rbac/src/main/kotlin/com/tencent/devops/auth/service/PermissionGradeManagerService.kt @@ -189,7 +189,8 @@ class PermissionGradeManagerService @Autowired constructor( type = ALL_MEMBERS, name = ALL_MEMBERS_NAME ) - ) + ), + productName = projectApprovalInfo.productName!! ) val gradeManagerApplicationCreateDTO = GradeManagerApplicationCreateDTO .builder() @@ -309,7 +310,9 @@ class PermissionGradeManagerService @Autowired constructor( type = ALL_MEMBERS, name = ALL_MEMBERS_NAME ) - ) + ), + productName = projectApprovalInfo.productName!!, + isCreateProject = false ) val gradeManagerDetail = iamV2ManagerService.getGradeManagerDetail(gradeManagerId) val gradeManagerApplicationUpdateDTO = GradeManagerApplicationUpdateDTO.builder() diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/ProjectInfoResponse.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/ProjectInfoResponse.kt index dd6233435c4..898d83c796a 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/ProjectInfoResponse.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/ProjectInfoResponse.kt @@ -124,5 +124,7 @@ data class ProjectInfoResponse( @ApiModelProperty("流水线数量上限") val pipelineLimit: Int? = 500, @ApiModelProperty("项目其他设置") - val properties: ProjectProperties? + val properties: ProjectProperties?, + @ApiModelProperty("产品运营ID") + val productId: Int? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/op/OPProjectResource.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/op/OPProjectResource.kt index 2aaf62ad639..a9ccd744bc5 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/op/OPProjectResource.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/op/OPProjectResource.kt @@ -132,6 +132,9 @@ interface OPProjectResource { @ApiParam(value = "是否是云研发项目 true:是 false:否", required = true) @QueryParam(value = "is_remotedev") remoteDevFlag: Boolean = false, + @ApiParam(value = "运营产品ID", required = true) + @QueryParam(value = "product_id") + productId: Int?, @Context request: HttpServletRequest ): Result?> diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/user/UserProjectResource.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/user/UserProjectResource.kt index 8c7b03de45f..2b153a27885 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/user/UserProjectResource.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/api/user/UserProjectResource.kt @@ -33,6 +33,7 @@ import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID_DEFAULT_VALUE import com.tencent.devops.common.api.pojo.Pagination import com.tencent.devops.common.auth.api.AuthPermission +import com.tencent.devops.project.pojo.OperationalProductVO import com.tencent.devops.project.pojo.ProjectCreateInfo import com.tencent.devops.project.pojo.ProjectDiffVO import com.tencent.devops.project.pojo.ProjectLogo @@ -330,4 +331,13 @@ interface UserProjectResource { @PathParam("project_id") projectId: String ): Result + + @GET + @Path("/product/getOperationalProducts") + @ApiOperation("查询运营产品") + fun getOperationalProducts( + @ApiParam("userId", required = true) + @HeaderParam(AUTH_HEADER_DEVOPS_USER_ID) + userId: String + ): Result> } diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsBaseDictDTO.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsBaseDictDTO.kt new file mode 100644 index 00000000000..58529f5d866 --- /dev/null +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsBaseDictDTO.kt @@ -0,0 +1,16 @@ +package com.tencent.devops.project.pojo + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("OBS基礎字典数据") +data class ObsBaseDictDTO( + @ApiModelProperty("jsonrpc") + val jsonrpc: String, + @ApiModelProperty("id") + val id: String, + @ApiModelProperty("method") + val method: String, + @ApiModelProperty("params") + val params: Map +) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResponse.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResponse.kt new file mode 100644 index 00000000000..39f2ecf6f68 --- /dev/null +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResponse.kt @@ -0,0 +1,14 @@ +package com.tencent.devops.project.pojo + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("OBS运营产品") +data class ObsOperationalProductResponse( + @ApiModelProperty("jsonrpc") + val jsonrpc: String, + @ApiModelProperty("id") + val id: String, + @ApiModelProperty("运营产品") + val result: ObsOperationalProductResult +) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResult.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResult.kt new file mode 100644 index 00000000000..29fda6ac421 --- /dev/null +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ObsOperationalProductResult.kt @@ -0,0 +1,10 @@ +package com.tencent.devops.project.pojo + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("OBS运营产品结果") +data class ObsOperationalProductResult( + @ApiModelProperty("运营产品") + val data: List +) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OpProjectUpdateInfoRequest.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OpProjectUpdateInfoRequest.kt index 42730dc8184..1ae6b7a7128 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OpProjectUpdateInfoRequest.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OpProjectUpdateInfoRequest.kt @@ -101,5 +101,7 @@ data class OpProjectUpdateInfoRequest( @ApiModelProperty(value = "流水线数量上限", required = false) val pipelineLimit: Int? = 500, @ApiModelProperty("项目相关配置") - val properties: ProjectProperties? = null + val properties: ProjectProperties? = null, + @ApiModelProperty("运营产品id") + val productId: Int? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OperationalProductVO.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OperationalProductVO.kt new file mode 100644 index 00000000000..9774154af44 --- /dev/null +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/OperationalProductVO.kt @@ -0,0 +1,15 @@ +package com.tencent.devops.project.pojo + +import com.fasterxml.jackson.annotation.JsonProperty +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("运营产品") +data class OperationalProductVO( + @ApiModelProperty("产品ID") + @JsonProperty(value = "ProductId", required = true) + val productId: Int, + @ApiModelProperty("产品ID") + @JsonProperty(value = "ProductName", required = true) + val productName: String +) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectApprovalInfo.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectApprovalInfo.kt index 3590c773292..72c4c53aff6 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectApprovalInfo.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectApprovalInfo.kt @@ -33,51 +33,38 @@ import io.swagger.annotations.ApiModelProperty data class ProjectApprovalInfo( @ApiModelProperty("项目名称") - // @JsonProperty("project_name") val projectName: String, @ApiModelProperty("项目类型") val approvalStatus: Int?, @ApiModelProperty("审批时间") - // @JsonProperty("approval_time") val approvalTime: String?, @ApiModelProperty("审批人") val approver: String?, @ApiModelProperty("创建时间") - // @JsonProperty("created_at") val createdAt: String?, @ApiModelProperty("创建人") val creator: String?, @ApiModelProperty("事业群ID") - // @JsonProperty("bg_id") val bgId: String?, @ApiModelProperty("事业群名字") - // @JsonProperty("bg_name") val bgName: String?, @ApiModelProperty("中心ID") - // @JsonProperty("center_id") val centerId: String?, @ApiModelProperty("中心名称") - // @JsonProperty("center_name") val centerName: String?, @ApiModelProperty("部门ID") - // @JsonProperty("dept_id") val deptId: String?, @ApiModelProperty("部门名称") - // @JsonProperty("dept_name") val deptName: String?, @ApiModelProperty("描述") val description: String?, @ApiModelProperty("英文缩写") - // @JsonProperty("english_name") val englishName: String, @ApiModelProperty("logo地址") - // @JsonProperty("logo_addr") val logoAddr: String?, @ApiModelProperty("修改人") - // @JsonProperty("updated_at") val updator: String?, @ApiModelProperty("修改时间") - // @JsonProperty("updated_at") val updatedAt: String?, @ApiModelProperty("项目最大可授权人员范围") val subjectScopes: List?, @@ -86,5 +73,9 @@ data class ProjectApprovalInfo( @ApiModelProperty("项目提示状态,0-不展示,1-展示创建成功,2-展示编辑成功") val tipsStatus: Int, @ApiModelProperty("项目性质") - val projectType: Int? + val projectType: Int?, + @ApiModelProperty("运营产品ID") + val productId: Int? = null, + @ApiModelProperty("运营产品名称") + val productName: String? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectCreateInfo.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectCreateInfo.kt index 4c818ad396c..ad1a7ad6994 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectCreateInfo.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectCreateInfo.kt @@ -35,36 +35,26 @@ import io.swagger.annotations.ApiModelProperty @ApiModel("项目-新增模型") data class ProjectCreateInfo( @ApiModelProperty("项目名称") - // @JsonProperty("project_name") val projectName: String, @ApiModelProperty("英文缩写") - // @JsonProperty("english_name") val englishName: String, @ApiModelProperty("项目类型") - // @JsonProperty("project_type") val projectType: Int = 0, @ApiModelProperty("描述") val description: String, @ApiModelProperty("一级部门ID") - // @JsonProperty("bg_id") val bgId: Long = 0, @ApiModelProperty("一级部门名字") - // @JsonProperty("bg_name") val bgName: String = "", @ApiModelProperty("二级部门ID") - // @JsonProperty("dept_id") val deptId: Long = 0, @ApiModelProperty("二级部门名称") - // @JsonProperty("dept_name") val deptName: String = "", @ApiModelProperty("三级部门ID") - // @JsonProperty("center_id") val centerId: Long = 0, @ApiModelProperty("三级部门名称") - // @JsonProperty("center_name") val centerName: String = "", @ApiModelProperty("是否保密") - // @get:JsonProperty("is_secrecy") var secrecy: Boolean = false, @ApiModelProperty("kind") val kind: Int = 0, @@ -75,5 +65,9 @@ data class ProjectCreateInfo( @ApiModelProperty("logo地址") val logoAddress: String? = null, @ApiModelProperty("项目性质") - val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value + val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value, + @ApiModelProperty("运营产品ID") + val productId: Int? = null, + @ApiModelProperty("运营产品名称") + val productName: String? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectDiffVO.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectDiffVO.kt index a2755fcb2bb..f8b8df650ed 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectDiffVO.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectDiffVO.kt @@ -37,27 +37,20 @@ data class ProjectDiffVO( @ApiModelProperty("主键ID") val id: Long, @ApiModelProperty("项目ID") - // @JsonProperty("project_id") val projectId: String, @ApiModelProperty("项目名称") - // @JsonProperty("project_name") val projectName: String, @ApiModelProperty("审批中项目名称") - // @JsonProperty("project_name") val afterProjectName: String, @ApiModelProperty("项目代码") - // @JsonProperty("project_code") val projectCode: String, @ApiModelProperty("审批状态") - // @JsonProperty("approval_status") val approvalStatus: Int?, @ApiModelProperty("审批时间") - // @JsonProperty("approval_time") val approvalTime: String?, @ApiModelProperty("审批人") val approver: String?, @ApiModelProperty("创建时间") - // @JsonProperty("created_at") val createdAt: String?, @ApiModelProperty("创建人") val creator: String?, @@ -98,7 +91,6 @@ data class ProjectDiffVO( @ApiModelProperty("评论") val remark: String?, @ApiModelProperty("修改时间") - // @JsonProperty("updated_at") val updatedAt: String?, @ApiModelProperty("修改人") val updator: String?, @@ -113,5 +105,9 @@ data class ProjectDiffVO( @ApiModelProperty("项目类型") val projectType: Int?, @ApiModelProperty("审批中项目类型") - val afterProjectType: Int? + val afterProjectType: Int?, + @ApiModelProperty("运营产品ID") + val productId: Int? = null, + @ApiModelProperty("审批中运营产品ID") + val afterProductId: Int? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectUpdateInfo.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectUpdateInfo.kt index fee800b4131..8e6bacf3071 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectUpdateInfo.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectUpdateInfo.kt @@ -35,39 +35,28 @@ import io.swagger.annotations.ApiModelProperty @ApiModel("项目-修改模型") data class ProjectUpdateInfo( @ApiModelProperty("项目名称") -// @JsonProperty("project_name") val projectName: String, @ApiModelProperty("项目类型") -// @JsonProperty("project_type") val projectType: Int = 0, @ApiModelProperty("事业群ID") -// @JsonProperty("bg_id") val bgId: Long = 0, @ApiModelProperty("事业群名字") -// @JsonProperty("bg_name") val bgName: String = "", @ApiModelProperty("中心ID") -// @JsonProperty("center_id") val centerId: Long = 0, @ApiModelProperty("中心名称") -// @JsonProperty("center_name") val centerName: String = "", @ApiModelProperty("部门ID") -// @JsonProperty("dept_id") val deptId: Long = 0, @ApiModelProperty("部门名称") -// @JsonProperty("dept_name") val deptName: String = "", @ApiModelProperty("描述") val description: String, @ApiModelProperty("英文缩写") -// @JsonProperty("english_name") val englishName: String = "", @ApiModelProperty("cc app id") -// @JsonProperty("cc_app_id") val ccAppId: Long?, @ApiModelProperty("cc app name") -// @JsonProperty("cc_app_name") var ccAppName: String?, // APP name 通过调用CC接口同步 @ApiModelProperty("容器选择, 0 是不选, 1 是k8s, 2 是mesos") val kind: Int?, @@ -80,5 +69,9 @@ data class ProjectUpdateInfo( @ApiModelProperty("logo地址") val logoAddress: String? = null, @ApiModelProperty("项目性质") - val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value + val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value, + @ApiModelProperty("运营产品ID") + val productId: Int? = null, + @ApiModelProperty("运营产品名称") + val productName: String? = null ) diff --git a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectVO.kt b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectVO.kt index 3b7b0c46376..a49af4e2607 100644 --- a/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectVO.kt +++ b/src/backend/ci/core/project/api-project/src/main/kotlin/com/tencent/devops/project/pojo/ProjectVO.kt @@ -38,91 +38,66 @@ data class ProjectVO( @ApiModelProperty("主键ID") val id: Long, @ApiModelProperty("项目ID(很少使用)") - // @JsonProperty("project_id") val projectId: String, @ApiModelProperty("项目名称") - // @JsonProperty("project_name") val projectName: String, @ApiModelProperty("项目代码(蓝盾项目Id)") - // @JsonProperty("project_code") val projectCode: String, @ApiModelProperty("项目类型") - // @JsonProperty("project_type") val projectType: Int?, @ApiModelProperty("审批状态") - // @JsonProperty("approval_status") val approvalStatus: Int?, @ApiModelProperty("审批时间") - // @JsonProperty("approval_time") val approvalTime: String?, @ApiModelProperty("审批人") val approver: String?, @ApiModelProperty("cc业务ID") - // @JsonProperty("cc_app_id") val ccAppId: Long?, @ApiModelProperty("cc业务名称") - // @JsonProperty("cc_app_name") val ccAppName: String?, @ApiModelProperty("创建时间") - // @JsonProperty("created_at") val createdAt: String?, @ApiModelProperty("创建人") val creator: String?, @ApiModelProperty("数据ID") - // @JsonProperty("data_id") val dataId: Long?, @ApiModelProperty("部署类型") - // @JsonProperty("deploy_type") val deployType: String?, @ApiModelProperty("事业群ID") - // @JsonProperty("bg_id") val bgId: String?, @ApiModelProperty("事业群名字") - // @JsonProperty("bg_name") val bgName: String?, @ApiModelProperty("中心ID") - // @JsonProperty("center_id") val centerId: String?, @ApiModelProperty("中心名称") - // @JsonProperty("center_name") val centerName: String?, @ApiModelProperty("部门ID") - // @JsonProperty("dept_id") val deptId: String?, @ApiModelProperty("部门名称") - // @JsonProperty("dept_name") val deptName: String?, @ApiModelProperty("描述") val description: String?, @ApiModelProperty("英文缩写") - // @JsonProperty("english_name") val englishName: String, @ApiModelProperty("extra") val extra: String?, @ApiModelProperty("是否离线") -// @get:JsonProperty("is_offlined") val offlined: Boolean?, @ApiModelProperty("是否保密") -// @get:JsonProperty("is_secrecy") val secrecy: Boolean?, @ApiModelProperty("是否启用图表激活") -// @get:JsonProperty("is_helm_chart_enabled") val helmChartEnabled: Boolean?, @ApiModelProperty("kind") val kind: Int?, @ApiModelProperty("logo地址") - // @JsonProperty("logo_addr") val logoAddr: String?, @ApiModelProperty("评论") val remark: String?, @ApiModelProperty("修改时间") - // @JsonProperty("updated_at") val updatedAt: String?, @ApiModelProperty("修改人") - // @JsonProperty("updated_at") val updator: String?, @ApiModelProperty("useBK") - // @JsonProperty("use_bk") val useBk: Boolean?, @ApiModelProperty("启用") val enabled: Boolean?, @@ -173,5 +148,7 @@ data class ProjectVO( @ApiModelProperty("是否展示用户管理图标") val showUserManageIcon: Boolean? = null, @ApiModelProperty("渠道") - val channelCode: String? = null + val channelCode: String? = null, + @ApiModelProperty("运营产品ID") + val productId: Int? = null ) diff --git a/src/backend/ci/core/project/biz-project-sample/src/main/kotlin/com/tencent/devops/project/service/SimpleProjectServiceImpl.kt b/src/backend/ci/core/project/biz-project-sample/src/main/kotlin/com/tencent/devops/project/service/SimpleProjectServiceImpl.kt index eaffdbc3419..6ee4d15f7cf 100644 --- a/src/backend/ci/core/project/biz-project-sample/src/main/kotlin/com/tencent/devops/project/service/SimpleProjectServiceImpl.kt +++ b/src/backend/ci/core/project/biz-project-sample/src/main/kotlin/com/tencent/devops/project/service/SimpleProjectServiceImpl.kt @@ -43,6 +43,7 @@ import com.tencent.devops.project.constant.ProjectMessageCode import com.tencent.devops.project.dao.ProjectDao import com.tencent.devops.project.dispatch.ProjectDispatcher import com.tencent.devops.project.jmx.api.ProjectJmxApi +import com.tencent.devops.project.pojo.OperationalProductVO import com.tencent.devops.project.pojo.ProjectCreateInfo import com.tencent.devops.project.pojo.ProjectCreateUserInfo import com.tencent.devops.project.pojo.ProjectUpdateInfo @@ -193,6 +194,15 @@ class SimpleProjectServiceImpl @Autowired constructor( override fun isRbacPermission(projectId: String): Boolean = true + override fun getOperationalProducts(): List { + return listOf( + OperationalProductVO( + productId = -1, + productName = "其他" + ) + ) + } + override fun buildRouterTag(routerTag: String?): String? = null override fun updateProjectRouterTag(englishName: String) = Unit diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectApprovalDao.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectApprovalDao.kt index acab955c3db..7788d8c0997 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectApprovalDao.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectApprovalDao.kt @@ -75,7 +75,9 @@ class ProjectApprovalDao { SUBJECT_SCOPES, AUTH_SECRECY, TIPS_STATUS, - PROJECT_TYPE + PROJECT_TYPE, + PRODUCT_ID, + PRODUCT_NAME ).values( projectCreateInfo.projectName, projectCreateInfo.englishName, @@ -95,7 +97,9 @@ class ProjectApprovalDao { JsonUtil.toJson(subjectScopes, false), projectCreateInfo.authSecrecy ?: ProjectAuthSecrecyStatus.PUBLIC.value, tipsStatus, - projectCreateInfo.projectType + projectCreateInfo.projectType, + projectCreateInfo.productId, + projectCreateInfo.productName ).onDuplicateKeyUpdate() .set(PROJECT_NAME, projectCreateInfo.projectName) .set(DESCRIPTION, projectCreateInfo.description) @@ -113,6 +117,8 @@ class ProjectApprovalDao { .set(UPDATOR, userId) .set(TIPS_STATUS, tipsStatus) .set(PROJECT_TYPE, projectCreateInfo.projectType) + .set(PRODUCT_ID, projectCreateInfo.productId) + .set(PRODUCT_NAME, projectCreateInfo.productName) .execute() } } @@ -143,6 +149,8 @@ class ProjectApprovalDao { .set(UPDATOR, userId) .set(TIPS_STATUS, tipsStatus) .set(PROJECT_TYPE, projectUpdateInfo.projectType) + .set(PRODUCT_ID, projectUpdateInfo.productId) + .set(PRODUCT_NAME, projectUpdateInfo.productName) .where(ENGLISH_NAME.eq(projectUpdateInfo.englishName)) .execute() } @@ -170,6 +178,8 @@ class ProjectApprovalDao { .set(UPDATOR, projectApprovalInfo.updator) .set(TIPS_STATUS, projectApprovalInfo.tipsStatus) .set(PROJECT_TYPE, projectApprovalInfo.projectType) + .set(PRODUCT_ID, projectApprovalInfo.productId) + .set(PRODUCT_NAME, projectApprovalInfo.productName) .where(ENGLISH_NAME.eq(projectApprovalInfo.englishName)) .execute() } @@ -266,7 +276,9 @@ class ProjectApprovalDao { approvalTime = approvalTime?.let { DateTimeUtil.toDateTime(it, "yyyy-MM-dd'T'HH:mm:ssZ") }, approver = approver, tipsStatus = tipsStatus, - projectType = projectType + projectType = projectType, + productId = productId, + productName = productName ) } } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectDao.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectDao.kt index 0db849b1863..efbcfaa52ef 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectDao.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/dao/ProjectDao.kt @@ -347,7 +347,8 @@ class ProjectDao { ENABLED, PROPERTIES, SUBJECT_SCOPES, - AUTH_SECRECY + AUTH_SECRECY, + PRODUCT_ID ).values( projectCreateInfo.projectName, projectId, @@ -375,7 +376,8 @@ class ProjectDao { JsonUtil.toJson(it, false) }, subjectScopesStr, - projectCreateInfo.authSecrecy ?: ProjectAuthSecrecyStatus.PUBLIC.value + projectCreateInfo.authSecrecy ?: ProjectAuthSecrecyStatus.PUBLIC.value, + projectCreateInfo.productId ).execute() } } @@ -406,6 +408,7 @@ class ProjectDao { .set(APPROVER, userId) .set(SUBJECT_SCOPES, subjectScopesStr) .set(PROJECT_TYPE, projectUpdateInfo.projectType) + .set(PRODUCT_ID, projectUpdateInfo.productId) projectUpdateInfo.authSecrecy?.let { update.set(AUTH_SECRECY, it) } logoAddress?.let { update.set(LOGO_ADDR, logoAddress) } projectUpdateInfo.properties?.let { update.set(PROPERTIES, JsonUtil.toJson(it, false)) } @@ -453,7 +456,8 @@ class ProjectDao { approvalStatus: Int?, routerTag: String?, otherRouterTagMaps: Map?, - remoteDevFlag: Boolean? + remoteDevFlag: Boolean?, + productId: Int? ): MutableList { val conditions = mutableListOf() if (!projectName.isNullOrBlank()) { @@ -464,6 +468,7 @@ class ProjectDao { } projectType?.let { conditions.add(PROJECT_TYPE.eq(projectType)) } isSecrecy?.let { conditions.add(IS_SECRECY.eq(isSecrecy)) } + productId?.let { conditions.add(PRODUCT_ID.eq(productId)) } if (!creator.isNullOrBlank()) conditions.add(CREATOR.eq(creator)) if (!approver.isNullOrBlank()) conditions.add(APPROVER.eq(approver)) approvalStatus?.let { conditions.add(APPROVAL_STATUS.eq(approvalStatus)) } @@ -480,7 +485,6 @@ class ProjectDao { conditions.add(CHANNEL.eq(ProjectChannelCode.BS.name)) conditions.add(JooqUtils.jsonExtractAny(PROPERTIES, "\$.remotedev").isTrue) } - return conditions } @@ -497,7 +501,8 @@ class ProjectDao { limit: Int, routerTag: String? = null, otherRouterTagMaps: Map? = null, - remoteDevFlag: Boolean? = null + remoteDevFlag: Boolean? = null, + productId: Int? = null ): Result { with(TProject.T_PROJECT) { val conditions = generateQueryProjectCondition( @@ -510,7 +515,8 @@ class ProjectDao { approvalStatus = approvalStatus, routerTag = routerTag, otherRouterTagMaps = otherRouterTagMaps, - remoteDevFlag = remoteDevFlag + remoteDevFlag = remoteDevFlag, + productId = productId ) return dslContext.selectFrom(this).where(conditions).orderBy(CREATED_AT.desc()).limit(offset, limit).fetch() } @@ -614,16 +620,15 @@ class ProjectDao { .set(IS_SECRECY, projectInfoRequest.secrecyFlag) .set(APPROVAL_STATUS, projectInfoRequest.approvalStatus) .set(APPROVAL_TIME, projectInfoRequest.approvalTime?.let { java.sql.Timestamp(it).toLocalDateTime() }) - .set(APPROVER, projectInfoRequest.approver) .set(USE_BK, projectInfoRequest.useBk) .set(CC_APP_ID, projectInfoRequest.ccAppId) .set(CC_APP_NAME, projectInfoRequest.cc_app_name ?: "") - .set(UPDATOR, projectInfoRequest.updator) .set(UPDATED_AT, LocalDateTime.now()) .set(KIND, projectInfoRequest.kind) .set(ENABLED, projectInfoRequest.enabled) .set(PIPELINE_LIMIT, projectInfoRequest.pipelineLimit) .set(PROPERTIES, projectInfoRequest.properties?.let { JsonUtil.toJson(it, false) }) + .set(PRODUCT_ID, projectInfoRequest.productId) if (projectInfoRequest.hybridCCAppId != null) { step.set(HYBRID_CC_APP_ID, projectInfoRequest.hybridCCAppId) @@ -651,7 +656,8 @@ class ProjectDao { approvalStatus: Int?, routerTag: String? = null, otherRouterTagMaps: Map? = null, - remoteDevFlag: Boolean? = null + remoteDevFlag: Boolean? = null, + productId: Int? = null ): Int { with(TProject.T_PROJECT) { val conditions = generateQueryProjectCondition( @@ -664,7 +670,8 @@ class ProjectDao { approvalStatus = approvalStatus, routerTag = routerTag, otherRouterTagMaps = otherRouterTagMaps, - remoteDevFlag = remoteDevFlag + remoteDevFlag = remoteDevFlag, + productId = productId ) return dslContext.selectCount().from(this).where(conditions).fetchOne(0, Int::class.java)!! } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/OPProjectResourceImpl.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/OPProjectResourceImpl.kt index 77d0677d7a3..f73edbf8abd 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/OPProjectResourceImpl.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/OPProjectResourceImpl.kt @@ -102,6 +102,7 @@ class OPProjectResourceImpl @Autowired constructor( codeCCGrayFlag: Boolean, repoGrayFlag: Boolean, remoteDevFlag: Boolean, + productId: Int?, request: HttpServletRequest ): Result?> { return projectTagService.getProjectListByFlag( @@ -117,7 +118,8 @@ class OPProjectResourceImpl @Autowired constructor( grayFlag = grayFlag, codeCCGrayFlag = codeCCGrayFlag, repoGrayFlag = repoGrayFlag, - remoteDevFlag = remoteDevFlag + remoteDevFlag = remoteDevFlag, + productId = productId ) } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/UserProjectResourceImpl.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/UserProjectResourceImpl.kt index 97e45e86a12..ea90df18c1a 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/UserProjectResourceImpl.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/resources/UserProjectResourceImpl.kt @@ -34,6 +34,7 @@ import com.tencent.devops.common.web.RestResource import com.tencent.devops.common.web.utils.I18nUtil import com.tencent.devops.project.api.user.UserProjectResource import com.tencent.devops.project.constant.ProjectMessageCode.PROJECT_NOT_EXIST +import com.tencent.devops.project.pojo.OperationalProductVO import com.tencent.devops.project.pojo.ProjectCreateExtInfo import com.tencent.devops.project.pojo.ProjectCreateInfo import com.tencent.devops.project.pojo.ProjectDiffVO @@ -231,4 +232,10 @@ class UserProjectResourceImpl @Autowired constructor( ) ) } + + override fun getOperationalProducts(userId: String): Result> { + return Result( + projectService.getOperationalProducts() + ) + } } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectApprovalService.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectApprovalService.kt index 918518d66f0..8aed40c3cbf 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectApprovalService.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectApprovalService.kt @@ -285,7 +285,8 @@ class ProjectApprovalService @Autowired constructor( ccAppId = projectInfo.ccAppId, ccAppName = projectInfo.ccAppName, kind = projectInfo.kind, - projectType = projectType ?: 0 + projectType = projectType ?: 0, + productId = projectApprovalInfo.productId ) } val logoAddress = projectUpdateInfo.logoAddress diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectService.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectService.kt index 870896c23ec..00f3b8a3965 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectService.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectService.kt @@ -32,6 +32,7 @@ import com.tencent.devops.common.api.pojo.Pagination import com.tencent.devops.common.auth.api.AuthPermission import com.tencent.devops.common.auth.api.pojo.MigrateProjectConditionDTO import com.tencent.devops.common.auth.api.pojo.SubjectScopeInfo +import com.tencent.devops.project.pojo.OperationalProductVO import com.tencent.devops.project.pojo.ProjectBaseInfo import com.tencent.devops.project.pojo.ProjectCreateExtInfo import com.tencent.devops.project.pojo.ProjectCreateInfo @@ -236,4 +237,6 @@ interface ProjectService { ): Boolean fun updateProjectCreator(projectUpdateCreatorDtoList: List): Boolean + + fun getOperationalProducts(): List } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectTagService.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectTagService.kt index fb94f22bf84..823fb553613 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectTagService.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectTagService.kt @@ -372,6 +372,7 @@ class ProjectTagService @Autowired constructor( } } + @Suppress("LongParameterList") fun getProjectListByFlag( projectName: String?, englishName: String?, @@ -385,7 +386,8 @@ class ProjectTagService @Autowired constructor( grayFlag: Boolean, codeCCGrayFlag: Boolean, repoGrayFlag: Boolean, - remoteDevFlag: Boolean + remoteDevFlag: Boolean, + productId: Int? ): com.tencent.devops.project.pojo.Result?> { val dataObj = mutableMapOf() @@ -412,7 +414,8 @@ class ProjectTagService @Autowired constructor( limit = limit, routerTag = routerTag, otherRouterTagMaps = otherRouterTagMaps, - remoteDevFlag = remoteDevFlag + remoteDevFlag = remoteDevFlag, + productId = productId ) val totalCount = projectDao.getProjectCount( dslContext = dslContext, @@ -425,7 +428,8 @@ class ProjectTagService @Autowired constructor( approvalStatus = approvalStatus, routerTag = routerTag, otherRouterTagMaps = otherRouterTagMaps, - remoteDevFlag = remoteDevFlag + remoteDevFlag = remoteDevFlag, + productId = productId ) val dataList = mutableListOf() @@ -479,7 +483,8 @@ class ProjectTagService @Autowired constructor( enableExternal = projectData.enableExternal, enableIdc = projectData.enableIdc, pipelineLimit = projectData.pipelineLimit, - properties = projectProperties + properties = projectProperties, + productId = projectData.productId ) } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/util/ProjectUtils.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/util/ProjectUtils.kt index 4c1ee45d5a8..ecbd40aae46 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/util/ProjectUtils.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/util/ProjectUtils.kt @@ -109,7 +109,8 @@ object ProjectUtils { authSecrecy = tProjectRecord.authSecrecy, managePermission = managePermission, showUserManageIcon = showUserManageIcon, - channelCode = tProjectRecord.channel + channelCode = tProjectRecord.channel, + productId = tProjectRecord.productId ) } @@ -161,7 +162,9 @@ object ProjectUtils { authSecrecy = tProjectRecord.authSecrecy, afterAuthSecrecy = projectApprovalInfo?.authSecrecy ?: tProjectRecord.authSecrecy, projectType = tProjectRecord.projectType, - afterProjectType = projectApprovalInfo?.projectType + afterProjectType = projectApprovalInfo?.projectType, + productId = tProjectRecord.productId, + afterProductId = projectApprovalInfo?.productId ) } } diff --git a/support-files/i18n/auth/message_zh_CN.properties b/support-files/i18n/auth/message_zh_CN.properties index b6d10ced6ab..c68622259dc 100644 --- a/support-files/i18n/auth/message_zh_CN.properties +++ b/support-files/i18n/auth/message_zh_CN.properties @@ -78,6 +78,7 @@ bkBelongProjectName=所属项目 bkProjectId=项目ID bkProjectDesc=项目描述 bkOrganization=所属组织 +bkProjectProduct=项目所属运营产品 bkAuthSecrecy=项目性质 bkSubjectScopes=最大可授权人员范围 bkResourceTypeName=资源类型名称 @@ -86,6 +87,7 @@ bkGroupName=用户组 bkDay=天 bkValidityPeriod=申请期限 bkCreateProjectApproval=创建项目审批 +bkUpdateProjectApproval=修改项目审批 bkApplyToJoinProject=申请加入项目 bkApplyToJoinGroup=申请加入用户组 bkDevopsName=蓝盾 diff --git a/support-files/sql/1001_ci_project_ddl_mysql.sql b/support-files/sql/1001_ci_project_ddl_mysql.sql index 8d7f7975072..7c59f2989d4 100644 --- a/support-files/sql/1001_ci_project_ddl_mysql.sql +++ b/support-files/sql/1001_ci_project_ddl_mysql.sql @@ -148,6 +148,7 @@ CREATE TABLE IF NOT EXISTS `T_PROJECT` ( `properties` text NULL COMMENT '项目其他配置', `SUBJECT_SCOPES` text DEFAULT NULL COMMENT '最大可授权人员范围', `AUTH_SECRECY` int(10) DEFAULT b'0' COMMENT '项目性质,0-公开,1-保密,2-机密', + `product_id` int(10) DEFAULT NULL comment '运营产品ID', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `project_name` (`project_name`) USING BTREE, UNIQUE KEY `project_id` (`project_id`) USING BTREE, @@ -362,7 +363,9 @@ CREATE TABLE IF NOT EXISTS `T_PROJECT_APPROVAL` ( `SUBJECT_SCOPES` text DEFAULT NULL COMMENT '最大可授权人员范围', `AUTH_SECRECY` int(10) DEFAULT b'0' COMMENT '项目性质,0-公开,1-保密,2-机密', `TIPS_STATUS` int(10) DEFAULT b'0' COMMENT '提示状态,0-不展示,1-展示创建成功,2-展示更新成功', - `PROJECT_TYPE` int(10) DEFAULT NULL comment '项目类型', + `PROJECT_TYPE` int(10) DEFAULT NULL COMMENT '项目类型', + `PRODUCT_ID` int(10) DEFAULT NULL COMMENT '运营产品ID', + `PRODUCT_NAME` VARCHAR(64) DEFAULT NULL comment '运营产品名称', PRIMARY KEY (`ID`) USING BTREE, UNIQUE KEY `project_name` (`PROJECT_NAME`) USING BTREE, UNIQUE KEY `english_name` (`ENGLISH_NAME`) USING BTREE diff --git a/support-files/sql/2003_v2.x/2020_ci_project-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_project-update_v2.0_mysql.sql index 0f896a38dbe..c55c0c32898 100644 --- a/support-files/sql/2003_v2.x/2020_ci_project-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_project-update_v2.0_mysql.sql @@ -48,6 +48,33 @@ BEGIN ADD COLUMN `cluster_type` VARCHAR(32) NOT NULL DEFAULT '' comment '集群类型'; END IF; + IF NOT EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_PROJECT' + AND COLUMN_NAME = 'product_id') THEN + ALTER TABLE `T_PROJECT` + ADD COLUMN `product_id` int(10) DEFAULT NULL comment '运营产品ID'; + END IF; + + IF NOT EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_PROJECT_APPROVAL' + AND COLUMN_NAME = 'PRODUCT_ID') THEN + ALTER TABLE `T_PROJECT_APPROVAL` + ADD COLUMN `PRODUCT_ID` int(10) DEFAULT NULL comment '运营产品ID'; + END IF; + + IF NOT EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_PROJECT_APPROVAL' + AND COLUMN_NAME = 'PRODUCT_NAME') THEN + ALTER TABLE `T_PROJECT_APPROVAL` + ADD COLUMN `PRODUCT_NAME` VARCHAR(64) DEFAULT NULL comment '运营产品名称'; + END IF; + COMMIT; END DELIMITER ;