| | |
| | | import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import com.ruoyi.file.utils.OBSUploadUtils; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Override |
| | | public String createActivityCode(String activityId,String backImageUrl) throws WxErrorException, FileNotFoundException { |
| | | |
| | | WxMaQrcodeService wxMaQrcodeService = wxMaService.getQrcodeService(); |
| | | String scene = activityId; |
| | | String page = ""; |
| | | String filePath = ""; |
| | | |
| | | String fileUrl = null; |
| | | File file = wxMaQrcodeService.createWxaCodeUnlimit(scene,page,filePath); |
| | | File qrCodeFile = new File("/home/image/qrcode.png"); |
| | | // 二维码内容 |
| | | String text = ""+activityId; |
| | | // 生成二维码 |
| | | QrCodeUtil.generate(text, 100, 100, qrCodeFile); |
| | | File backFile ; |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | InputStream codeStream = new FileInputStream(file); |
| | | InputStream backStream = new FileInputStream(file); |
| | | InputStream codeStream = new FileInputStream(qrCodeFile); |
| | | InputStream backStream = new FileInputStream(qrCodeFile); |
| | | // 将图片合成在一起 |
| | | ImgUtil.pressImage( |
| | | backStream, // 主图片 |