| @@ -2,6 +2,7 @@ package com.iformall.controller.app; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor; | |||
| import com.alibaba.druid.support.json.JSONUtils; | |||
| import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| @@ -24,6 +25,7 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.core.task.AsyncTaskExecutor; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.ServletException; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @@ -59,27 +61,33 @@ public class WxAppinfoController extends BaseController { | |||
| private UploadController uploadController; | |||
| @Autowired | |||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||
| private AsyncTaskExecutor asyncTaskExecutor; | |||
| ExecutorService fixedThreadPool = Executors.newFixedThreadPool(100); | |||
| @Autowired | |||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||
| @ApiOperation("加载老数据二维码") | |||
| @GetMapping("/updateQrCode") | |||
| public void updateQrCode(String p)throws ServletException, IOException { | |||
| if("xlldxx".equals(p)) { | |||
| if("xlldxx".equals(p)){ | |||
| String pageUrl = "pages/index/index"; | |||
| List<WxMerchant> list = wxMerchantMapper.findQrcodeEmptyList(); | |||
| for (WxMerchant merchant : list) { | |||
| fixedThreadPool.execute(new Runnable() { | |||
| for (WxMerchant merchant:list) { | |||
| asyncTaskExecutor.execute(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| String param = merchant.getWeappScene(); | |||
| ResultData resultData = exportQrcode(null, null, merchant.getTenantId(), 1, pageUrl, param, 0, "", "", "店铺详情", true); | |||
| Map<String, String> map = (Map) resultData.data; | |||
| String url = map.get("url"); | |||
| merchant.setQrCode(url); | |||
| wxMerchantMapper.updateByPrimaryKeySelective(merchant); | |||
| try{ | |||
| String param = merchant.getWeappScene(); | |||
| ResultData resultData = exportQrcode(null,null,merchant.getTenantId(),1,pageUrl,param,0,"","","店铺详情",true); | |||
| Map<String,String> map = (Map)resultData.data; | |||
| String url = map.get("url"); | |||
| merchant.setQrCode(url); | |||
| wxMerchantMapper.updateByPrimaryKeySelective(merchant); | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error("updateQrCode error:"+e.getMessage(),e); | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| @@ -94,15 +102,20 @@ public class WxAppinfoController extends BaseController { | |||
| List<WxCouponChannel> list = wxCouponChannelMapper.findQrcodeEmptyList(); | |||
| for (WxCouponChannel couponChannel:list) { | |||
| fixedThreadPool.execute(new Runnable() { | |||
| asyncTaskExecutor.execute(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| String param = couponChannel.getWeappScene(); | |||
| ResultData resultData = exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); | |||
| Map<String,String> map = (Map)resultData.data; | |||
| String url = map.get("url"); | |||
| couponChannel.setQrCode(url); | |||
| wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); | |||
| try { | |||
| String param = couponChannel.getWeappScene(); | |||
| ResultData resultData = exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","店铺详情",true); | |||
| Map<String,String> map = (Map)resultData.data; | |||
| String url = map.get("url"); | |||
| couponChannel.setQrCode(url); | |||
| wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error("updateCouponQrCode error:"+e.getMessage(),e); | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| @@ -116,11 +129,11 @@ public class WxAppinfoController extends BaseController { | |||
| String name = (String) params.get("name"); | |||
| String pageUrl = (String) params.get("pageUrl"); | |||
| String sceneParam = (String) params.get("sceneParam"); | |||
| int type = 0; | |||
| int type = 1; | |||
| try { | |||
| type = (int) params.get("type"); | |||
| } catch (Exception e) { | |||
| type = 0; | |||
| type = 1; | |||
| } | |||
| int withText = 0; | |||