Bläddra i källkod

最新h2分权手册信息更新

18672342715 2 år sedan
förälder
incheckning
df9dc5dc4a

+ 30 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/Handbook.java

@@ -67,4 +67,34 @@ public class Handbook {
 
     //人员所属公司
     private String f0000012;
+
+    public Handbook(String objectId, String name, String createdBy, String ownerId, String ownerDeptId,
+                    String createdTime, String modifiedTime, String f0000001, String f0000002, String f0000003,
+                    String f0000004, String f0000005, String f0000011, String f0000006, String f0000007,
+                    String f0000009, String f0000008, String f0000010, String f0000012) {
+        super();
+        this.objectId = objectId;
+        this.name = name;
+        this.createdBy = createdBy;
+        this.ownerId = ownerId;
+        this.ownerDeptId = ownerDeptId;
+        this.createdTime = createdTime;
+        this.modifiedTime = modifiedTime;
+        this.f0000001 = f0000001;
+        this.f0000002 = f0000002;
+        this.f0000003 = f0000003;
+        this.f0000004 = f0000004;
+        this.f0000005 = f0000005;
+        this.f0000011 = f0000011;
+        this.f0000006 = f0000006;
+        this.f0000007 = f0000007;
+        this.f0000009 = f0000009;
+        this.f0000008 = f0000008;
+        this.f0000010 = f0000010;
+        this.f0000012 = f0000012;
+    }
+
+    public Handbook() {
+        super();
+    }
 }

+ 16 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/MyExcelData.java

@@ -31,4 +31,20 @@ public class MyExcelData {
 
     //集团分管领导
     private String groupChargeLeader;
+
+    public MyExcelData(String name, String company, String firstName, String secondName,
+                       String thirdName, String manager, String groupChargeLeader) {
+        super();
+        this.name = name;
+        this.company = company;
+        this.firstName = firstName;
+        this.secondName = secondName;
+        this.thirdName = thirdName;
+        this.manager = manager;
+        this.groupChargeLeader = groupChargeLeader;
+    }
+
+    public MyExcelData() {
+        super();
+    }
 }

+ 11 - 14
src/test/java/com/galaxis/manatee/Test/zzx/ProjectTest2.java

@@ -3,6 +3,7 @@ package com.galaxis.manatee.Test.zzx;
 import com.galaxis.manatee.entity.chuanyun.data.object.Handbook;
 import com.galaxis.manatee.entity.chuanyun.data.object.MyExcelData;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -29,8 +30,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  */
 public class ProjectTest2 {
     public static void main(String[] args) {
-        List<List<Object>> excel1 = getExcel("C:\\Users\\86186\\Desktop\\分权手册2022_09_21_16_33_42.xlsx");
-        List<List<Object>> excel2 = getExcel("C:\\Users\\86186\\Desktop\\凯捷--2022年度分级授权手册20220920更新了花名册.xls");
+        List<List<Object>> excel1 = getExcel("C:\\Users\\mayn\\Desktop\\分权手册2022_09_21_16_33_42.xlsx");
+        List<List<Object>> excel2 = getExcel("C:\\Users\\mayn\\Desktop\\凯捷--2022年度分级授权手册20220920更新了花名册(1).xls");
 
         // 最新的h2分权手册
         List<MyExcelData> excelDataList = new ArrayList<>();
@@ -96,7 +97,8 @@ public class ProjectTest2 {
         // System.err.println(handbookList.toString());
         // System.err.println(handbookList.get(609));  //刘东升
 
-        toTxt(handbookList);
+        // toTxt(handbookList);
+        toExcel(handbookList);
     }
 
     //将List导出成Excel
@@ -105,8 +107,7 @@ public class ProjectTest2 {
         HSSFWorkbook workbook = new HSSFWorkbook();
 
         //创建一个sheet
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM-dd");
-        HSSFSheet sheet = workbook.createSheet("更新过后的分权手册" + simpleDateFormat.format(new Date()));
+        HSSFSheet sheet = workbook.createSheet("更新过后的分权手册");
 
         //在sheet表中添加0行
         HSSFRow row = sheet.createRow(0);
@@ -196,7 +197,8 @@ public class ProjectTest2 {
             row1.createCell(18).setCellValue(handbook.getF0000012());
         }
 
-        File file = new File("C:/Users/86186/Desktop/test.txt");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYYMMddHHmmss");
+        File file = new File("C:/Users/mayn/Desktop/更新过后的分权手册" + simpleDateFormat.format(new Date()) + ".xls");
         if (file.exists()) {
             file.delete();
         }
@@ -204,9 +206,10 @@ public class ProjectTest2 {
         //将文件保存到指定的位置
         try {
             file.createNewFile();
-//            workbook.write(file);
+            FileOutputStream outputStream = FileUtils.openOutputStream(file);
+            workbook.write(outputStream);
             System.out.println("导出到成功");
-            System.out.println("默认位置:C:/Users/86186/Desktop/test.txt");
+            System.out.println("默认位置:C:/Users/mayn/Desktop/更新过后的分权手册" + simpleDateFormat.format(new Date()) + ".xls");
             workbook.close();
         } catch (IOException e) {
             e.printStackTrace();
@@ -233,7 +236,6 @@ public class ProjectTest2 {
         Workbook wb = null;
         Sheet sheet = null;
         Row row = null;
-
         wb = readExcel(filePath);
 
         List<List<List<Object>>> list = new ArrayList<>();
@@ -322,9 +324,4 @@ public class ProjectTest2 {
         }
         return cellvalue;
     }
-
-    public static Boolean isNotNull(List<Object> objects, int index) {
-
-        return true;
-    }
 }