EPC、国网、南网模板 兼容office 版本
This commit is contained in:
parent
8ec39ef898
commit
da7e6962b9
|
|
@ -0,0 +1,326 @@
|
|||
package com.bonus.tool.template;
|
||||
|
||||
import com.bonus.tool.template.util.FreeMarkerUtil;
|
||||
import com.bonus.tool.template.util.WordUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:Test
|
||||
* @author:cwchen
|
||||
* @date:2025-04-25-17:05
|
||||
* @version:1.0
|
||||
* @description:
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestGWDOC {
|
||||
|
||||
public static void download() {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
List<Map<String, Object>> list3 = new ArrayList<>();
|
||||
List<Map<String, Object>> list4 = new ArrayList<>();
|
||||
List<Map<String, Object>> list5 = new ArrayList<>();
|
||||
String fileName = null;
|
||||
try {
|
||||
data.put("title", "中老500千伏联网项目(老挝段)EPC总承包项目投标技术文件");
|
||||
// 近年完成的类似项目情况表
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("i", i + 1);
|
||||
map.put("proName", "博诺思测试项目" + (i + 1));
|
||||
map.put("dy", "±800kV");
|
||||
map.put("num", "");
|
||||
map.put("line", "75.95km");
|
||||
map.put("date", "2018年07月17日");
|
||||
map.put("fw", "线路施工");
|
||||
map.put("fr", "中国南方电网有限责任公司超高压输电公司");
|
||||
map.put("phone", "020-38123423");
|
||||
list.add(map);
|
||||
}
|
||||
// 近年完成的类似项目情况-材料图片
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("proName", (i + 1) + "." + "博诺思测试项目" + (i + 1));
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("index", (100 * (i + 1)) + (j + 1));
|
||||
map2.put("width", "375.35");
|
||||
map2.put("height", "207.85");
|
||||
map2.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
imgList.add(map2);
|
||||
}
|
||||
map.put("imgList", imgList);
|
||||
list2.add(map);
|
||||
}
|
||||
// 核心分包商业绩证明
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("i", i + 1);
|
||||
map.put("unit", "川东电力集团有限公司" + (i + 1));
|
||||
List<Map<String, Object>> yjList = new ArrayList<>();
|
||||
List<Map<String, Object>> zzList = new ArrayList<>();
|
||||
List<Map<String, Object>> personList = new ArrayList<>();
|
||||
List<Map<String, Object>> personImgList = new ArrayList<>();
|
||||
List<Map<String, Object>> zmImgList = new ArrayList<>();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("i", j + 1);
|
||||
map2.put("proName", "酒泉-湖南±800kV特高压直流输电线路工程(组塔6段)施工合同" + (j + 1));
|
||||
map2.put("unit", "安徽博诺思");
|
||||
map2.put("money", "300");
|
||||
map2.put("date", "2017年4月1日至2017年10月30日");
|
||||
map2.put("sf", "分包人");
|
||||
map2.put("bz", "");
|
||||
yjList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("index", (1000 * (i + 1)) + (j + 1));
|
||||
map2.put("width", "481.15");
|
||||
map2.put("height", "634.5");
|
||||
map2.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
zzList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("i", (j + 1));
|
||||
map2.put("name", "袁林" + (j + 1));
|
||||
map2.put("zc", "高级");
|
||||
map2.put("zf", "川1442006200805530/632527197109127012");
|
||||
map2.put("fg", "项目经理");
|
||||
map2.put("yj", "揭阳500千伏盘龙站配套220千伏线路工程(基础工程)第一标段施工专业分包、川渝特高压交流工程线路工程施工包17基础施工专业分包");
|
||||
map2.put("bz", "");
|
||||
personList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("userType", "项目经理");
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
for (int k = 0; k < 3; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("index", (10000 * (j + 1)) + (k + 1));
|
||||
map3.put("width", "481.15");
|
||||
map3.put("height", "634.5");
|
||||
map3.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
imgList.add(map3);
|
||||
}
|
||||
map2.put("imgList", imgList);
|
||||
personImgList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("proName", (j + 1) + "、" + "酒泉-湖南±800kV特高压直流输电线路工程(组塔6段)施工合同");
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
for (int k = 0; k < 3; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("index", (100000 * (j + 1)) + (k + 1));
|
||||
map3.put("width", "481.15");
|
||||
map3.put("height", "634.5");
|
||||
map3.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
imgList.add(map3);
|
||||
}
|
||||
map2.put("imgList", imgList);
|
||||
zmImgList.add(map2);
|
||||
}
|
||||
map.put("yjList", yjList);
|
||||
map.put("zzList", zzList);
|
||||
map.put("personList", personList);
|
||||
map.put("personImgList", personImgList);
|
||||
map.put("zmImgList", zmImgList);
|
||||
list3.add(map);
|
||||
}
|
||||
|
||||
// 项目人员配置情况
|
||||
for (int i = 0; i < 1; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<Map<String, Object>> userSettingList = new ArrayList<>();
|
||||
List<Map<String, Object>> otherUserList = new ArrayList<>();
|
||||
List<Map<String, Object>> personImgList = new ArrayList<>();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("i", j + 1);
|
||||
map2.put("fbbh", "");
|
||||
map2.put("name", "");
|
||||
map2.put("bh", "");
|
||||
map2.put("xmName", "杨跃龙");
|
||||
map2.put("zsmc", "一级注册建造师");
|
||||
map2.put("zch", "云1532010201168898");
|
||||
map2.put("xm", "陈忠海");
|
||||
map2.put("safety", "李永东");
|
||||
map2.put("aqy", "邓宇" +
|
||||
"彭阳春" +
|
||||
"张翔");
|
||||
map2.put("zjy", "普诚" +
|
||||
"李松阳" +
|
||||
"卢绍义");
|
||||
map2.put("zz", "汤合成");
|
||||
userSettingList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
List<Map<String, Object>> zsList = new ArrayList<>();
|
||||
map2.put("i", j + 1);
|
||||
map2.put("zw", "项目总工");
|
||||
map2.put("name", "陈忠海");
|
||||
map2.put("zc", "工程师");
|
||||
map2.put("yg", "正式职工");
|
||||
map2.put("bh", "");
|
||||
map2.put("zs", "工程师证");
|
||||
map2.put("jb", "中级");
|
||||
map2.put("zh", "CSG05202101310083");
|
||||
map2.put("zy", "电力工程技术");
|
||||
if (j == 0) {
|
||||
|
||||
} else {
|
||||
Map<String, Object> map4 = new HashMap<>();
|
||||
map4.put("zs", "助理工程师");
|
||||
map4.put("jb", "初级");
|
||||
map4.put("zh", "CSG05202101427936");
|
||||
map4.put("zy", "输配电及用电工程");
|
||||
map4.put("bh", "");
|
||||
zsList.add(map4);
|
||||
}
|
||||
map2.put("zsList", zsList);
|
||||
otherUserList.add(map2);
|
||||
}
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("index", (1000000 * (i + 1)) + (j + 1));
|
||||
map2.put("width", "481.15");
|
||||
map2.put("height", "634.5");
|
||||
map2.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
personImgList.add(map2);
|
||||
}
|
||||
map.put("userSettingList", userSettingList);
|
||||
map.put("otherUserList", otherUserList);
|
||||
map.put("personImgList", personImgList);
|
||||
list4.add(map);
|
||||
}
|
||||
// 项目关键人员简历及证明材料
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<Map<String, Object>> jlList = new ArrayList<>();
|
||||
List<Map<String, Object>> personImgList = new ArrayList<>();
|
||||
if (i == 0) {
|
||||
map.put("jlTitle", "项目经理简历及证明材料");
|
||||
map.put("userType", "项目经理");
|
||||
for (int j = 0; j < 1; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("type", "项目经理");
|
||||
map2.put("name", "杨跃龙");
|
||||
map2.put("card", "420502197612010155");
|
||||
map2.put("xl", "专科");
|
||||
map2.put("zc", "工程师");
|
||||
map2.put("zs", "一级注册建造师");
|
||||
map2.put("bh", "云1532010201168898");
|
||||
map2.put("rcdate", "2024.06");
|
||||
map2.put("tcDate", "2026.12");
|
||||
List<Map<String, Object>> yjList = new ArrayList<>();
|
||||
for (int k = 0; k < 4; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("date", "2016.06~2017.11");
|
||||
map3.put("proName", "滇西北至广东±800kV特高压直流输电工程1标");
|
||||
map3.put("gm", "新建铁塔286基,新建线路145.55km");
|
||||
map3.put("content", "线路施工");
|
||||
map3.put("zw", "项目经理");
|
||||
yjList.add(map3);
|
||||
}
|
||||
map2.put("yjList", yjList);
|
||||
jlList.add(map2);
|
||||
}
|
||||
} else {
|
||||
map.put("jlTitle", "项目部质检员及证明材料");
|
||||
map.put("userType", "项目部质检员");
|
||||
for (int j = 0; j < 2; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("type", "项目部质检员" + "(" + (j + 1) + ")");
|
||||
map2.put("name", "杨跃龙" + (j + 1));
|
||||
map2.put("card", "420502197612010155");
|
||||
map2.put("xl", "专科");
|
||||
map2.put("zc", "工程师");
|
||||
map2.put("zs", "一级注册建造师");
|
||||
map2.put("bh", "云1532010201168898");
|
||||
map2.put("rcdate", "2024.06");
|
||||
map2.put("tcDate", "2026.12");
|
||||
List<Map<String, Object>> yjList = new ArrayList<>();
|
||||
for (int k = 0; k < 4; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("date", "2016.06~2017.11");
|
||||
map3.put("proName", "滇西北至广东±800kV特高压直流输电工程1标");
|
||||
map3.put("gm", "新建铁塔286基,新建线路145.55km");
|
||||
map3.put("content", "线路施工");
|
||||
map3.put("zw", "项目经理");
|
||||
yjList.add(map3);
|
||||
}
|
||||
map2.put("yjList", yjList);
|
||||
jlList.add(map2);
|
||||
}
|
||||
}
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < 1; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("zmcl", "");
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
for (int k = 0; k < 3; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("index", (1000000 * (j + 1)) + (k + 1));
|
||||
map3.put("width", "481.15");
|
||||
map3.put("height", "634.5");
|
||||
map3.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
imgList.add(map3);
|
||||
}
|
||||
map2.put("imgList", imgList);
|
||||
personImgList.add(map2);
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("zmcl", "项目部安全员(" + (j + 1) + ")(邓宇)证明材料");
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
for (int k = 0; k < 3; k++) {
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("index", (1000000 * (j + 1)) + (k + 1));
|
||||
map3.put("width", "481.15");
|
||||
map3.put("height", "634.5");
|
||||
map3.put("base64Url", FreeMarkerUtil.getImageBase("C:\\Users\\10488\\Desktop\\图片5.png"));
|
||||
imgList.add(map3);
|
||||
}
|
||||
map2.put("imgList", imgList);
|
||||
personImgList.add(map2);
|
||||
}
|
||||
}
|
||||
map.put("jlList", jlList);
|
||||
map.put("personImgList", personImgList);
|
||||
list5.add(map);
|
||||
}
|
||||
data.put("tbr", "云南送变电工程有限公司");
|
||||
data.put("list", list);
|
||||
data.put("list2", list2);
|
||||
data.put("list3", list3);
|
||||
data.put("list4", list4);
|
||||
data.put("list5", list5);
|
||||
WordUtils.exportMillCertificateWord2(null, null, data, "test", "GW_DOC.ftl", "C:\\Users\\10488\\Desktop\\test (2)\\");
|
||||
} catch (Exception e) {
|
||||
log.error("GW下载", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
download();
|
||||
}
|
||||
|
||||
public static String handleValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return "";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ public class WordUtils {
|
|||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
String fileName = uploadPath + File.separator + title + ".docx";
|
||||
String fileName = uploadPath + File.separator + title + ".doc";
|
||||
out = new FileOutputStream(new File(fileName));
|
||||
byte[] buffer = new byte[512]; // 缓冲区
|
||||
int bytesToRead = -1;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue