| | |
| | | <exclude>config/test/*</exclude> |
| | | <exclude>config/xcx/*</exclude> |
| | | |
| | | <!----> |
| | | <!-- |
| | | <exclude>config/config.json</exclude> |
| | | <exclude>config/application.properties</exclude> |
| | | <exclude>config/system.properties</exclude> |
| | | |
| | | --> |
| | | |
| | | |
| | | |
| | |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.util.ArrayList; |
| | |
| | | URL url = null; |
| | | int imageNumber = 0; |
| | | try { |
| | | url = new URL(imgUrl); |
| | | DataInputStream dataInputStream = new DataInputStream(url.openStream()); |
| | | |
| | | InputStream inputStream = null; |
| | | HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(imgUrl).openConnection(); |
| | | httpURLConnection.setRequestMethod("GET"); |
| | | httpURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"); |
| | | httpURLConnection.setRequestProperty("Accept-Encoding", "gzip"); |
| | | httpURLConnection.setRequestProperty("Referer","no-referrer"); |
| | | httpURLConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); |
| | | httpURLConnection.setConnectTimeout(15000); |
| | | httpURLConnection.setReadTimeout(20000); |
| | | inputStream = httpURLConnection.getInputStream(); |
| | | |
| | | |
| | | |
| | | FileOutputStream fileOutputStream = new FileOutputStream(new File(savePath)); |
| | | ByteArrayOutputStream output = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int length; |
| | | while ((length = dataInputStream.read(buffer)) > 0) { |
| | | while ((length = inputStream.read(buffer)) > 0) { |
| | | output.write(buffer, 0, length); |
| | | } |
| | | byte[] context=output.toByteArray(); |
| | | fileOutputStream.write(output.toByteArray()); |
| | | dataInputStream.close(); |
| | | inputStream.close(); |
| | | fileOutputStream.close(); |
| | | } catch (MalformedURLException e) { |
| | | e.printStackTrace(); |
| | |
| | | import java.util.Map; |
| | | |
| | | public class WxacodeUtil { |
| | | /** |
| | | * 小程序秘钥 |
| | | */ |
| | | private static final String XCX_SECRET = "xcx_secret"; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | private static final String XCX_APPID = "xcx_appid"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * token获取地址 |
| | | */ |
| | |
| | | */ |
| | | private static final String GET_WXACODE ="https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="; |
| | | |
| | | public static String getWxacode(String scene,String page,String fileName) throws Exception { |
| | | public static String getWxacode(String scene,String page,String fileName,String appid,String secret) throws Exception { |
| | | LogUtil.debug("scene={},page={},fileName={}",scene,page,fileName); |
| | | //获取token |
| | | String appid = PropertiesUtil.getString(XCX_APPID); |
| | | String secret = PropertiesUtil.getString(XCX_SECRET); |
| | | String result1 = get(TOKEN_URL.replace("APPID", appid).replace("SECRET", secret)); |
| | | String access_token = JSONObject.parseObject(result1).getString("access_token"); |
| | | if(StringUtils.isNotBlank(access_token)) { |
| | |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.constance.SystemConstance; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.service.SysShopInfoService; |
| | | import com.matrix.system.shopXcx.api.WeChatApiTools; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | @Resource |
| | | private SysShopInfoService shopInfoService; // 店铺Service |
| | | |
| | | |
| | | @Autowired |
| | | WeChatApiTools weChatApiTools; |
| | | |
| | | @RequestMapping(value = "/showList") |
| | | @ResponseBody |
| | |
| | | AjaxResult creteSohopQrcode(@PathVariable("shopId") Long shopId) { |
| | | SysShopInfo shopInfo = shopInfoService.findById(shopId); |
| | | try { |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(shopId + "", "pages/index/index", MD5Util.strToMD5(shopId + "")); |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(shopId + "", "pages/index/index", MD5Util.strToMD5(shopId + "") |
| | | ,weChatApiTools.getAppid(shopInfo.getCompanyId()),weChatApiTools.getSecret(shopInfo.getCompanyId())); |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | | String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.biz.bean.BizUser; |
| | | |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.shopXcx.bean.ShopWxAcode; |
| | | import com.matrix.component.tools.WxacodeUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.system.shopXcx.api.WeChatApiTools; |
| | | import com.matrix.system.shopXcx.bean.ShopWxAcode; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import java.util.Collections; |
| | | |
| | | /** |
| | | * @description 获取<link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">接口 |
| | | * @description 获取 |
| | | * @author jiangyouyao |
| | | * @date 2019-07-03 15:15 |
| | | */ |
| | |
| | | public class WxGetAcodeAction { |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | @Autowired |
| | | WeChatApiTools weChatApiTools; |
| | | /** |
| | | * 获取微信二维码 |
| | | * @param |
| | |
| | | public AjaxResult getWxAcode(@RequestBody ShopWxAcode wxAcode) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | String openId = loginUser.getOpenId(); |
| | | //String openId = "omfv64kVgvGpz6D8p4J3WZYuT6M4"; |
| | | try { |
| | | String wxacodeUrl = WxacodeUtil.getWxacode(wxAcode.getScene(), wxAcode.getPage(), wxAcode.getFileName()); |
| | | String wxacodeUrl = WxacodeUtil.getWxacode(wxAcode.getScene(), wxAcode.getPage(), wxAcode.getFileName(), |
| | | weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); |
| | | String substring = wxacodeUrl.substring(0, 5); |
| | | if("error".equals(substring)){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, wxacodeUrl); |
| | |
| | | import com.matrix.component.tools.ImageUtil; |
| | | import com.matrix.component.tools.WxacodeUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.MD5Util; |
| | | import com.matrix.core.tools.PropertiesUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | |
| | | 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") |
| | |
| | | |
| | | String urlPath = baseSaveUrl + "/" + "wxacode" + "/" + targetImg; |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(loginUser.getOpenId() + "", "pages/distributorCenter/applyFor/applyFor", MD5Util.strToMD5(loginUser.getOpenId() + "qrcode")); |
| | | 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)); |
| | | |
| | | //获取海报 |
| | |
| | | |
| | | g.dispose(); |
| | | ImageIO.write(backgroundImgBuf, "png", new File(targetImgPath)); |
| | | |
| | | |
| | | return AjaxResult.buildSuccessInstance(urlPath); |
| | | } catch (Exception e) { |
| | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.PropertiesUtil; |
| | | import com.matrix.core.tools.UUIDUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | 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; |
| | | |
| | |
| | | |
| | | 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); |
| | | // 图片保存目录路径 |
| | |
| | | |
| | | 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); |
| | | // 图片保存目录路径 |
| | |
| | | |
| | | |
| | | |
| | | 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); |
| | | // 图片保存目录路径 |