|
@@ -311,9 +311,9 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
|
|
|
|
configuration.setClassForTemplateLoading(this.getClass(), "/templates");
|
|
configuration.setClassForTemplateLoading(this.getClass(), "/templates");
|
|
Template template = configuration.getTemplate("wordPhone.ftl");
|
|
Template template = configuration.getTemplate("wordPhone.ftl");
|
|
- File outFile = new File(ZHONGZHENG_PROFILE+"wordJpg.doc"); //导出文件
|
|
|
|
- // Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(touch),"UTF-8"));
|
|
|
|
- Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile),"UTF-8"));
|
|
|
|
|
|
+ // File outFile = new File(ZHONGZHENG_PROFILE+"wordJpg.doc"); //导出文件
|
|
|
|
+ Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(touch),"UTF-8"));
|
|
|
|
+ // Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile),"UTF-8"));
|
|
try {
|
|
try {
|
|
//写入数据
|
|
//写入数据
|
|
template.process(bindingMap,out);
|
|
template.process(bindingMap,out);
|
|
@@ -323,7 +323,7 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
} catch (TemplateException | freemarker.template.TemplateException e) {
|
|
} catch (TemplateException | freemarker.template.TemplateException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- OssRequest ossRequest = new OssRequest();
|
|
|
|
|
|
+ /* OssRequest ossRequest = new OssRequest();
|
|
FileInputStream fileInputStream = new FileInputStream(ZHONGZHENG_PROFILE+"wordJpg.doc");
|
|
FileInputStream fileInputStream = new FileInputStream(ZHONGZHENG_PROFILE+"wordJpg.doc");
|
|
MultipartFile multipartFile = new MockMultipartFile(ZHONGZHENG_PROFILE+"wordJpg.doc", ZHONGZHENG_PROFILE+"wordJpg.doc",
|
|
MultipartFile multipartFile = new MockMultipartFile(ZHONGZHENG_PROFILE+"wordJpg.doc", ZHONGZHENG_PROFILE+"wordJpg.doc",
|
|
ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
|
ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
|
@@ -331,6 +331,22 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
ossRequest.setImageStatus(6);
|
|
ossRequest.setImageStatus(6);
|
|
//上传阿里云
|
|
//上传阿里云
|
|
String upload = ossService.upload(ossRequest);
|
|
String upload = ossService.upload(ossRequest);
|
|
|
|
+ return upload;*/
|
|
|
|
+ //将模板输出为图片
|
|
|
|
+ final Java2DRenderer renderer = new Java2DRenderer(touch, 1000, 1000);
|
|
|
|
+ final BufferedImage img = renderer.getImage();
|
|
|
|
+ final FSImageWriter imageWriter = new FSImageWriter();
|
|
|
|
+ imageWriter.setWriteCompressionQuality(1.0f);
|
|
|
|
+ imageWriter.write(img, ZHONGZHENG_PROFILE+"wordJpg.jpg");//输出路径
|
|
|
|
+
|
|
|
|
+ OssRequest ossRequest = new OssRequest();
|
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(ZHONGZHENG_PROFILE+"wordJpg.jpg");
|
|
|
|
+ MultipartFile multipartFile = new MockMultipartFile(ZHONGZHENG_PROFILE+"wordJpg.jpg", ZHONGZHENG_PROFILE+"wordJpg.jpg",
|
|
|
|
+ ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
|
|
|
+ ossRequest.setFile(multipartFile);
|
|
|
|
+ ossRequest.setImageStatus(6);
|
|
|
|
+ //上传阿里云
|
|
|
|
+ String upload = ossService.upload(ossRequest);
|
|
return upload;
|
|
return upload;
|
|
}
|
|
}
|
|
|
|
|