导出排序(按照章节号从小到大)
This commit is contained in:
+24
-5
@@ -35,10 +35,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/lawss/activiti")
|
||||
@@ -68,8 +66,29 @@ public class WorkFlowController {
|
||||
if(exportExcelEO.getFileName()==null||exportExcelEO.getFileName().trim().length()==0){
|
||||
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;
|
||||
|
||||
Workbook excel = TableToExcel.createExcel(exportExcelEO.getColumnName(), exportExcelEO.getDataList(), null, exportExcelEO.getFileName());
|
||||
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;
|
||||
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Workbook excel = TableToExcel.createExcel(exportExcelEO.getColumnName(), dataList, null, exportExcelEO.getFileName());
|
||||
|
||||
response.reset();
|
||||
|
||||
|
||||
+1
@@ -104,6 +104,7 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
|
||||
if (!StringUtils.isEmpty(cid)){
|
||||
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(SarPublicIdeaAll.CID,cid);
|
||||
wrapper.orderByAsc("part_code");
|
||||
data=sarPublicIdeaAllDao.selectList(wrapper);
|
||||
}
|
||||
List<GetExcelDto> standExcel=new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user