CmdbApplicationQueryReturn cmdbApplicationQueryReturn = new CmdbApplicationQueryReturn();
cmdbApplicationQueryReturn.setEndTime("2023-03");
cmdbApplicationQueryReturn.setTotal("3");
CmdbApplicationQueryReturn cmdbApplicationQueryReturn2 = new CmdbApplicationQueryReturn();
cmdbApplicationQueryReturn2.setEndTime("2022-04");
cmdbApplicationQueryReturn2.setTotal("4");
CmdbApplicationQueryReturn cmdbApplicationQueryReturn3 = new CmdbApplicationQueryReturn();
cmdbApplicationQueryReturn3.setEndTime("2022-04");
cmdbApplicationQueryReturn3.setTotal("5");
CmdbApplicationQueryReturn cmdbApplicationQueryReturn4 = new CmdbApplicationQueryReturn();
cmdbApplicationQueryReturn4.setEndTime("2023-05");
cmdbApplicationQueryReturn4.setTotal("6");
ArrayList<CmdbApplicationQueryReturn> list = new ArrayList<>();
list.add(cmdbApplicationQueryReturn);
list.add(cmdbApplicationQueryReturn2);
list.add(cmdbApplicationQueryReturn3);
list.add(cmdbApplicationQueryReturn4);
ArrayList<CmdbApplicationQueryReturn> paperRecordList = list.stream().sorted(Comparator.comparing(CmdbApplicationQueryReturn::getTotal).reversed()).collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(item->item.getEndTime()))), ArrayList::new)
);
System.out.println(paperRecordList.toString());