导出排序(按照章节号从小到大)
This commit is contained in:
+1
-19
@@ -67,25 +67,7 @@ public class WorkFlowController {
|
||||
exportExcelEO.setFileName(UUID.fastUUID().toString(true));
|
||||
}
|
||||
List<Map<String, Object>> dataList = exportExcelEO.getDataList().stream()
|
||||
.sorted((a,b) ->{
|
||||
String[] firstArray = a.get("chapterNumber").toString().split("\\.");
|
||||
String[] secondArray = b.get("chapterNumber").toString().split("\\.");
|
||||
int length=0;
|
||||
int length1 = firstArray.length;
|
||||
int length2 = secondArray.length;
|
||||
|
||||
length=(length1<length2) ? length1: length2;
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
if (firstArray[i]==secondArray[i]){
|
||||
continue;
|
||||
}else{
|
||||
return firstArray[i].compareTo(secondArray[i]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
})
|
||||
.sorted(Comparator.comparing(a -> Double.valueOf(a.get("chapterNumber").toString())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Workbook excel = TableToExcel.createExcel(exportExcelEO.getColumnName(), dataList, null, exportExcelEO.getFileName());
|
||||
|
||||
Reference in New Issue
Block a user