|
@@ -98,7 +98,12 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
|
|
|
|
|
|
PosterTemplate posterTemplate=new PosterTemplate();
|
|
|
posterTemplate.setBackImg("1.png");
|
|
|
-
|
|
|
+ posterTemplate.setAddressPosition("856");
|
|
|
+ posterTemplate.setNumberPosition("856");
|
|
|
+ posterTemplate.setLogoPosition("30;34");
|
|
|
+ posterTemplate.setQrcodePosition1("123;123;77;505");
|
|
|
+ posterTemplate.setQrcodePosition2("123;123;300;505");
|
|
|
+
|
|
|
PosterJoin posterJoin=new PosterJoin();
|
|
|
posterJoin.setLogoImg("2.png");
|
|
|
posterJoin.setQrcodeImg1("3.png");
|
|
@@ -106,18 +111,21 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
|
|
|
posterJoin.setName("活动");
|
|
|
posterJoin.setPhone("联系人:吴老师 13265096161");
|
|
|
posterJoin.setAddress("地址:佛山市南海区桂城融和路号号中铁建水岸花园号号号铺铺铺");//33个字
|
|
|
-
|
|
|
+
|
|
|
String url=runGeneratePosterImg(posterTemplate, posterJoin,"");
|
|
|
System.out.println(url);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
public static String runGeneratePosterImg(PosterTemplate posterTemplate,PosterJoin posterJoin,String activityName) {
|
|
|
try {
|
|
|
- String savePath =PropertiesUtil.getValue("file_save_path")+"poster/";
|
|
|
- //String savePath="C:/Users/Admin/Desktop/poster/";
|
|
|
+ String savePath =PropertiesUtil.getValue("file_save_path");
|
|
|
+ String posterPath ="/poster/";
|
|
|
+ //String savePath="E:";
|
|
|
// 按/poster/活动/机构/海报 保存
|
|
|
- String save_path = savePath+activityName+"/";
|
|
|
+ String save_path = savePath+posterPath+activityName+"/"+posterJoin.getName()+"/";
|
|
|
String target_path = save_path+IdWorker.generateId() + ".png";
|
|
|
// 创建文件夹
|
|
|
File f = new File(save_path);
|
|
@@ -147,7 +155,10 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
|
|
|
g3.drawImage(codeImage, 0, 0, null);
|
|
|
g3.dispose();
|
|
|
ImgBean.modifyImagetogeter(codeOutput, target_template,Integer.parseInt(qrcodePositions[2]),Integer.parseInt(qrcodePositions[3]));
|
|
|
-
|
|
|
+
|
|
|
+ //合成后删除图片
|
|
|
+ File code1File = new File(code);
|
|
|
+ code1File.delete();
|
|
|
//合成二维码2
|
|
|
if(StringUtils.isNotEmpty(posterTemplate.getQrcodePosition2())) {
|
|
|
qrcodePositions=posterTemplate.getQrcodePosition2().split(";");
|
|
@@ -165,6 +176,10 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
|
|
|
g3.drawImage(codeImage, 0, 0, null);
|
|
|
g3.dispose();
|
|
|
ImgBean.modifyImagetogeter(codeOutput, target_template,Integer.parseInt(qrcodePositions[2]),Integer.parseInt(qrcodePositions[3]));
|
|
|
+
|
|
|
+ //合成后删除图片
|
|
|
+ File code1File2 = new File(code);
|
|
|
+ code1File2.delete();
|
|
|
}
|
|
|
|
|
|
//合成联系人
|
|
@@ -179,7 +194,8 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
|
|
|
left=(33-posterJoin.getAddress().length())/2*15;
|
|
|
}
|
|
|
ImgBean.modifyImage(target_template,"地址:"+posterJoin.getAddress(),left,Integer.parseInt(addressPositions[0]),new Color(220,220,220),new Font("黑体", Font.PLAIN, 15));
|
|
|
-
|
|
|
+
|
|
|
+ //System.out.println("step--生成海报-->ImgBean.writeImageLocal--"+target_path);
|
|
|
//生成海报
|
|
|
ImgBean.writeImageLocal(target_path, source_template);
|
|
|
|