|
|
@@ -35,7 +35,7 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
@Test
|
|
|
public void test() throws IOException, WriterException {
|
|
|
BufferedImage shareImg = ImageIO.read(this.getClass()
|
|
|
- .getResourceAsStream("/static/certificate/2021-121-28197.png"));
|
|
|
+ .getResourceAsStream("/static/certificate/2021-187-28197.png"));
|
|
|
BufferedImage result = new BufferedImage(2480, 1748, BufferedImage.TYPE_INT_RGB);
|
|
|
Graphics2D g = result.createGraphics();
|
|
|
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
|
|
@@ -49,7 +49,7 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
Hashtable<EncodeHintType, Object> hints = new Hashtable<>();
|
|
|
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
|
|
hints.put(EncodeHintType.MARGIN, 1);
|
|
|
- BitMatrix bitMatrix = new MultiFormatWriter().encode("http://yskj.njlyw.cn:8081/h5/home?performanceId=17824", BarcodeFormat.QR_CODE, 1000, 1000, hints);
|
|
|
+ BitMatrix bitMatrix = new MultiFormatWriter().encode("http://yskj.njlyw.cn:8081/h5/home?programmeId=18705", BarcodeFormat.QR_CODE, 1000, 1000, hints);
|
|
|
// BufferedImage image = new BufferedImage(240, 240, BufferedImage.TYPE_INT_RGB);
|
|
|
BufferedImage code = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
|
|
// BufferedImage avatar = ImageIO.read(new File("/Users/qiufangchao/Desktop/17824.png"));
|
|
|
@@ -74,21 +74,21 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
// 文字
|
|
|
g.setColor(new Color(48, 52, 82)); //根据图片的背景设置水印颜色
|
|
|
// 编号
|
|
|
- String small = "17824";
|
|
|
+ String small = "18705";
|
|
|
Font fontSmall = new Font("黑体", Font.PLAIN, 35);
|
|
|
g.setFont(fontSmall);
|
|
|
g.drawString(small, 2000, 544);
|
|
|
|
|
|
// 姓名
|
|
|
Font font = new Font("黑体", Font.BOLD, 60);
|
|
|
- String content = "朱姝宁";
|
|
|
+ String content = "田雨歆";
|
|
|
// 加水印
|
|
|
g.setFont(font); //设置字体
|
|
|
//设置水印的坐标
|
|
|
g.drawString(content, 400, 601); //画出水印
|
|
|
|
|
|
// 节目名称
|
|
|
- String content1 = "最美的风景";
|
|
|
+ String content1 = "人物素描";
|
|
|
|
|
|
if (content1.length() < 8) {
|
|
|
// String body1 = "多声部手风琴原创作品《最";
|
|
|
@@ -111,7 +111,7 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
.toOutputStream(out);
|
|
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
|
|
|
|
|
- File file = new File("/Users/qiufangchao/Desktop/朱姝宁2.jpg");
|
|
|
+ File file = new File("/Users/qiufangchao/Desktop/美术-一等奖-18705.jpg");
|
|
|
byte[] buffer = new byte[in.available()];
|
|
|
in.read(buffer);
|
|
|
OutputStream outStream = new FileOutputStream(file);
|