| | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.component.tools.ImageUtil; |
| | | import com.matrix.component.tools.WxacodeUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | import com.matrix.system.shopXcx.api.WeChatApiTools; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | |
| | | |
| | | @Autowired |
| | | private BizUserDao bizUserDao; |
| | | |
| | | @Autowired |
| | | WeChatApiTools weChatApiTools; |
| | | |
| | | @ApiOperation(value = "查询推广计划", notes = "") |
| | | @GetMapping(value = "/getTgPlan") |
| | | public AjaxResult getTgPlan() { |
| | | BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_PLAN, HostInterceptor.getCompanyId()); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance(""); |
| | | ajaxResult.putInMap("data",busParameterSettings.getParamValue3()); |
| | | ajaxResult.setData(busParameterSettings.getParamValue3()); |
| | | return ajaxResult; |
| | | } |
| | | |
| | |
| | | AjaxResult getInvitationPoster() { |
| | | try { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(loginUser.getOpenId() + "", "pages/index/index", MD5Util.strToMD5(loginUser.getOpenId() + "")); |
| | | |
| | | //获取海报 |
| | | BusParameterSettings posterSetting = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, HostInterceptor.getCompanyId()); |
| | | |
| | | String posterSavePath = posterSetting.getParamValue1(); |
| | | BufferedImage productImgBuf = ImageIO.read(new File(qrcodeSavePath)); |
| | | BufferedImage qrcordImgBuf = ImageIO.read(new File(posterSavePath)); |
| | | |
| | | BufferedImage backgroundImgBuf = new BufferedImage(750, 900, BufferedImage.TYPE_4BYTE_ABGR); |
| | | //绘制背景+产品 |
| | | Graphics2D g = backgroundImgBuf.createGraphics(); |
| | | g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1)); |
| | | |
| | | |
| | | |
| | | |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | | String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); |
| | | // 图片访问URL |
| | | String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); |
| | | String qrcodeImgUrl = qrcodeSavePath.replace(baseSavePath, baseSaveUrl); |
| | | |
| | | return AjaxResult.buildSuccessInstance(qrcodeImgUrl); |
| | | //目标海报物理存储路径 |
| | | String targetImg=MD5Util.strToMD5(loginUser.getOpenId()) +"haibao.png"; |
| | | String targetImgPath=baseSavePath+"wxacode" + File.separatorChar+targetImg ; |
| | | |
| | | String urlPath = baseSaveUrl + "/" + "wxacode" + "/" + targetImg; |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(loginUser.getOpenId() + "", "pages/distributorCenter/applyFor/applyFor", MD5Util.strToMD5(loginUser.getOpenId())+"qrcode" |
| | | ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); |
| | | |
| | | BufferedImage qrcordImgBuf = ImageIO.read(new File(qrcodeSavePath)); |
| | | |
| | | //获取海报 |
| | | BusParameterSettings posterSetting = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, HostInterceptor.getCompanyId()); |
| | | String posterPath=baseSavePath+"wxacode" + File.separatorChar+MD5Util.strToMD5(loginUser.getOpenId())+"poster.png"; |
| | | ImageUtil.downloadPicture(posterSetting.getParamValue(),posterPath); |
| | | BufferedImage posterImgBuf = ImageIO.read(new File(posterPath)); |
| | | |
| | | //获取用户头像 |
| | | String userPhotoPath=baseSavePath+"wxacode" + File.separatorChar+MD5Util.strToMD5(loginUser.getOpenId())+"userPhoto.png"; |
| | | ImageUtil.downloadPicture(loginUser.getAvatarUrl(),userPhotoPath); |
| | | BufferedImage userPhotoImgBuf = ImageIO.read(new File(userPhotoPath)); |
| | | |
| | | |
| | | BufferedImage backgroundImgBuf = new BufferedImage(700, 900, BufferedImage.TYPE_4BYTE_ABGR); |
| | | //绘制背景+产品 |
| | | Graphics2D g = backgroundImgBuf.createGraphics(); |
| | | //g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1)); |
| | | g.setColor(Color.WHITE); |
| | | g.fillRect(0,0,700,900); |
| | | g.drawImage(posterImgBuf,0,0,700, 700,null); |
| | | |
| | | g.drawImage(userPhotoImgBuf,20,720,80,80,null); |
| | | |
| | | g.drawImage(qrcordImgBuf,500,720,150,150,null); |
| | | |
| | | g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); |
| | | |
| | | g.setFont(new Font("WenQuanYi Micro Hei", Font.BOLD, 24)); |
| | | g.setColor(Color.BLACK); |
| | | g.drawString(loginUser.getNickName()+"邀请你一起推广赚佣金",120,750); |
| | | |
| | | g.dispose(); |
| | | ImageIO.write(backgroundImgBuf, "png", new File(targetImgPath)); |
| | | |
| | | return AjaxResult.buildSuccessInstance(urlPath); |
| | | } catch (Exception e) { |
| | | LogUtil.error("门店生成二维码错误:{}", e, ""); |
| | | LogUtil.error("推广二维码生成错误:{}", e, ""); |
| | | return AjaxResult.buildFailInstance("二维码生成失败"); |
| | | } |
| | | return AjaxResult.buildFailInstance("二维码生成失败"); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |