This commit is contained in:
linfso 2024-09-25 20:41:16 +08:00
parent 9cf900e1d9
commit 4ab5c8e19b

View File

@ -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("发送成功");
}
}