admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
@@ -60,6 +60,12 @@
         InputStream portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
         InputStream erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
         // 官方默认头像
         if (portraitInputStream == null) {
            portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
         }
         // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
         ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode);
@@ -109,6 +115,11 @@
         InputStream portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
         InputStream erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
         // 官方默认头像
         if (portraitInputStream == null) {
            portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
         }
         // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
         ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath,
               erCodePostionX, erCodePostionY, erCodeSize, inviteCode);
@@ -161,7 +172,6 @@
         portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
      } else {
         targetPath = FileUtil.getCacheDir() + "/share_" + uid + "_" + System.currentTimeMillis() + ".jpg";
         erCodeTempPath = FileUtil.getCacheDir() + "/" + uid + "_" + System.currentTimeMillis() + ".jpg";
@@ -175,7 +185,13 @@
         portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
         erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
      }
      // 官方默认头像
      if (portraitInputStream == null) {
         portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
      }
      // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
      ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, pX, pY,
            size, inviteCode);
@@ -247,6 +263,11 @@
         portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
      }
      // 官方默认头像
      if (portraitInputStream == null) {
         portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
      }
      // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
      ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode,
            content, date);
@@ -286,11 +307,12 @@
   
   
   @Override
   public FileUploadResult drawDynamicGoodsPoster(String erCodeUrl, String portrait, String inviteCode, GoodsDetailVO goods) {
   public FileUploadResult drawDynamicGoodsPoster(String erCodeUrl, String portrait, String inviteCode,
         String mainPic, GoodsDetailVO goods) {
      // 二维码流
      InputStream erCodeStream = null;
      try {
         erCodeStream = QRCodeUtil.getInstance(250).encode(erCodeUrl);
         erCodeStream = QRCodeUtil.getInstance(250).encodeDeleteWhite(erCodeUrl);
      } catch (Exception e1) {
         e1.printStackTrace();
      }
@@ -309,7 +331,7 @@
      }
      
      // 画图
      InputStream drawStream = ImageUtil.drawGoodsPoster(erCodeStream, portraitStream,inviteCode, goods);
      InputStream drawStream = ImageUtil.drawGoodsPoster(erCodeStream, portraitStream,inviteCode,mainPic, goods);
      // 上传位置
      String uuid = UUID.randomUUID().toString().replace("-", "");
      String upPath = FilePathEnum.shareGoods.getPath() + uuid + "_" + goods.getGoodsId() + "_" + System.currentTimeMillis() + ".png";