From 7ac435d93858f6658248c2d4ea763ce1cfd0f012 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Sat, 16 Jan 2021 22:52:58 +0800
Subject: [PATCH] 消息提醒

---
 zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
index 7094fe9..3549c4a 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
@@ -21,10 +21,10 @@
 import com.matrix.system.shopXcx.bean.ShopWxtemplateMsg;
 import com.matrix.system.shopXcx.dao.ShopWxtemplateMsgDao;
 import com.matrix.system.wechart.templateMsg.GzhTemplateMessagePojo;
-import com.matrix.system.wechart.templateMsg.TemplateNameConstance;
 import com.matrix.system.wechart.templateMsg.UniformMsgPojo;
 import com.rabbitmq.client.DeliverCallback;
 import com.rabbitmq.client.Delivery;
+import io.swagger.models.auth.In;
 import org.apache.commons.collections.map.HashedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -62,29 +62,29 @@
             String messages = new String(message.getBody(), "UTF-8");
             JSONObject messageJsonParam=JSONObject.parseObject(messages);
 
-            if(!messageJsonParam.containsKey("companyId")){
-                LogUtil.error("小程序消息推送参数格式异常发送模板消息需要传JSONO字符串作为格式 例如:{\"companyId\":17} companyId 是必须属性");
+            if(!messageJsonParam.containsKey("companyId")||(!messageJsonParam.containsKey("templateCode"))){
+                LogUtil.error("小程序消息推送参数格式异常发送模板消息需要传JSONO字符串作为格式 例如:{\"companyId\":17,\"templateCode\":10000} companyId 、templateCode 是必须属性");
                 return;
             }
-
             Long companyId = Long.parseLong( messageJsonParam.get("companyId").toString());
+            Integer templateCode = Integer.parseInt( messageJsonParam.get("templateCode").toString());
 
             //获取公司微信配置参数
             BusParameterSettings xcxAppId = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINIPROGRAM_APPID, companyId);
             BusParameterSettings xcxSecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINIPROGRAM_SECRET, companyId);
             BusParameterSettings gzhAppid = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.GZH_APPID, companyId);
             //获取消息模板
-            ShopWxtemplateMsg template = shopWxtemplateMsgDao.selectByCode(TemplateNameConstance.GZH_YYTX,companyId);
+            ShopWxtemplateMsg template = shopWxtemplateMsgDao.selectByCode(templateCode,companyId);
             //校验参数
             if(xcxAppId==null||xcxSecret==null||gzhAppid==null||template==null){
                 LogUtil.error("小程序消息推送配置缺失xcxAppId="+xcxAppId+";xcxSecret="+xcxSecret+";gzhAppid="+gzhAppid+";template="+template);
                 return;
             }
-
             //获取模板动态构建类
             TemplateMessageBulder templateMessageBulder = (TemplateMessageBulder) GlueFactory.getInstance().loadInstance(template.getTemplateClass());
             //为模板动态类装备必要的参数
             Map<String, Object> bulderParam = new HashedMap();
+            bulderParam.put("xcxAppId", xcxAppId.getParamValue());
             bulderParam.put("gzhAppid", gzhAppid.getParamValue());
             bulderParam.put("template_id", template.getUuid());
             bulderParam.put("messageJsonParam", messageJsonParam);

--
Gitblit v1.9.1