|
@@ -29,7 +29,6 @@ import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
-import java.io.InputStream;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
@@ -82,9 +81,6 @@ public class NumberController {
|
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
Long eventId = Long.valueOf(cacheObject.toString());
|
|
Long eventId = Long.valueOf(cacheObject.toString());
|
|
|
|
|
|
|
|
- // 边界检查和修正
|
|
|
|
|
- // validateAndCorrectBibParams(bibParam);
|
|
|
|
|
-
|
|
|
|
|
// 调试日志
|
|
// 调试日志
|
|
|
log.info("创建参赛证任务,taskName: {}, bibParam: {}", taskName, bibParam);
|
|
log.info("创建参赛证任务,taskName: {}, bibParam: {}", taskName, bibParam);
|
|
|
log.info("bibParam详情 - fontName: {}, fontSize: {}, fontColor: {}, logoX: {}, logoY: {}",
|
|
log.info("bibParam详情 - fontName: {}, fontSize: {}, fontColor: {}, logoX: {}, logoY: {}",
|
|
@@ -192,93 +188,6 @@ public class NumberController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 验证和修正参赛证参数边界
|
|
|
|
|
- */
|
|
|
|
|
- private void validateAndCorrectBibParams(GenerateBibBo bibParam) {
|
|
|
|
|
- // 修正二维码尺寸(范围16-512)
|
|
|
|
|
- if (bibParam.getQRCodeWidth() != null) {
|
|
|
|
|
- int qrWidth = Math.max(16, Math.min(512, bibParam.getQRCodeWidth()));
|
|
|
|
|
- if (Integer.compare(qrWidth, bibParam.getQRCodeWidth()) != 0) {
|
|
|
|
|
- log.warn("二维码宽度超出边界,从 {} 修正为 {}", bibParam.getQRCodeWidth(), qrWidth);
|
|
|
|
|
- bibParam.setQRCodeWidth(qrWidth);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (bibParam.getQRCodeHeight() != null) {
|
|
|
|
|
- int qrHeight = Math.max(16, Math.min(512, bibParam.getQRCodeHeight()));
|
|
|
|
|
- if (Integer.compare(qrHeight, bibParam.getQRCodeHeight()) != 0) {
|
|
|
|
|
- log.warn("二维码高度超出边界,从 {} 修正为 {}", bibParam.getQRCodeHeight(), qrHeight);
|
|
|
|
|
- bibParam.setQRCodeHeight(qrHeight);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修正号码字体大小(范围8-200)
|
|
|
|
|
- if (bibParam.getNumberFontSize() != null) {
|
|
|
|
|
- int numberFontSize = Math.max(8, Math.min(200, bibParam.getNumberFontSize()));
|
|
|
|
|
- if (Integer.compare(numberFontSize, bibParam.getNumberFontSize()) != 0) {
|
|
|
|
|
- log.warn("号码字体大小超出边界,从 {} 修正为 {}", bibParam.getNumberFontSize(), numberFontSize);
|
|
|
|
|
- bibParam.setNumberFontSize(numberFontSize);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修正赛事名称字体大小(范围8-120)
|
|
|
|
|
- if (bibParam.getEventFontSize() != null) {
|
|
|
|
|
- int eventFontSize = Math.max(8, Math.min(120, bibParam.getEventFontSize()));
|
|
|
|
|
- if (Integer.compare(eventFontSize, bibParam.getEventFontSize()) != 0) {
|
|
|
|
|
- log.warn("赛事名称字体大小超出边界,从 {} 修正为 {}", bibParam.getEventFontSize(), eventFontSize);
|
|
|
|
|
- bibParam.setEventFontSize(eventFontSize);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 修正字体大小(范围8-200)
|
|
|
|
|
- if (bibParam.getFontSize() != null) {
|
|
|
|
|
- int fontSize = Math.max(8, Math.min(200, bibParam.getFontSize()));
|
|
|
|
|
- if (Integer.compare(fontSize, bibParam.getFontSize()) != 0) {
|
|
|
|
|
- log.warn("字体大小超出边界,从 {} 修正为 {}", bibParam.getFontSize(), fontSize);
|
|
|
|
|
- bibParam.setFontSize(fontSize);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修正画布尺寸(范围100-4000)
|
|
|
|
|
- if (bibParam.getCanvasWidth() != null) {
|
|
|
|
|
- int canvasWidth = Math.max(100, Math.min(4000, bibParam.getCanvasWidth()));
|
|
|
|
|
- if (Integer.compare(canvasWidth, bibParam.getCanvasWidth()) != 0) {
|
|
|
|
|
- log.warn("画布宽度超出边界,从 {} 修正为 {}", bibParam.getCanvasWidth(), canvasWidth);
|
|
|
|
|
- bibParam.setCanvasWidth(canvasWidth);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (bibParam.getCanvasHeight() != null) {
|
|
|
|
|
- int canvasHeight = Math.max(100, Math.min(4000, bibParam.getCanvasHeight()));
|
|
|
|
|
- if (Integer.compare(canvasHeight, bibParam.getCanvasHeight()) != 0) {
|
|
|
|
|
- log.warn("画布高度超出边界,从 {} 修正为 {}", bibParam.getCanvasHeight(), canvasHeight);
|
|
|
|
|
- bibParam.setCanvasHeight(canvasHeight);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修正Logo尺寸(范围10-500)
|
|
|
|
|
- if (bibParam.getLogoWidth() != null) {
|
|
|
|
|
- int logoWidth = Math.max(10, Math.min(500, bibParam.getLogoWidth()));
|
|
|
|
|
- if (Integer.compare(logoWidth, bibParam.getLogoWidth()) != 0) {
|
|
|
|
|
- log.warn("Logo宽度超出边界,从 {} 修正为 {}", bibParam.getLogoWidth(), logoWidth);
|
|
|
|
|
- bibParam.setLogoWidth(logoWidth);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (bibParam.getLogoHeight() != null) {
|
|
|
|
|
- int logoHeight = Math.max(10, Math.min(500, bibParam.getLogoHeight()));
|
|
|
|
|
- if (Integer.compare(logoHeight, bibParam.getLogoHeight()) != 0) {
|
|
|
|
|
- log.warn("Logo高度超出边界,从 {} 修正为 {}", bibParam.getLogoHeight(), logoHeight);
|
|
|
|
|
- bibParam.setLogoHeight(logoHeight);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- log.info("参赛证参数边界检查完成");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生成画布模版
|
|
* 生成画布模版
|
|
|
*/
|
|
*/
|