From 48a204f4c90a80c0bb4e5ba1f9f0f42939cadba8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 01 一月 2020 10:19:34 +0800 Subject: [PATCH] 用户资金记录bug修改,京东,拼多多小程序商品转链 --- fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java index d35ea6f..9117290 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java @@ -1,5 +1,6 @@ package com.yeshi.fanli.util; +import java.awt.AlphaComposite; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; @@ -805,12 +806,13 @@ try { + boolean index = true; // 鐢荤涓�寮� for (int i = 0; i < goodsList.size(); i++) { CommonGoods goods = goodsList.get(i); BigDecimal couplePrice = CommonGoodsUtil.getAfterUseCouplePrice(goods); // 绗竴寮犲浘闇�瑕佹湁浠锋牸淇℃伅 - if (i == 0) { + if (i == 0 || index) { int topX = 50; int topY = 50; @@ -819,6 +821,9 @@ int widht = 650; int height = 650; InputStream goodsPicture = TaoBaoHttpUtil.getAsInputStream(goods.getPicture().replace("_.webp", "").replace("_220x220", "")); + if (goodsPicture == null) + continue; + BufferedImage picImage = ImageIO.read(goodsPicture); picImage = ImageUtil.zoomInImage(picImage, widht, height); g2d.drawImage(picImage, topX, topX, null); @@ -885,6 +890,8 @@ g2d.drawString("楼 " + withNoZera + "", quanBGWidht + 70, quanBGHeight + 48); } + index = false; + } else { // 璁$畻宸︿笂瑙掑潗鏍� int topX = 0; @@ -906,8 +913,10 @@ topY = 50 + (315 + 20) * 2; // 鐢诲ぇ鍥� - InputStream goodsPicture = TaoBaoHttpUtil - .getAsInputStream(goods.getPicture().replace("_.webp", "")); + InputStream goodsPicture = TaoBaoHttpUtil.getAsInputStream(goods.getPicture().replace("_.webp", "")); + if (goodsPicture == null) + continue; + BufferedImage picImage = ImageIO.read(goodsPicture); picImage = ImageUtil.zoomInImage(picImage, 315, 315); g2d.drawImage(picImage, topX, topY, null); @@ -1519,6 +1528,21 @@ // 鐢婚個璇风爜(閭�璇风爜鐨勫ぇ灏忎笌瀛椾綋鍥哄畾) if (!StringUtil.isNullOrEmpty(inviteCode)) { + + int ax = pX - (inviteCode.length() - 4)*13 ; + int ay = pY + size + 118; + + int width_diap = 235 + (int) (24.6 * (inviteCode.length() - 4)); + g2d.setColor(Color.white); + // 鐢诲嚭涓�涓煩褰� + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.65f)); // 閫忔槑搴� + g2d.fillRect(ax, ay - 38, width_diap, 50); + // 鍓嶅崐鍦� + g2d.fillArc(ax - 25, ay- 38, 50, 50, 90, 180); + // 鍚庡崐鍦� + g2d.fillArc(ax + width_diap - 25, ay- 38, 50, 50, 270, 180); + + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 1f)); String st = "閭�璇风爜锛�" + inviteCode; String os = System.getProperty("os.name"); String fontBoldPath = "/usr/share/fonts/PingFang_Medium.ttf"; @@ -1532,17 +1556,12 @@ } catch (FontFormatException e) { e.printStackTrace(); } - g2d.setFont(boldFont); g2d.getFontMetrics(boldFont); g2d.setColor(new Color(0, 0, 0)); - int ax = pX - 30; - int ay = pY + size + 118; - g2d.setColor(new Color(0, 0, 0)); g2d.drawString(st, ax, ay); - } OutputStream out = new FileOutputStream(new File(targetPath)); -- Gitblit v1.8.0