管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-21 b9b490e0ec226389c6e2502fecf918f7537d8c57
src/main/java/com/lf/server/service/all/TestService.java
@@ -8,6 +8,7 @@
import com.lf.server.entity.all.PermsAuthEntity;
import com.lf.server.entity.all.ResAuthEntity;
import com.lf.server.entity.bd.DlgagnpEntity;
import com.lf.server.entity.ctrl.CountEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.MetaFileEntity;
import com.lf.server.entity.md.MdzxcgEntity;
@@ -265,4 +266,44 @@
            //
        }
    }
    public void testWord() {
        String inputFile = "C:\\Users\\Administrator\\Desktop\\ts\\项目数据分类统计.docx";
        String outPutFile = "C:\\Users\\Administrator\\Desktop\\ts\\NewWord.docx";
        Map<String, String> textMap = new HashMap<>();
        textMap.put("title", "深圳液化天然气应急调峰站外输管道工程(XQ03T04)");
        List<String[]> tableList = new ArrayList<>();
        tableList.add(new String[]{"" + 1, "数字线划图", "123.54平方米"});
        tableList.add(new String[]{"" + 2, "地灾点", "120个"});
        WordHelper.generateWord(inputFile, outPutFile, textMap, tableList);
    }
    public void testExcel() {
        String source = "C:\\Users\\Administrator\\Desktop\\ts\\项目数据分类统计.xlsx";
        String target = "C:\\Users\\Administrator\\Desktop\\ts\\NewWord.xlsx";
        List<CountEntity> list = new ArrayList<>();
        CountEntity c1 = new CountEntity();
        c1.setNo(1);
        c1.setM1("数字线划图");
        c1.setM2("123.54平方米");
        list.add(c1);
        CountEntity c2 = new CountEntity();
        c2.setNo(2);
        c2.setM1("地灾点");
        c2.setM2("120个");
        list.add(c2);
        Map<String, Object> map = new HashMap<>(1);
        map.put("title", "深圳液化天然气应急调峰站外输管道工程(XQ03T04)");
        Map<String, List<CountEntity>> listMap = new HashMap<>(1);
        listMap.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map, listMap);
    }
}