ソースを参照

Merge branch 'dev-xym-fix4' of Server/growth-manager into master

xueyiming 2 ヶ月 前
コミット
c0309c1260

+ 6 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageServiceImpl.java

@@ -96,7 +96,12 @@ public class MessageServiceImpl implements MessageService {
             String accessToken = weComAccessTokenService.getWeComAccessToken(corpId);
             String url = POST_WE_COM_SEND_WELCOME_MSG
                     + "?access_token=" + accessToken;
-            String s = httpPoolClient.post(url, jsonObject.toJSONString());
+            String s;
+            if (corpId == 1L) {
+                s = httpPoolClient.post(url, jsonObject.toJSONString());
+            } else {
+                s = weComSendService.sendPost(url, jsonObject.toJSONString());
+            }
             JSONObject res = JSONObject.parseObject(s);
             log.info("sendAutoReplyMessage res={}", res);
             Integer code = res.getInteger("errcode");

+ 12 - 3
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComSendServiceImpl.java

@@ -5,6 +5,8 @@ import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
 import com.tzld.piaoquan.growth.common.model.vo.SendRequestParam;
 import com.tzld.piaoquan.growth.common.service.WeComSendService;
 import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
+import lombok.extern.slf4j.Slf4j;
+import lombok.val;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -13,6 +15,7 @@ import org.springframework.stereotype.Service;
 import java.io.File;
 import java.io.IOException;
 
+@Slf4j
 @Service
 public class WeComSendServiceImpl implements WeComSendService {
 
@@ -33,7 +36,9 @@ public class WeComSendServiceImpl implements WeComSendService {
         SendRequestParam sendRequestParam = new SendRequestParam();
         sendRequestParam.setUrl(url);
         sendRequestParam.setParam(param);
-        return httpPoolClient.post(sendUrl, JSON.toJSONString(sendRequestParam));
+        String res = httpPoolClient.post(sendUrl, JSON.toJSONString(sendRequestParam));
+        log.info("sendPost res={}", res);
+        return res;
     }
 
     @Override
@@ -44,7 +49,9 @@ public class WeComSendServiceImpl implements WeComSendService {
         }
         String sendUrl = "http://" + sendRequestIp + "/wecom/server/send/get";
         sendUrl += "?url=" + url;
-        return httpPoolClient.get(sendUrl);
+        String res = httpPoolClient.get(sendUrl);
+        log.info("sendGet res={}", res);
+        return res;
     }
 
     @Override
@@ -55,6 +62,8 @@ public class WeComSendServiceImpl implements WeComSendService {
         }
         String sendUrl = "http://" + sendRequestIp + "/wecom/server/send/post/file";
         sendUrl += "?url=" + url;
-        return httpPoolClient.post(sendUrl, file);
+        String res = httpPoolClient.post(sendUrl, file);
+        log.info("sendPostFile res={}", res);
+        return res;
     }
 }

+ 10 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java

@@ -13,6 +13,7 @@ import com.tzld.piaoquan.growth.common.model.po.*;
 import com.tzld.piaoquan.growth.common.model.vo.UserTagParam;
 import com.tzld.piaoquan.growth.common.model.vo.WeComUserVo;
 import com.tzld.piaoquan.growth.common.service.WeComAccessTokenService;
+import com.tzld.piaoquan.growth.common.service.WeComSendService;
 import com.tzld.piaoquan.growth.common.service.WeComUserService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
@@ -63,6 +64,9 @@ public class WeComUserServiceImpl implements WeComUserService {
     @Value("${needFilterTagIdConfig:[]}")
     private String needFilterTagIdConfig;
 
+    @Autowired
+    private WeComSendService weComSendService;
+
 
     @Override
     public void addStaffWithUser(String externalUserId, String carrierId, Long corpId) {
@@ -233,7 +237,12 @@ public class WeComUserServiceImpl implements WeComUserService {
         try {
             String weComAccessToken = weComAccessTokenService.getWeComAccessToken(corpId);
             String url = String.format(GET_WE_COM_EXTERNAL_CONTACT_GET + "?access_token=%s&external_userid=%s", weComAccessToken, externalUserId);
-            String res = httpPoolClient.get(url);
+            String res;
+            if (corpId == 1L) {
+                res = httpPoolClient.get(url);
+            } else {
+                res = weComSendService.sendGet(url);
+            }
             JSONObject jsonObject = JSONObject.parseObject(res);
             Integer errcode = jsonObject.getInteger("errcode");
             if (errcode == 0) {