feat:线上合成图片错误问题
This commit is contained in:
1 parent
11ca688a2b
commit
65fb7dc228
1 file changed
+3
-2
+3
-2
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -395,7 +396,6 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
}
|
||||
// 开始盖章
|
||||
String picUrl = String.format("%s%s", imageBaseUrl, invoice.getPicUrl());
|
||||
File receiptStamp = FileUtil.file("image/receiptStamp.png");
|
||||
// 发票底图宽高 3969 x 2154
|
||||
int baseMapWidth = 3969, baseMapHeight = 2154;
|
||||
// 盖章图片宽高
|
||||
@@ -405,7 +405,7 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
// 读取底图
|
||||
BufferedImage baseImage = ImageIO.read(new URL(picUrl));
|
||||
// 读取盖章图片
|
||||
BufferedImage stampImage = ImageIO.read(receiptStamp);
|
||||
BufferedImage stampImage = ImageIO.read( ResourceUtil.getResource("image/receiptStamp.png"));
|
||||
stampImage.getScaledInstance(stampWidth, stampHeight, Image.SCALE_SMOOTH);
|
||||
// 创建新的图像上下文
|
||||
Graphics2D g2d = baseImage.createGraphics();
|
||||
@@ -428,6 +428,7 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
String url = (String) data.get("url");
|
||||
return url;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|盖章失败,IO异常,invoice:|{}|error:|{}|", TAG, JSONUtil.toJsonStr(invoice), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user