浏览代码

3.3.2 update

xiaofei 1 年之前
父节点
当前提交
776468ed32

+ 9 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TPMatrixServiceImpl.java

@@ -167,7 +167,14 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
                 for (TPMatrix tpMatrix : entry.getValue()) {
                     requirementMap.add(tpMatrix.getRequirementId(), tpMatrix);
                 }
-                requirementMap.entrySet().stream().forEach(requirementEntry -> requirementEntry.getValue().stream().forEach(tpMatrix -> content.add(tpMatrix.getContent() == null ? "" : String.valueOf(tpMatrix.getContent()))));
+                for (Map.Entry<Long, List<TPMatrix>> requirementEntry : requirementMap.entrySet()) {
+                   List<TPMatrix> requirementList = requirementEntry.getValue();
+                    // 排序,解决字符串1和10排序问题
+                    if (requirementList.size() > 1) {
+                        requirementList.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getSubName())));
+                    }
+                    requirementList.stream().forEach(tpMatrix -> content.add(tpMatrix.getContent() == null ? "" : String.valueOf(tpMatrix.getContent())));
+                }
                 contentList.add(content);
             });
 
@@ -178,7 +185,7 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
 
     private void exportExcel(HttpServletResponse response, List<ProfessionalExportHead> professionalExportHeadList, List<List<String>> contentList, String professionalName) {
         XSSFWorkbook wb = new XSSFWorkbook();
-        XSSFSheet sheet = wb.createSheet(professionalName);
+        XSSFSheet sheet = wb.createSheet("sheet1");
 
         // 表对样式
         XSSFCellStyle styleHead = wb.createCellStyle(); // 样式对象