Skip to content

Commit

Permalink
项目支持关联运营产品和根据运营产品搜索 #9636
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Nov 7, 2023
1 parent a949275 commit b6f07a1
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" // 资源类型名称
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ class ItsmService @Autowired constructor(
desc: String,
organization: String,
authSecrecy: Int,
subjectScopes: List<SubjectScopeInfo>
subjectScopes: List<SubjectScopeInfo>,
productName: String
): 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(),
Expand All @@ -156,7 +158,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()
Expand All @@ -167,6 +171,7 @@ 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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class PermissionGradeManagerService @Autowired constructor(
type = ALL_MEMBERS,
name = ALL_MEMBERS_NAME
)
)
),
productName = projectApprovalInfo.productName!!
)
val gradeManagerApplicationCreateDTO = GradeManagerApplicationCreateDTO
.builder()
Expand Down Expand Up @@ -309,7 +310,8 @@ class PermissionGradeManagerService @Autowired constructor(
type = ALL_MEMBERS,
name = ALL_MEMBERS_NAME
)
)
),
productName = projectApprovalInfo.productName!!
)
val gradeManagerDetail = iamV2ManagerService.getGradeManagerDetail(gradeManagerId)
val gradeManagerApplicationUpdateDTO = GradeManagerApplicationUpdateDTO.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModelProperty
data class OperationalProductVO(
@ApiModelProperty("产品ID")
@JsonProperty(value = "ProductId", required = true)
val productId: String,
val productId: Int,
@ApiModelProperty("产品ID")
@JsonProperty(value = "ProductName", required = true)
val productName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,7 @@ data class ProjectApprovalInfo(
@ApiModelProperty("项目性质")
val projectType: Int?,
@ApiModelProperty("运营产品ID")
val productId: Int? = null
val productId: Int? = null,
@ApiModelProperty("运营产品名称")
val productName: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,7 @@ data class ProjectCreateInfo(
@ApiModelProperty("项目性质")
val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value,
@ApiModelProperty("运营产品ID")
val productId: Int? = null
val productId: Int? = null,
@ApiModelProperty("运营产品名称")
val productName: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@ data class ProjectUpdateInfo(
@ApiModelProperty("项目性质")
val authSecrecy: Int? = ProjectAuthSecrecyStatus.PUBLIC.value,
@ApiModelProperty("运营产品ID")
val productId: Int? = null
val productId: Int? = null,
@ApiModelProperty("运营产品名称")
val productName: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -144,6 +150,7 @@ class ProjectApprovalDao {
.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()
}
Expand Down Expand Up @@ -172,6 +179,7 @@ class ProjectApprovalDao {
.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()
}
Expand Down Expand Up @@ -269,7 +277,8 @@ class ProjectApprovalDao {
approver = approver,
tipsStatus = tipsStatus,
projectType = projectType,
productId = productId
productId = productId,
productName = productName
)
}
}
Expand Down
1 change: 1 addition & 0 deletions support-files/i18n/auth/message_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ bkBelongProjectName=所属项目
bkProjectId=项目ID
bkProjectDesc=项目描述
bkOrganization=所属组织
bkProjectProduct=项目所属运营产品
bkAuthSecrecy=项目性质
bkSubjectScopes=最大可授权人员范围
bkResourceTypeName=资源类型名称
Expand Down
1 change: 1 addition & 0 deletions support-files/sql/1001_ci_project_ddl_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ CREATE TABLE IF NOT EXISTS `T_PROJECT_APPROVAL` (
`TIPS_STATUS` int(10) DEFAULT b'0' COMMENT '提示状态,0-不展示,1-展示创建成功,2-展示更新成功',
`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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ BEGIN
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 <CI_UBF>
DELIMITER ;
Expand Down

0 comments on commit b6f07a1

Please sign in to comment.