| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.component.tools.WxacodeUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | |
| | | import com.matrix.core.tools.PropertiesUtil; |
| | | import com.matrix.core.tools.UUIDUtil; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.shopXcx.api.WeChatApiTools; |
| | | import com.matrix.system.shopXcx.api.pojo.QrcodeImgParam; |
| | | import com.matrix.system.shopXcx.api.vo.QrcodeVo; |
| | | import com.matrix.system.shopXcx.api.vo.WxActivitiesGroupBuyVO; |
| | |
| | | @CrossOrigin(origins = "*", maxAge = 3600) |
| | | public class WxShareProductAction { |
| | | |
| | | |
| | | @Autowired |
| | | WeChatApiTools weChatApiTools; |
| | | @Autowired |
| | | private ShopProductDao shopProductDao; |
| | | |
| | |
| | | ShopActivitiesGroupInfoDao shopActivitiesGroupInfoDao; |
| | | |
| | | @Autowired |
| | | BizUserDao bizUserDao; |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | ShopActivitiesSeckillInfoDao shopActivitiesSeckillInfoDao; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | */ |
| | |
| | | @RequestMapping(value = "/getProductShareQrcode") |
| | | public @ResponseBody |
| | | AjaxResult getwxacode1(@RequestBody QrcodeVo qrcodeVo) throws Exception { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | loginUser = bizUserDao.selectById(loginUser.getUserId()); |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | loginUser = sysVipInfoDao.selectById(loginUser.getId()); |
| | | //活动类型 |
| | | ShopActivities activities=null; |
| | | //是否为拼团分享 |
| | |
| | | } |
| | | ShopShareQrcord queryOrcode = new ShopShareQrcord(); |
| | | queryOrcode.setProductId(qrcodeVo.getProductId()); |
| | | queryOrcode.setUserId(loginUser.getOpenId()); |
| | | queryOrcode.setUserId(loginUser.getId()); |
| | | |
| | | if (isGroupProduct ) { |
| | | queryOrcode.setProductId(Integer.parseInt(qrcodeVo.getActId() + "")); |
| | |
| | | //如果未查询到就先插入数据再更新数据 |
| | | shareQrcord.setCreateBy(loginUser.getOpenId()); |
| | | shareQrcord.setUpdateBy(loginUser.getOpenId()); |
| | | shareQrcord.setUserId(loginUser.getOpenId()); |
| | | shareQrcord.setUserId(loginUser.getId()); |
| | | shareQrcord.setShopId(qrcodeVo.getShopId()); |
| | | //拼团活动 |
| | | if (isGroupProduct ) { |
| | |
| | | qrcodeImgParam = getQrcodeImgParam(loginUser, qrcodeVo); |
| | | shareQrcord.setProductId(qrcodeVo.getProductId()); |
| | | } |
| | | |
| | | qrcodeImgParam.logo=""; |
| | | //绘制二维码 |
| | | drawQrcode(qrcodeImgParam); |
| | | |
| | |
| | | * @param qrcodeVo |
| | | * @return |
| | | */ |
| | | private QrcodeImgParam getSeckillQrcodeImgParam(BizUser loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | private QrcodeImgParam getSeckillQrcodeImgParam(SysVipInfo loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | |
| | | ShopActivitiesSeckillInfo seckillInfo = shopActivitiesSeckillInfoDao.selectById(qrcodeVo.getSkillId()); |
| | | |
| | | ShopProduct shopProduct = shopProductDao.selectById(seckillInfo.getGoodsId().intValue()); |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID()); |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() |
| | | ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); |
| | | |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = "【秒杀】" + shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" +seckillInfo.getSiPrice(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | return qrcodeImgParam; |
| | | } |
| | | |
| | |
| | | * @param qrcodeVo |
| | | * @return |
| | | */ |
| | | private QrcodeImgParam getGroupQrcodeImgParam(BizUser loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | private QrcodeImgParam getGroupQrcodeImgParam(SysVipInfo loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | |
| | | WxActivitiesGroupBuyVO groupBuyVO = shopActivitiesGroupInfoDao.selectGroupInfoWithPriceByActId(qrcodeVo.getActId()); |
| | | |
| | | ShopProduct shopProduct = shopProductDao.selectById(groupBuyVO.getGoodsId().intValue()); |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID()); |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() |
| | | ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); |
| | | |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = "【拼团】" + shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" + price.getGpPrice(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | return qrcodeImgParam; |
| | | } |
| | | |
| | | @NotNull |
| | | private QrcodeImgParam getQrcodeImgParam(BizUser loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | private QrcodeImgParam getQrcodeImgParam(SysVipInfo loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | |
| | | ShopProduct shopProduct = shopProductDao.selectById(qrcodeVo.getProductId()); |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID()); |
| | | |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() |
| | | ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); |
| | | |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" + shopProduct.getPrice().toString(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | |
| | | ShopCoupon shopCoupon = shopProduct.getShopCoupon(); |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | if (shopCoupon != null) { |
| | | String beginTiem = DateUtil.dateFormatStr(shopCoupon.getBeginTime(), DateUtil.DATE_FORMAT_SPLITE_DD); |
| | | String endTiem = DateUtil.dateFormatStr(shopCoupon.getEndTime(), DateUtil.DATE_FORMAT_SPLITE_DD); |
| | |
| | | g = b2Img.createGraphics(); |
| | | g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1)); |
| | | g.drawImage(qrcordImgBuf, 320, 550, 140, 140, null); |
| | | g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
| | | g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); |
| | | //标题 |
| | | g.setColor(new Color(0xF10D0A0A, true)); |
| | | Font font = new Font("微软雅黑", Font.PLAIN, 24); |