Browse Source

合同审核后更新客户档案以及交车确认部分模板

master
dimengzhe 3 years ago
parent
commit
51cc18eec6
  1. 22
      yxt-common/yxt-common-base/src/main/java/com/yxt/common/base/utils/WordConvertUtils.java

22
yxt-common/yxt-common-base/src/main/java/com/yxt/common/base/utils/WordConvertUtils.java

@ -26,7 +26,7 @@ public class WordConvertUtils {
* @param fileName 文件名
*/
public static void creatWord(Map<String, Object> map, File file, String targetPath, String fileName, String dir) {
String curDate = DateUtils.dateConvertStr(new Date(), "yyyy年MM月dd日");
// String curDate = DateUtils.dateConvertStr(new Date(), "yyyy年MM月dd日");
try {
//Configuration 用于读取ftl文件
Configuration configuration = new Configuration(new Version("2.3.0"));
@ -44,12 +44,32 @@ public class WordConvertUtils {
Template template = configuration.getTemplate(file.getName(), "utf-8");
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"), 10240);
template.process(map, out);
file.delete();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void inputStreamToFile(InputStream ins, File file) {
OutputStream os = null;
try {
os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* word转换为pdf
*

Loading…
Cancel
Save