瀏覽代碼

Merge branch 'wanghaicheng' of lift-manager/lift-server into develop

wanghaicheng 5 年之前
父節點
當前提交
7b5fa0698a

+ 3 - 2
lift-upload/src/main/java/com/upload/util/WatermarkUtil.java

@@ -128,6 +128,7 @@ public class WatermarkUtil {
         //设置字体
         int fontSize = imgWidth / 30;
         Font font = new Font("宋体", Font.BOLD, fontSize);
+        float registrationCodeX = imgWidth - imgWidth / 1920F * (registrationCode.length() * fontSize / 72F * 96F);
         //创建输出流
         ByteArrayOutputStream bs = new ByteArrayOutputStream();
         ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(bs);
@@ -135,11 +136,11 @@ public class WatermarkUtil {
         int markWidth = imgWidth / 4;
         int markHeight = (imgWidth * mark.getHeight(null)) / (4 * mark.getWidth(null));
         //组装要画的数据
-        String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd hh:mm:ss"));
+        String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"));
         Local local = new Local(
                 workerName, 0, imgHeight - fontSize * 2,
                 now, 0, imgHeight,
-                registrationCode, imgWidth - registrationCode.length() * fontSize / 10 * 6, imgHeight - markHeight - fontSize,
+                registrationCode, (int) registrationCodeX, imgHeight - markHeight - fontSize,
                 markWidth, markHeight, imgWidth - markWidth, imgHeight - markHeight,
                 multipartFile, font, new Color(42, 148, 188));
         //调用画图片和文字的方法

+ 1 - 1
lift-upload/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 20234
+  port: 10111
 
 spring:
   application: