Procházet zdrojové kódy

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

cs před 2 roky
rodič
revize
df6c4ece80

+ 19 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -100,6 +100,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     @Value(value = "${configEnv.isDev}")
     private boolean isDev;
 
+    @Value(value = "${configEnv.isPrivateDeploy}")
+    private boolean isPrivateDeploy;
+
     @Autowired
     RestTemplate restTemplate;
 
@@ -276,17 +279,25 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         try {
             if (isDev) return;
             String accessToken = getCorpAccessToken(corpInfo);
-            String url = URL_SEND_WXCORP_MSG.replaceAll("ACCESS_TOKEN", accessToken);
+            String url=URL_SEND_WXCORP_MSG.replaceAll("ACCESS_TOKEN", accessToken);
             HttpHeaders headers = new HttpHeaders();
             headers.setContentType(MediaType.APPLICATION_JSON);
             JSONObject reqParam = new JSONObject();
-            reqParam.put("touser", corpUserid);
-            reqParam.put("toparty", "");
-            reqParam.put("totag", "");
-            reqParam.put("msgtype", "template_msg");
-            reqParam.put("agentid", corpInfo.getAgentid());
-            reqParam.put("template_msg", msg);
-
+            if(isPrivateDeploy){
+                reqParam.put("touser", corpUserid);
+                reqParam.put("toparty", "");
+                reqParam.put("totag", "");
+                reqParam.put("msgtype", "text");
+                reqParam.put("agentid", corpInfo.getAgentid());
+                reqParam.put("text", msg);
+            }else {
+                reqParam.put("touser", corpUserid);
+                reqParam.put("toparty", "");
+                reqParam.put("totag", "");
+                reqParam.put("msgtype", "template_msg");
+                reqParam.put("agentid", corpInfo.getAgentid());
+                reqParam.put("template_msg", msg);
+            }
             HttpEntity<String> requestEntity = new HttpEntity<String>(reqParam.toJSONString(), headers);
             ResponseEntity<String> responseEntity = this.restTemplate.exchange(url,
                     HttpMethod.POST, requestEntity, String.class);
@@ -303,7 +314,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
             } else {
                 System.err.println("发送失败:" + responseEntity.getStatusCode() + ", " + responseEntity.getBody());
             }
-
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 14 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -382,9 +382,13 @@ public class TimingTask {
                     jsonObj.put("key", "待审核数量");
                     jsonObj.put("value",StringUtils.isEmpty(map.get("num"))?"":map.get("num"));
                     dataJson.add(jsonObj);
-                    json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
-                    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=review#wechat_redirect");
-                    json.put("content_item",dataJson);
+                    if(isPrivateDeploy){
+                        json.put("content","待审核数量: "+(StringUtils.isEmpty(map.get("num"))?"":map.get("num"))+"\\n<a href=\\\"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\\\">去审核</a>");
+                    }else {
+                        json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
+                        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=review#wechat_redirect");
+                        json.put("content_item",dataJson);
+                    }
                     wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
                     }
                 }
@@ -626,9 +630,13 @@ public class TimingTask {
                         jsonObj.put("key", "提示");
                         jsonObj.put("value", StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg());
                         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);
+                        if(isPrivateDeploy){
+                            json.put("content",StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg()+"\\n<a href=\\\"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\\\">去填写</a>");
+                        }else {
+                            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);
+                        }
                         if (cpList.size() > 0) {
                             wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
                         }