From 9745cbfefe1306c441e51e1c247bb7dc76629fbc Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Wed, 10 Jan 2024 16:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E8=AF=A6=E7=BB=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../peanut/common/utils/CertificateUtil.java | 17 ++++++++--------- .../modules/book/controller/BookController.java | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/peanut/common/utils/CertificateUtil.java b/src/main/java/com/peanut/common/utils/CertificateUtil.java index 1f303f8a..49cb95f9 100644 --- a/src/main/java/com/peanut/common/utils/CertificateUtil.java +++ b/src/main/java/com/peanut/common/utils/CertificateUtil.java @@ -8,6 +8,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Date; +import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -44,8 +45,7 @@ public class CertificateUtil extends Thread{ @Override public void run() { - Date startTime = new Date(); - System.out.println(name+"-开始!"); +// System.out.println(name+"-开始!"); try { Image src = ImageIO.read(new File(inputSrc)); // 获取图片的高和宽 @@ -107,12 +107,11 @@ public class CertificateUtil extends Thread{ // 释放资源 g.dispose(); - File outputfile = new File(outputSrc+name+".png"); - ImageIO.write(image, "png", outputfile); + String filename = UUID.randomUUID().toString() + System.currentTimeMillis(); + File outputfile = new File(outputSrc+ filename +".jpg"); + ImageIO.write(image, "jpg", outputfile); - Date endTime = new Date(); - System.out.println(endTime.getTime()-startTime.getTime() + ""); - System.out.println(name+"-生成完成!"); + System.out.println(no +","+ name +","+ filename); } catch (IOException e) { throw new RuntimeException(e); } @@ -128,8 +127,8 @@ public class CertificateUtil extends Thread{ String time = "于2024年1月4日至5日"; String des = "圆满完成中医形质病学培训班"; String trans = "Successful completion of the"; - String trans2 = "Chinese Medicine Morphology and Disease Training"; - String trans3 = "course on 2024 1.4-5"; + String trans2 = "Training course on TCM somatology"; + String trans3 = "on 2024.01.04-05"; //Traditional Chinese Medicine Morphology and Disease Training Course String endy = "2024"; String endm = "1"; diff --git a/src/main/java/com/peanut/modules/book/controller/BookController.java b/src/main/java/com/peanut/modules/book/controller/BookController.java index 1e1ae5e0..5d5d26c4 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookController.java @@ -114,7 +114,21 @@ public class BookController { // @RequiresPermissions("book:book:info") public R info(@PathVariable("id") Integer id) { BookEntity book = bookService.getById(id); - + //返回结果添加图书类型 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(MedicaldesBook::getBookId,id); + List list = medicaldesBookService.list(wrapper); + if (list.size() > 0) { + String type = ""; + for (MedicaldesBook mb : list) { + if (StringUtils.isEmpty(type)){ + type += mb.getTypeId(); + }else { + type += "," + mb.getTypeId(); + } + } + book.setMedicaldesBookType(type); + } return R.ok().put("book", book); }