Browse Source

维修工单excel

lyhzzz 2 years ago
parent
commit
e4a2b3888d
1 changed files with 14 additions and 9 deletions
  1. 14 9
      src/main/java/com/fdkankan/sale/util/MyExcelUtil.java

+ 14 - 9
src/main/java/com/fdkankan/sale/util/MyExcelUtil.java

@@ -85,18 +85,23 @@ public class MyExcelUtil {
         List<Integer> mergeRowsIndex  =new ArrayList<>();
         //需要合并的列
         List<Integer> mergeColumnIndex = new ArrayList<>();
+        Integer index = 0;
         if(type == 0){
-            Integer index = 13;
-            if(obj2 != null){
-                List<PriceListExcelVo> list = (List<PriceListExcelVo>)obj2;
-                Integer i = 0;
-                for (PriceListExcelVo excelVo : list) {
-                    mergeColumnIndex.add(index + i);
-                    i++;
-                }
-            }
+             index = 13;
             mergeRowsIndex  = Arrays.asList(1);
         }
+        if(type == 1){
+             index = 42;
+            mergeRowsIndex  = Arrays.asList(2);
+        }
+        if(obj2 != null){
+            List<PriceListExcelVo> list = (List<PriceListExcelVo>)obj2;
+            Integer i = 0;
+            for (PriceListExcelVo excelVo : list) {
+                mergeColumnIndex.add(index + i);
+                i++;
+            }
+        }
 
         excelWriter = EasyExcel.write(localFile)
                 .withTemplate(templateFileName)