瀏覽代碼

企业微信审核通过 的消息提醒审核人显示没有转译

seyason 1 年之前
父節點
當前提交
fe07846951

+ 19 - 23
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WxCorpInfoController.java

@@ -65,30 +65,26 @@ public class WxCorpInfoController {
 
     @RequestMapping("/testSendTemplateMsg")
     public HttpRespMsg testSendTemplateMsg(String userId) {
-        String corpwxuserIds = "";
-        //多个用户
-        String[] userIds = userId.split("\\|");
-        List<String> ids = Arrays.asList(userIds);
-        List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id",ids));
-        corpwxuserIds = userList.stream().filter(u->!StringUtils.isEmpty(u.getCorpwxUserid())).map(User::getCorpwxUserid).collect(Collectors.joining("|"));
-        if (corpwxuserIds.length() > 0) {
-            int companyId=userList.get(0).getCompanyId();
-            WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
-            System.out.println("发送给:"+corpwxuserIds);
-            //推送到企业微信
+        int companyId=7;
+        WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
+        String corpwxuserIds = "woy9TkCAAAPD6149u46N_Yi5ARSA4VFw";
+        System.out.println("发送给:"+corpwxuserIds);
+        //推送到企业微信
 //        String corpUid = user.getCorpwxUserid();
-            JSONObject json=new JSONObject();
-            JSONArray dataJson=new JSONArray();
-            JSONObject jsonObj=new JSONObject();
-            jsonObj.put("key", "提示");
-            jsonObj.put("value", "测试提醒消息21:12");
-            dataJson.add(jsonObj);
-            json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
-            json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
-            json.put("content_item",dataJson);
-            wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo, corpwxuserIds, json);
-
-        }
+        JSONObject json=new JSONObject();
+        JSONArray dataJson=new JSONArray();
+        JSONObject item=new JSONObject();
+        item.put("key","审核人");
+        item.put("value","$userName=woy9TkCAAAPD6149u46N_Yi5ARSA4VFw$");
+        dataJson.add(item);
+        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
+        JSONObject item2=new JSONObject();
+        item2.put("key","日期");
+        item2.put("value","2021-07-14");
+        dataJson.add(item2);
+        json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
+        json.put("content_item",dataJson);
+        wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo,corpwxuserIds,json);
         return new HttpRespMsg();
     }
 

+ 4 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -2001,11 +2001,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             User u = first.get();
                             if(u.getCorpwxUserid()!=null){
                                 if(wxCorpInfoList.size()>0){
-                                    JSONObject json=new JSONObject();
+                                    WxCorpInfo wxCorpInfo = wxCorpInfoList.get(0);
+                                    JSONObject json = new JSONObject();
                                     JSONArray dataJson=new JSONArray();
                                     JSONObject item=new JSONObject();
                                     item.put("key","审核人");
-                                    item.put("value",user.getName());
+                                    item.put("value",wxCorpInfo.getSaasSyncContact() == 1?("$userName="+user.getName()+"$"): user.getName());
                                     dataJson.add(item);
                                     if(timeType.getNeedEvaluate()==1){
                                         JSONObject item1=new JSONObject();
@@ -2022,7 +2023,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                     dataJson.add(item2);
                                     json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
                                     json.put("content_item",dataJson);
-                                    wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfoList.get(0),u.getCorpwxUserid(),json);
+                                    wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo,u.getCorpwxUserid(),json);
                                 }
                             }
                             if(u.getDingdingUserid()!=null){