소스 검색

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

wanghaicheng 5 년 전
부모
커밋
7b5fa0698a
2개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 2
      lift-upload/src/main/java/com/upload/util/WatermarkUtil.java
  2. 1 1
      lift-upload/src/main/resources/application.yml

+ 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: