mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Feature]MM2管理-补充集群Group列表信息(#894)
This commit is contained in:
@@ -39,5 +39,5 @@ public interface GroupManager {
|
||||
|
||||
Result<Void> resetGroupOffsets(GroupOffsetResetDTO dto, String operator) throws Exception;
|
||||
|
||||
List<GroupTopicOverviewVO> getGroupTopicOverviewVOList (Long clusterPhyId, List<GroupMemberPO> groupMemberPOList);
|
||||
List<GroupTopicOverviewVO> getGroupTopicOverviewVOList(Long clusterPhyId, List<GroupMemberPO> groupMemberPOList);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.pagination.PaginationMulFuzzySearchDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 22/02/24
|
||||
*/
|
||||
@Data
|
||||
public class ClusterGroupsOverviewDTO extends PaginationMulFuzzySearchDTO {
|
||||
@ApiModelProperty("查找该Topic")
|
||||
private String topicName;
|
||||
|
||||
@ApiModelProperty("查找该Group")
|
||||
private String groupName;
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public interface GroupService {
|
||||
/**
|
||||
* DB-GroupTopic相关接口
|
||||
*/
|
||||
List<GroupMemberPO> listGroupByCluster(Long clusterPhyId);
|
||||
List<GroupMemberPO> listGroupByTopic(Long clusterPhyId, String topicName);
|
||||
|
||||
PaginationResult<GroupMemberPO> pagingGroupMembers(Long clusterPhyId,
|
||||
|
||||
@@ -224,6 +224,14 @@ public class GroupServiceImpl extends BaseKafkaVersionControlService implements
|
||||
return GroupStateEnum.getByState(poList.get(0).getState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupMemberPO> listGroupByCluster(Long clusterPhyId) {
|
||||
LambdaQueryWrapper<GroupMemberPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(GroupMemberPO::getClusterPhyId, clusterPhyId);
|
||||
|
||||
return groupMemberDAO.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupMemberPO> listGroupByTopic(Long clusterPhyId, String topicName) {
|
||||
LambdaQueryWrapper<GroupMemberPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -2,21 +2,20 @@ package com.xiaojukeji.know.streaming.km.rest.api.v3.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.biz.group.GroupManager;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.cluster.ClusterGroupSummaryDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.cluster.ClusterGroupsOverviewDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.MetricGroupPartitionDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.pagination.PaginationBaseDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.pagination.field.PaginationFuzzySearchFieldDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.result.PaginationResult;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.result.Result;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.topic.TopicPartitionKS;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.vo.group.GroupOverviewVO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.vo.group.GroupTopicBasicVO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.vo.metrics.line.MetricMultiLinesVO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.vo.group.GroupTopicOverviewVO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.ApiPrefix;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.Tuple;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ConvertUtil;
|
||||
import com.xiaojukeji.know.streaming.km.core.service.group.GroupMetricService;
|
||||
import com.xiaojukeji.know.streaming.km.core.service.group.GroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -37,24 +36,17 @@ public class ClusterGroupsController {
|
||||
@Autowired
|
||||
private GroupManager groupManager;
|
||||
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
@Autowired
|
||||
private GroupMetricService groupMetricService;
|
||||
|
||||
@Deprecated
|
||||
@ApiOperation(value = "集群Groups信息列表", notes = "废弃, 下一个版本删除")
|
||||
@PostMapping(value = "clusters/{clusterPhyId}/groups-overview")
|
||||
@ApiOperation(value = "集群Groups信息列表")
|
||||
@GetMapping(value = "clusters/{clusterPhyId}/groups-basic")
|
||||
@ResponseBody
|
||||
public PaginationResult<GroupTopicOverviewVO> getClusterPhyGroupsOverview(@PathVariable Long clusterPhyId,
|
||||
@RequestBody ClusterGroupsOverviewDTO dto) {
|
||||
Tuple<String, String> searchKeyTuple = this.getSearchKeyWords(dto);
|
||||
return groupManager.pagingGroupMembers(
|
||||
clusterPhyId,
|
||||
dto.getTopicName(),
|
||||
dto.getGroupName(),
|
||||
searchKeyTuple.getV1(),
|
||||
searchKeyTuple.getV2(),
|
||||
dto
|
||||
);
|
||||
public Result<List<GroupTopicBasicVO>> getGroupsBasic(@PathVariable Long clusterPhyId) {
|
||||
return Result.buildSuc(ConvertUtil.list2List(groupService.listGroupByCluster(clusterPhyId), GroupTopicBasicVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "集群Groups信息列表")
|
||||
@@ -90,24 +82,4 @@ public class ClusterGroupsController {
|
||||
}
|
||||
|
||||
/**************************************************** private method ****************************************************/
|
||||
|
||||
@Deprecated
|
||||
private Tuple<String, String> getSearchKeyWords(ClusterGroupsOverviewDTO dto) {
|
||||
if (ValidateUtils.isEmptyList(dto.getFuzzySearchDTOList())) {
|
||||
return new Tuple<>("", "");
|
||||
}
|
||||
|
||||
String searchTopicName = "";
|
||||
String searchGroupName = "";
|
||||
for (PaginationFuzzySearchFieldDTO searchFieldDTO: dto.getFuzzySearchDTOList()) {
|
||||
if (searchFieldDTO.getFieldName().equals("topicName")) {
|
||||
searchTopicName = searchFieldDTO.getFieldValue();
|
||||
}
|
||||
if (searchFieldDTO.getFieldName().equals("groupName")) {
|
||||
searchGroupName = searchFieldDTO.getFieldValue();
|
||||
}
|
||||
}
|
||||
|
||||
return new Tuple<>(searchTopicName, searchGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user