diff --git a/common/src/main/java/com/xiaojukeji/kafka/manager/common/entity/po/OrderPartitionDO.java b/common/src/main/java/com/xiaojukeji/kafka/manager/common/entity/po/OrderPartitionDO.java index 5fab1681..01666b18 100644 --- a/common/src/main/java/com/xiaojukeji/kafka/manager/common/entity/po/OrderPartitionDO.java +++ b/common/src/main/java/com/xiaojukeji/kafka/manager/common/entity/po/OrderPartitionDO.java @@ -9,6 +9,10 @@ public class OrderPartitionDO extends BaseDO{ private String applicant; + private Integer partitionNum; + + private String brokerList; + private Long peakBytesIn; private String description; @@ -51,6 +55,22 @@ public class OrderPartitionDO extends BaseDO{ this.applicant = applicant; } + public Integer getPartitionNum() { + return partitionNum; + } + + public void setPartitionNum(Integer partitionNum) { + this.partitionNum = partitionNum; + } + + public String getBrokerList() { + return brokerList; + } + + public void setBrokerList(String brokerList) { + this.brokerList = brokerList; + } + public Long getPeakBytesIn() { return peakBytesIn; } @@ -98,6 +118,8 @@ public class OrderPartitionDO extends BaseDO{ ", clusterName='" + clusterName + '\'' + ", topicName='" + topicName + '\'' + ", applicant='" + applicant + '\'' + + ", partitionNum=" + partitionNum + + ", brokerList='" + brokerList + '\'' + ", peakBytesIn=" + peakBytesIn + ", description='" + description + '\'' + ", orderStatus=" + orderStatus + diff --git a/dao/src/main/resources/mapper/OrderPartitionDao.xml b/dao/src/main/resources/mapper/OrderPartitionDao.xml index 3eb11c03..8214865b 100644 --- a/dao/src/main/resources/mapper/OrderPartitionDao.xml +++ b/dao/src/main/resources/mapper/OrderPartitionDao.xml @@ -11,6 +11,8 @@ + + @@ -38,6 +40,16 @@ cluster_name=#{clusterName}, topic_name=#{topicName}, applicant=#{applicant}, + + + partition_num=#{partitionNum}, + + + + + broker_list=#{brokerList}, + + peak_bytes_in=#{peakBytesIn}, description=#{description}, order_status=#{orderStatus}, diff --git a/doc/create_mysql_table.sql b/doc/create_mysql_table.sql index 8f0a3861..9a66ac67 100644 --- a/doc/create_mysql_table.sql +++ b/doc/create_mysql_table.sql @@ -149,6 +149,8 @@ CREATE TABLE `order_partition` ( `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', `cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称', `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称', + `broker_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'Broker列表, 逗号分割', + `partition_num` int(11) NOT NULL DEFAULT 0 COMMENT '新增分区数', `applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人', `peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量', `description` text COMMENT '备注信息', diff --git a/doc/create_postgresql_table.sql b/doc/create_postgresql_table.sql index cdf04388..6d03c005 100644 --- a/doc/create_postgresql_table.sql +++ b/doc/create_postgresql_table.sql @@ -198,6 +198,8 @@ CREATE TABLE order_partition cluster_name varchar(128) NOT NULL DEFAULT '', -- '集群名称', topic_name varchar(192) NOT NULL DEFAULT '', -- 'Topic名称', applicant varchar(128) NOT NULL DEFAULT '', -- '申请人', + partition_num int NOT NULL DEFAULT '0', -- '分区数', + broker_list varchar(128) NOT NULL DEFAULT '', -- 'Broker列表', peak_bytes_in bigint NOT NULL DEFAULT '0', -- '峰值流量', description text, -- '备注信息', order_status int NOT NULL DEFAULT '0', -- '工单状态', diff --git a/docker/mysql/create_mysql_table.sql b/docker/mysql/create_mysql_table.sql index 8f0a3861..9a66ac67 100644 --- a/docker/mysql/create_mysql_table.sql +++ b/docker/mysql/create_mysql_table.sql @@ -149,6 +149,8 @@ CREATE TABLE `order_partition` ( `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', `cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称', `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称', + `broker_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'Broker列表, 逗号分割', + `partition_num` int(11) NOT NULL DEFAULT 0 COMMENT '新增分区数', `applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人', `peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量', `description` text COMMENT '备注信息', diff --git a/web/src/main/java/com/xiaojukeji/kafka/manager/web/api/versionone/OrderController.java b/web/src/main/java/com/xiaojukeji/kafka/manager/web/api/versionone/OrderController.java index 07bfb503..1b6723eb 100644 --- a/web/src/main/java/com/xiaojukeji/kafka/manager/web/api/versionone/OrderController.java +++ b/web/src/main/java/com/xiaojukeji/kafka/manager/web/api/versionone/OrderController.java @@ -332,7 +332,9 @@ public class OrderController { return new Result(); } - private Result expandTopic(ClusterDO clusterDO, OrderPartitionExecModel reqObj, OrderPartitionDO orderPartitionDO) { + private Result expandTopic(ClusterDO clusterDO, + OrderPartitionExecModel reqObj, + OrderPartitionDO orderPartitionDO) { List brokerIdList = regionService.getFullBrokerId(clusterDO.getId(), reqObj.getRegionIdList(), reqObj.getBrokerIdList()); try { TopicMetadata topicMetadata = new TopicMetadata(); @@ -343,6 +345,8 @@ public class OrderController { if (!AdminTopicStatusEnum.SUCCESS.equals(adminTopicStatusEnum)) { return new Result(StatusCode.OPERATION_ERROR, adminTopicStatusEnum.getMessage()); } + orderPartitionDO.setPartitionNum(reqObj.getPartitionNum()); + orderPartitionDO.setBrokerList(ListUtils.intList2String(brokerIdList)); } catch (Exception e) { logger.error("expandTopic@OrderController, create failed, req:{}.", reqObj); return new Result(StatusCode.OPERATION_ERROR, Constant.KAFKA_MANAGER_INNER_ERROR); diff --git a/web/src/main/java/com/xiaojukeji/kafka/manager/web/converters/OrderConverter.java b/web/src/main/java/com/xiaojukeji/kafka/manager/web/converters/OrderConverter.java index 55041cf2..df07cbd2 100644 --- a/web/src/main/java/com/xiaojukeji/kafka/manager/web/converters/OrderConverter.java +++ b/web/src/main/java/com/xiaojukeji/kafka/manager/web/converters/OrderConverter.java @@ -86,7 +86,8 @@ public class OrderConverter { public static OrderPartitionVO convert2OrderPartitionVO(OrderPartitionDO orderPartitionDO, TopicMetadata topicMetadata, - Long maxAvgBytes, List regionDOList) { + Long maxAvgBytes, + List regionDOList) { if (orderPartitionDO == null) { return null; } @@ -100,8 +101,12 @@ public class OrderConverter { if (topicMetadata == null) { return orderPartitionVO; } - orderPartitionVO.setPartitionNum(topicMetadata.getPartitionNum()); + + orderPartitionVO.setPartitionNum(null); orderPartitionVO.setBrokerIdList(new ArrayList<>(topicMetadata.getBrokerIdSet())); + if (OrderStatusEnum.PASSED.getCode().equals(orderPartitionDO.getOrderStatus())) { + orderPartitionVO.setPartitionNum(orderPartitionDO.getPartitionNum()); + } if (regionDOList == null || regionDOList.isEmpty()) { orderPartitionVO.setRegionNameList(new ArrayList<>());