Skip to content

Commit f005c6b

Browse files
author
zengqiao
committed
版本列表增加排序
1 parent 7be4625 commit f005c6b

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

km-core/src/main/java/com/xiaojukeji/know/streaming/km/core/service/cluster/ClusterPhyService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ void modifyClusterPhyById(ClusterPhyPO clusterPhyPO, String operator) throws
7373
* 获取系统已存在的kafka版本列表
7474
* @return
7575
*/
76-
Set<String> getClusterVersionSet();
76+
List<String> getClusterVersionList();
7777
}

km-core/src/main/java/com/xiaojukeji/know/streaming/km/core/service/cluster/impl/ClusterPhyServiceImpl.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
import org.springframework.dao.DuplicateKeyException;
2525
import org.springframework.stereotype.Service;
2626

27+
import java.util.ArrayList;
28+
import java.util.Collections;
2729
import java.util.List;
28-
import java.util.Set;
2930
import java.util.stream.Collectors;
3031

3132
/**
@@ -205,9 +206,12 @@ public void modifyClusterPhyById(ClusterPhyPO clusterPhyPO, String operator) thr
205206
}
206207

207208
@Override
208-
public Set<String> getClusterVersionSet() {
209-
List<ClusterPhy> clusterPhyList = listAllClusters();
210-
Set<String> versionSet = clusterPhyList.stream().map(elem -> elem.getKafkaVersion()).collect(Collectors.toSet());
211-
return versionSet;
209+
public List<String> getClusterVersionList() {
210+
List<ClusterPhy> clusterPhyList = this.listAllClusters();
211+
212+
List<String> versionList = new ArrayList<>(clusterPhyList.stream().map(elem -> elem.getKafkaVersion()).collect(Collectors.toSet()));
213+
Collections.sort(versionList);
214+
215+
return versionList;
212216
}
213217
}

km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/api/v3/cluster/MultiClusterPhyController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.springframework.validation.annotation.Validated;
1717
import org.springframework.web.bind.annotation.*;
1818

19-
import java.util.Set;
19+
import java.util.List;
2020

2121

2222
/**
@@ -49,7 +49,7 @@ public Result<ClusterPhysStateVO> getClusterPhysState() {
4949

5050
@ApiOperation(value = "多物理集群-已存在kafka版本", notes = "")
5151
@GetMapping(value = "physical-clusters/exist-version")
52-
public Result<Set<String>> getClusterPhysVersion() {
53-
return Result.buildSuc(clusterPhyService.getClusterVersionSet());
52+
public Result<List<String>> getClusterPhysVersion() {
53+
return Result.buildSuc(clusterPhyService.getClusterVersionList());
5454
}
5555
}

0 commit comments

Comments
 (0)