浏览代码

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

于继渤 1 年之前
父节点
当前提交
1795f8bf09

+ 8 - 0
src/main/java/com/dk/mdm/infrastructure/config/Config.java

@@ -126,4 +126,12 @@ public class Config {
      */
     @Value("${wx.templateId}")
     private String templateId;
+
+    /**
+     * @desc   : 微信小程序订阅消息模板id列表
+     * @author : 刘尧
+     * @date   : 2024/07/22 10:03
+     */
+    @Value("${wx.miniMessageModelIds}")
+    private String[] miniMessageModelIds;
 }

+ 15 - 18
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -476,11 +476,19 @@ public class CusFollowService extends BaseService<CusFollow> {
 //                        mapMessage.put("publicOpenId", user.get("publicOpenId"));
                         mapMessage.put("userWxId", user.get("userWxId"));
                         mapMessage.put("first", "客户跟进提醒");
-//                        mapMessage.put("keywordList", list);
-                        mapMessage.put("keywordMap", keywordMap);
+//                      mapMessage.put("keywordList", list);
+//                      mapMessage.put("keywordMap", keywordMap);
                         mapMessage.put("remark", "客户跟进备注");
-//                        sendUniformMessage(mapMessage);
-                        wxMessagePush(mapMessage);
+//                      sendUniformMessage(mapMessage);
+                        String[] miniMessageModelIds = config.getMiniMessageModelIds();
+                        // 构造对应的显示信息 和模板数据结构对应
+                        JSONObject data = new JSONObject();
+                        data.put("time4", createDataItem("value", String.valueOf(keywordMap.get("followTime"))));
+                        data.put("thing1", createDataItem("value", String.valueOf(keywordMap.get("cusName"))));
+                        data.put("phone_number2", createDataItem("value", String.valueOf(keywordMap.get("cusPhone"))));
+                        data.put("thing6", createDataItem("value", String.valueOf(keywordMap.get("remark"))));
+                        data.put("thing5", createDataItem("value", String.valueOf(mapMessage.get("remark"))));
+                        wxMessagePush(miniMessageModelIds[0], data, mapMessage);
                     }
                 }
 
@@ -558,14 +566,14 @@ public class CusFollowService extends BaseService<CusFollow> {
      * @author : 刘尧
      * @date : 2024-07-19 08:56
      * */
-    public ResponseResultVO<?> wxMessagePush(Map<String, Object> map) {
+    public ResponseResultVO<?> wxMessagePush(String messId, JSONObject data, Map<String, Object> map) {
         // 获取微信Token
         String wxToken = getWxToken();
         Map<String, Object> params = new HashMap<>();
         // 接口调用凭证
         params.put("access_token", wxToken);
         // 所需下发的订阅模板id
-        params.put("template_id", "z3REuwft6NLPxVW8s5HN1UgWjFstWjD0QfCXNLTa0LA");
+        params.put("template_id", messId);
         // 点击模板卡片后的跳转页面
         if (map.containsKey("otherParam")) {
             params.put("page", "pages/welcome/welcome?loginType=" + map.get("loginType").toString() + "&otherParam=" + map.get("otherParam").toString());
@@ -576,18 +584,7 @@ public class CusFollowService extends BaseService<CusFollow> {
         params.put("touser", map.get("userWxId"));
         // 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;
         params.put("miniprogram_state", "trial");
-
-        // 获取客户信息
-        Object keywordMap = map.get("keywordMap");
-        Map<String, Object> personMap = BeanUtil.beanToMap(keywordMap);
-
-        // 构造对应的显示信息 和模板数据结构对应
-        JSONObject data = new JSONObject();
-        data.put("time4", createDataItem("value", String.valueOf(personMap.get("followTime"))));
-        data.put("thing1", createDataItem("value", String.valueOf(personMap.get("cusName"))));
-        data.put("phone_number2", createDataItem("value", String.valueOf(personMap.get("cusPhone"))));
-        data.put("thing6", createDataItem("value", String.valueOf(personMap.get("remark"))));
-        data.put("thing5", createDataItem("value", String.valueOf(map.get("remark"))));
+        // 配置模板中明细值
         params.put("data", data);
 
         ResponseResultVO<JSONObject> post = HttpUtils.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + wxToken, params);

+ 2 - 1
src/main/resources/dev/bootstrap.yml

@@ -115,7 +115,8 @@ wx:
   wxPublicAccountAppId: wx6bb9335b534f7b28
   wxPublicAccountAppSecret: 78a99837c113756599d1748b813ca698
   templateId: V5Ju7-8BfDKJJm1HgH4j5km68rPs777pMVJ0_MKqR00
-
+  # 微信小程序订阅消息模板id列表
+  miniMessageModelIds: ["z3REuwft6NLPxVW8s5HN1UgWjFstWjD0QfCXNLTa0LA"]
 
   # 支付的信息
   pay:

+ 2 - 0
src/main/resources/prod/bootstrap.yml

@@ -113,6 +113,8 @@ wx:
   wxPublicAccountAppId: wx6bb9335b534f7b28
   wxPublicAccountAppSecret: 78a99837c113756599d1748b813ca698
   templateId: V5Ju7-8BfDKJJm1HgH4j5km68rPs777pMVJ0_MKqR00
+  # 微信小程序订阅消息模板id列表
+  miniMessageModelIds: [ "z3REuwft6NLPxVW8s5HN1UgWjFstWjD0QfCXNLTa0LA" ]
 
   # 支付的信息
   pay:

+ 2 - 0
src/main/resources/st/bootstrap.yml

@@ -103,6 +103,8 @@ wx:
   edit_corp_tag: https://qyapi.weixin.qq.com/cgi-bin/externalcontact/edit_corp_tag?access_token=
   #  删除企业客户标签
   del_corp_tag: https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag?access_token=
+  # 微信小程序订阅消息模板id列表
+  miniMessageModelIds: [ "z3REuwft6NLPxVW8s5HN1UgWjFstWjD0QfCXNLTa0LA" ]
 
 dongke:
   base:

+ 2 - 0
src/main/resources/test/bootstrap.yml

@@ -113,6 +113,8 @@ wx:
   wxPublicAccountAppId: wx6bb9335b534f7b28
   wxPublicAccountAppSecret: 78a99837c113756599d1748b813ca698
   templateId: FbOkFnLo86XllRKElGwWVFkc8VAXg386PyF9wndqItE
+  # 微信小程序订阅消息模板id列表
+  miniMessageModelIds: [ "z3REuwft6NLPxVW8s5HN1UgWjFstWjD0QfCXNLTa0LA" ]
 
   # 支付的信息
   pay: