|
|
@@ -34,13 +34,13 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
|
|
|
@Test
|
|
|
public void test() throws IOException, WriterException {
|
|
|
- String[] array = {"盛颖帆", "杨墨涵", "潘瑾汐", "朱建玥", "金兴蕾", "雷普", "王锦曦", "高嘉涵", "常彧嘉", "宋佳怡"};
|
|
|
-
|
|
|
+ String[] array = {"何雨田"};
|
|
|
+ String pid = "18971";
|
|
|
for (String str : array) {
|
|
|
|
|
|
|
|
|
BufferedImage shareImg = ImageIO.read(this.getClass()
|
|
|
- .getResourceAsStream("/static/certificate/2021-124-28198.png"));
|
|
|
+ .getResourceAsStream("/static/certificate/2021-124-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);
|
|
|
@@ -54,7 +54,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?programmeId=19798", BarcodeFormat.QR_CODE, 1000, 1000, hints);
|
|
|
+ BitMatrix bitMatrix = new MultiFormatWriter().encode("http://yskj.njlyw.cn:8081/h5/home?programmeId=" + pid, 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"));
|
|
|
@@ -79,10 +79,10 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
// 文字
|
|
|
g.setColor(new Color(48, 52, 82)); //根据图片的背景设置水印颜色
|
|
|
// 编号
|
|
|
- String small = "19798";
|
|
|
+// String small = "18971";
|
|
|
Font fontSmall = new Font("黑体", Font.PLAIN, 35);
|
|
|
g.setFont(fontSmall);
|
|
|
- g.drawString(small, 2000, 544);
|
|
|
+ g.drawString(pid, 2000, 544);
|
|
|
|
|
|
// 姓名
|
|
|
Font font = new Font("黑体", Font.BOLD, 60);
|
|
|
@@ -93,7 +93,7 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
g.drawString(str, 400, 601); //画出水印
|
|
|
|
|
|
// 节目名称
|
|
|
- String content1 = "我对月亮说句话";
|
|
|
+ String content1 = "月愿";
|
|
|
|
|
|
if (content1.length() < 8) {
|
|
|
// String body1 = "多声部手风琴原创作品《最";
|
|
|
@@ -116,7 +116,7 @@ public class ParticipantServiceTest extends ApplicationTests {
|
|
|
.toOutputStream(out);
|
|
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
|
|
|
|
|
- File file = new File("/Users/qiufangchao/Desktop/bu/我对月亮说句话-" + str + ".jpg");
|
|
|
+ File file = new File("/Users/qiufangchao/Desktop/补证书/月愿-" + str + ".jpg");
|
|
|
byte[] buffer = new byte[in.available()];
|
|
|
in.read(buffer);
|
|
|
OutputStream outStream = new FileOutputStream(file);
|