|
@@ -88,7 +88,13 @@ public class DomainOrderService {
|
|
|
if (StringUtils.isEmpty(str)) {
|
|
if (StringUtils.isEmpty(str)) {
|
|
|
throw new BusinessException("sms context is empty!");
|
|
throw new BusinessException("sms context is empty!");
|
|
|
}
|
|
}
|
|
|
- Pattern p = Pattern.compile("[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
|
|
|
|
|
|
|
+ boolean canChinese = sysConfigService.getBoolean("domain_sc");
|
|
|
|
|
+ Pattern p;
|
|
|
|
|
+ if (!canChinese) {
|
|
|
|
|
+ p = Pattern.compile("[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ p = Pattern.compile("[\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
|
|
|
|
|
+ }
|
|
|
Matcher m = p.matcher(str);
|
|
Matcher m = p.matcher(str);
|
|
|
return m.find();
|
|
return m.find();
|
|
|
}
|
|
}
|
|
@@ -378,36 +384,60 @@ public class DomainOrderService {
|
|
|
} else {
|
|
} else {
|
|
|
domainName = domain.toUpperCase();
|
|
domainName = domain.toUpperCase();
|
|
|
}
|
|
}
|
|
|
- InputStream is1 = this.getClass()
|
|
|
|
|
- .getResourceAsStream("/font/VonwaonBitmap_16pxLite.ttf");
|
|
|
|
|
- Font font1 = Font.createFont(Font.TRUETYPE_FONT, is1);
|
|
|
|
|
- is1.close();
|
|
|
|
|
- InputStream is2 = this.getClass()
|
|
|
|
|
- .getResourceAsStream("/font/VonwaonBitmap_12pxLite.ttf");
|
|
|
|
|
- Font font2 = Font.createFont(Font.TRUETYPE_FONT, is2);
|
|
|
|
|
- is2.close();
|
|
|
|
|
|
|
+ Pattern p;
|
|
|
|
|
+ p = Pattern.compile("[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
|
|
|
|
|
+ Matcher m = p.matcher(domain);
|
|
|
|
|
+ boolean chinese = m.find();
|
|
|
|
|
+ Font font1;
|
|
|
|
|
+ Font font2;
|
|
|
|
|
+ if (!chinese) {
|
|
|
|
|
+ InputStream is1 = this.getClass()
|
|
|
|
|
+ .getResourceAsStream("/font/VonwaonBitmap_16pxLite.ttf");
|
|
|
|
|
+ font1 = Font.createFont(Font.TRUETYPE_FONT, is1);
|
|
|
|
|
+ is1.close();
|
|
|
|
|
+ InputStream is2 = this.getClass()
|
|
|
|
|
+ .getResourceAsStream("/font/VonwaonBitmap_12pxLite.ttf");
|
|
|
|
|
+ font2 = Font.createFont(Font.TRUETYPE_FONT, is2);
|
|
|
|
|
+ is2.close();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ InputStream is1 = this.getClass()
|
|
|
|
|
+ .getResourceAsStream("/font/尔雅荣耀手书.ttf");
|
|
|
|
|
+ font1 = Font.createFont(Font.TRUETYPE_FONT, is1);
|
|
|
|
|
+ is1.close();
|
|
|
|
|
+ InputStream is2 = this.getClass()
|
|
|
|
|
+ .getResourceAsStream("/font/尔雅荣耀手书.ttf");
|
|
|
|
|
+ font2 = Font.createFont(Font.TRUETYPE_FONT, is2);
|
|
|
|
|
+ is2.close();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int length = domainName.length();
|
|
int length = domainName.length();
|
|
|
BufferedImage shareImg;
|
|
BufferedImage shareImg;
|
|
|
- if (length == 1) {
|
|
|
|
|
- InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_jing.png");
|
|
|
|
|
- shareImg = ImageIO.read(is3);
|
|
|
|
|
- is3.close();
|
|
|
|
|
- } else if (length == 2) {
|
|
|
|
|
- InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_lv.png");
|
|
|
|
|
- shareImg = ImageIO.read(is3);
|
|
|
|
|
- is3.close();
|
|
|
|
|
- } else if (length == 3) {
|
|
|
|
|
- InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_b.png");
|
|
|
|
|
- shareImg = ImageIO.read(is3);
|
|
|
|
|
- is3.close();
|
|
|
|
|
- } else if (length == 4) {
|
|
|
|
|
- InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_h.png");
|
|
|
|
|
|
|
+ if (chinese) {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_baijiaxing.png");
|
|
|
shareImg = ImageIO.read(is3);
|
|
shareImg = ImageIO.read(is3);
|
|
|
is3.close();
|
|
is3.close();
|
|
|
} else {
|
|
} else {
|
|
|
- InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_zi.png");
|
|
|
|
|
- shareImg = ImageIO.read(is3);
|
|
|
|
|
- is3.close();
|
|
|
|
|
|
|
+ if (length == 1) {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_jing.png");
|
|
|
|
|
+ shareImg = ImageIO.read(is3);
|
|
|
|
|
+ is3.close();
|
|
|
|
|
+ } else if (length == 2) {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_lv.png");
|
|
|
|
|
+ shareImg = ImageIO.read(is3);
|
|
|
|
|
+ is3.close();
|
|
|
|
|
+ } else if (length == 3) {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_b.png");
|
|
|
|
|
+ shareImg = ImageIO.read(is3);
|
|
|
|
|
+ is3.close();
|
|
|
|
|
+ } else if (length == 4) {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_h.png");
|
|
|
|
|
+ shareImg = ImageIO.read(is3);
|
|
|
|
|
+ is3.close();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ InputStream is3 = this.getClass().getResourceAsStream("/static/img/png_zi.png");
|
|
|
|
|
+ shareImg = ImageIO.read(is3);
|
|
|
|
|
+ is3.close();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -426,56 +456,68 @@ public class DomainOrderService {
|
|
|
|
|
|
|
|
|
|
|
|
|
int domainLength = domainName.length();
|
|
int domainLength = domainName.length();
|
|
|
- if (domainLength > 10) {
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
|
|
- Font topFont = font1.deriveFont(Font.PLAIN, 130f);
|
|
|
|
|
- Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
- int subIndex = domainLength / 3;
|
|
|
|
|
- String str1 = domainName.substring(0, subIndex);
|
|
|
|
|
- String str2 = domainName.substring(subIndex, subIndex + subIndex);
|
|
|
|
|
- String str3 = domainName.substring(subIndex + subIndex, domainLength);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, str1, new Rectangle(0, 180, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, str2, new Rectangle(0, 300, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, str3, new Rectangle(0, 420, shareImg
|
|
|
|
|
|
|
+ if (chinese) {
|
|
|
|
|
+ g.setColor(new Color(255, 241, 187));
|
|
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 180f);
|
|
|
|
|
+ Font downFont = font2.deriveFont(Font.PLAIN, 30f);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domainName, new Rectangle(5, 200, shareImg
|
|
|
.getWidth(), 86), topFont);
|
|
.getWidth(), 86), topFont);
|
|
|
- ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 540, shareImg
|
|
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(-10, 370, shareImg
|
|
|
.getWidth(), 86), topFont);
|
|
.getWidth(), 86), topFont);
|
|
|
g.setColor(new Color(255, 255, 255));
|
|
g.setColor(new Color(255, 255, 255));
|
|
|
- ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 650, shareImg
|
|
|
|
|
- .getWidth(), 12), downFont);
|
|
|
|
|
- }
|
|
|
|
|
- if (domainLength > 5 & domainLength <= 10) {
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
|
|
- Font topFont = font1.deriveFont(Font.PLAIN, 190f);
|
|
|
|
|
- Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
- int subIndex = domainLength / 2;
|
|
|
|
|
- String str1 = domainName.substring(0, subIndex);
|
|
|
|
|
- String str2 = domainName.substring(subIndex, domainLength);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, str1, new Rectangle(0, 180, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, str2, new Rectangle(0, 350, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 520, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
|
|
- ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 650, shareImg
|
|
|
|
|
- .getWidth(), 12), downFont);
|
|
|
|
|
- }
|
|
|
|
|
- if (domainLength <= 5) {
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
|
|
- Font topFont = font1.deriveFont(Font.PLAIN, 240f);
|
|
|
|
|
- Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, domainName, new Rectangle(17, 220, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(-10, 420, shareImg
|
|
|
|
|
- .getWidth(), 86), topFont);
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
|
|
- ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 620, shareImg
|
|
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 600, shareImg
|
|
|
.getWidth(), 12), downFont);
|
|
.getWidth(), 12), downFont);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (domainLength > 10) {
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 130f);
|
|
|
|
|
+ Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
+ int subIndex = domainLength / 3;
|
|
|
|
|
+ String str1 = domainName.substring(0, subIndex);
|
|
|
|
|
+ String str2 = domainName.substring(subIndex, subIndex + subIndex);
|
|
|
|
|
+ String str3 = domainName.substring(subIndex + subIndex, domainLength);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, str1, new Rectangle(0, 180, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, str2, new Rectangle(0, 300, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, str3, new Rectangle(0, 420, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 540, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 650, shareImg
|
|
|
|
|
+ .getWidth(), 12), downFont);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (domainLength > 5 & domainLength <= 10) {
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 190f);
|
|
|
|
|
+ Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
+ int subIndex = domainLength / 2;
|
|
|
|
|
+ String str1 = domainName.substring(0, subIndex);
|
|
|
|
|
+ String str2 = domainName.substring(subIndex, domainLength);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, str1, new Rectangle(0, 180, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, str2, new Rectangle(0, 350, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 520, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 650, shareImg
|
|
|
|
|
+ .getWidth(), 12), downFont);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (domainLength <= 5) {
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 240f);
|
|
|
|
|
+ Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domainName, new Rectangle(17, 220, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(-10, 420, shareImg
|
|
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 620, shareImg
|
|
|
|
|
+ .getWidth(), 12), downFont);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//二维码
|
|
//二维码
|
|
|
// QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
// QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
|
// Map<EncodeHintType, Object> hints = new HashMap<>();
|
|
// Map<EncodeHintType, Object> hints = new HashMap<>();
|
|
@@ -534,10 +576,10 @@ public class DomainOrderService {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Scheduled(cron = "0 0/60 9-20 * * ?")
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 0/5 9-20 * * ?")
|
|
|
public void batchPass() {
|
|
public void batchPass() {
|
|
|
long time = sysConfigService.getInt("domain_pendingTime");
|
|
long time = sysConfigService.getInt("domain_pendingTime");
|
|
|
- LocalDateTime lastTime = LocalDateTime.now().minusHours(time);
|
|
|
|
|
|
|
+ LocalDateTime lastTime = LocalDateTime.now().minusHours(time - 1);
|
|
|
List<DomainOrder> domainOrders = domainOrderRepo
|
|
List<DomainOrder> domainOrders = domainOrderRepo
|
|
|
.findAllByStatusAndCreatedAtBeforeAndOrderStatus(CollectionStatus.PENDING, lastTime, OrderStatus.FINISH);
|
|
.findAllByStatusAndCreatedAtBeforeAndOrderStatus(CollectionStatus.PENDING, lastTime, OrderStatus.FINISH);
|
|
|
domainOrders.forEach(domainOrder -> {
|
|
domainOrders.forEach(domainOrder -> {
|