فهرست منبع

欢迎语优化

xw 2 روز پیش
والد
کامیت
069db01794

+ 47 - 47
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -2310,54 +2310,54 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
         QwExternalContact contact=qwExternalContact;
         QwUser qwUser = qwUserMapper.selectQwUserByCorpIdAndUserId(corpId, userID);
 
-        if (state != null && state != "") {
-            String s = "way:" + corpId + ":";
-            if (state.contains(s)) {
-                if (welcomeCode != null && welcomeCode != "") {
-                    String substring = state.substring(state.indexOf(s) + s.length());
-                    QwContactWay qwContactWay = qwContactWayMapper.selectQwContactWayById(Long.parseLong(substring));
-                    logger.info("qwContactWay:"+qwContactWay);
-                    if (qwContactWay != null) {
-                        isWay = true;
-                        wayId = qwContactWay;
-                        if (qwContactWay.getIsWelcome() != null && qwContactWay.getIsWelcome() == 1) {
-                            Boolean isClose = true;
-                            if (wayId.getIsSpanWelcome() == 1) {
-                                ExternalContact externalContact = externalContactResult.getExternal_contact();
-                                String name = externalContact.getName();
-                                String closeWelcomeWord = wayId.getCloseWelcomeWord();
-                                if (closeWelcomeWord != null && closeWelcomeWord.length() > 0) {
-                                    List<String> strings = JSON.parseArray(closeWelcomeWord, String.class);
-                                    for (String string : strings) {
-                                        if (name.contains(string)) {
-                                            isClose = false;
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-                            if (qwContactWay.getIsWelcome() == 1 && isClose) {
-                                isSend = qwContactWayService.sendWelcomeMsg(qwContactWay, corpId, welcomeCode,qwUser,contact.getId());
-                            }
-                        }
-                        if (qwContactWay.getUserType() == 1 && qwContactWay.getIsUserLimit() == 1) {
-                            QwContactWayUser qwContactWayUser = qwContactWayUserMapper.selectQwContactWayUserByUserIdAndCompanyId(userID, corpId);
-                            if (qwContactWayUser != null) {
-                                qwContactWayUser.setDayCount(qwContactWayUser.getDayCount() - 1);
-                                qwContactWayUserMapper.updateQwContactWayUser(qwContactWayUser);
-                                if (qwContactWayUser.getDayCount() <= 0) {
-                                    //超过限制
-                                    qwContactWayService.updateQwContactWayBYLimit(qwContactWayUser.getWayId());
-                                }
-
-                            }
-                        }
-                    }
-                }
-            }
-        }
+//        if (state != null && state != "") {
+//            String s = "way:" + corpId + ":";
+//            if (state.contains(s)) {
+//                if (welcomeCode != null && welcomeCode != "") {
+//                    String substring = state.substring(state.indexOf(s) + s.length());
+//                    QwContactWay qwContactWay = qwContactWayMapper.selectQwContactWayById(Long.parseLong(substring));
+//                    logger.info("qwContactWay:"+qwContactWay);
+//                    if (qwContactWay != null) {
+//                        isWay = true;
+//                        wayId = qwContactWay;
+//                        if (qwContactWay.getIsWelcome() != null && qwContactWay.getIsWelcome() == 1) {
+//                            Boolean isClose = true;
+//                            if (wayId.getIsSpanWelcome() == 1) {
+//                                ExternalContact externalContact = externalContactResult.getExternal_contact();
+//                                String name = externalContact.getName();
+//                                String closeWelcomeWord = wayId.getCloseWelcomeWord();
+//                                if (closeWelcomeWord != null && closeWelcomeWord.length() > 0) {
+//                                    List<String> strings = JSON.parseArray(closeWelcomeWord, String.class);
+//                                    for (String string : strings) {
+//                                        if (name.contains(string)) {
+//                                            isClose = false;
+//                                            break;
+//                                        }
+//                                    }
+//                                }
+//                            }
+//                            if (qwContactWay.getIsWelcome() == 1 && isClose) {
+//                                isSend = qwContactWayService.sendWelcomeMsg(qwContactWay, corpId, welcomeCode,qwUser,contact.getId());
+//                            }
+//                        }
+//                        if (qwContactWay.getUserType() == 1 && qwContactWay.getIsUserLimit() == 1) {
+//                            QwContactWayUser qwContactWayUser = qwContactWayUserMapper.selectQwContactWayUserByUserIdAndCompanyId(userID, corpId);
+//                            if (qwContactWayUser != null) {
+//                                qwContactWayUser.setDayCount(qwContactWayUser.getDayCount() - 1);
+//                                qwContactWayUserMapper.updateQwContactWayUser(qwContactWayUser);
+//                                if (qwContactWayUser.getDayCount() <= 0) {
+//                                    //超过限制
+//                                    qwContactWayService.updateQwContactWayBYLimit(qwContactWayUser.getWayId());
+//                                }
+//
+//                            }
+//                        }
+//                    }
+//                }
+//            }
+//        }
 
-        if (isSend && welcomeCode != null && welcomeCode != "") {
+        if (welcomeCode != null && welcomeCode != "") {
             if (qwUser != null) {
                 // 查询成员的欢迎语以及欢迎图片
                 QwFriendWelcomeVO qwFriendWelcomeVO = qwFriendWelcomeMapper.selectQwFriendWelcomeByUserIdVO(qwUser.getId(), corpId);

+ 23 - 23
fs-service/src/main/java/com/fs/qwApi/service/impl/QwApiServiceImpl.java

@@ -1602,28 +1602,28 @@ public class QwApiServiceImpl implements QwApiService {
     }
 
 
-//    public String sendPost(String url,Object param,String corpId){
-//
-//        QwCompany qwCompany = iQwCompanyService.selectQwCompanyByCorpId(corpId);
-//
-//        String appSecret = qwCompany.getOpenSecret();
-//
-//        HttpClient httpClient = HttpClients.createDefault();
-//        try {
-//            URIBuilder builder = new URIBuilder(url);
-//
-//            builder.setParameter("access_token", getToken(corpId,appSecret));
-//            URI uri = builder.build();
-//            HttpPost httpPost  = new HttpPost(uri);
-//            httpPost.setEntity( new StringEntity(JSON.toJSONString(param),StandardCharsets.UTF_8));
-//            HttpResponse response = httpClient.execute(httpPost);
-//            String reJson = EntityUtils.toString(response.getEntity());
-//            return reJson;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        return null;
-//    }
+    public String sendPost(String url,Object param,String corpId){
+
+        QwCompany qwCompany = iQwCompanyService.selectQwCompanyByCorpId(corpId);
+
+        String appSecret = qwCompany.getOpenSecret();
+
+        HttpClient httpClient = HttpClients.createDefault();
+        try {
+            URIBuilder builder = new URIBuilder(url);
+
+            builder.setParameter("access_token", getToken(corpId,appSecret));
+            URI uri = builder.build();
+            HttpPost httpPost  = new HttpPost(uri);
+            httpPost.setEntity( new StringEntity(JSON.toJSONString(param),StandardCharsets.UTF_8));
+            HttpResponse response = httpClient.execute(httpPost);
+            String reJson = EntityUtils.toString(response.getEntity());
+            return reJson;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 
     public String sendBookPost(String url,QwOpenidByUserParams body,String corpId){
         QwCompany qwCompany = iQwCompanyService.selectQwCompanyByCorpId(corpId);
@@ -1915,7 +1915,7 @@ public class QwApiServiceImpl implements QwApiService {
     @Override
     public QwResult sendWelcomeMsg(SendWelcomeMsgParam param, String corpId) {
 
-        String json = sendPost(QwApiConfig.sendWelcomeMsg,param,corpId, false);
+        String json = sendPost(QwApiConfig.sendWelcomeMsg,param,corpId);
         QwResult qwResult = JSON.parseObject(json, QwResult.class);
         return qwResult;
     }