|
|
@ -23,6 +23,7 @@ import com.gxwebsoft.common.core.utils.FileServerUtil; |
|
|
|
import com.gxwebsoft.common.core.utils.ImageUtil; |
|
|
|
import com.gxwebsoft.common.core.web.PageParam; |
|
|
|
import com.gxwebsoft.common.core.web.PageResult; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -113,41 +114,18 @@ public class BszxBmServiceImpl extends ServiceImpl<BszxBmMapper, BszxBm> impleme |
|
|
|
return "https://oss.wsdns.cn/20250908/f8b88d734aac4006a89b9aeb5c3f4f75.png"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 百色中学
|
|
|
|
// Font font = new Font("阿里巴巴普惠体", Font.PLAIN, 40);
|
|
|
|
//合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准)
|
|
|
|
ImageCombiner combiner = new ImageCombiner(article.getAddress(), OutputFormat.JPG); |
|
|
|
//加文本元素:姓名
|
|
|
|
// if (item.getType().equals(0)) {
|
|
|
|
// combiner.addTextElement(item.getName().concat(" 校友"), 40, 220, 540);
|
|
|
|
// } else {
|
|
|
|
// combiner.addTextElement(item.getName(), 40, 220, 540);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566);
|
|
|
|
//加图片元素:盖章
|
|
|
|
// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420);
|
|
|
|
|
|
|
|
|
|
|
|
if (item.getType().equals(0)) { |
|
|
|
combiner.addTextElement(item.getName().concat(" 校友"), 30, 160, 1008); |
|
|
|
} else { |
|
|
|
combiner.addTextElement(item.getName(), 30, 160, 1008); |
|
|
|
} |
|
|
|
final ImageCombiner combiner = getImageCombiner(item, article); |
|
|
|
|
|
|
|
// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566);
|
|
|
|
//加图片元素:盖章
|
|
|
|
// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420);
|
|
|
|
//执行图片合并
|
|
|
|
combiner.combine(); |
|
|
|
|
|
|
|
if (!FileUtil.exist(uploadPath + "/file/poster/" + item.getTenantId() + "/bm")) { |
|
|
|
FileUtil.mkdir(uploadPath + "/file/poster/" + item.getTenantId() + "/bm"); |
|
|
|
if (!FileUtil.exist(uploadPath + "/poster/" + item.getTenantId() + "/bm")) { |
|
|
|
FileUtil.mkdir(uploadPath + "/poster/" + item.getTenantId() + "/bm"); |
|
|
|
} |
|
|
|
String basePath = "/poster/" + item.getTenantId() + "/bm/big-" + item.getId() + ".jpg"; |
|
|
|
String smallPath = "/poster/" + item.getTenantId() + "/bm/" + item.getId() + ".jpg"; |
|
|
|
String filename = uploadPath + "/file" + basePath; |
|
|
|
String smallFileName = uploadPath + "/file" + smallPath; |
|
|
|
String filename = uploadPath + basePath; |
|
|
|
String smallFileName = uploadPath + smallPath; |
|
|
|
combiner.save(filename); |
|
|
|
|
|
|
|
File input = new File(filename); |
|
|
@ -161,6 +139,35 @@ public class BszxBmServiceImpl extends ServiceImpl<BszxBmMapper, BszxBm> impleme |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private static ImageCombiner getImageCombiner(BszxBm item, CmsArticle article) throws Exception { |
|
|
|
ImageCombiner combiner = new ImageCombiner(article.getAddress(), OutputFormat.JPG); |
|
|
|
//加文本元素:姓名
|
|
|
|
// if (item.getType().equals(0)) {
|
|
|
|
// combiner.addTextElement(item.getName().concat(" 校友"), 40, 220, 540);
|
|
|
|
// } else {
|
|
|
|
// combiner.addTextElement(item.getName(), 40, 220, 540);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566);
|
|
|
|
//加图片元素:盖章
|
|
|
|
// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420);
|
|
|
|
|
|
|
|
|
|
|
|
if (item.getType().equals(0)) { |
|
|
|
combiner.addTextElement(item.getName().concat(" 校友"), 30, 160, 1008); |
|
|
|
} else { |
|
|
|
combiner.addTextElement(item.getName(), 30, 160, 1008); |
|
|
|
} |
|
|
|
|
|
|
|
// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566);
|
|
|
|
//加图片元素:盖章
|
|
|
|
// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420);
|
|
|
|
//执行图片合并
|
|
|
|
combiner.combine(); |
|
|
|
return combiner; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public BszxBm getByUserId(Integer userId) { |
|
|
|
return getOne(new LambdaQueryWrapper<BszxBm>().eq(BszxBm::getUserId, userId).last("limit 1")); |
|
|
|