From 4ab5c8e19b63c0c1b2adb1a6be9fe306490623f2 Mon Sep 17 00:00:00 2001 From: linfso Date: Wed, 25 Sep 2024 20:41:16 +0800 Subject: [PATCH] md --- .../erp/oms/web/Oms2cCommonController.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cCommonController.java b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cCommonController.java index 7b4114d..3e8ba71 100644 --- a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cCommonController.java +++ b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cCommonController.java @@ -11,6 +11,8 @@ package com.xdadan.erp.oms.web; +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -32,6 +34,7 @@ import com.xdadan.erp.oms.system.service.ISysConfigService; import com.xdadan.erp.oms.utils.TraceUtils; import feign.Response; import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -41,6 +44,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Date; +import java.util.HashMap; +import java.util.Map; /** * EMIS 公共 Controller @@ -70,6 +75,9 @@ public class Oms2cCommonController extends BaseController @Autowired private ISysConfigService configService; + @Autowired + private WxMaService wxMaService; + /** * 获取电子面单单号 @@ -261,4 +269,29 @@ public class Oms2cCommonController extends BaseController } } + + /** + * 获取解析地址 + */ + @RequestMapping(value = "/sendWxSappNotifyToUser") + public AjaxResult sendWxSappNotify(String billCode,String openId,String tplId,String paramStr) + { + WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder() + .toUser(openId) + .templateId(tplId) + .page("pages/post/query?billCode="+billCode) + .build(); + JSONObject jObjParam = JSONObject.parseObject(paramStr); + + jObjParam.forEach( (k,v)-> { wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));} ); + try { + wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage); + } catch (WxErrorException e) { + e.printStackTrace(); + } + + return AjaxResult.success("发送成功"); + } + + }